[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-75799":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":14,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":20,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":42,"readmeContent":43,"aiSummary":44,"trendingCount":15,"starSnapshotCount":15,"syncStatus":16,"lastSyncTime":45,"discoverSource":46},75799,"ai-auto-trading","python-telegramBot\u002Fai-auto-trading","python-telegramBot","AI trading bot crypto LLM agent quantitative trading automated trading algorithmic trading Binance Gate.io TypeScript Node.js VoltAgent crypto bot risk management multi-strategy","https:\u002F\u002Fgithub.com\u002Fpython-telegramBot\u002Fai-auto-trading",null,"TypeScript",81,572,1,0,2,74,56.67,"GNU Affero General Public License v3.0",false,"main",[23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41],"ai-trading","algorithmic-trading","automated-trading","binance","crypto","crypto-bot","cryptocurrency","gate-io","llm","machine-learning","nexusquant","nodejs","openai","quantitative-trading","risk-management","spot-trading","trading-bot","typescript","voltagent","2026-06-12 04:01:18","# NexusQuant | 灵枢量化\n\n> **AI-Driven Multi-Strategy, Multi-Timeframe Cryptocurrency Trading Monitor**\n\n\u003Cdiv align=\"center\">\n\n[![VoltAgent](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FFramework-VoltAgent-purple.svg)](https:\u002F\u002Fvoltagent.dev)\n[![OpenAI Compatible](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FAI-OpenAI_Compatible-orange.svg)](https:\u002F\u002Fopenrouter.ai)\n[![Gate.io](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FExchange-Gate.io-00D4AA.svg)](https:\u002F\u002Fwww.gatesite.org\u002Fsignup\u002FVQBEAwgL?ref_type=103)\n[![Binance](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FExchange-Binance-F0B90B.svg)](https:\u002F\u002Fwww.maxweb.red\u002Freferral\u002Fearn-together\u002Frefer2earn-usdc\u002Fclaim?hl=zh-CN&ref=GRO_28502_NCRQJ&utm_source=default)\n[![TypeScript](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLanguage-TypeScript-3178C6.svg?logo=typescript&logoColor=white)](https:\u002F\u002Fwww.typescriptlang.org)\n[![Node.js](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FRuntime-Node.js%2020+-339933.svg?logo=node.js&logoColor=white)](https:\u002F\u002Fnodejs.org)\n[![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-AGPL--3.0-blue.svg)](.\u002FLICENSE)\n[![Stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fpython-telegramBot\u002Fai-auto-trading)](https:\u002F\u002Fgithub.com\u002Fpython-telegramBot\u002Fai-auto-trading\u002Fstargazers)\n\n**Repository:** [github.com\u002Fpython-telegramBot\u002Fai-auto-trading](https:\u002F\u002Fgithub.com\u002Fpython-telegramBot\u002Fai-auto-trading)\n\n| [English](.\u002FREADME_EN.md) | [简体中文](.\u002FREADME_ZH.md) | [日本語](.\u002FREADME_JA.md) |\n|:---:|:---:|:---:|\n\n\u003C\u002Fdiv>\n\n---\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Core Capabilities](#core-capabilities)\n- [System Architecture](#system-architecture)\n- [Tech Stack](#tech-stack)\n- [Quick Start](#quick-start)\n- [Configuration Reference](#configuration-reference)\n- [Trading Strategies](#trading-strategies)\n- [Monitoring Dashboard](#monitoring-dashboard)\n- [Risk Management](#risk-management)\n- [Documentation](#documentation)\n- [Risk Disclaimer](#risk-disclaimer)\n- [License](#license)\n- [Resources & Referrals](#resources--referrals)\n\n---\n\n## Overview\n\n**NexusQuant (灵枢量化)** is a next-generation AI-powered cryptocurrency automated trading system that fundamentally redefines quantitative trading by deeply integrating large language models with institutional-grade trading practices.\n\n![ai-auto-trading](.\u002Fpublic\u002Fimage.png)\n\n### Design Philosophy\n\n**AI-First Architecture** — The system treats AI as an autonomous trading agent, granting it full decision-making authority over market analysis, strategy selection, position management, and risk control.\n\n**Adaptive Intelligence** — True market adaptability is achieved through a Market State Recognition Engine (8 distinct states), a Dynamic Strategy Router, and an Intelligent Opportunity Scoring System.\n\n**Professional Risk Control** — Features ATR-adaptive stop-losses, R-Multiple partial take-profits, server-side conditional orders, and database transaction rollback mechanisms to ensure capital protection at every layer.\n\n---\n\n## Core Capabilities\n\n### 1. State-Adaptive Entry System\n\nAutomatically identifies 8 distinct market states — including oversold uptrends, overbought downtrends, trend continuations, and range-bound extremes — then intelligently routes to the optimal strategy. This prevents false breakout entries and captures genuine trend reversals.\n\n### 2. Scientific Stop-Loss System\n\n- ATR-based dynamic stop-loss calculation for market-responsive protection\n- Server-side execution ensures protection persists even if the application crashes\n- Pre-entry stop-loss space validation before any position is opened\n- Intelligent trailing stops that move only in the favorable direction\n\n### 3. R-Multiple Partial Take-Profit\n\nInstitutional risk-multiple thinking automated end-to-end. Positions are partially closed at 2R, 3R, and 5R targets, with stop-losses automatically moved to breakeven or better after each partial exit.\n\n### 4. Transaction Integrity Protection\n\nDatabase transaction rollback mechanisms, inconsistency-state logging, and idempotency protection ensure exchange records and local database records remain fully synchronized at all times.\n\n### 5. Intelligent Opportunity Scoring\n\nA multi-factor quantitative scoring model evaluates every potential trade before entry:\n\n| Factor | Weight |\n|--------|--------|\n| Signal Strength | 40% |\n| Risk\u002FReward Ratio | 25% |\n| Market Conditions | 20% |\n| Position Correlation | 15% |\n\nOnly trades exceeding the minimum score threshold are executed.\n\n### 6. System Health Monitoring\n\nReal-time three-tier health indicators (🟢 Healthy \u002F 🟡 Warning \u002F 🔴 Critical), automated health checks, orphan order detection and cleanup, and proactive alerting keep the system operating reliably around the clock.\n\n---\n\n## System Architecture\n\n```\n┌─────────────────────────────────────────────────────────┐\n│                   Trading Agent (AI)                    │\n│          DeepSeek V3.2 \u002F Grok 4 \u002F Claude \u002F Gemini       │\n└─────────────────┬───────────────────────────────────────┘\n                  │\n                  ├─── Market Data Analysis\n                  ├─── Position Management\n                  └─── Trade Execution Decisions\n\n┌─────────────────┴───────────────────────────────────────┐\n│                    VoltAgent Core                       │\n│              (Agent Orchestration & Tool Routing)       │\n└─────────┬───────────────────────────────────┬───────────┘\n          │                                   │\n┌─────────┴──────────┐            ┌───────────┴───────────┐\n│    Trading Tools   │            │   Exchange API Client  │\n│                    │            │                        │\n│ - Market Data      │◄───────────┤ - Order Management     │\n│ - Account Info     │            │ - Position Query       │\n│ - Trade Execution  │            │ - Market Data Stream   │\n└─────────┬──────────┘            └────────────────────────┘\n          │\n┌─────────┴──────────┐\n│   LibSQL Database  │\n│                    │\n│ - Account History  │\n│ - Trade Signals    │\n│ - Agent Decisions  │\n└────────────────────┘\n```\n\n---\n\n## Tech Stack\n\n| Component | Technology | Purpose |\n|-----------|-----------|---------|\n| Framework | [VoltAgent](https:\u002F\u002Fvoltagent.dev) | AI agent orchestration and tool routing |\n| AI Models | OpenAI-compatible API | DeepSeek V3.2, Grok 4, Claude 4.5, Gemini 2.5, and more |\n| Exchanges | [Gate.io](https:\u002F\u002Fwww.gatesite.org\u002Fsignup\u002FVQBEAwgL?ref_type=103) \u002F [Binance](https:\u002F\u002Fwww.maxweb.red\u002Freferral\u002Fearn-together\u002Frefer2earn-usdc\u002Fclaim?hl=zh-CN&ref=GRO_28502_NCRQJ&utm_source=default) | Perpetual futures trading (testnet & mainnet) |\n| Database | LibSQL (SQLite) | Local data persistence |\n| Web Server | Hono | High-performance monitoring interface |\n| Language | TypeScript | Type-safe development |\n| Runtime | Node.js 20.19+ | JavaScript execution environment |\n\n---\n\n## Quick Start\n\n### Step 1 — Register an Exchange Account\n\nNexusQuant supports both **Gate.io** and **Binance**. Choose based on your needs:\n\n#### Option A: Gate.io *(Recommended for beginners)*\n\nGate.io offers a well-developed testnet environment ideal for learning and strategy validation before risking real capital.\n\n- [Register on Gate.io](https:\u002F\u002Fwww.gatesite.org\u002Fsignup\u002FVQBEAwgL?ref_type=103) — Referral code: `VQBEAwgL`\n- Testnet: \u003Chttps:\u002F\u002Ftestnet.gate.com\u002F>\n\n#### Option B: Binance *(World's largest exchange)*\n\nBinance offers superior liquidity, high trading volume, and full testnet support.\n\n- [Register on Binance](https:\u002F\u002Fwww.maxweb.red\u002Freferral\u002Fearn-together\u002Frefer2earn-usdc\u002Fclaim?hl=zh-CN&ref=GRO_28502_NCRQJ&utm_source=default) — Referral code: `GRO_28502_NCRQJ`\n- Testnet: \u003Chttps:\u002F\u002Ftestnet.binancefuture.com\u002F>\n\n> **Beginner's Tip:** Always start on the testnet. You get a full trading experience with zero financial risk — perfect for validating your configuration before going live.\n\n---\n\n### Step 2 — Prerequisites\n\nEnsure the following are installed on your system:\n\n- **Node.js** >= 20.19.0\n- **npm** or **pnpm**\n- **Git**\n\n---\n\n### Step 3 — Install the Project\n\n```bash\n# Clone the repository\ngit clone \u003Crepository-url>\ncd ai-auto-trading\n\n# Install dependencies\nnpm install\n```\n\n---\n\n### Step 4 — Configure Environment Variables\n\n```bash\ncp .env.example .env\nnano .env\n```\n\n#### Key Configuration Options\n\n```env\n# ── Server ──────────────────────────────────────────────\nPORT=3100\n\n# ── Trading Core ────────────────────────────────────────\nTRADING_INTERVAL_MINUTES=5          # How often the agent runs (minutes)\nTRADING_STRATEGY=balanced           # Strategy: ultra-short | swing-trend | conservative | balanced | aggressive\nTRADING_SYMBOLS=BTC,ETH,SOL,BNB,XRP # Comma-separated list of trading pairs\nMAX_LEVERAGE=15                     # Maximum leverage multiplier\nMAX_POSITIONS=5                     # Maximum concurrent open positions\nINITIAL_BALANCE=1000                # Starting capital (USDT)\nACCOUNT_STOP_LOSS_USDT=50           # Account-level stop-loss threshold\nACCOUNT_TAKE_PROFIT_USDT=20000      # Account-level take-profit threshold\n\n# ── Scientific Stop-Loss System (Recommended) ───────────\nENABLE_SCIENTIFIC_STOP_LOSS=true    # Enable ATR-adaptive stop-loss\nENABLE_TRAILING_STOP_LOSS=true      # Enable trailing stop-loss\nENABLE_STOP_LOSS_FILTER=true        # Require valid stop-loss space before entry\n\n# ── Exchange Selection ───────────────────────────────────\nEXCHANGE_NAME=gate                  # Options: gate | binance\n\n# ── Gate.io (required when EXCHANGE_NAME=gate) ──────────\nGATE_API_KEY=your_api_key_here\nGATE_API_SECRET=your_api_secret_here\nGATE_USE_TESTNET=true\n\n# ── Binance (required when EXCHANGE_NAME=binance) ───────\nBINANCE_API_KEY=your_api_key_here\nBINANCE_API_SECRET=your_api_secret_here\nBINANCE_USE_TESTNET=true\n\n# ── AI Model (OpenAI-compatible) ─────────────────────────\nOPENAI_API_KEY=your_api_key_here\nOPENAI_BASE_URL=https:\u002F\u002Fopenrouter.ai\u002Fapi\u002Fv1\nAI_MODEL_NAME=deepseek\u002Fdeepseek-v3.2-exp\n```\n\n#### Obtaining API Keys\n\n**AI Models:**\n\n| Provider | URL |\n|----------|-----|\n| OpenRouter (multi-model) | \u003Chttps:\u002F\u002Fopenrouter.ai\u002Fkeys> |\n| OpenAI | \u003Chttps:\u002F\u002Fplatform.openai.com\u002Fapi-keys> |\n| DeepSeek | \u003Chttps:\u002F\u002Fplatform.deepseek.com\u002Fapi_keys> |\n\n**Exchanges:**\n\n| Exchange | Environment | URL |\n|----------|------------|-----|\n| Gate.io | Testnet | \u003Chttps:\u002F\u002Fwww.gate.io\u002Ftestnet> |\n| Gate.io | Mainnet | \u003Chttps:\u002F\u002Fwww.gatesite.org\u002Fsignup\u002FVQBEAwgL?ref_type=103> |\n| Binance | Testnet | \u003Chttps:\u002F\u002Ftestnet.binancefuture.com\u002F> |\n| Binance | Mainnet | \u003Chttps:\u002F\u002Fwww.maxweb.red\u002Freferral\u002Fearn-together\u002Frefer2earn-usdc\u002Fclaim?hl=zh-CN&ref=GRO_28502_NCRQJ&utm_source=default> |\n\n---\n\n### Step 5 — Initialize the Database\n\n```bash\nnpm run db:init\n```\n\n---\n\n### Step 6 — Start the Trading System\n\n```bash\n# Development mode (hot reload)\nnpm run dev\n\n# Production mode\nnpm run trading:start\n```\n\n---\n\n### Step 7 — Open the Monitoring Dashboard\n\nNavigate to \u003Chttp:\u002F\u002Flocalhost:3100> in your browser.\n\n---\n\n## Configuration Reference\n\n### Trading Strategies\n\nChoose a strategy that matches your risk tolerance and trading goals:\n\n| Strategy | Monthly Target | Risk Level | Best For |\n|----------|---------------|------------|----------|\n| `ultra-short` | 40%+ | High | Scalping, high-frequency |\n| `swing-trend` | 40%+ | High | Multi-day trend capture |\n| `conservative` | 10–20% | Low | Capital preservation |\n| `balanced` ⭐ | 20–40% | Medium | **Recommended default** |\n| `aggressive` | 40%+ | High | Maximum growth |\n\n> **Note:** Return targets are illustrative projections, not guarantees. Actual results depend on market conditions.\n\n---\n\n## Monitoring Dashboard\n\nThe real-time web dashboard at `http:\u002F\u002Flocalhost:3100` provides full visibility into system operation:\n\n### Account Overview\n- Current balance and net equity\n- Daily, weekly, and cumulative P&L\n- Sharpe ratio and maximum drawdown\n\n### Active Positions\n- Real-time unrealized and realized P&L\n- Entry price, current price, and leverage\n- Position duration with staleness warnings\n- Stop-loss and take-profit levels\n\n### Trade History\n- Complete order log with timestamps\n- Win rate and average R-multiple\n- Fees and net profit breakdown\n\n### Performance Analytics\n- Win rate analysis and R-multiple distribution\n- Profit factor and strategy comparison\n- Drawdown analysis and time-based breakdowns\n- Per-asset performance and risk metrics\n\n> **Why this matters:** Identify which strategies are working, spot P&L patterns, optimize position sizing, and detect strategy degradation early — before it significantly impacts capital.\n\n### AI Decision Transparency\n- Full agent reasoning process logs\n- Market state classification details\n- Strategy selection rationale\n\n### System Health\n- Real-time 🟢🟡🔴 health indicators\n- Orphan order detection and cleanup status\n- Data consistency check results\n\n---\n\n## Risk Management\n\nNexusQuant implements a multi-layered risk management framework designed to protect capital at every level.\n\n### Scientific Stop-Loss System\n- **ATR-adaptive calculation** — Stop distances scale dynamically with market volatility\n- **Server-side execution** — Stops are placed as exchange-side conditional orders, surviving application restarts\n- **Pre-entry validation** — Positions are only opened when the required stop-loss space is available\n- **Intelligent trailing** — Stops trail only in the profitable direction, locking in gains without premature exits\n\n### R-Multiple Partial Take-Profit\n- Exits are automated at 2R, 3R, and 5R profit targets\n- After each partial exit, the stop-loss is moved to breakeven or higher\n- No manual intervention required — the system executes the full plan autonomously\n\n### Traditional Risk Controls\n- Single-position forced close at −30% loss\n- Forced position close after 36 hours to avoid overnight exposure compounding\n- Peak-to-trough drawdown protection at the position level\n- Account-level stop-loss and take-profit thresholds (`ACCOUNT_STOP_LOSS_USDT` \u002F `ACCOUNT_TAKE_PROFIT_USDT`)\n\n---\n\n## Documentation\n\nFull documentation is available in multiple languages:\n\n| Language | Link |\n|----------|------|\n| English | [README_EN.md](.\u002FREADME_EN.md) |\n| 简体中文 | [README_ZH.md](.\u002FREADME_ZH.md) |\n| 日本語 | [README_JA.md](.\u002FREADME_JA.md) |\n\nDocumentation covers: all 5 trading strategies in detail, complete configuration guide, all CLI commands, PM2 and Docker deployment, troubleshooting, and API reference.\n\n---\n\n## Risk Disclaimer\n\n> ⚠️ **This system is provided for educational and research purposes only. Cryptocurrency trading carries substantial risk and may result in the partial or total loss of your invested capital.**\n\n- Always test your strategy thoroughly on the testnet before using real funds\n- Never invest more than you can afford to lose entirely\n- The user bears full responsibility for all trading activity and outcomes\n- Past performance shown in documentation does not guarantee future results\n- No warranty or guarantee of system performance is expressed or implied\n\n---\n\n## License\n\nThis project is licensed under the **GNU Affero General Public License v3.0 (AGPL-3.0)**.\n\n### Key Terms\n\n- **Free to use** — Use this software for any purpose\n- **Copyleft** — Any modifications must be released under AGPL-3.0\n- **Network use** — If deployed as a service, the source code must be made publicly available\n- **No warranty** — The software is provided \"as is\" without any warranty\n\nSee the [LICENSE](.\u002FLICENSE) file for the complete terms.\n\n---\n\n## Resources & Referrals\n\nUsing a referral link costs you nothing extra and directly supports continued development of this open-source project by generating fee rebates.\n\n### Gate.io\n\n- **Referral Link:** \u003Chttps:\u002F\u002Fwww.gatesite.org\u002Fsignup\u002FVQBEAwgL?ref_type=103>\n- **Referral Code:** `VQBEAwgL`\n\n### Binance\n\n- **Referral Link:** \u003Chttps:\u002F\u002Fwww.maxweb.red\u002Freferral\u002Fearn-together\u002Frefer2earn-usdc\u002Fclaim?hl=zh-CN&ref=GRO_28502_NCRQJ&utm_source=default>\n- **Referral Code:** `GRO_28502_NCRQJ`\n\n> Both exchanges share the same account across testnet and mainnet, so you can test freely before going live. Registering via referral link grants you fee rebate benefits at no extra cost, while helping sustain this project long-term.\n\n### Related Links\n\n| Resource | URL |\n|----------|-----|\n| VoltAgent Documentation | \u003Chttps:\u002F\u002Fvoltagent.dev\u002Fdocs\u002F> |\n| OpenRouter Model Catalog | \u003Chttps:\u002F\u002Fopenrouter.ai\u002Fmodels> |\n| Gate.io API Documentation | \u003Chttps:\u002F\u002Fwww.gate.io\u002Fdocs\u002Fdevelopers\u002Fapiv4\u002F> |\n| Gate.io Testnet | \u003Chttps:\u002F\u002Fwww.gate.io\u002Ftestnet> |\n\n---\n\n## Contributing\n\nContributions are welcome! Please refer to the [full documentation](.\u002FREADME_ZH.md#参与贡献) for contribution guidelines, coding standards, and how to submit pull requests.\n\n---\n\n\u003Cdiv align=\"center\">\n\n[![Star History Chart](https:\u002F\u002Fapi.star-history.com\u002Fsvg?repos=losesky\u002Fai-auto-trading&type=Date)](https:\u002F\u002Fstar-history.com\u002F#losesky\u002Fai-auto-trading&Date)\n\n*If you find NexusQuant useful, consider giving it a ⭐ on GitHub — it helps others discover the project.*\n\n\u003C\u002Fdiv>","NexusQuant（灵枢量化）是一款基于AI的加密货币自动化交易系统，通过将大型语言模型与机构级交易实践深度结合，重新定义了量化交易。项目核心功能包括状态自适应入场系统、动态策略路由以及智能机会评分系统，能够自动识别8种不同的市场状态，并据此做出交易决策。技术上采用TypeScript开发，支持Node.js运行环境，兼容OpenAI接口，可在Binance和Gate.io等交易所上进行操作。适用于需要高度自动化且具备风险控制机制的加密货币交易场景，特别是对于追求多策略、多时间框架下交易优化的专业投资者或团队而言尤为适用。","2026-06-11 03:53:21","CREATED_QUERY"]