Back to feed

endless-sky-team/ai-trading-agent

endless-sky-team/ai-trading-agent
202
+20/day
161
TypeScript

llm trading bot ai agent crypto bitcoin ethereum perpetuals openrouter lighter algorithmic automated quant typescript react postgres bun fintech defi machine-learning open-source crypto-bot signals

From the README

AI Trading Agent

Repository (clone / issues / PRs): github.com/endless-sky-team/ai-trading-agent

Keywords: trading-bot ai-trading openrouter lighter lighter-xyz perpetuals llm llm-agent tool-calling prisma postgresql bun typescript express react vite vercel-ai-sdk crypto bitcoin ethereum altcoin algorithmic-trading automated-trading quant quantitative fintech audit telemetry positions risk open-source defi research crypto-bot autonomous-agent streaming llm openapi portfolio dashboard invocations-timeseries prisma-studio cors rest-api javascript esm bun-runtime

Disclaimer: Automated trading carries significant financial risk. This software is provided for educational and experimental use. You are solely responsible for API keys, position sizing, capital at risk, and compliance with laws in your jurisdiction. Never trade funds you cannot afford to lose.

Table of contents

  1. Why this project is useful
  2. What you get
  3. Prerequisites
  4. Quick start
  5. How a single cycle works
  6. Database models and tool types
  7. Important: position side handling
  8. Optional dashboard API and UI
  9. Project layout
  10. Tech stack
  11. Troubleshooting
  12. Useful tips
  13. License

Why this project is useful

This agent is useful when you want a repeatable, observable loop between market data, an LLM, and a small set of exchange actions—without building that plumbing from scratch every time.

| What it helps with | Why that matters | |--------------------|------------------| | Prompt + data assembly | Each run merges candlestick-derived signals (intraday and longer horizon), balances, positions, and invocation count into one prompt (prompt.ts). You reuse the pipeline and only tune strategy text or markets. | | Multi-model experimentation | Add rows under Models with different openRoutermodelName strings to compare models on similar conditions, or route multiple Lighter accounts from one process, without duplicating the runner. | | Auditing and review | Responses and tool usage land in PostgreSQL (Invocations, ToolCalls), which is useful for debugging behavior, measuring how often the model opens vs. flattens, and tracing what was decided when. | | Guardrailed automation | The model does not get arbitrary API access—it only invokes the trading tools wired in code, which is useful for limiting blast radius compared to unrestricted agents. | | Hands-off scheduling | A fixed cadence (every 5 minutes after start) removes the need to manually trigger runs when you already trust your prompt and sizing rules. |

Useful for: researchers comparing LLMs on tradin