From 08515b5ff841c0d3fb3a3bb69bf0d8484c9646fb Mon Sep 17 00:00:00 2001 From: TIANHE Date: Mon, 26 Jan 2026 19:36:43 +0800 Subject: [PATCH 1/3] new Signed-off-by: TIANHE --- quantdinger_vue/Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/quantdinger_vue/Dockerfile b/quantdinger_vue/Dockerfile index cc9976e..25a385a 100644 --- a/quantdinger_vue/Dockerfile +++ b/quantdinger_vue/Dockerfile @@ -6,8 +6,6 @@ WORKDIR /app # Copy package files COPY package*.json ./ -COPY pnpm-lock.yaml* ./ -COPY yarn.lock* ./ # Install dependencies (prefer npm) RUN npm install --legacy-peer-deps From 53cadb5ab5d0127de91c937afbb7af3e6006975d Mon Sep 17 00:00:00 2001 From: TIANHE Date: Mon, 26 Jan 2026 20:32:34 +0800 Subject: [PATCH 2/3] add deepcoin Signed-off-by: TIANHE --- README.md | 902 +++--------------- README_CN.md | 38 +- README_JA.md | 38 +- README_KO.md | 38 +- README_TW.md | 38 +- .../app/services/live_trading/deepcoin.py | 640 +++++++++++++ .../app/services/live_trading/factory.py | 11 + .../app/services/live_trading/symbols.py | 35 + backend_api_python/app/services/strategy.py | 3 + quantdinger_vue/src/locales/lang/ar-SA.js | 3 +- quantdinger_vue/src/locales/lang/de-DE.js | 3 +- quantdinger_vue/src/locales/lang/en-US.js | 3 +- quantdinger_vue/src/locales/lang/fr-FR.js | 3 +- quantdinger_vue/src/locales/lang/ja-JP.js | 3 +- quantdinger_vue/src/locales/lang/ko-KR.js | 3 +- quantdinger_vue/src/locales/lang/th-TH.js | 3 +- quantdinger_vue/src/locales/lang/vi-VN.js | 4 +- quantdinger_vue/src/locales/lang/zh-CN.js | 3 +- quantdinger_vue/src/locales/lang/zh-TW.js | 3 +- .../src/views/trading-assistant/index.vue | 5 +- 20 files changed, 875 insertions(+), 904 deletions(-) create mode 100644 backend_api_python/app/services/live_trading/deepcoin.py diff --git a/README.md b/README.md index a935893..7914263 100644 --- a/README.md +++ b/README.md @@ -51,33 +51,24 @@ ## ๐Ÿ“– Introduction -### What is QuantDinger? +**QuantDinger** is a local-first, privacy-first, self-hosted quantitative trading platform. It runs on your own infrastructure, providing multi-user accounts backed by PostgreSQL while keeping full control of your strategies, trading data, and API keys. -QuantDinger is a **local-first, privacy-first, self-hosted quantitative trading infrastructure**. It runs on your own machine/server, providing **multi-user accounts backed by PostgreSQL** while keeping full control of your strategies, trading data, and API keys. +### Why QuantDinger? -### Why Local-First? +| Feature | QuantDinger | Cloud SaaS | +|---------|-------------|------------| +| Data Ownership | โœ… Local storage | โŒ Vendor-controlled | +| Strategy Privacy | โœ… Never leaves your server | โŒ Uploaded to cloud | +| Subscription Fees | โœ… None | โŒ Monthly charges | +| Customization | โœ… Full source access | โŒ Limited | -Unlike SaaS platforms that lock your data and strategies in the cloud, QuantDinger runs locally. Your strategies, trading logs, API keys, and analysis results stay on your machine. No vendor lock-in, no subscription fees, no data exfiltration. +### Core Capabilities -### Who is this for? - -QuantDinger is built for traders, researchers, and engineers who: -- Value data sovereignty and privacy -- Want transparent, auditable trading infrastructure -- Prefer engineering over marketing -- Need a complete workflow: data, analysis, backtesting, and execution - -### Core Features - -QuantDinger includes a built-in **LLM-based multi-agent research system** that gathers financial intelligence from the web, combines it with local market data, and generates analysis reports. This integrates with strategy development, backtesting, and live trading workflows. - -### Core Value - -- **๐Ÿ”“ Apache 2.0 Open Source (Code)**: Permissive and commercial-friendly. You can fork and modify the codebase under Apache 2.0, while preserving required notices. -- **๐Ÿ Python-Native & Visual**: Write indicators in standard Python (easier than PineScript) with AI assistance. Visualize signals directly on chartsโ€”a "Local TradingView" experience. -- **๐Ÿค– AI-Loop Optimization**: It doesn't just run strategies; AI analyzes backtest results to suggest parameter tuning (Stop-Loss/TP/MACD settings), forming a closed optimization loop. -- **๐ŸŒ Universal Market Access**: One unified system for Crypto (Live), US/CN Stocks, Forex, and Futures (Data/Notify). -- **โšก Docker & Clean Arch**: 4-line command deployment. Modern Tech Stack (Vue + Python) with a clean, separation-of-concerns architecture. +- **๐Ÿ Python-Native Strategies** โ€” Write indicators in standard Python with AI assistance +- **๐Ÿค– AI Multi-Agent Research** โ€” LLM-powered analysis with web scraping and market intelligence +- **๐Ÿ“Š Visual Backtesting** โ€” TradingView-like charting with strategy visualization +- **โšก Live Trading** โ€” Direct API execution for 10+ crypto exchanges, IBKR, and MT5 +- **๐Ÿ”’ Self-Hosted** โ€” Your data stays on your infrastructure --- @@ -85,763 +76,214 @@ QuantDinger includes a built-in **LLM-based multi-agent research system** that g
- QuantDinger Project Introduction Video + QuantDinger Demo -

Click the video above to watch the QuantDinger project introduction

+

Click to watch the project introduction

--- -## ๐Ÿ“š Documentation - -### Guides -- [Python Strategy Development Guide](docs/STRATEGY_DEV_GUIDE.md) -- [Interactive Brokers (IBKR) Trading Guide](docs/IBKR_TRADING_GUIDE_EN.md) ๐Ÿ†• -- [MetaTrader 5 (MT5) Trading Guide](docs/MT5_TRADING_GUIDE_EN.md) ๐Ÿ†• - -### Notification Configuration -- [Telegram Notification Setup](docs/NOTIFICATION_TELEGRAM_CONFIG_EN.md) -- [Email (SMTP) Notification Setup](docs/NOTIFICATION_EMAIL_CONFIG_EN.md) -- [SMS (Twilio) Notification Setup](docs/NOTIFICATION_SMS_CONFIG_EN.md) - -## ๐Ÿ“ธ Visual Tour +## ๐Ÿ“ธ Screenshots
-

๐Ÿ—บ๏ธ System Architecture Overview

-

A comprehensive view of QuantDinger's AI-powered research, backtesting, and automated trading capabilities.

- QuantDinger System Topology + System Architecture +

System Architecture Overview

-
- -
-

๐Ÿ“Š Professional Quant Dashboard

-

Real-time monitoring of market dynamics, assets, and strategy status.

- QuantDinger Dashboard -
- -
- - +
- - + - - + - +
-

๐Ÿค– AI Deep Research

-

Multi-agent collaboration for market sentiment & technical analysis.

- AI Market Analysis -
-

๐Ÿ’ฌ Smart Trading Assistant

-

Natural language interface for instant market insights.

- Trading Assistant -
Dashboard
Dashboard
-

๐Ÿ“ˆ Interactive Indicator Analysis

-

Rich library of technical indicators with drag-and-drop analysis.

- Indicator Analysis -
-

๐Ÿ Python Strategy Gen

-

Built-in editor with AI-assisted strategy coding.

- Code Generation -
AI Analysis
AI Multi-Agent Analysis
-

๐Ÿ“Š Portfolio Monitor

-

Track positions, set alerts, and receive AI-powered analysis via Email/Telegram.

- Portfolio Monitor -
Indicator Analysis
Indicator Analysis
--- +## ๐Ÿ”Œ Supported Exchanges & Brokers + +### Cryptocurrency (Direct API Trading) + +| Exchange | Spot | Futures | Features | +|:--------:|:----:|:-------:|:---------| +| **Binance** | โœ… | โœ… | Margin, COIN-M, USDโ“ˆ-M | +| **OKX** | โœ… | โœ… | Options, Copy Trading | +| **Bitget** | โœ… | โœ… | Copy Trading | +| **Bybit** | โœ… | โœ… | Linear, Inverse | +| **KuCoin** | โœ… | โœ… | โ€” | +| **Gate.io** | โœ… | โœ… | โ€” | +| **Kraken** | โœ… | โœ… | โ€” | +| **Coinbase** | โœ… | โ€” | Spot Only | +| **Bitfinex** | โœ… | โœ… | Derivatives | +| **Deepcoin** | โœ… | โœ… | โ€” | + +### Traditional Brokers + +| Broker | Markets | Platform | +|:------:|:--------|:---------| +| **Interactive Brokers** | US/HK Stocks, Options | TWS / IB Gateway | +| **MetaTrader 5** | Forex, CFDs | MT5 Terminal | + +### Market Data Sources + +| Market | Sources | +|--------|---------| +| Crypto | 100+ exchanges via CCXT | +| US Stocks | Yahoo Finance, Finnhub, Tiingo | +| CN/HK Stocks | AkShare, East Money | +| Forex | Finnhub, OANDA | + +--- + ## โœจ Key Features ### 1. Visual Python Strategy Workbench -*Better than PineScript, Smarter than SaaS.* -- **Python Native**: Write indicators and strategies in Python. Leverage the entire Python ecosystem (Pandas, Numpy, TA-Lib) instead of proprietary languages like PineScript. -- **"Mini-TradingView" Experience**: Run your Python indicators directly on the built-in K-line charts. Visually debug buy/sell signals on historical data. -- **AI-Assisted Coding**: Let the built-in AI write the complex logic for you. From idea to code in seconds. +Write strategies in Python with full ecosystem access (Pandas, NumPy, TA-Lib). AI assists with code generation, and signals visualize directly on interactive charts. ### 2. Complete Trading Lifecycle -*From Indicator to Execution, Seamlessly.* -1. **Indicator**: Define your market entry/exit signals. -2. **Strategy Config**: Attach risk management rules (Position sizing, Stop-Loss, Take-Profit). -3. **Backtest & AI Optimization**: Run backtests, view rich performance metrics, and **let AI analyze the result to suggest improvements** (e.g., "Adjust MACD threshold to X"). -4. **Execution Mode**: - - **Live Trading**: - - **Cryptocurrency**: Direct API execution for 10+ exchanges (Binance, OKX, Bitget, Bybit, etc.) - - **US/HK Stocks**: Via Interactive Brokers (IBKR) ๐Ÿ†• - - **Forex**: Via MetaTrader 5 (MT5) ๐Ÿ†• - - **Signal Notification**: For markets without live trading support (A-shares/Futures), send signals via Telegram, Discord, Email, SMS, or Webhook. - -### 3. AI Multi-Agent Research -*Your 24/7 AI Investment Committee.* - -The system employs a multi-agent team to act as a secondary filter for your strategies: - -- **Research Agents**: Scrape web news and macro events (Google/Bing). -- **Analysis Agents**: Analyze technical indicators and capital flows. -- **Strategic Integration**: The AI judgment can serve as a "Market Filter"โ€”only allowing your strategy to trade when the AI sentiment aligns (e.g., "Don't buy if AI Risk Analyst flags high macro danger"). - -### 4. Universal Data Engine - -QuantDinger provides a unified data interface across multiple markets: - -- **Cryptocurrency**: Direct API connections for trading (10+ exchanges) and CCXT integration for market data (100+ sources) -- **Stocks**: Yahoo Finance, Finnhub, Tiingo (US stocks), and AkShare (CN/HK stocks) -- **Futures/Forex**: OANDA and major futures data sources -- **Proxy Support**: Built-in proxy configuration for restricted network environments - -### 5. Memory-Augmented Agents (Local RAG + Reflection Loop) - -QuantDingerโ€™s agents donโ€™t start from scratch every time. The backend includes a **local memory store** and an optional **reflection/verification loop**: - -- **What it is**: RAG-style experience retrieval injected into agent prompts (NOT model fine-tuning). -- **Where it lives**: PostgreSQL database (shared with main data) or local files under `backend_api_python/data/memory/` (privacy-first). - -```mermaid -flowchart TB - %% ===== ๐ŸŒ Entry Layer ===== - subgraph Entry["๐ŸŒ API Entry"] - A["๐Ÿ“ก POST /api/analysis/multi"] - A2["๐Ÿ”„ POST /api/analysis/reflect"] - end - - %% ===== โš™๏ธ Service Layer ===== - subgraph Service["โš™๏ธ Service Orchestration"] - B[AnalysisService] - C[AgentCoordinator] - D["๐Ÿ“Š Build Context
price ยท kline ยท news ยท indicators"] - end - - %% ===== ๐Ÿค– Multi-Agent Workflow ===== - subgraph Agents["๐Ÿค– Multi-Agent Workflow"] - - subgraph P1["๐Ÿ“ˆ Phase 1 ยท Analysis (Parallel)"] - E1["๐Ÿ” MarketAnalyst
Technical"] - E2["๐Ÿ“‘ FundamentalAnalyst
Fundamentals"] - E3["๐Ÿ“ฐ NewsAnalyst
News & Events"] - E4["๐Ÿ’ญ SentimentAnalyst
Market Mood"] - E5["โš ๏ธ RiskAnalyst
Risk Assessment"] - end - - subgraph P2["๐ŸŽฏ Phase 2 ยท Debate (Parallel)"] - F1["๐Ÿ‚ BullResearcher
Bullish Case"] - F2["๐Ÿป BearResearcher
Bearish Case"] - end - - subgraph P3["๐Ÿ’น Phase 3 ยท Decision"] - G["๐ŸŽฐ TraderAgent
Final Verdict โ†’ BUY / SELL / HOLD"] - end - - end - - %% ===== ๐Ÿง  Memory Layer ===== - subgraph Memory["๐Ÿง  PostgreSQL Memory Store"] - M1[("market_analyst")] - M2[("fundamental")] - M3[("news_analyst")] - M4[("sentiment")] - M5[("risk_analyst")] - M6[("bull_researcher")] - M7[("bear_researcher")] - M8[("trader_agent")] - end - - %% ===== ๐Ÿ”„ Reflection Loop ===== - subgraph Reflect["๐Ÿ”„ Reflection Loop (Optional)"] - R[ReflectionService] - RR[("reflection_records.db")] - W["โฐ ReflectionWorker"] - end - - %% ===== Main Flow ===== - A --> B --> C --> D - D --> P1 --> P2 --> P3 - - %% ===== Memory Read/Write ===== - E1 <-.-> M1 - E2 <-.-> M2 - E3 <-.-> M3 - E4 <-.-> M4 - E5 <-.-> M5 - F1 <-.-> M6 - F2 <-.-> M7 - G <-.-> M8 - - %% ===== Reflection Flow ===== - C --> R --> RR - W --> RR - W -.->|"verify + learn"| M8 - A2 -.->|"manual review"| M8 +``` +Indicator โ†’ Strategy Config โ†’ Backtest โ†’ AI Optimization โ†’ Live Execution ``` -**Retrieval ranking (simplified)**: +### 3. AI Multi-Agent Research -\[ -score = w_{sim}\cdot sim + w_{recency}\cdot recency + w_{returns}\cdot returns\_score -\] +A team of specialized agents analyzes markets: +- **Research Agents** โ€” Web scraping for news and events +- **Analysis Agents** โ€” Technical indicators and capital flows +- **Risk Assessment** โ€” Market filter based on AI sentiment -Config lives in `.env` (see `backend_api_python/env.example`): `ENABLE_AGENT_MEMORY`, `AGENT_MEMORY_TOP_K`, `AGENT_MEMORY_ENABLE_VECTOR`, `AGENT_MEMORY_HALF_LIFE_DAYS`, and `ENABLE_REFLECTION_WORKER`. +### 4. Multi-LLM Support -### 6. Strategy Runtime +| Provider | Models | +|----------|--------| +| OpenRouter | 100+ models | +| OpenAI | GPT-4o, GPT-4o-mini | +| Google | Gemini 1.5 Flash/Pro | +| DeepSeek | DeepSeek Chat | +| xAI | Grok Beta | -- **Thread-Based Executor**: Independent thread pool for strategy execution -- **Auto-Restore**: Resumes running strategies after system restarts -- **Order Queue**: Background worker for order execution +### 5. Enterprise Features -### 7. Multi-LLM Provider Support - -QuantDinger supports multiple AI providers with auto-detection: - -| Provider | Features | -|----------|----------| -| **OpenRouter** | Multi-model gateway (default), 100+ models | -| **OpenAI** | GPT-4o, GPT-4o-mini | -| **Google Gemini** | Gemini 1.5 Flash/Pro | -| **DeepSeek** | DeepSeek Chat (cost-effective) | -| **xAI Grok** | Grok Beta | - -Simply configure your preferred provider's API key in `.env`. The system auto-detects available providers. - -### 8. User Management & Security - -- **Multi-User Support**: PostgreSQL-backed user accounts with role-based permissions -- **OAuth Login**: Google and GitHub OAuth integration -- **Email Verification**: Registration and password reset via email codes -- **Security Features**: Cloudflare Turnstile captcha, IP/account rate limiting -- **Demo Mode**: Read-only mode for public demonstrations - -### 9. Tech Stack - -- **Backend**: Python (Flask) + PostgreSQL + Redis (optional) -- **Frontend**: Vue 2 + Ant Design Vue + KlineCharts/ECharts -- **Deployment**: Docker Compose (with PostgreSQL) +- **Multi-User Support** โ€” PostgreSQL-backed accounts with role-based permissions +- **OAuth Integration** โ€” Google and GitHub login +- **Security** โ€” Cloudflare Turnstile, rate limiting, email verification --- -## ๐Ÿ”Œ Supported Exchanges & Brokers +## ๐Ÿš€ Quick Start -QuantDinger supports multiple execution methods for different market types: +### Docker Deployment (Recommended) -### Cryptocurrency Exchanges (Direct API) +```bash +# Clone and configure +git clone https://github.com/brokermr810/QuantDinger.git +cd QuantDinger +cp backend_api_python/env.example backend_api_python/.env -| Exchange | Markets | -|:--------:|:---------| -| Binance | Spot, Futures, Margin | -| OKX | Spot, Perpetual, Options | -| Bitget | Spot, Futures, Copy Trading | -| Bybit | Spot, Linear Futures | -| Coinbase Exchange | Spot | -| Kraken | Spot, Futures | -| KuCoin | Spot, Futures | -| Gate.io | Spot, Futures | -| Bitfinex | Spot, Derivatives | +# Start services +docker-compose up -d --build +``` -### Traditional Brokers +**Access:** +- Frontend: http://localhost:8888 +- API: http://localhost:5000 +- Default login: `quantdinger` / `123456` -| Broker | Markets | Platform | -|:------:|:--------|:---------| -| **Interactive Brokers (IBKR)** | US Stocks, HK Stocks | TWS / IB Gateway ๐Ÿ†• | -| **MetaTrader 5 (MT5)** | Forex | MT5 Terminal ๐Ÿ†• | +### Docker Commands -### Market Data (via CCXT) +```bash +docker-compose ps # Status +docker-compose logs -f # Logs +docker-compose down # Stop +docker-compose up -d --build # Rebuild +``` -Bybit, Gate.io, Kraken, KuCoin, HTX, and 100+ other exchanges for market data. +### Local Development + +```bash +# Backend +cd backend_api_python +pip install -r requirements.txt +cp env.example .env +python run.py + +# Frontend +cd quantdinger_vue +npm install && npm run serve +``` --- -### Multi-Language Support +## ๐Ÿ“š Documentation -QuantDinger is built for a global audience with comprehensive internationalization: +- [Python Strategy Development Guide](docs/STRATEGY_DEV_GUIDE.md) +- [Interactive Brokers (IBKR) Trading Guide](docs/IBKR_TRADING_GUIDE_EN.md) +- [MetaTrader 5 (MT5) Trading Guide](docs/MT5_TRADING_GUIDE_EN.md) +- [Telegram Notification Setup](docs/NOTIFICATION_TELEGRAM_CONFIG_EN.md) +- [Email Notification Setup](docs/NOTIFICATION_EMAIL_CONFIG_EN.md) + +--- + +## ๐Ÿ—๏ธ Architecture + +``` +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ quantdinger_vue โ”‚ +โ”‚ (Vue 2 + Ant Design Vue) โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + โ”‚ HTTP (/api/*) + โ–ผ +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ backend_api_python โ”‚ +โ”‚ (Flask + Strategy Runtime) โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + โ”‚ + โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” + โ–ผ โ–ผ โ–ผ +PostgreSQL Redis Exchanges + (opt) & LLMs +``` + +--- + +## ๐ŸŒ Multi-Language Support

English - Simplified Chinese + Chinese Traditional Chinese Japanese Korean German French - Thai - Vietnamese - Arabic

-All UI elements, error messages, and documentation are fully translated. Language is auto-detected based on browser settings or can be manually switched in the app. - --- -### Supported Markets +## ๐Ÿ“œ License -| Market Type | Data Sources | Trading | -|-------------|--------------|---------| -| **Cryptocurrency** | Binance, OKX, Bitget, + 100 exchanges | โœ… Full support | -| **US Stocks** | Yahoo Finance, Finnhub, Tiingo | โœ… Via IBKR ๐Ÿ†• | -| **HK Stocks** | AkShare, East Money | โœ… Via IBKR ๐Ÿ†• | -| **CN Stocks (A-shares)** | AkShare, East Money | โšก Data only | -| **Forex** | Finnhub, OANDA | โœ… Via MT5 ๐Ÿ†• | -| **Futures** | Exchange APIs, AkShare | โšก Data only | +Licensed under **Apache License 2.0**. See [LICENSE](LICENSE). ---- - -### Architecture (Current Repo) - -```text -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ quantdinger_vue โ”‚ -โ”‚ (Vue 2 + Ant Design Vue) โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - โ”‚ HTTP (/api/*) - โ–ผ -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ backend_api_python โ”‚ -โ”‚ (Flask + strategy runtime) โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - โ”‚ - โ”œโ”€ PostgreSQL (multi-user support) - โ”œโ”€ Redis (optional cache) - โ””โ”€ Data providers / LLMs / Exchanges -``` - ---- - -### Repository Layout - -```text -. -โ”œโ”€ backend_api_python/ # Flask API + AI + backtest + strategy runtime -โ”‚ โ”œโ”€ app/ -โ”‚ โ”œโ”€ env.example # Copy to .env for local config -โ”‚ โ”œโ”€ requirements.txt -โ”‚ โ””โ”€ run.py # Entrypoint -โ””โ”€ quantdinger_vue/ # Vue 2 UI (dev server proxies /api -> backend) -``` - ---- - -## Quick Start - -### Option 1: Docker Deployment (Recommended) - -The fastest way to get QuantDinger running with PostgreSQL database and multi-user support. - -#### 1. Configure Environment - -Create a `.env` file in project root: - -```bash -# Database Configuration -POSTGRES_USER=quantdinger -POSTGRES_PASSWORD=your_secure_password -POSTGRES_DB=quantdinger - -# Admin Account (created on first startup) -ADMIN_USER=quantdinger -ADMIN_PASSWORD=123456 - -# Optional: AI Features -OPENROUTER_API_KEY=your_api_key -``` - -#### 2. Start Services - -**Linux / macOS** -```bash -git clone https://github.com/brokermr810/QuantDinger.git && \ -cd QuantDinger && \ -cp backend_api_python/env.example backend_api_python/.env && \ -docker-compose up -d --build -``` - -**Windows (PowerShell)** -```powershell -git clone https://github.com/brokermr810/QuantDinger.git -cd QuantDinger -Copy-Item backend_api_python\env.example -Destination backend_api_python\.env -docker-compose up -d --build -``` - -This will automatically: -- Start PostgreSQL database (port 5432) -- Initialize database schema -- Start backend API (port 5000) -- Start frontend (port 8888) -- Create admin user from `ADMIN_USER`/`ADMIN_PASSWORD` in `.env` - -#### 3. Access the Application - -- **Frontend UI**: http://localhost:8888 -- **Backend API**: http://localhost:5000 -- **Default Account**: Uses `ADMIN_USER` / `ADMIN_PASSWORD` from `.env` (default: `quantdinger` / `123456`, please change for production) - -> **Note**: For production, edit `backend_api_python/.env` to set strong passwords, add `OPENROUTER_API_KEY` for AI features, then restart with `docker-compose restart backend`. - -#### Docker Commands Reference - -```bash -# View running status -docker-compose ps - -# View logs -docker-compose logs -f - -# View backend logs only -docker-compose logs -f backend - -# View frontend logs only -docker-compose logs -f frontend - -# Stop services -docker-compose down - -# Stop and remove volumes (WARNING: deletes database!) -docker-compose down -v - -# Restart services -docker-compose restart - -# Rebuild and restart -docker-compose up -d --build - -# Enter backend container -docker exec -it quantdinger-backend /bin/bash - -# Enter frontend container -docker exec -it quantdinger-frontend /bin/sh -``` - -#### Docker Architecture - -``` -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ Frontend โ”‚ โ”‚ Backend โ”‚ โ”‚ PostgreSQL โ”‚ -โ”‚ (Nginx) โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ (Python) โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ Database โ”‚ -โ”‚ Port: 8888 โ”‚ โ”‚ Port: 5000 โ”‚ โ”‚ Port: 5432 โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - โ”‚ โ”‚ โ”‚ - โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - Docker Network -``` - -- **Frontend**: Vue.js app served by Nginx, proxies API requests to backend -- **Backend**: Python Flask API service with multi-user authentication -- **PostgreSQL**: Database for user data, strategies, and trading records - -#### Data Persistence - -The following data is persisted across container restarts: - -```yaml -volumes: - postgres_data: # PostgreSQL database - - ./backend_api_python/logs:/app/logs # Logs - - ./backend_api_python/data:/app/data # Data directory - - ./backend_api_python/.env:/app/.env # Configuration -``` - -#### Customization - -**Change ports** - Edit `docker-compose.yml`: - -```yaml -services: - frontend: - ports: - - "8080:80" # Change to port 8080 - - backend: - ports: - - "5001:5000" # Change to port 5001 -``` - -**Configure HTTPS** - Use a reverse proxy (like Caddy/Nginx): - -```bash -# Using Caddy (automatic HTTPS) -caddy reverse-proxy --from yourdomain.com --to localhost:80 -``` - -#### Production Recommendations - -**Security:** - -```bash -# Generate strong SECRET_KEY -openssl rand -hex 32 - -# Set secure admin password -ADMIN_PASSWORD=your-very-secure-password -``` - -**Resource limits** - Add to `docker-compose.yml`: - -```yaml -services: - backend: - deploy: - resources: - limits: - cpus: '2' - memory: 2G - reservations: - cpus: '0.5' - memory: 512M -``` - -**Log management:** - -```yaml -services: - backend: - logging: - driver: "json-file" - options: - max-size: "100m" - max-file: "3" -``` - -#### Docker Troubleshooting - -**Frontend can't connect to backend:** - -```bash -docker-compose logs backend -curl http://localhost:5000/api/health -``` - -**Database connection issues:** - -```bash -# Check PostgreSQL container status -docker-compose logs postgres - -# Verify PostgreSQL is ready -docker exec quantdinger-db pg_isready -U quantdinger - -# Connect to database manually -docker exec -it quantdinger-db psql -U quantdinger -d quantdinger -``` - -**Build failures:** - -```bash -# Clear Docker cache and rebuild -docker-compose build --no-cache -``` - -**Out of memory:** - -```bash -# Check memory usage -docker stats - -# Add swap space (Linux) -sudo fallocate -l 2G /swapfile -sudo chmod 600 /swapfile -sudo mkswap /swapfile -sudo swapon /swapfile -``` - -#### Updating - -```bash -# Pull latest code -git pull - -# Rebuild and restart -docker-compose up -d --build -``` - -#### Backup - -```bash -# Backup PostgreSQL database -docker exec quantdinger-db pg_dump -U quantdinger quantdinger > backup/quantdinger_$(date +%Y%m%d).sql - -# Backup configuration -cp backend_api_python/.env backup/.env_$(date +%Y%m%d) - -# Restore database (if needed) -cat backup/quantdinger_YYYYMMDD.sql | docker exec -i quantdinger-db psql -U quantdinger quantdinger -``` - ---- - -### Option 2: Local Development - -**Prerequisites** - -- Python 3.10+ recommended -- Node.js 16+ recommended -- PostgreSQL 14+ installed and running - -#### 1. Setup PostgreSQL - -```bash -# Create database and user -sudo -u postgres psql -CREATE DATABASE quantdinger; -CREATE USER quantdinger WITH ENCRYPTED PASSWORD 'your_password'; -GRANT ALL PRIVILEGES ON DATABASE quantdinger TO quantdinger; -\q - -# Initialize schema -psql -U quantdinger -d quantdinger -f backend_api_python/migrations/init.sql -``` - -#### 2. Start the backend (Flask API) - -```bash -cd backend_api_python -pip install -r requirements.txt -cp env.example .env # Windows: copy env.example .env -``` - -Edit `.env` and set: -```bash -DATABASE_URL=postgresql://quantdinger:your_password@localhost:5432/quantdinger -SECRET_KEY=your-secret-key -ADMIN_USER=quantdinger -ADMIN_PASSWORD=123456 -``` - -Then start: -```bash -python run.py -``` - -Backend will be available at `http://localhost:5000`. - -#### 2. Start the frontend (Vue UI) - -```bash -cd quantdinger_vue -npm install -npm run serve -``` - -Frontend dev server runs at `http://localhost:8000` and proxies `/api/*` to `http://localhost:5000` (see `quantdinger_vue/vue.config.js`). - ---- - -### Configuration (.env) - -Use `backend_api_python/env.example` as a template. Common settings include: - -- **Auth**: `SECRET_KEY`, `ADMIN_USER`, `ADMIN_PASSWORD` -- **Server**: `PYTHON_API_HOST`, `PYTHON_API_PORT`, `PYTHON_API_DEBUG` -- **Database**: `DATABASE_URL` (PostgreSQL connection string) -- **AI / LLM**: `LLM_PROVIDER` (openrouter/openai/google/deepseek/grok), provider-specific API keys -- **OAuth**: `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET`, `GITHUB_CLIENT_ID`, `GITHUB_CLIENT_SECRET` -- **Security**: `TURNSTILE_SITE_KEY`, `TURNSTILE_SECRET_KEY`, `ENABLE_REGISTRATION` -- **Web search**: `SEARCH_PROVIDER`, `SEARCH_GOOGLE_*`, `SEARCH_BING_API_KEY` -- **Order Execution**: `ORDER_MODE` (maker/market), `MAKER_WAIT_SEC`, `MAKER_OFFSET_BPS` -- **Proxy (optional)**: `PROXY_PORT` or `PROXY_URL` -- **Workers**: `ENABLE_PENDING_ORDER_WORKER`, `ENABLE_PORTFOLIO_MONITOR` - ---- - -### API - -The backend provides REST endpoints for login, market data, indicators, backtesting, strategies, and AI analysis. - -- Health: `GET /health` (also supports `GET /api/health` for deployment probes) -- Auth (frontend-compatible): `POST /api/user/login`, `POST /api/user/logout`, `GET /api/user/info` - -For the full route list, see `backend_api_python/app/routes/`. - ---- - -### License - -Licensed under the **Apache License 2.0**. See `LICENSE`. +**Trademark Notice:** Apache 2.0 does not grant trademark rights. QuantDinger branding (name/logo) is protected. See [TRADEMARKS.md](TRADEMARKS.md) for usage guidelines. --- ## ๐Ÿค Community & Support -- **Contributing**: [Contributing Guide](CONTRIBUTING.md) ยท [Contributors](CONTRIBUTORS.md) - **Telegram**: [QuantDinger Group](https://t.me/quantdinger) - **Discord**: [Join Server](https://discord.gg/vwJ8zxFh9Q) -- **๐Ÿ“บ Video Demo**: [Project Introduction](https://youtu.be/HPTVpqL7knM) -- **YouTube**: [@quantdinger](https://youtube.com/@quantdinger) -- **Email**: [brokermr810@gmail.com](mailto:brokermr810@gmail.com) - **GitHub Issues**: [Report bugs / Request features](https://github.com/brokermr810/QuantDinger/issues) - ---- - -## ๐Ÿ’ผ Commercial License & Sponsorship - -QuantDinger is licensed under **Apache License 2.0** (code). However, **Apache 2.0 does NOT grant trademark rights**. Our branding assets (name/logo) are protected as trademarks and are governed separately from the code license: - -- **Copyright/Attribution**: You must keep required copyright and license notices (including any NOTICE/attribution in the repo and in the UI where applicable). -- **Trademarks (Name/Logo/Branding)**: Without permission, you may not modify QuantDinger branding (name/logo/UI brand), or use it to imply endorsement or misrepresent origin. If you redistribute a modified version, you should remove QuantDinger branding and rebrand unless you have a commercial license. - -If you need to keep/modify QuantDinger branding in a redistribution (including UI branding and logo usage), please contact us for a **commercial license**. - -See: `TRADEMARKS.md` - -### What you get with a Commercial License - -- **Commercial authorization** to modify branding/copyright display as agreed -- **Operations support**: deployment, upgrades, incident support, and maintenance guidance -- **Consulting services**: architecture review, performance tuning, strategy workflow consulting -- **Sponsorship options**: become a project sponsor and we can **display your logo/ad** (README/website/in-app placement as agreed) - -### Contact - -- **Telegram**: `https://t.me/worldinbroker` - **Email**: [brokermr810@gmail.com](mailto:brokermr810@gmail.com) --- -### ๐Ÿ’ผ Trusted Exchange Partners (Affiliate Links) - -By using our partner links, you support QuantDinger's development while enjoying the same trading experience. - -
- - - - - - -
- - Binance - -

- World's Largest Crypto Exchange
- Spot โ€ข Futures โ€ข Margin Trading -
- - OKX - -

- Leading Derivatives Platform
- Spot โ€ข Perpetual โ€ข Options -
- - Bitget - -

- Innovative Copy Trading
- Spot โ€ข Futures โ€ข Social Trading -
-
- ---- - -### ๐Ÿ’ Direct Support (Donations) - -Your contributions help us maintain and improve QuantDinger. +## ๐Ÿ’ Support the Project **Crypto Donations (ERC-20 / BEP-20 / Polygon / Arbitrum)** @@ -856,47 +298,19 @@ Your contributions help us maintain and improve QuantDinger. --- -### ๐ŸŽ“ Supporting Partners - -We are proud to be supported by academic institutions and organizations advancing quantitative finance education and research. +## ๐ŸŽ“ Supporting Partners
- - - - -
- - Indiana University Quantitative Finance Society - -

- Quantitative Finance Society (QFS)
- Indiana University Bloomington
- Fostering the next generation of quantitative finance professionals -
+ + QFS + +
+ Quantitative Finance Society
+ Indiana University Bloomington
-> ๐Ÿ’ก **Interested in becoming a supporting partner?** We welcome collaborations with universities, research institutions, and organizations. Contact us at [brokermr810@gmail.com](mailto:brokermr810@gmail.com) or via [Telegram](https://t.me/worldinbroker). - --- -### Acknowledgements +## ๐Ÿ™ Acknowledgements -QuantDinger stands on the shoulders of great open-source projects: - -| Project | Description | Link | -|---------|-------------|------| -| **Flask** | Lightweight WSGI web framework | [flask.palletsprojects.com](https://flask.palletsprojects.com/) | -| **flask-cors** | Cross-Origin Resource Sharing extension | [GitHub](https://github.com/corydolphin/flask-cors) | -| **Pandas** | Data analysis and manipulation library | [pandas.pydata.org](https://pandas.pydata.org/) | -| **CCXT** | Cryptocurrency exchange trading library | [github.com/ccxt/ccxt](https://github.com/ccxt/ccxt) | -| **yfinance** | Yahoo Finance market data downloader | [github.com/ranaroussi/yfinance](https://github.com/ranaroussi/yfinance) | -| **akshare** | China financial data interface | [github.com/akfamily/akshare](https://github.com/akfamily/akshare) | -| **requests** | HTTP library for Python | [requests.readthedocs.io](https://requests.readthedocs.io/) | -| **Vue.js** | Progressive JavaScript framework | [vuejs.org](https://vuejs.org/) | -| **Ant Design Vue** | Enterprise-class UI components | [antdv.com](https://antdv.com/) | -| **KlineCharts** | Lightweight financial charting library | [github.com/klinecharts/KLineChart](https://github.com/klinecharts/KLineChart) | -| **Lightweight Charts** | TradingView charting library | [github.com/nicepkg/lightweight-charts](https://github.com/nicepkg/lightweight-charts) | -| **ECharts** | Apache data visualization library | [echarts.apache.org](https://echarts.apache.org/) | - -Thanks to all maintainers and contributors across these ecosystems! โค๏ธ +Built with [Flask](https://flask.palletsprojects.com/) ยท [Vue.js](https://vuejs.org/) ยท [CCXT](https://github.com/ccxt/ccxt) ยท [Pandas](https://pandas.pydata.org/) ยท [KlineCharts](https://github.com/klinecharts/KLineChart) ยท [Ant Design Vue](https://antdv.com/) diff --git a/README_CN.md b/README_CN.md index 15f9468..c148a5d 100644 --- a/README_CN.md +++ b/README_CN.md @@ -381,6 +381,7 @@ QuantDinger ๆ”ฏๆŒๅคš็งๅธ‚ๅœบ็ฑปๅž‹็š„ๆ‰ง่กŒๆ–นๅผ๏ผš | KuCoin | ็Žฐ่ดง, ๅˆ็บฆ | | Gate.io | ็Žฐ่ดง, ๅˆ็บฆ | | Bitfinex | ็Žฐ่ดง, ่ก็”Ÿๅ“ | +| Deepcoin | ็Žฐ่ดง, ๆฐธ็ปญ | ### ไผ ็ปŸๅˆธๅ•† @@ -613,43 +614,6 @@ QuantDinger ็š„ไปฃ็ ไฝฟ็”จ **Apache License 2.0** ๆŽˆๆƒใ€‚ไฝ†้œ€่ฆๆณจๆ„๏ผš** --- -### ๐Ÿ’ผ ๅ€ผๅพ—ไฟก่ต–็š„ไบคๆ˜“ๆ‰€ๅˆไฝœไผ™ไผด๏ผˆ่”็›Ÿ้“พๆŽฅ๏ผ‰ - -ไฝฟ็”จๆˆ‘ไปฌ็š„ๅˆไฝœไผ™ไผด้“พๆŽฅ๏ผŒๅœจไบซๅ—็›ธๅŒไบคๆ˜“ไฝ“้ชŒ็š„ๅŒๆ—ถๆ”ฏๆŒ QuantDinger ็š„ๅ‘ๅฑ•ใ€‚ - -
- - - - - - -
- - Binance - -

- ๅ…จ็ƒๆœ€ๅคง็š„ๅŠ ๅฏ†่ดงๅธไบคๆ˜“ๆ‰€
- ็Žฐ่ดง โ€ข ๆœŸ่ดง โ€ข ๆ ๆ†ไบคๆ˜“ -
- - OKX - -

- ้ข†ๅ…ˆ็š„่ก็”Ÿๅ“ๅนณๅฐ
- ็Žฐ่ดง โ€ข ๆฐธ็ปญๅˆ็บฆ โ€ข ๆœŸๆƒ -
- - Bitget - -

- ๅˆ›ๆ–ฐ็š„่ทŸๅ•ไบคๆ˜“
- ็Žฐ่ดง โ€ข ๆœŸ่ดง โ€ข ็คพไบคไบคๆ˜“ -
-
- ---- - ### ๐Ÿ’ ็›ดๆŽฅๆ”ฏๆŒ๏ผˆๆ่ต ๏ผ‰ ไฝ ็š„่ดก็ŒฎๅธฎๅŠฉๆˆ‘ไปฌ็ปดๆŠคๅ’Œๆ”น่ฟ› QuantDingerใ€‚ diff --git a/README_JA.md b/README_JA.md index eebb5d1..19b5562 100644 --- a/README_JA.md +++ b/README_JA.md @@ -351,6 +351,7 @@ QuantDingerใฏ่ค‡ๆ•ฐใฎๅธ‚ๅ ดใ‚ฟใ‚คใƒ—ใซๅฏพใ—ใฆ่ค‡ๆ•ฐใฎๅฎŸ่กŒๆ–นๆณ•ใ‚’ใ‚ตใƒ | KuCoin | ็พ็‰ฉ, ๅ…ˆ็‰ฉ | | Gate.io | ็พ็‰ฉ, ๅ…ˆ็‰ฉ | | Bitfinex | ็พ็‰ฉ, ใƒ‡ใƒชใƒใƒ†ใ‚ฃใƒ– | +| Deepcoin | ็พ็‰ฉ, ็„กๆœŸ้™ | ### ไผ็ตฑ็š„ใชใƒ–ใƒญใƒผใ‚ซใƒผ @@ -569,43 +570,6 @@ QuantDinger ใฎใ‚ณใƒผใƒ‰ใฏ **Apache License 2.0** ใงๆไพ›ใ•ใ‚Œใฆใ„ใพใ™ --- -### ๐Ÿ’ผ ๅ–ๅผ•ๆ‰€ใƒ‘ใƒผใƒˆใƒŠใƒผ๏ผˆใ‚ขใƒ•ใ‚ฃใƒชใ‚จใ‚คใƒˆใƒชใƒณใ‚ฏ๏ผ‰ - -ใƒ‘ใƒผใƒˆใƒŠใƒผใƒชใƒณใ‚ฏใ‚’ไฝฟ็”จใ™ใ‚‹ใ“ใจใงใ€ๅŒใ˜ๅ–ๅผ•ไฝ“้จ“ใ‚’ๆฅฝใ—ใฟใชใŒใ‚‰ QuantDinger ใฎ้–‹็™บใ‚’ๆ”ฏๆดใงใใพใ™ใ€‚ - -
- - - - - - -
- - Binance - -

- ไธ–็•Œๆœ€ๅคงใฎๆš—ๅท้€š่ฒจๅ–ๅผ•ๆ‰€
- ็พ็‰ฉ โ€ข ๅ…ˆ็‰ฉ โ€ข ใƒžใƒผใ‚ธใƒณๅ–ๅผ• -
- - OKX - -

- ไธป่ฆใชใƒ‡ใƒชใƒใƒ†ใ‚ฃใƒ–ใƒ—ใƒฉใƒƒใƒˆใƒ•ใ‚ฉใƒผใƒ 
- ็พ็‰ฉ โ€ข ใƒ‘ใƒผใƒšใƒใƒฅใ‚ขใƒซ โ€ข ใ‚ชใƒ—ใ‚ทใƒงใƒณ -
- - Bitget - -

- ้ฉๆ–ฐ็š„ใชใ‚ณใƒ”ใƒผใƒˆใƒฌใƒผใƒ‰
- ็พ็‰ฉ โ€ข ๅ…ˆ็‰ฉ โ€ข ใ‚ฝใƒผใ‚ทใƒฃใƒซใƒˆใƒฌใƒผใƒ‰ -
-
- ---- - ### ๐Ÿ’ ็›ดๆŽฅใ‚ตใƒใƒผใƒˆ๏ผˆๅฏ„ไป˜๏ผ‰ ใ‚ใชใŸใฎใ”ๆ”ฏๆดใฏ QuantDinger ใฎ็ถญๆŒใƒปๆ”นๅ–„ใซๅฝน็ซ‹ใกใพใ™ใ€‚ diff --git a/README_KO.md b/README_KO.md index 1278294..6da86ee 100644 --- a/README_KO.md +++ b/README_KO.md @@ -351,6 +351,7 @@ QuantDinger๋Š” ๋‹ค์–‘ํ•œ ์‹œ์žฅ ์œ ํ˜•์— ๋Œ€ํ•ด ์—ฌ๋Ÿฌ ์‹คํ–‰ ๋ฐฉ๋ฒ•์„ ์ง€์› | KuCoin | ํ˜„๋ฌผ, ์„ ๋ฌผ | | Gate.io | ํ˜„๋ฌผ, ์„ ๋ฌผ | | Bitfinex | ํ˜„๋ฌผ, ํŒŒ์ƒ์ƒํ’ˆ | +| Deepcoin | ํ˜„๋ฌผ, ๋ฌด๊ธฐํ•œ | ### ์ „ํ†ต์ ์ธ ๋ธŒ๋กœ์ปค @@ -582,43 +583,6 @@ QuantDinger์˜ ์ฝ”๋“œ๋Š” **Apache License 2.0**์œผ๋กœ ์ œ๊ณต๋ฉ๋‹ˆ๋‹ค. ๋‹ค๋งŒ ** --- -### ๐Ÿ’ผ ๊ฑฐ๋ž˜์†Œ ํŒŒํŠธ๋„ˆ(์–ดํ•„๋ฆฌ์—์ดํŠธ ๋งํฌ) - -ํŒŒํŠธ๋„ˆ ๋งํฌ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋™์ผํ•œ ๊ฑฐ๋ž˜ ๊ฒฝํ—˜์„ ์ฆ๊ธฐ๋ฉด์„œ QuantDinger์˜ ๊ฐœ๋ฐœ์„ ์ง€์›ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. - -
- - - - - - -
- - Binance - -

- ์„ธ๊ณ„ ์ตœ๋Œ€ ์•”ํ˜ธํ™”ํ ๊ฑฐ๋ž˜์†Œ
- ํ˜„๋ฌผ โ€ข ์„ ๋ฌผ โ€ข ๋งˆ์ง„ ๊ฑฐ๋ž˜ -
- - OKX - -

- ์ฃผ์š” ํŒŒ์ƒ์ƒํ’ˆ ํ”Œ๋žซํผ
- ํ˜„๋ฌผ โ€ข ์˜๊ตฌ ์„ ๋ฌผ โ€ข ์˜ต์…˜ -
- - Bitget - -

- ํ˜์‹ ์ ์ธ ๋ณต์‚ฌ ๊ฑฐ๋ž˜
- ํ˜„๋ฌผ โ€ข ์„ ๋ฌผ โ€ข ์†Œ์…œ ๊ฑฐ๋ž˜ -
-
- ---- - ### ๐Ÿ’ ์ง์ ‘ ์ง€์›(๊ธฐ๋ถ€) ๊ท€ํ•˜์˜ ๊ธฐ์—ฌ๋Š” QuantDinger์˜ ์œ ์ง€ ๋ฐ ๊ฐœ์„ ์— ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค. diff --git a/README_TW.md b/README_TW.md index ec57a9d..ce2b2a4 100644 --- a/README_TW.md +++ b/README_TW.md @@ -351,6 +351,7 @@ QuantDinger ๆ”ฏๆŒๅคš็จฎๅธ‚ๅ ด้กžๅž‹็š„ๅŸท่กŒๆ–นๅผ๏ผš | KuCoin | ็พ่ฒจ, ๅˆ็ด„ | | Gate.io | ็พ่ฒจ, ๅˆ็ด„ | | Bitfinex | ็พ่ฒจ, ่ก็”Ÿๅ“ | +| Deepcoin | ็พ่ฒจ, ๆฐธ็บŒ | ### ๅ‚ณ็ตฑๅˆธๅ•† @@ -583,43 +584,6 @@ QuantDinger ็š„ไปฃ็ขผไฝฟ็”จ **Apache License 2.0** ๆŽˆๆฌŠใ€‚ไฝ†่ซ‹ๆณจๆ„๏ผš**Apa --- -### ๐Ÿ’ผ ๅ€ผๅพ—ไฟก่ณด็š„ไบคๆ˜“ๆ‰€ๅˆไฝœๅคฅไผด๏ผˆ่ฏ็›Ÿ้ˆๆŽฅ๏ผ‰ - -ไฝฟ็”จๆˆ‘ๅ€‘็š„ๅˆไฝœๅคฅไผด้ˆๆŽฅ๏ผŒๅœจไบซๅ—็›ธๅŒไบคๆ˜“้ซ”้ฉ—็š„ๅŒๆ™‚ๆ”ฏๆŒ QuantDinger ็š„็™ผๅฑ•ใ€‚ - -
- - - - - - -
- - Binance - -

- ๅ…จ็ƒๆœ€ๅคง็š„ๅŠ ๅฏ†่ฒจๅนฃไบคๆ˜“ๆ‰€
- ็พ่ฒจ โ€ข ๆœŸ่ฒจ โ€ข ๆง“ๆกฟไบคๆ˜“ -
- - OKX - -

- ้ ˜ๅ…ˆ็š„่ก็”Ÿๅ“ๅนณๅฐ
- ็พ่ฒจ โ€ข ๆฐธ็บŒๅˆ็ด„ โ€ข ๆœŸๆฌŠ -
- - Bitget - -

- ๅ‰ตๆ–ฐ็š„่ทŸๅ–ฎไบคๆ˜“
- ็พ่ฒจ โ€ข ๆœŸ่ฒจ โ€ข ็คพไบคไบคๆ˜“ -
-
- ---- - ### ๐Ÿ’ ็›ดๆŽฅๆ”ฏๆŒ๏ผˆๆ่ดˆ๏ผ‰ ไฝ ็š„่ฒข็ปๅนซๅŠฉๆˆ‘ๅ€‘็ถญ่ญทๅ’Œๆ”น้€ฒ QuantDingerใ€‚ diff --git a/backend_api_python/app/services/live_trading/deepcoin.py b/backend_api_python/app/services/live_trading/deepcoin.py new file mode 100644 index 0000000..f7265ab --- /dev/null +++ b/backend_api_python/app/services/live_trading/deepcoin.py @@ -0,0 +1,640 @@ +""" +Deepcoin (direct REST) client for spot / perpetual swap orders. + +Based on official Deepcoin Python SDK example. +API Base URL: https://api.deepcoin.com + +Signing: +- DC-ACCESS-SIGN = base64(hmac_sha256(secret, timestamp + method + uri + body)) +- For GET: message = timestamp + method + uri (with query params) +- For POST: message = timestamp + method + uri + json_body +""" + +from __future__ import annotations + +import base64 +import datetime +import hashlib +import hmac +import json +import time +from decimal import Decimal, ROUND_DOWN +from typing import Any, Dict, Optional, Tuple +from urllib.parse import urlencode + +import requests + +from app.services.live_trading.base import BaseRestClient, LiveOrderResult, LiveTradingError +from app.services.live_trading.symbols import to_deepcoin_symbol + + +class DeepcoinClient(BaseRestClient): + """ + Deepcoin REST client for spot and perpetual swap trading. + + Based on official Deepcoin Python SDK. + Supports both spot and swap (perpetual futures) markets. + """ + + def __init__( + self, + *, + api_key: str, + secret_key: str, + passphrase: str = "", + base_url: str = "https://api.deepcoin.com", + timeout_sec: float = 15.0, + market_type: str = "swap", # "swap" (perpetual) or "spot" + ): + super().__init__(base_url=base_url, timeout_sec=timeout_sec) + self.api_key = (api_key or "").strip() + self.secret_key = (secret_key or "").strip() + self.passphrase = (passphrase or "").strip() + self.market_type = (market_type or "swap").strip().lower() + if self.market_type not in ("swap", "spot"): + self.market_type = "swap" + + if not self.api_key or not self.secret_key: + raise LiveTradingError("Missing Deepcoin api_key/secret_key") + + # Best-effort cache for instrument metadata (qty step, min qty, etc.) + # Key: f"{market_type}:{symbol}" -> (fetched_at_ts, info_dict) + self._inst_cache: Dict[str, Tuple[float, Dict[str, Any]]] = {} + self._inst_cache_ttl_sec = 300.0 + + # Best-effort cache for leverage settings + self._lev_cache: Dict[str, Tuple[float, bool]] = {} + self._lev_cache_ttl_sec = 60.0 + + @staticmethod + def _to_dec(x: Any) -> Decimal: + try: + return Decimal(str(x)) + except Exception: + return Decimal("0") + + @staticmethod + def _dec_str(d: Decimal) -> str: + try: + return format(d, "f") + except Exception: + return str(d) + + @staticmethod + def _floor_to_step(value: Decimal, step: Decimal) -> Decimal: + if step is None: + return value + if value <= 0: + return Decimal("0") + try: + st = Decimal(step) + except Exception: + st = Decimal("0") + if st <= 0: + return value + try: + n = (value / st).to_integral_value(rounding=ROUND_DOWN) + return n * st + except Exception: + return Decimal("0") + + def _get_iso_time(self) -> str: + """ + Generate ISO 8601 timestamp for Deepcoin API. + Format: 2024-07-29T11:12:00.123Z + """ + ticks = time.time() + localdate = datetime.datetime.utcfromtimestamp(ticks) + iso_time = localdate.isoformat() + # Ensure milliseconds and Z suffix + iso_time_change = iso_time[:23] + "Z" + return iso_time_change + + def _build_uri_with_params(self, uri: str, params: Optional[Dict[str, Any]], method: str) -> str: + """ + Build URI with query parameters for GET requests. + For POST requests, return URI as-is. + """ + if method.upper() == "GET" and params and params != {}: + query_parts = [] + for key, value in params.items(): + query_parts.append(f"{key}={value}") + query_string = "&".join(query_parts) + return f"{uri}?{query_string}" + return uri + + def _sign(self, iso_time: str, method: str, uri: str, data: Optional[Dict[str, Any]] = None) -> str: + """ + Generate HMAC-SHA256 signature for request authentication. + + For POST: message = timestamp + method + uri + json_body + For GET: message = timestamp + method + uri (with query params) + """ + method_upper = method.upper() + if method_upper == "POST" and data: + # Convert dict to JSON string with double quotes + data_str = json.dumps(data, separators=(',', ':')) + message = f"{iso_time}{method_upper}{uri}{data_str}" + else: + message = f"{iso_time}{method_upper}{uri}" + + message_bytes = message.encode('utf-8') + key_bytes = self.secret_key.encode('utf-8') + sign = base64.b64encode( + hmac.new(key=key_bytes, msg=message_bytes, digestmod=hashlib.sha256).digest() + ).decode('utf-8') + return sign + + def _headers(self, iso_time: str, sign: str) -> Dict[str, str]: + """ + Build authenticated request headers. + """ + headers = { + "DC-ACCESS-KEY": self.api_key, + "DC-ACCESS-SIGN": sign, + "DC-ACCESS-TIMESTAMP": iso_time, + "DC-ACCESS-PASSPHRASE": self.passphrase, + "Content-Type": "application/json", + } + return headers + + def _public_request(self, method: str, uri: str, *, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]: + """ + Make public (unauthenticated) API request. + """ + full_uri = self._build_uri_with_params(uri, params, method) + url = f"{self.base_url}{full_uri}" + + try: + if method.upper() == "GET": + resp = requests.get(url=url, timeout=self.timeout_sec) + else: + resp = requests.post(url=url, json=params, timeout=self.timeout_sec) + + if resp.status_code >= 400: + raise LiveTradingError(f"Deepcoin HTTP {resp.status_code}: {resp.text[:500]}") + + data = resp.json() + if isinstance(data, dict): + code = data.get("code") or data.get("retCode") + if code not in (0, "0", None, "", "00000"): + raise LiveTradingError(f"Deepcoin error: {data}") + return data if isinstance(data, dict) else {"raw": data} + except requests.RequestException as e: + raise LiveTradingError(f"Deepcoin request failed: {str(e)}") + + def _signed_request( + self, + method: str, + uri: str, + *, + params: Optional[Dict[str, Any]] = None, + ) -> Dict[str, Any]: + """ + Make authenticated API request following Deepcoin signing spec. + + For GET requests: params are appended to URI as query string + For POST requests: params are sent as JSON body + """ + iso_time = self._get_iso_time() + method_upper = method.upper() + + # Build full URI (with query params for GET) + full_uri = self._build_uri_with_params(uri, params, method) + + # Generate signature + if method_upper == "POST": + sign = self._sign(iso_time, method_upper, uri, params) + else: + sign = self._sign(iso_time, method_upper, full_uri, None) + + headers = self._headers(iso_time, sign) + url = f"{self.base_url}{full_uri}" + + try: + if method_upper == "POST": + body_str = json.dumps(params, separators=(',', ':')) if params else "" + resp = requests.post(url=url, headers=headers, data=body_str, timeout=self.timeout_sec) + else: + resp = requests.get(url=url, headers=headers, timeout=self.timeout_sec) + + if resp.status_code >= 400: + raise LiveTradingError(f"Deepcoin HTTP {resp.status_code}: {resp.text[:500]}") + + data = resp.json() + if isinstance(data, dict): + code = data.get("code") or data.get("retCode") + if code not in (0, "0", None, "", "00000"): + raise LiveTradingError(f"Deepcoin error: {data}") + return data if isinstance(data, dict) else {"raw": data} + except requests.RequestException as e: + raise LiveTradingError(f"Deepcoin request failed: {str(e)}") + + def ping(self) -> bool: + """ + Test API connectivity using public endpoint. + """ + try: + # Try public endpoint to check connectivity + url = f"{self.base_url}/deepcoin/market/time" + resp = requests.get(url=url, timeout=self.timeout_sec) + return resp.status_code == 200 + except Exception: + return False + + def get_balance(self) -> Dict[str, Any]: + """ + Get account balance. + + Endpoint: GET /deepcoin/account/balances + """ + params = {"instType": "SWAP" if self.market_type == "swap" else "SPOT"} + return self._signed_request("GET", "/deepcoin/account/balances", params=params) + + def get_positions(self, *, symbol: str = "") -> Dict[str, Any]: + """ + Get open positions. + + Endpoint: GET /deepcoin/account/positions + """ + params: Dict[str, Any] = {"instType": "SWAP" if self.market_type == "swap" else "SPOT"} + if symbol: + params["instId"] = to_deepcoin_symbol(symbol) + return self._signed_request("GET", "/deepcoin/account/positions", params=params) + + def set_leverage(self, *, symbol: str, leverage: float, mgn_mode: str = "cross") -> bool: + """ + Set leverage for a trading pair. + + Endpoint: POST /deepcoin/account/set-leverage + """ + sym = to_deepcoin_symbol(symbol) + if not sym: + return False + + try: + lv = int(float(leverage or 1.0)) + except Exception: + lv = 1 + if lv < 1: + lv = 1 + + mm = str(mgn_mode or "cross").strip().lower() + if mm not in ("cross", "isolated"): + mm = "cross" + + # Check cache + cache_key = f"{sym}:{mm}:{lv}" + now = time.time() + cached = self._lev_cache.get(cache_key) + if cached: + ts, ok = cached + if ok and (now - float(ts or 0.0)) <= float(self._lev_cache_ttl_sec or 60.0): + return True + + params = { + "instId": sym, + "lever": str(lv), + "mgnMode": mm, + "mrgPosition": "merge", + } + + try: + self._signed_request("POST", "/deepcoin/account/set-leverage", params=params) + self._lev_cache[cache_key] = (now, True) + return True + except Exception: + return False + + def get_instrument_info(self, *, symbol: str) -> Dict[str, Any]: + """ + Get instrument metadata (min qty, qty step, etc.). + + Endpoint: GET /deepcoin/market/instruments + """ + sym = to_deepcoin_symbol(symbol) + if not sym: + return {} + + key = f"{self.market_type}:{sym}" + now = time.time() + cached = self._inst_cache.get(key) + if cached: + ts, obj = cached + if obj and (now - float(ts or 0.0)) <= float(self._inst_cache_ttl_sec or 300.0): + return obj + + inst_type = "SWAP" if self.market_type == "swap" else "SPOT" + params = {"instType": inst_type, "instId": sym} + + try: + raw = self._public_request("GET", "/deepcoin/market/instruments", params=params) + data = (raw.get("data") or []) if isinstance(raw, dict) else [] + first: Dict[str, Any] = data[0] if isinstance(data, list) and data else {} + if isinstance(first, dict) and first: + self._inst_cache[key] = (now, first) + return first if isinstance(first, dict) else {} + except Exception: + return {} + + def _normalize_qty(self, *, symbol: str, qty: float) -> Decimal: + """ + Normalize order quantity to exchange requirements. + """ + q = self._to_dec(qty) + if q <= 0: + return Decimal("0") + + sym = to_deepcoin_symbol(symbol) + try: + info = self.get_instrument_info(symbol=sym) or {} + except Exception: + info = {} + + # Extract lot size filter + step = self._to_dec(info.get("lotSz") or info.get("qtyStep") or "0") + mn = self._to_dec(info.get("minSz") or info.get("minOrderQty") or "0") + + if step > 0: + q = self._floor_to_step(q, step) + if mn > 0 and q < mn: + return Decimal("0") + return q + + def place_market_order( + self, + *, + symbol: str, + side: str, + qty: float, + reduce_only: bool = False, + pos_side: str = "", + client_order_id: Optional[str] = None, + ) -> LiveOrderResult: + """ + Place a market order. + + Endpoint: POST /deepcoin/trade/order + + Args: + symbol: Trading pair (e.g., "BTC/USDT:USDT" or "BTCUSDT") + side: "buy" or "sell" + qty: Order quantity in base currency + reduce_only: If True, only reduce position (for futures) + pos_side: Position side for hedge mode ("long" or "short") + client_order_id: Optional client order ID + """ + sym = to_deepcoin_symbol(symbol) + sd = (side or "").strip().lower() + if sd not in ("buy", "sell"): + raise LiveTradingError(f"Invalid side: {side}") + + q_req = float(qty or 0.0) + q_dec = self._normalize_qty(symbol=symbol, qty=q_req) + if float(q_dec or 0) <= 0: + raise LiveTradingError(f"Invalid qty (below step/min): requested={q_req}") + + params: Dict[str, Any] = { + "instId": sym, + "tdMode": "cash" if self.market_type == "spot" else "cross", + "side": sd, + "ordType": "market", + "sz": self._dec_str(q_dec), + } + + if self.market_type != "spot": + ps = (pos_side or "").strip().lower() + if ps in ("long", "short", "net"): + params["posSide"] = ps + if reduce_only: + params["reduceOnly"] = True + + if client_order_id: + params["clOrdId"] = str(client_order_id) + + raw = self._signed_request("POST", "/deepcoin/trade/order", params=params) + data = (raw.get("data") or []) if isinstance(raw, dict) else [] + first: Dict[str, Any] = data[0] if isinstance(data, list) and data else {} + oid = str(first.get("ordId") or first.get("orderId") or first.get("clOrdId") or "") + + return LiveOrderResult( + exchange_id="deepcoin", + exchange_order_id=oid, + filled=0.0, + avg_price=0.0, + raw=raw, + ) + + def place_limit_order( + self, + *, + symbol: str, + side: str, + qty: float, + price: float, + reduce_only: bool = False, + pos_side: str = "", + client_order_id: Optional[str] = None, + ) -> LiveOrderResult: + """ + Place a limit order. + + Endpoint: POST /deepcoin/trade/order + """ + sym = to_deepcoin_symbol(symbol) + sd = (side or "").strip().lower() + if sd not in ("buy", "sell"): + raise LiveTradingError(f"Invalid side: {side}") + + q_req = float(qty or 0.0) + px = float(price or 0.0) + if q_req <= 0 or px <= 0: + raise LiveTradingError("Invalid qty/price") + + q_dec = self._normalize_qty(symbol=symbol, qty=q_req) + if float(q_dec or 0) <= 0: + raise LiveTradingError(f"Invalid qty (below step/min): requested={q_req}") + + params: Dict[str, Any] = { + "instId": sym, + "tdMode": "cash" if self.market_type == "spot" else "cross", + "side": sd, + "ordType": "limit", + "sz": self._dec_str(q_dec), + "px": str(px), + } + + if self.market_type != "spot": + ps = (pos_side or "").strip().lower() + if ps in ("long", "short", "net"): + params["posSide"] = ps + if reduce_only: + params["reduceOnly"] = True + + if client_order_id: + params["clOrdId"] = str(client_order_id) + + raw = self._signed_request("POST", "/deepcoin/trade/order", params=params) + data = (raw.get("data") or []) if isinstance(raw, dict) else [] + first: Dict[str, Any] = data[0] if isinstance(data, list) and data else {} + oid = str(first.get("ordId") or first.get("orderId") or first.get("clOrdId") or "") + + return LiveOrderResult( + exchange_id="deepcoin", + exchange_order_id=oid, + filled=0.0, + avg_price=0.0, + raw=raw, + ) + + def cancel_order(self, *, symbol: str, order_id: str = "", client_order_id: str = "") -> Dict[str, Any]: + """ + Cancel an order. + + Endpoint: POST /deepcoin/trade/cancel-order + """ + sym = to_deepcoin_symbol(symbol) + params: Dict[str, Any] = {"instId": sym} + + if order_id: + params["ordId"] = str(order_id) + elif client_order_id: + params["clOrdId"] = str(client_order_id) + else: + raise LiveTradingError("Deepcoin cancel_order requires order_id or client_order_id") + + return self._signed_request("POST", "/deepcoin/trade/cancel-order", params=params) + + def get_order(self, *, symbol: str, order_id: str = "", client_order_id: str = "") -> Dict[str, Any]: + """ + Get order details. + + Endpoint: GET /deepcoin/trade/order + """ + sym = to_deepcoin_symbol(symbol) + params: Dict[str, Any] = {"instId": sym} + + if order_id: + params["ordId"] = str(order_id) + elif client_order_id: + params["clOrdId"] = str(client_order_id) + else: + raise LiveTradingError("Deepcoin get_order requires order_id or client_order_id") + + resp = self._signed_request("GET", "/deepcoin/trade/order", params=params) + data = (resp.get("data") or []) if isinstance(resp, dict) else [] + first: Dict[str, Any] = data[0] if isinstance(data, list) and data else {} + return first + + def get_open_orders(self, *, symbol: str = "") -> Dict[str, Any]: + """ + Get open orders. + + Endpoint: GET /deepcoin/trade/orders-pending + """ + params: Dict[str, Any] = {"instType": "SWAP" if self.market_type == "swap" else "SPOT"} + if symbol: + params["instId"] = to_deepcoin_symbol(symbol) + return self._signed_request("GET", "/deepcoin/trade/orders-pending", params=params) + + def get_order_history(self, *, symbol: str = "", limit: int = 100) -> Dict[str, Any]: + """ + Get order history. + + Endpoint: GET /deepcoin/trade/orders-history + """ + params: Dict[str, Any] = { + "instType": "SWAP" if self.market_type == "swap" else "SPOT", + "limit": str(limit), + } + if symbol: + params["instId"] = to_deepcoin_symbol(symbol) + return self._signed_request("GET", "/deepcoin/trade/orders-history", params=params) + + def wait_for_fill( + self, + *, + symbol: str, + order_id: str = "", + client_order_id: str = "", + max_wait_sec: float = 3.0, + poll_interval_sec: float = 0.5, + ) -> Dict[str, Any]: + """ + Poll order status until filled or timeout. + + Returns: + { + "filled": float, + "avg_price": float, + "fee": float, + "fee_ccy": str, + "status": str, + "order": {...} + } + """ + end_ts = time.time() + float(max_wait_sec or 0.0) + last: Dict[str, Any] = {} + + while True: + try: + last = self.get_order( + symbol=symbol, + order_id=str(order_id or ""), + client_order_id=str(client_order_id or ""), + ) + except Exception: + last = last or {} + + status = str(last.get("state") or last.get("status") or last.get("orderStatus") or "") + + try: + filled = float(last.get("accFillSz") or last.get("fillSz") or last.get("cumExecQty") or 0.0) + except Exception: + filled = 0.0 + + try: + avg_price = float(last.get("avgPx") or last.get("fillPx") or last.get("avgPrice") or 0.0) + except Exception: + avg_price = 0.0 + + # Extract fee + fee = 0.0 + fee_ccy = "" + try: + fee = abs(float(last.get("fee") or last.get("cumExecFee") or 0.0)) + fee_ccy = str(last.get("feeCcy") or "") + except Exception: + pass + + if filled > 0 and avg_price > 0: + return { + "filled": filled, + "avg_price": avg_price, + "fee": fee, + "fee_ccy": fee_ccy, + "status": status, + "order": last, + } + + if status.lower() in ("filled", "cancelled", "canceled", "rejected"): + return { + "filled": filled, + "avg_price": avg_price, + "fee": fee, + "fee_ccy": fee_ccy, + "status": status, + "order": last, + } + + if time.time() >= end_ts: + return { + "filled": filled, + "avg_price": avg_price, + "fee": fee, + "fee_ccy": fee_ccy, + "status": status, + "order": last, + } + + time.sleep(float(poll_interval_sec or 0.5)) diff --git a/backend_api_python/app/services/live_trading/factory.py b/backend_api_python/app/services/live_trading/factory.py index 366bf93..fb956a4 100644 --- a/backend_api_python/app/services/live_trading/factory.py +++ b/backend_api_python/app/services/live_trading/factory.py @@ -24,6 +24,7 @@ from app.services.live_trading.kraken_futures import KrakenFuturesClient from app.services.live_trading.kucoin import KucoinSpotClient, KucoinFuturesClient from app.services.live_trading.gate import GateSpotClient, GateUsdtFuturesClient from app.services.live_trading.bitfinex import BitfinexClient, BitfinexDerivativesClient +from app.services.live_trading.deepcoin import DeepcoinClient # Lazy import IBKR to avoid ImportError if ib_insync not installed IBKRClient = None @@ -114,6 +115,16 @@ def create_client(exchange_config: Dict[str, Any], *, market_type: str = "swap") return BitfinexClient(api_key=api_key, secret_key=secret_key, base_url=base_url) return BitfinexDerivativesClient(api_key=api_key, secret_key=secret_key, base_url=base_url) + if exchange_id == "deepcoin": + base_url = _get(exchange_config, "base_url", "baseUrl") or "https://api.deepcoin.com" + return DeepcoinClient( + api_key=api_key, + secret_key=secret_key, + passphrase=passphrase, + base_url=base_url, + market_type=mt, + ) + # Traditional brokers (IBKR for US/HK stocks only) if exchange_id == "ibkr": # Note: Market category validation should be done at the caller level diff --git a/backend_api_python/app/services/live_trading/symbols.py b/backend_api_python/app/services/live_trading/symbols.py index 96b4eb9..56b9497 100644 --- a/backend_api_python/app/services/live_trading/symbols.py +++ b/backend_api_python/app/services/live_trading/symbols.py @@ -185,3 +185,38 @@ def to_bitfinex_perp_symbol(symbol: str) -> str: return f"t{base}F0:{q}F0" +def to_deepcoin_symbol(symbol: str) -> str: + """ + Deepcoin symbol format: typically BASE-QUOTE for spot, BASE-QUOTE-SWAP for perpetual. + Examples: + - Spot: BTC-USDT + - Perpetual: BTC-USDT-SWAP + + If symbol already contains '-', return as-is (already in Deepcoin format). + """ + s = (symbol or "").strip() + if not s: + return s + + # Already in Deepcoin format + if "-" in s: + return s.upper() + + base, quote = _split_base_quote(symbol) + if not base or not quote: + # Best effort: remove slashes and colons + return s.replace("/", "-").replace(":", "-").upper() + + # Return BASE-QUOTE format (caller adds -SWAP if needed for futures) + return f"{base}-{quote}" + + +def to_deepcoin_swap_symbol(symbol: str) -> str: + """ + Deepcoin perpetual swap symbol format: BASE-QUOTE-SWAP, e.g. BTC-USDT-SWAP. + """ + base_symbol = to_deepcoin_symbol(symbol) + if base_symbol.endswith("-SWAP"): + return base_symbol + return f"{base_symbol}-SWAP" + diff --git a/backend_api_python/app/services/strategy.py b/backend_api_python/app/services/strategy.py index cb60f98..6c59d50 100644 --- a/backend_api_python/app/services/strategy.py +++ b/backend_api_python/app/services/strategy.py @@ -282,6 +282,7 @@ class StrategyService: from app.services.live_trading.kucoin import KucoinFuturesClient from app.services.live_trading.gate import GateSpotClient, GateUsdtFuturesClient from app.services.live_trading.bitfinex import BitfinexClient, BitfinexDerivativesClient + from app.services.live_trading.deepcoin import DeepcoinClient resolved = resolve_exchange_config(exchange_config or {}) safe_cfg = safe_exchange_config_for_log(resolved) @@ -350,6 +351,8 @@ class StrategyService: priv_data = client.get_wallets() elif isinstance(client, BitfinexDerivativesClient): priv_data = client.get_wallets() + elif isinstance(client, DeepcoinClient): + priv_data = client.get_balance() except Exception as e: msg = str(e) # Add actionable hints for the most common Binance auth error. diff --git a/quantdinger_vue/src/locales/lang/ar-SA.js b/quantdinger_vue/src/locales/lang/ar-SA.js index 0bad384..fef6a97 100644 --- a/quantdinger_vue/src/locales/lang/ar-SA.js +++ b/quantdinger_vue/src/locales/lang/ar-SA.js @@ -1233,7 +1233,8 @@ const locale = { 'ftxus': 'ุฅู ุชูŠ ุฅูƒุณ ุงู„ูˆู„ุงูŠุงุช ุงู„ู…ุชุญุฏุฉ', 'binanceus': 'ุจูŠู†ุงู†ุณ ุงู„ูˆู„ุงูŠุงุช ุงู„ู…ุชุญุฏุฉ', 'binancecoinm': 'ุนู…ู„ุฉ ุจูŠู†ุงู†ุณ-M', - 'binanceusdm': 'Binance USDโ“ˆ-M' + 'binanceusdm': 'Binance USDโ“ˆ-M', + 'deepcoin': 'ุฏูŠุจูƒูˆูŠู†' }, 'ai-trading-assistant.title': 'ู…ุณุงุนุฏ ุงู„ุชุฏุงูˆู„ ุจุงู„ุฐูƒุงุก ุงู„ุงุตุทู†ุงุนูŠ', 'ai-trading-assistant.strategyList': 'ู‚ุงุฆู…ุฉ ุงู„ุฅุณุชุฑุงุชูŠุฌูŠุฉ', diff --git a/quantdinger_vue/src/locales/lang/de-DE.js b/quantdinger_vue/src/locales/lang/de-DE.js index c37ba2b..59bceee 100644 --- a/quantdinger_vue/src/locales/lang/de-DE.js +++ b/quantdinger_vue/src/locales/lang/de-DE.js @@ -1283,7 +1283,8 @@ const locale = { 'ftxus': 'FTX USA', 'binanceus': 'Binance USA', 'binancecoinm': 'Binance COIN-M', - 'binanceusdm': 'Binance USDโ“ˆ-M' + 'binanceusdm': 'Binance USDโ“ˆ-M', + 'deepcoin': 'Deepcoin' }, 'ai-trading-assistant.title': 'KI-Handelsassistent', 'ai-trading-assistant.strategyList': 'Strategieliste', diff --git a/quantdinger_vue/src/locales/lang/en-US.js b/quantdinger_vue/src/locales/lang/en-US.js index 4534e79..8b88fb3 100644 --- a/quantdinger_vue/src/locales/lang/en-US.js +++ b/quantdinger_vue/src/locales/lang/en-US.js @@ -1664,7 +1664,8 @@ const locale = { 'binanceus': 'Binance US', 'binancecoinm': 'Binance COIN-M', 'binanceusdm': 'Binance USDโ“ˆ-M', - 'ibkr': 'Interactive Brokers (IBKR)' + 'ibkr': 'Interactive Brokers (IBKR)', + 'deepcoin': 'Deepcoin' }, 'ai-trading-assistant.title': 'AI Trading Assistant', 'ai-trading-assistant.strategyList': 'Strategy List', diff --git a/quantdinger_vue/src/locales/lang/fr-FR.js b/quantdinger_vue/src/locales/lang/fr-FR.js index 6b253e6..e84ca57 100644 --- a/quantdinger_vue/src/locales/lang/fr-FR.js +++ b/quantdinger_vue/src/locales/lang/fr-FR.js @@ -1234,7 +1234,8 @@ const locale = { 'ftxus': 'FTX ร‰tats-Unis', 'binanceus': 'Binance ร‰tats-Unis', 'binancecoinm': 'Binance COIN-M', - 'binanceusdm': 'Binance USDโ“ˆ-M' + 'binanceusdm': 'Binance USDโ“ˆ-M', + 'deepcoin': 'Deepcoin' }, 'ai-trading-assistant.title': 'Assistant de trading IA', 'ai-trading-assistant.strategyList': 'Liste de stratรฉgies', diff --git a/quantdinger_vue/src/locales/lang/ja-JP.js b/quantdinger_vue/src/locales/lang/ja-JP.js index b1affc6..7309e8b 100644 --- a/quantdinger_vue/src/locales/lang/ja-JP.js +++ b/quantdinger_vue/src/locales/lang/ja-JP.js @@ -1238,7 +1238,8 @@ const locale = { 'ftxus': 'FTX็ฑณๅ›ฝ', 'binanceus': 'ใƒใ‚คใƒŠใƒณใ‚นUS', 'binancecoinm': 'ใƒใ‚คใƒŠใƒณใ‚น COIN-M', - 'binanceusdm': 'ใƒใ‚คใƒŠใƒณใ‚นUSDโ“ˆ-M' + 'binanceusdm': 'ใƒใ‚คใƒŠใƒณใ‚นUSDโ“ˆ-M', + 'deepcoin': 'ใƒ‡ใ‚ฃใƒผใƒ—ใ‚ณใ‚คใƒณ' }, 'ai-trading-assistant.title': 'AIๅ–ๅผ•ใ‚ขใ‚ทใ‚นใ‚ฟใƒณใƒˆ', 'ai-trading-assistant.strategyList': 'ๆˆฆ็•ฅไธ€่ฆง', diff --git a/quantdinger_vue/src/locales/lang/ko-KR.js b/quantdinger_vue/src/locales/lang/ko-KR.js index db6d847..1abd96f 100644 --- a/quantdinger_vue/src/locales/lang/ko-KR.js +++ b/quantdinger_vue/src/locales/lang/ko-KR.js @@ -1238,7 +1238,8 @@ const locale = { 'ftxus': 'FTX ๋ฏธ๊ตญ', 'binanceus': '๋ฐ”์ด๋‚ธ์Šค ๋ฏธ๊ตญ', 'binancecoinm': '๋ฐ”์ด๋‚ธ์Šค ์ฝ”์ธ-M', - 'binanceusdm': '๋ฐ”์ด๋‚ธ์Šค USDโ“ˆ-M' + 'binanceusdm': '๋ฐ”์ด๋‚ธ์Šค USDโ“ˆ-M', + 'deepcoin': '๋”ฅ์ฝ”์ธ' }, 'ai-trading-assistant.title': 'AI ํŠธ๋ ˆ์ด๋”ฉ ๋„์šฐ๋ฏธ', 'ai-trading-assistant.strategyList': '์ „๋žต ๋ชฉ๋ก', diff --git a/quantdinger_vue/src/locales/lang/th-TH.js b/quantdinger_vue/src/locales/lang/th-TH.js index f46ad35..a6ac03d 100644 --- a/quantdinger_vue/src/locales/lang/th-TH.js +++ b/quantdinger_vue/src/locales/lang/th-TH.js @@ -1235,7 +1235,8 @@ const locale = { 'ftxus': 'FTX เธชเธซเธฃเธฑเธเธญเน€เธกเธฃเธดเธเธฒ', 'binanceus': 'Binance เธชเธซเธฃเธฑเธเธญเน€เธกเธฃเธดเธเธฒ', 'binancecoinm': 'Binance COIN-M', - 'binanceusdm': 'Binance USDโ“ˆ-M' + 'binanceusdm': 'Binance USDโ“ˆ-M', + 'deepcoin': 'เธ”เธตเธžเธ„เธญเธขเธ™เนŒ' }, 'ai-trading-assistant.title': 'เธœเธนเน‰เธŠเนˆเธงเธขเธเธฒเธฃเธ‹เธทเน‰เธญเธ‚เธฒเธข AI', 'ai-trading-assistant.strategyList': 'เธฃเธฒเธขเธเธฒเธฃเธเธฅเธขเธธเธ—เธ˜เนŒ', diff --git a/quantdinger_vue/src/locales/lang/vi-VN.js b/quantdinger_vue/src/locales/lang/vi-VN.js index 28aaee8..ed53382 100644 --- a/quantdinger_vue/src/locales/lang/vi-VN.js +++ b/quantdinger_vue/src/locales/lang/vi-VN.js @@ -2376,7 +2376,9 @@ const locale = { 'binancecoinm': 'Binance COIN-M', -'binanceusdm': 'Binance USDโ“ˆ-M' +'binanceusdm': 'Binance USDโ“ˆ-M', + +'deepcoin': 'Deepcoin' }, diff --git a/quantdinger_vue/src/locales/lang/zh-CN.js b/quantdinger_vue/src/locales/lang/zh-CN.js index 623ff25..2ef2202 100644 --- a/quantdinger_vue/src/locales/lang/zh-CN.js +++ b/quantdinger_vue/src/locales/lang/zh-CN.js @@ -1559,7 +1559,8 @@ const locale = { 'binanceus': 'Binance US', 'binancecoinm': 'Binance COIN-M', 'binanceusdm': 'Binance USDโ“ˆ-M', -'ibkr': '็›ˆ้€่ฏๅˆธ (IBKR)' +'ibkr': '็›ˆ้€่ฏๅˆธ (IBKR)', +'deepcoin': 'Deepcoin' }, 'ai-trading-assistant.title': 'AIไบคๆ˜“ๅŠฉๆ‰‹', 'ai-trading-assistant.strategyList': '็ญ–็•ฅๅˆ—่กจ', diff --git a/quantdinger_vue/src/locales/lang/zh-TW.js b/quantdinger_vue/src/locales/lang/zh-TW.js index 284c506..e955007 100644 --- a/quantdinger_vue/src/locales/lang/zh-TW.js +++ b/quantdinger_vue/src/locales/lang/zh-TW.js @@ -1421,7 +1421,8 @@ const locale = { 'ftxus': 'FTX US', 'binanceus': 'Binance US', 'binancecoinm': 'Binance COIN-M', - 'binanceusdm': 'Binance USDโ“ˆ-M' + 'binanceusdm': 'Binance USDโ“ˆ-M', + 'deepcoin': 'Deepcoin' }, 'ai-trading-assistant.title': 'AIไบคๆ˜“ๅŠฉๆ‰‹', 'ai-trading-assistant.strategyList': '็ญ–็•ฅๅˆ—่กจ', diff --git a/quantdinger_vue/src/views/trading-assistant/index.vue b/quantdinger_vue/src/views/trading-assistant/index.vue index 624b3e0..a4936dc 100644 --- a/quantdinger_vue/src/views/trading-assistant/index.vue +++ b/quantdinger_vue/src/views/trading-assistant/index.vue @@ -1255,7 +1255,8 @@ const EXCHANGE_OPTIONS = [ { value: 'kraken', labelKey: 'kraken' }, { value: 'kucoin', labelKey: 'kucoin' }, { value: 'gate', labelKey: 'gate' }, - { value: 'bitfinex', labelKey: 'bitfinex' } + { value: 'bitfinex', labelKey: 'bitfinex' }, + { value: 'deepcoin', labelKey: 'deepcoin' } ] // Traditional broker options (US/HK stocks) - extensible for future brokers @@ -1289,7 +1290,7 @@ export default { }, needsPassphrase () { // Exchanges that require passphrase - return ['okx', 'okex', 'coinbaseexchange', 'kucoin', 'bitget'].includes(this.currentExchangeId) + return ['okx', 'okex', 'coinbaseexchange', 'kucoin', 'bitget', 'deepcoin'].includes(this.currentExchangeId) }, // Check if current market uses IBKR (US Stock / HK Stock) isIBKRMarket () { From 0bf4bb5bd9ff881a093d7726b7da1118f9c94278 Mon Sep 17 00:00:00 2001 From: TIANHE Date: Mon, 26 Jan 2026 20:34:29 +0800 Subject: [PATCH 3/3] new Signed-off-by: TIANHE --- README.md | 866 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 708 insertions(+), 158 deletions(-) diff --git a/README.md b/README.md index 7914263..b14dc37 100644 --- a/README.md +++ b/README.md @@ -51,24 +51,33 @@ ## ๐Ÿ“– Introduction -**QuantDinger** is a local-first, privacy-first, self-hosted quantitative trading platform. It runs on your own infrastructure, providing multi-user accounts backed by PostgreSQL while keeping full control of your strategies, trading data, and API keys. +### What is QuantDinger? -### Why QuantDinger? +QuantDinger is a **local-first, privacy-first, self-hosted quantitative trading infrastructure**. It runs on your own machine/server, providing **multi-user accounts backed by PostgreSQL** while keeping full control of your strategies, trading data, and API keys. -| Feature | QuantDinger | Cloud SaaS | -|---------|-------------|------------| -| Data Ownership | โœ… Local storage | โŒ Vendor-controlled | -| Strategy Privacy | โœ… Never leaves your server | โŒ Uploaded to cloud | -| Subscription Fees | โœ… None | โŒ Monthly charges | -| Customization | โœ… Full source access | โŒ Limited | +### Why Local-First? -### Core Capabilities +Unlike SaaS platforms that lock your data and strategies in the cloud, QuantDinger runs locally. Your strategies, trading logs, API keys, and analysis results stay on your machine. No vendor lock-in, no subscription fees, no data exfiltration. -- **๐Ÿ Python-Native Strategies** โ€” Write indicators in standard Python with AI assistance -- **๐Ÿค– AI Multi-Agent Research** โ€” LLM-powered analysis with web scraping and market intelligence -- **๐Ÿ“Š Visual Backtesting** โ€” TradingView-like charting with strategy visualization -- **โšก Live Trading** โ€” Direct API execution for 10+ crypto exchanges, IBKR, and MT5 -- **๐Ÿ”’ Self-Hosted** โ€” Your data stays on your infrastructure +### Who is this for? + +QuantDinger is built for traders, researchers, and engineers who: +- Value data sovereignty and privacy +- Want transparent, auditable trading infrastructure +- Prefer engineering over marketing +- Need a complete workflow: data, analysis, backtesting, and execution + +### Core Features + +QuantDinger includes a built-in **LLM-based multi-agent research system** that gathers financial intelligence from the web, combines it with local market data, and generates analysis reports. This integrates with strategy development, backtesting, and live trading workflows. + +### Core Value + +- **๐Ÿ”“ Apache 2.0 Open Source (Code)**: Permissive and commercial-friendly. You can fork and modify the codebase under Apache 2.0, while preserving required notices. +- **๐Ÿ Python-Native & Visual**: Write indicators in standard Python (easier than PineScript) with AI assistance. Visualize signals directly on chartsโ€”a "Local TradingView" experience. +- **๐Ÿค– AI-Loop Optimization**: It doesn't just run strategies; AI analyzes backtest results to suggest parameter tuning (Stop-Loss/TP/MACD settings), forming a closed optimization loop. +- **๐ŸŒ Universal Market Access**: One unified system for Crypto (Live), US/CN Stocks, Forex, and Futures (Data/Notify). +- **โšก Docker & Clean Arch**: 4-line command deployment. Modern Tech Stack (Vue + Python) with a clean, separation-of-concerns architecture. --- @@ -76,214 +85,727 @@
- QuantDinger Demo + QuantDinger Project Introduction Video -

Click to watch the project introduction

+

Click the video above to watch the QuantDinger project introduction

--- -## ๐Ÿ“ธ Screenshots +## ๐Ÿ“š Documentation + +### Guides +- [Python Strategy Development Guide](docs/STRATEGY_DEV_GUIDE.md) +- [Interactive Brokers (IBKR) Trading Guide](docs/IBKR_TRADING_GUIDE_EN.md) ๐Ÿ†• +- [MetaTrader 5 (MT5) Trading Guide](docs/MT5_TRADING_GUIDE_EN.md) ๐Ÿ†• + +### Notification Configuration +- [Telegram Notification Setup](docs/NOTIFICATION_TELEGRAM_CONFIG_EN.md) +- [Email (SMTP) Notification Setup](docs/NOTIFICATION_EMAIL_CONFIG_EN.md) +- [SMS (Twilio) Notification Setup](docs/NOTIFICATION_SMS_CONFIG_EN.md) + +## ๐Ÿ“ธ Visual Tour
- System Architecture -

System Architecture Overview

+

๐Ÿ—บ๏ธ System Architecture Overview

+

A comprehensive view of QuantDinger's AI-powered research, backtesting, and automated trading capabilities.

+ QuantDinger System Topology
- +
+ +
+

๐Ÿ“Š Professional Quant Dashboard

+

Real-time monitoring of market dynamics, assets, and strategy status.

+ QuantDinger Dashboard +
+ +
+ +
- + + - + + - +
Dashboard
Dashboard
+

๐Ÿค– AI Deep Research

+

Multi-agent collaboration for market sentiment & technical analysis.

+ AI Market Analysis +
+

๐Ÿ’ฌ Smart Trading Assistant

+

Natural language interface for instant market insights.

+ Trading Assistant +
AI Analysis
AI Multi-Agent Analysis
+

๐Ÿ“ˆ Interactive Indicator Analysis

+

Rich library of technical indicators with drag-and-drop analysis.

+ Indicator Analysis +
+

๐Ÿ Python Strategy Gen

+

Built-in editor with AI-assisted strategy coding.

+ Code Generation +
Indicator Analysis
Indicator Analysis
+

๐Ÿ“Š Portfolio Monitor

+

Track positions, set alerts, and receive AI-powered analysis via Email/Telegram.

+ Portfolio Monitor +
--- -## ๐Ÿ”Œ Supported Exchanges & Brokers - -### Cryptocurrency (Direct API Trading) - -| Exchange | Spot | Futures | Features | -|:--------:|:----:|:-------:|:---------| -| **Binance** | โœ… | โœ… | Margin, COIN-M, USDโ“ˆ-M | -| **OKX** | โœ… | โœ… | Options, Copy Trading | -| **Bitget** | โœ… | โœ… | Copy Trading | -| **Bybit** | โœ… | โœ… | Linear, Inverse | -| **KuCoin** | โœ… | โœ… | โ€” | -| **Gate.io** | โœ… | โœ… | โ€” | -| **Kraken** | โœ… | โœ… | โ€” | -| **Coinbase** | โœ… | โ€” | Spot Only | -| **Bitfinex** | โœ… | โœ… | Derivatives | -| **Deepcoin** | โœ… | โœ… | โ€” | - -### Traditional Brokers - -| Broker | Markets | Platform | -|:------:|:--------|:---------| -| **Interactive Brokers** | US/HK Stocks, Options | TWS / IB Gateway | -| **MetaTrader 5** | Forex, CFDs | MT5 Terminal | - -### Market Data Sources - -| Market | Sources | -|--------|---------| -| Crypto | 100+ exchanges via CCXT | -| US Stocks | Yahoo Finance, Finnhub, Tiingo | -| CN/HK Stocks | AkShare, East Money | -| Forex | Finnhub, OANDA | - ---- - ## โœจ Key Features ### 1. Visual Python Strategy Workbench +*Better than PineScript, Smarter than SaaS.* -Write strategies in Python with full ecosystem access (Pandas, NumPy, TA-Lib). AI assists with code generation, and signals visualize directly on interactive charts. +- **Python Native**: Write indicators and strategies in Python. Leverage the entire Python ecosystem (Pandas, Numpy, TA-Lib) instead of proprietary languages like PineScript. +- **"Mini-TradingView" Experience**: Run your Python indicators directly on the built-in K-line charts. Visually debug buy/sell signals on historical data. +- **AI-Assisted Coding**: Let the built-in AI write the complex logic for you. From idea to code in seconds. ### 2. Complete Trading Lifecycle +*From Indicator to Execution, Seamlessly.* -``` -Indicator โ†’ Strategy Config โ†’ Backtest โ†’ AI Optimization โ†’ Live Execution -``` +1. **Indicator**: Define your market entry/exit signals. +2. **Strategy Config**: Attach risk management rules (Position sizing, Stop-Loss, Take-Profit). +3. **Backtest & AI Optimization**: Run backtests, view rich performance metrics, and **let AI analyze the result to suggest improvements** (e.g., "Adjust MACD threshold to X"). +4. **Execution Mode**: + - **Live Trading**: + - **Cryptocurrency**: Direct API execution for 10+ exchanges (Binance, OKX, Bitget, Bybit, etc.) + - **US/HK Stocks**: Via Interactive Brokers (IBKR) ๐Ÿ†• + - **Forex**: Via MetaTrader 5 (MT5) ๐Ÿ†• + - **Signal Notification**: For markets without live trading support (A-shares/Futures), send signals via Telegram, Discord, Email, SMS, or Webhook. ### 3. AI Multi-Agent Research +*Your 24/7 AI Investment Committee.* -A team of specialized agents analyzes markets: -- **Research Agents** โ€” Web scraping for news and events -- **Analysis Agents** โ€” Technical indicators and capital flows -- **Risk Assessment** โ€” Market filter based on AI sentiment +The system employs a multi-agent team to act as a secondary filter for your strategies: -### 4. Multi-LLM Support +- **Research Agents**: Scrape web news and macro events (Google/Bing). +- **Analysis Agents**: Analyze technical indicators and capital flows. +- **Strategic Integration**: The AI judgment can serve as a "Market Filter"โ€”only allowing your strategy to trade when the AI sentiment aligns (e.g., "Don't buy if AI Risk Analyst flags high macro danger"). -| Provider | Models | -|----------|--------| -| OpenRouter | 100+ models | -| OpenAI | GPT-4o, GPT-4o-mini | -| Google | Gemini 1.5 Flash/Pro | -| DeepSeek | DeepSeek Chat | -| xAI | Grok Beta | +### 4. Universal Data Engine -### 5. Enterprise Features +QuantDinger provides a unified data interface across multiple markets: -- **Multi-User Support** โ€” PostgreSQL-backed accounts with role-based permissions -- **OAuth Integration** โ€” Google and GitHub login -- **Security** โ€” Cloudflare Turnstile, rate limiting, email verification +- **Cryptocurrency**: Direct API connections for trading (10+ exchanges) and CCXT integration for market data (100+ sources) +- **Stocks**: Yahoo Finance, Finnhub, Tiingo (US stocks), and AkShare (CN/HK stocks) +- **Futures/Forex**: OANDA and major futures data sources +- **Proxy Support**: Built-in proxy configuration for restricted network environments + +### 5. Memory-Augmented Agents (Local RAG + Reflection Loop) + +QuantDingerโ€™s agents donโ€™t start from scratch every time. The backend includes a **local memory store** and an optional **reflection/verification loop**: + +- **What it is**: RAG-style experience retrieval injected into agent prompts (NOT model fine-tuning). +- **Where it lives**: PostgreSQL database (shared with main data) or local files under `backend_api_python/data/memory/` (privacy-first). + +```mermaid +flowchart TB + %% ===== ๐ŸŒ Entry Layer ===== + subgraph Entry["๐ŸŒ API Entry"] + A["๐Ÿ“ก POST /api/analysis/multi"] + A2["๐Ÿ”„ POST /api/analysis/reflect"] + end + + %% ===== โš™๏ธ Service Layer ===== + subgraph Service["โš™๏ธ Service Orchestration"] + B[AnalysisService] + C[AgentCoordinator] + D["๐Ÿ“Š Build Context
price ยท kline ยท news ยท indicators"] + end + + %% ===== ๐Ÿค– Multi-Agent Workflow ===== + subgraph Agents["๐Ÿค– Multi-Agent Workflow"] + + subgraph P1["๐Ÿ“ˆ Phase 1 ยท Analysis (Parallel)"] + E1["๐Ÿ” MarketAnalyst
Technical"] + E2["๐Ÿ“‘ FundamentalAnalyst
Fundamentals"] + E3["๐Ÿ“ฐ NewsAnalyst
News & Events"] + E4["๐Ÿ’ญ SentimentAnalyst
Market Mood"] + E5["โš ๏ธ RiskAnalyst
Risk Assessment"] + end + + subgraph P2["๐ŸŽฏ Phase 2 ยท Debate (Parallel)"] + F1["๐Ÿ‚ BullResearcher
Bullish Case"] + F2["๐Ÿป BearResearcher
Bearish Case"] + end + + subgraph P3["๐Ÿ’น Phase 3 ยท Decision"] + G["๐ŸŽฐ TraderAgent
Final Verdict โ†’ BUY / SELL / HOLD"] + end + + end + + %% ===== ๐Ÿง  Memory Layer ===== + subgraph Memory["๐Ÿง  PostgreSQL Memory Store"] + M1[("market_analyst")] + M2[("fundamental")] + M3[("news_analyst")] + M4[("sentiment")] + M5[("risk_analyst")] + M6[("bull_researcher")] + M7[("bear_researcher")] + M8[("trader_agent")] + end + + %% ===== ๐Ÿ”„ Reflection Loop ===== + subgraph Reflect["๐Ÿ”„ Reflection Loop (Optional)"] + R[ReflectionService] + RR[("reflection_records.db")] + W["โฐ ReflectionWorker"] + end + + %% ===== Main Flow ===== + A --> B --> C --> D + D --> P1 --> P2 --> P3 + + %% ===== Memory Read/Write ===== + E1 <-.-> M1 + E2 <-.-> M2 + E3 <-.-> M3 + E4 <-.-> M4 + E5 <-.-> M5 + F1 <-.-> M6 + F2 <-.-> M7 + G <-.-> M8 + + %% ===== Reflection Flow ===== + C --> R --> RR + W --> RR + W -.->|"verify + learn"| M8 + A2 -.->|"manual review"| M8 +``` + +**Retrieval ranking (simplified)**: + +\[ +score = w_{sim}\cdot sim + w_{recency}\cdot recency + w_{returns}\cdot returns\_score +\] + +Config lives in `.env` (see `backend_api_python/env.example`): `ENABLE_AGENT_MEMORY`, `AGENT_MEMORY_TOP_K`, `AGENT_MEMORY_ENABLE_VECTOR`, `AGENT_MEMORY_HALF_LIFE_DAYS`, and `ENABLE_REFLECTION_WORKER`. + +### 6. Strategy Runtime + +- **Thread-Based Executor**: Independent thread pool for strategy execution +- **Auto-Restore**: Resumes running strategies after system restarts +- **Order Queue**: Background worker for order execution + +### 7. Multi-LLM Provider Support + +QuantDinger supports multiple AI providers with auto-detection: + +| Provider | Features | +|----------|----------| +| **OpenRouter** | Multi-model gateway (default), 100+ models | +| **OpenAI** | GPT-4o, GPT-4o-mini | +| **Google Gemini** | Gemini 1.5 Flash/Pro | +| **DeepSeek** | DeepSeek Chat (cost-effective) | +| **xAI Grok** | Grok Beta | + +Simply configure your preferred provider's API key in `.env`. The system auto-detects available providers. + +### 8. User Management & Security + +- **Multi-User Support**: PostgreSQL-backed user accounts with role-based permissions +- **OAuth Login**: Google and GitHub OAuth integration +- **Email Verification**: Registration and password reset via email codes +- **Security Features**: Cloudflare Turnstile captcha, IP/account rate limiting +- **Demo Mode**: Read-only mode for public demonstrations + +### 9. Tech Stack + +- **Backend**: Python (Flask) + PostgreSQL + Redis (optional) +- **Frontend**: Vue 2 + Ant Design Vue + KlineCharts/ECharts +- **Deployment**: Docker Compose (with PostgreSQL) --- -## ๐Ÿš€ Quick Start +## ๐Ÿ”Œ Supported Exchanges & Brokers -### Docker Deployment (Recommended) +QuantDinger supports multiple execution methods for different market types: -```bash -# Clone and configure -git clone https://github.com/brokermr810/QuantDinger.git -cd QuantDinger -cp backend_api_python/env.example backend_api_python/.env +### Cryptocurrency Exchanges (Direct API) -# Start services -docker-compose up -d --build -``` +| Exchange | Markets | +|:--------:|:---------| +| Binance | Spot, Futures, Margin | +| OKX | Spot, Perpetual, Options | +| Bitget | Spot, Futures, Copy Trading | +| Bybit | Spot, Linear Futures | +| Coinbase Exchange | Spot | +| Kraken | Spot, Futures | +| KuCoin | Spot, Futures | +| Gate.io | Spot, Futures | +| Bitfinex | Spot, Derivatives | -**Access:** -- Frontend: http://localhost:8888 -- API: http://localhost:5000 -- Default login: `quantdinger` / `123456` +### Traditional Brokers -### Docker Commands +| Broker | Markets | Platform | +|:------:|:--------|:---------| +| **Interactive Brokers (IBKR)** | US Stocks, HK Stocks | TWS / IB Gateway ๐Ÿ†• | +| **MetaTrader 5 (MT5)** | Forex | MT5 Terminal ๐Ÿ†• | -```bash -docker-compose ps # Status -docker-compose logs -f # Logs -docker-compose down # Stop -docker-compose up -d --build # Rebuild -``` +### Market Data (via CCXT) -### Local Development - -```bash -# Backend -cd backend_api_python -pip install -r requirements.txt -cp env.example .env -python run.py - -# Frontend -cd quantdinger_vue -npm install && npm run serve -``` +Bybit, Gate.io, Kraken, KuCoin, HTX, and 100+ other exchanges for market data. --- -## ๐Ÿ“š Documentation +### Multi-Language Support -- [Python Strategy Development Guide](docs/STRATEGY_DEV_GUIDE.md) -- [Interactive Brokers (IBKR) Trading Guide](docs/IBKR_TRADING_GUIDE_EN.md) -- [MetaTrader 5 (MT5) Trading Guide](docs/MT5_TRADING_GUIDE_EN.md) -- [Telegram Notification Setup](docs/NOTIFICATION_TELEGRAM_CONFIG_EN.md) -- [Email Notification Setup](docs/NOTIFICATION_EMAIL_CONFIG_EN.md) - ---- - -## ๐Ÿ—๏ธ Architecture - -``` -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ quantdinger_vue โ”‚ -โ”‚ (Vue 2 + Ant Design Vue) โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - โ”‚ HTTP (/api/*) - โ–ผ -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ backend_api_python โ”‚ -โ”‚ (Flask + Strategy Runtime) โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - โ”‚ - โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” - โ–ผ โ–ผ โ–ผ -PostgreSQL Redis Exchanges - (opt) & LLMs -``` - ---- - -## ๐ŸŒ Multi-Language Support +QuantDinger is built for a global audience with comprehensive internationalization:

English - Chinese + Simplified Chinese Traditional Chinese Japanese Korean German French + Thai + Vietnamese + Arabic

+All UI elements, error messages, and documentation are fully translated. Language is auto-detected based on browser settings or can be manually switched in the app. + --- -## ๐Ÿ“œ License +### Supported Markets -Licensed under **Apache License 2.0**. See [LICENSE](LICENSE). +| Market Type | Data Sources | Trading | +|-------------|--------------|---------| +| **Cryptocurrency** | Binance, OKX, Bitget, + 100 exchanges | โœ… Full support | +| **US Stocks** | Yahoo Finance, Finnhub, Tiingo | โœ… Via IBKR ๐Ÿ†• | +| **HK Stocks** | AkShare, East Money | โœ… Via IBKR ๐Ÿ†• | +| **CN Stocks (A-shares)** | AkShare, East Money | โšก Data only | +| **Forex** | Finnhub, OANDA | โœ… Via MT5 ๐Ÿ†• | +| **Futures** | Exchange APIs, AkShare | โšก Data only | -**Trademark Notice:** Apache 2.0 does not grant trademark rights. QuantDinger branding (name/logo) is protected. See [TRADEMARKS.md](TRADEMARKS.md) for usage guidelines. +--- + +### Architecture (Current Repo) + +```text +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ quantdinger_vue โ”‚ +โ”‚ (Vue 2 + Ant Design Vue) โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + โ”‚ HTTP (/api/*) + โ–ผ +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ backend_api_python โ”‚ +โ”‚ (Flask + strategy runtime) โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + โ”‚ + โ”œโ”€ PostgreSQL (multi-user support) + โ”œโ”€ Redis (optional cache) + โ””โ”€ Data providers / LLMs / Exchanges +``` + +--- + +### Repository Layout + +```text +. +โ”œโ”€ backend_api_python/ # Flask API + AI + backtest + strategy runtime +โ”‚ โ”œโ”€ app/ +โ”‚ โ”œโ”€ env.example # Copy to .env for local config +โ”‚ โ”œโ”€ requirements.txt +โ”‚ โ””โ”€ run.py # Entrypoint +โ””โ”€ quantdinger_vue/ # Vue 2 UI (dev server proxies /api -> backend) +``` + +--- + +## Quick Start + +### Option 1: Docker Deployment (Recommended) + +The fastest way to get QuantDinger running with PostgreSQL database and multi-user support. + +#### 1. Configure Environment + +Create a `.env` file in project root: + +```bash +# Database Configuration +POSTGRES_USER=quantdinger +POSTGRES_PASSWORD=your_secure_password +POSTGRES_DB=quantdinger + +# Admin Account (created on first startup) +ADMIN_USER=quantdinger +ADMIN_PASSWORD=123456 + +# Optional: AI Features +OPENROUTER_API_KEY=your_api_key +``` + +#### 2. Start Services + +**Linux / macOS** +```bash +git clone https://github.com/brokermr810/QuantDinger.git && \ +cd QuantDinger && \ +cp backend_api_python/env.example backend_api_python/.env && \ +docker-compose up -d --build +``` + +**Windows (PowerShell)** +```powershell +git clone https://github.com/brokermr810/QuantDinger.git +cd QuantDinger +Copy-Item backend_api_python\env.example -Destination backend_api_python\.env +docker-compose up -d --build +``` + +This will automatically: +- Start PostgreSQL database (port 5432) +- Initialize database schema +- Start backend API (port 5000) +- Start frontend (port 8888) +- Create admin user from `ADMIN_USER`/`ADMIN_PASSWORD` in `.env` + +#### 3. Access the Application + +- **Frontend UI**: http://localhost:8888 +- **Backend API**: http://localhost:5000 +- **Default Account**: Uses `ADMIN_USER` / `ADMIN_PASSWORD` from `.env` (default: `quantdinger` / `123456`, please change for production) + +> **Note**: For production, edit `backend_api_python/.env` to set strong passwords, add `OPENROUTER_API_KEY` for AI features, then restart with `docker-compose restart backend`. + +#### Docker Commands Reference + +```bash +# View running status +docker-compose ps + +# View logs +docker-compose logs -f + +# View backend logs only +docker-compose logs -f backend + +# View frontend logs only +docker-compose logs -f frontend + +# Stop services +docker-compose down + +# Stop and remove volumes (WARNING: deletes database!) +docker-compose down -v + +# Restart services +docker-compose restart + +# Rebuild and restart +docker-compose up -d --build + +# Enter backend container +docker exec -it quantdinger-backend /bin/bash + +# Enter frontend container +docker exec -it quantdinger-frontend /bin/sh +``` + +#### Docker Architecture + +``` +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ Frontend โ”‚ โ”‚ Backend โ”‚ โ”‚ PostgreSQL โ”‚ +โ”‚ (Nginx) โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ (Python) โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ Database โ”‚ +โ”‚ Port: 8888 โ”‚ โ”‚ Port: 5000 โ”‚ โ”‚ Port: 5432 โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + โ”‚ โ”‚ โ”‚ + โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + Docker Network +``` + +- **Frontend**: Vue.js app served by Nginx, proxies API requests to backend +- **Backend**: Python Flask API service with multi-user authentication +- **PostgreSQL**: Database for user data, strategies, and trading records + +#### Data Persistence + +The following data is persisted across container restarts: + +```yaml +volumes: + postgres_data: # PostgreSQL database + - ./backend_api_python/logs:/app/logs # Logs + - ./backend_api_python/data:/app/data # Data directory + - ./backend_api_python/.env:/app/.env # Configuration +``` + +#### Customization + +**Change ports** - Edit `docker-compose.yml`: + +```yaml +services: + frontend: + ports: + - "8080:80" # Change to port 8080 + + backend: + ports: + - "5001:5000" # Change to port 5001 +``` + +**Configure HTTPS** - Use a reverse proxy (like Caddy/Nginx): + +```bash +# Using Caddy (automatic HTTPS) +caddy reverse-proxy --from yourdomain.com --to localhost:80 +``` + +#### Production Recommendations + +**Security:** + +```bash +# Generate strong SECRET_KEY +openssl rand -hex 32 + +# Set secure admin password +ADMIN_PASSWORD=your-very-secure-password +``` + +**Resource limits** - Add to `docker-compose.yml`: + +```yaml +services: + backend: + deploy: + resources: + limits: + cpus: '2' + memory: 2G + reservations: + cpus: '0.5' + memory: 512M +``` + +**Log management:** + +```yaml +services: + backend: + logging: + driver: "json-file" + options: + max-size: "100m" + max-file: "3" +``` + +#### Docker Troubleshooting + +**Frontend can't connect to backend:** + +```bash +docker-compose logs backend +curl http://localhost:5000/api/health +``` + +**Database connection issues:** + +```bash +# Check PostgreSQL container status +docker-compose logs postgres + +# Verify PostgreSQL is ready +docker exec quantdinger-db pg_isready -U quantdinger + +# Connect to database manually +docker exec -it quantdinger-db psql -U quantdinger -d quantdinger +``` + +**Build failures:** + +```bash +# Clear Docker cache and rebuild +docker-compose build --no-cache +``` + +**Out of memory:** + +```bash +# Check memory usage +docker stats + +# Add swap space (Linux) +sudo fallocate -l 2G /swapfile +sudo chmod 600 /swapfile +sudo mkswap /swapfile +sudo swapon /swapfile +``` + +#### Updating + +```bash +# Pull latest code +git pull + +# Rebuild and restart +docker-compose up -d --build +``` + +#### Backup + +```bash +# Backup PostgreSQL database +docker exec quantdinger-db pg_dump -U quantdinger quantdinger > backup/quantdinger_$(date +%Y%m%d).sql + +# Backup configuration +cp backend_api_python/.env backup/.env_$(date +%Y%m%d) + +# Restore database (if needed) +cat backup/quantdinger_YYYYMMDD.sql | docker exec -i quantdinger-db psql -U quantdinger quantdinger +``` + +--- + +### Option 2: Local Development + +**Prerequisites** + +- Python 3.10+ recommended +- Node.js 16+ recommended +- PostgreSQL 14+ installed and running + +#### 1. Setup PostgreSQL + +```bash +# Create database and user +sudo -u postgres psql +CREATE DATABASE quantdinger; +CREATE USER quantdinger WITH ENCRYPTED PASSWORD 'your_password'; +GRANT ALL PRIVILEGES ON DATABASE quantdinger TO quantdinger; +\q + +# Initialize schema +psql -U quantdinger -d quantdinger -f backend_api_python/migrations/init.sql +``` + +#### 2. Start the backend (Flask API) + +```bash +cd backend_api_python +pip install -r requirements.txt +cp env.example .env # Windows: copy env.example .env +``` + +Edit `.env` and set: +```bash +DATABASE_URL=postgresql://quantdinger:your_password@localhost:5432/quantdinger +SECRET_KEY=your-secret-key +ADMIN_USER=quantdinger +ADMIN_PASSWORD=123456 +``` + +Then start: +```bash +python run.py +``` + +Backend will be available at `http://localhost:5000`. + +#### 2. Start the frontend (Vue UI) + +```bash +cd quantdinger_vue +npm install +npm run serve +``` + +Frontend dev server runs at `http://localhost:8000` and proxies `/api/*` to `http://localhost:5000` (see `quantdinger_vue/vue.config.js`). + +--- + +### Configuration (.env) + +Use `backend_api_python/env.example` as a template. Common settings include: + +- **Auth**: `SECRET_KEY`, `ADMIN_USER`, `ADMIN_PASSWORD` +- **Server**: `PYTHON_API_HOST`, `PYTHON_API_PORT`, `PYTHON_API_DEBUG` +- **Database**: `DATABASE_URL` (PostgreSQL connection string) +- **AI / LLM**: `LLM_PROVIDER` (openrouter/openai/google/deepseek/grok), provider-specific API keys +- **OAuth**: `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET`, `GITHUB_CLIENT_ID`, `GITHUB_CLIENT_SECRET` +- **Security**: `TURNSTILE_SITE_KEY`, `TURNSTILE_SECRET_KEY`, `ENABLE_REGISTRATION` +- **Web search**: `SEARCH_PROVIDER`, `SEARCH_GOOGLE_*`, `SEARCH_BING_API_KEY` +- **Order Execution**: `ORDER_MODE` (maker/market), `MAKER_WAIT_SEC`, `MAKER_OFFSET_BPS` +- **Proxy (optional)**: `PROXY_PORT` or `PROXY_URL` +- **Workers**: `ENABLE_PENDING_ORDER_WORKER`, `ENABLE_PORTFOLIO_MONITOR` + +--- + +### API + +The backend provides REST endpoints for login, market data, indicators, backtesting, strategies, and AI analysis. + +- Health: `GET /health` (also supports `GET /api/health` for deployment probes) +- Auth (frontend-compatible): `POST /api/user/login`, `POST /api/user/logout`, `GET /api/user/info` + +For the full route list, see `backend_api_python/app/routes/`. + +--- + +### License + +Licensed under the **Apache License 2.0**. See `LICENSE`. --- ## ๐Ÿค Community & Support +- **Contributing**: [Contributing Guide](CONTRIBUTING.md) ยท [Contributors](CONTRIBUTORS.md) - **Telegram**: [QuantDinger Group](https://t.me/quantdinger) - **Discord**: [Join Server](https://discord.gg/vwJ8zxFh9Q) +- **๐Ÿ“บ Video Demo**: [Project Introduction](https://youtu.be/HPTVpqL7knM) +- **YouTube**: [@quantdinger](https://youtube.com/@quantdinger) +- **Email**: [brokermr810@gmail.com](mailto:brokermr810@gmail.com) - **GitHub Issues**: [Report bugs / Request features](https://github.com/brokermr810/QuantDinger/issues) + +--- + +## ๐Ÿ’ผ Commercial License & Sponsorship + +QuantDinger is licensed under **Apache License 2.0** (code). However, **Apache 2.0 does NOT grant trademark rights**. Our branding assets (name/logo) are protected as trademarks and are governed separately from the code license: + +- **Copyright/Attribution**: You must keep required copyright and license notices (including any NOTICE/attribution in the repo and in the UI where applicable). +- **Trademarks (Name/Logo/Branding)**: Without permission, you may not modify QuantDinger branding (name/logo/UI brand), or use it to imply endorsement or misrepresent origin. If you redistribute a modified version, you should remove QuantDinger branding and rebrand unless you have a commercial license. + +If you need to keep/modify QuantDinger branding in a redistribution (including UI branding and logo usage), please contact us for a **commercial license**. + +See: `TRADEMARKS.md` + +### What you get with a Commercial License + +- **Commercial authorization** to modify branding/copyright display as agreed +- **Operations support**: deployment, upgrades, incident support, and maintenance guidance +- **Consulting services**: architecture review, performance tuning, strategy workflow consulting +- **Sponsorship options**: become a project sponsor and we can **display your logo/ad** (README/website/in-app placement as agreed) + +### Contact + +- **Telegram**: `https://t.me/worldinbroker` - **Email**: [brokermr810@gmail.com](mailto:brokermr810@gmail.com) --- -## ๐Ÿ’ Support the Project + +### ๐Ÿ’ Direct Support (Donations) + +Your contributions help us maintain and improve QuantDinger. **Crypto Donations (ERC-20 / BEP-20 / Polygon / Arbitrum)** @@ -298,19 +820,47 @@ Licensed under **Apache License 2.0**. See [LICENSE](LICENSE). --- -## ๐ŸŽ“ Supporting Partners +### ๐ŸŽ“ Supporting Partners + +We are proud to be supported by academic institutions and organizations advancing quantitative finance education and research.
- - QFS - -
- Quantitative Finance Society
- Indiana University Bloomington + + + + +
+ + Indiana University Quantitative Finance Society + +

+ Quantitative Finance Society (QFS)
+ Indiana University Bloomington
+ Fostering the next generation of quantitative finance professionals +
+> ๐Ÿ’ก **Interested in becoming a supporting partner?** We welcome collaborations with universities, research institutions, and organizations. Contact us at [brokermr810@gmail.com](mailto:brokermr810@gmail.com) or via [Telegram](https://t.me/worldinbroker). + --- -## ๐Ÿ™ Acknowledgements +### Acknowledgements -Built with [Flask](https://flask.palletsprojects.com/) ยท [Vue.js](https://vuejs.org/) ยท [CCXT](https://github.com/ccxt/ccxt) ยท [Pandas](https://pandas.pydata.org/) ยท [KlineCharts](https://github.com/klinecharts/KLineChart) ยท [Ant Design Vue](https://antdv.com/) +QuantDinger stands on the shoulders of great open-source projects: + +| Project | Description | Link | +|---------|-------------|------| +| **Flask** | Lightweight WSGI web framework | [flask.palletsprojects.com](https://flask.palletsprojects.com/) | +| **flask-cors** | Cross-Origin Resource Sharing extension | [GitHub](https://github.com/corydolphin/flask-cors) | +| **Pandas** | Data analysis and manipulation library | [pandas.pydata.org](https://pandas.pydata.org/) | +| **CCXT** | Cryptocurrency exchange trading library | [github.com/ccxt/ccxt](https://github.com/ccxt/ccxt) | +| **yfinance** | Yahoo Finance market data downloader | [github.com/ranaroussi/yfinance](https://github.com/ranaroussi/yfinance) | +| **akshare** | China financial data interface | [github.com/akfamily/akshare](https://github.com/akfamily/akshare) | +| **requests** | HTTP library for Python | [requests.readthedocs.io](https://requests.readthedocs.io/) | +| **Vue.js** | Progressive JavaScript framework | [vuejs.org](https://vuejs.org/) | +| **Ant Design Vue** | Enterprise-class UI components | [antdv.com](https://antdv.com/) | +| **KlineCharts** | Lightweight financial charting library | [github.com/klinecharts/KLineChart](https://github.com/klinecharts/KLineChart) | +| **Lightweight Charts** | TradingView charting library | [github.com/nicepkg/lightweight-charts](https://github.com/nicepkg/lightweight-charts) | +| **ECharts** | Apache data visualization library | [echarts.apache.org](https://echarts.apache.org/) | + +Thanks to all maintainers and contributors across these ecosystems! โค๏ธ