MCPcopy Index your code
hub / github.com/brokermr810/QuantDinger

github.com/brokermr810/QuantDinger @v4.0.7 sqlite

repository ↗ · DeepWiki ↗ · release v4.0.7 ↗
4,745 symbols 21,335 edges 445 files 1,776 documented · 37%
README

QuantDinger Logo

QuantDinger

The open-source AI infrastructure layer for quant trading

Turn trading ideas into Python strategies, backtests, paper trading, and live execution - all in one self-hosted stack.

QuantDinger is a product of Open Byte Inc.

AI research -> Strategy code -> Backtest -> Paper/Live execution -> Monitoring

  <a href="https://github.com/brokermr810/QuantDinger/raw/v4.0.7/README.md"><strong>English</strong></a>
  <span style="color: #afb8c1;"> / </span>
  <a href="https://github.com/brokermr810/QuantDinger/raw/v4.0.7/docs/README_CN.md"><strong>Chinese</strong></a>






  <a href="https://ai.quantdinger.com"><strong>SaaS</strong></a>
  <span style="color: #d8dee4;"> &nbsp;·&nbsp; </span>
  <a href="https://github.com/brokermr810/QuantDinger/raw/v4.0.7/docs/api/README.md"><strong>API Docs</strong></a>
  <span style="color: #d8dee4;"> &nbsp;·&nbsp; </span>
  <a href="https://www.youtube.com/watch?v=tNAZ9uMiUUw"><strong>Video Demo</strong></a>
  <span style="color: #d8dee4;"> &nbsp;·&nbsp; </span>
  <a href="https://www.quantdinger.com"><strong>Website</strong></a>






  <a href="https://t.me/quantdinger"><img src="https://img.shields.io/badge/Telegram-Join-26A5E4?style=flat-square&logo=telegram&logoColor=white" alt="Telegram"></a>
  &nbsp;
  <a href="https://discord.com/invite/tyx5B6TChr"><img src="https://img.shields.io/badge/Discord-Server-5865F2?style=flat-square&logo=discord&logoColor=white" alt="Discord"></a>
  &nbsp;
  <a href="https://youtube.com/@quantdinger"><img src="https://img.shields.io/badge/YouTube-%40quantdinger-FF0000?style=flat-square&logo=youtube&logoColor=white" alt="YouTube"></a>
  &nbsp;
  <a href="https://x.com/QuantDinger_EN"><img src="https://img.shields.io/badge/X-%40QuantDinger_EN-000000?style=flat-square&logo=x&logoColor=white" alt="X"></a>










<a href="https://github.com/brokermr810/QuantDinger/raw/v4.0.7/LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square&logo=apache" alt="License"></a>
<img src="https://img.shields.io/github/v/release/brokermr810/QuantDinger?style=flat-square&color=orange&label=Version" alt="Version">
<img src="https://img.shields.io/badge/Python-3.10%2B%20%7C%20Docker%20image%203.12-3776AB?style=flat-square&logo=python&logoColor=white" alt="Python">
<img src="https://img.shields.io/badge/Docker-Compose%20Ready-2496ED?style=flat-square&logo=docker&logoColor=white" alt="Docker">
<img src="https://img.shields.io/badge/Frontend-Prebuilt-1f8b4c?style=flat-square" alt="Frontend">
<img src="https://img.shields.io/badge/Agent%20Gateway-MCP%20Ready-6f42c1?style=flat-square" alt="Agent Gateway">
<img src="https://img.shields.io/badge/PostgreSQL-18-336791?style=flat-square&logo=postgresql&logoColor=white" alt="PostgreSQL">
<img src="https://img.shields.io/github/stars/brokermr810/QuantDinger?style=flat-square&logo=github" alt="Stars">
<img src="https://img.shields.io/github/forks/brokermr810/QuantDinger?style=flat-square&logo=github&label=Forks" alt="Forks">

Contents

Try in 2 minutes · Why QuantDinger · Safety model · Technical highlights · Repositories · AI agents & MCP · Overview · Features · Architecture · Install · Docs · FAQ · License


Try in 2 minutes

Fastest path: one command. No git clone, no npm, no Vue source tree. The installer asks for the admin account, writes secure secrets, pulls GHCR images, and starts Docker Compose.

Prerequisites: Docker with Compose v2 (Docker Desktop on Windows/macOS). Node.js is not required.

curl -fsSL https://raw.githubusercontent.com/brokermr810/QuantDinger/main/install.sh | bash

Windows PowerShell:

irm https://raw.githubusercontent.com/brokermr810/QuantDinger/main/install.ps1 | iex

Installs to ~/quantdinger on Linux/macOS and $HOME\quantdinger on Windows by default. Override with ... | bash -s -- /opt/quantdinger or $env:QUANTDINGER_INSTALL_DIR="C:\QuantDinger" before the PowerShell one-liner.

Then open http://localhost:8888 and sign in with the admin username/password you entered during installation. The same stack also serves the mobile H5 client at http://localhost:8889.

Windows, manual clone, or mirror troubleshooting

Windows (PowerShell) - manual clone path:

git clone https://github.com/brokermr810/QuantDinger.git
Set-Location QuantDinger
Copy-Item backend_api_python\env.example -Destination backend_api_python\.env
$key = & python -c "import secrets; print(secrets.token_hex(32))" 2>$null
if (-not $key) { $key = & py -c "import secrets; print(secrets.token_hex(32))" 2>$null }
(Get-Content backend_api_python\.env) -replace '^SECRET_KEY=.*$', "SECRET_KEY=$key" | Set-Content backend_api_python\.env -Encoding utf8
# Edit backend_api_python\.env before first start:
#   ADMIN_USER=your_admin_user
#   ADMIN_PASSWORD=your_secure_password
docker compose pull
docker compose up -d

Standard clone (macOS / Linux):

git clone https://github.com/brokermr810/QuantDinger.git
cd QuantDinger
cp backend_api_python/env.example backend_api_python/.env
./scripts/generate-secret-key.sh
# Edit backend_api_python/.env before first start:
#   ADMIN_USER=your_admin_user
#   ADMIN_PASSWORD=your_secure_password
docker compose pull
docker compose up -d

Slow docker pull (China / VPN): add IMAGE_PREFIX=docker.m.daocloud.io/library/ to a repository-root .env, or configure Docker Desktop → Proxies.

For step-by-step detail and troubleshooting, see Installation & first-time setup.


Why QuantDinger

Traditional workflow QuantDinger
ChatGPT only generates code Runs, backtests, and executes strategies in one stack
TradingView + Jupyter + exchange bots are fragmented One self-hosted stack from research to execution
SaaS platforms hold API keys User-owned deployment — your infra, your keys
AI agents without scopes or audit Scoped Agent Gateway, paper-only default, audit logs

QuantDinger is a self-hosted, local-first quantitative infrastructure layer — not a chatbot with a buy button. It unifies multi-LLM research, Python-native strategy engines, server-side backtesting, and multi-broker live execution across crypto venues, IBKR, and Alpaca in one production-grade stack you fully control.

Safety model

  • Agent tokens are paper-only by default — live trading requires explicit server-side unlock.
  • Live execution requires explicit permission — token scope + AGENT_LIVE_TRADING_ENABLED on self-hosted stacks.
  • Exchange keys stay inside the user's own deployment — not held by QuantDinger SaaS operators on self-hosted installs.
  • Every agent call is audit-logged — append-only audit trail for automation and compliance review.
  • QuantDinger does not provide investment advice — software for lawful research and execution only; you are responsible for compliance and risk.

API documentation

Resource Link
Human Web API (OpenAPI) docs/api/openapi.yaml
ReDoc viewer (serve over HTTP) docs/api/index.html — run python -m http.server from docs/api/
Conventions (auth, envelopes) docs/API_CONVENTIONS.md
Agent Gateway docs/agent/agent-openapi.json

QuantDinger quick demo: install, sign in, charting, AI analysis, and strategy workflow

From zero to running stack — charting, AI research, and strategy workflow in minutes.

QuantDinger system architecture: Data Sources → Indicator / Signal / Strategy / Backtesting / AI Analysis layers → Execution, with the closed-loop quant workflow (Idea → Indicator → Strategy → Backtest → Optimize → Execute → Monitor)

AI research -> Strategy code -> Backtest -> Paper/Live execution -> Monitoring

Technical highlights

What makes QuantDinger different
Full-stack quant OS Charting, indicator IDE, AI research, backtests, live bots, quick trade, and broker account management — one product, one Postgres state store.
Agent-native First-class Agent Gateway (/api/agent/v1) + quantdinger-mcp on PyPI — Cursor, Claude Code, and Codex can read markets, run backtests, and trade (paper by default) with full audit logs.
Dual strategy runtimes IndicatorStrategy (four-way dataframe signals + chart overlays) and ScriptStrategy (event-driven on_bar, explicit orders) — research and production in the same codebase.
Multi-venue execution Direct adapters for Binance, OKX, Bitget, Bybit, Gate, HTX, Coinbase Exchange, Kraken, IBKR, and Alpaca — unified Broker Accounts page with isolated multi-tenant sessions.
Production-grade infra PostgreSQL 18 + Redis 7, connection pooling, background workers (orders, portfolio monitor, reflection), idempotent schema bootstrap, GHCR multi-arch images (amd64/arm64).
Security by default Refuses default SECRET_KEY, agent tokens hashed at rest, paper-only trading unless explicitly unlocked server-side, every agent call audit-logged.
Operator-ready OAuth, multi-user roles, credits/membership/USDT billing toggles, an 11-language web UI, and multilingual docs — build a commercial quant product on top, not just a hobby bot.

More install paths (GHCR-only, build notes)

Lightest — two files only (no git clone):

curl -O https://raw.githubusercontent.com/brokermr810/QuantDinger/main/docker-compose.ghcr.yml
curl -o backend.env https://raw.githubusercontent.com/brokermr810/QuantDinger/main/backend_api_python/env.example
# Edit backend.env before first start:
#   ADMIN_USER=your_admin_user
#   ADMIN_PASSWORD=your_secure_password
docker compose -f docker-compose.ghcr.yml pull
docker compose -f docker-compose.ghcr.yml up -d

Do not use docker compose up --build for a normal install — the main compose file only declares image: for the frontend; --build affects the backend only. Rebuild backend after code changes: docker compose up -d --build backend. For Vue source builds, use docker-compose.build.yml (see Installation).

Related repositories

This repo ships the backend, Docker Compose stack, and documentation. The web UI and mobile H5 images are published independently to GHCR by sibling repos. Use the sibling repos when you need source-level UI changes or native mobile builds:

Repository What it is
QuantDinger (this repo) Backend (Flask/Python), Compose stack, docs
QuantDinger-Vue Web frontend source (Vue) — tagging v* publishes ghcr.io/brokermr810/quantdinger-frontend automatically
QuantDinger-Mobile Mobile + H5 client — Compose serves the H5 image at http://localhost:8889; the repo also builds native shells

Note: Node.js is only required if you build the web or mobile UI from source; the default Docker quick start pulls the published images and does not need it. For source builds, use Node 22 LTS as the shared local version: the mobile H5 repo requires Node 20.19+ or 22.12+ (Vite 7), and the desktop web repo also works on Node 22.

Use it from an AI agent (Cursor / Claude Code / Codex / MCP)

QuantDinger ships an Agent Gateway at /api/agent/v1 plus a small MCP server (quantdinger-mcp on PyPI) that wraps it as Model Context Protocol tools. Issue a token once and your AI client can read markets, manage strategies, run backtests, and (paper-only by default) place trades — without ever seeing your exchange keys or your admin JWT.

Every agent call is audit-logged, and trading-class tokens are paper-only by default. Live execution requires both paper_only=false on the token AND AGENT_LIVE_TRADING_ENABLED=true on the server.

Two backends, same client config — only QUANTDINGER_BASE_URL differs:

  • Hosted (30 s try-out) — sign up at ai.quantdinger.comProfile → My Agent Token → Issue Token. T (Trading) scope is available; paper-only by default. Live execution still requires paper_only=false on the token, explicit risk acknowledgme

Core symbols most depended-on inside this repo

get
called by 2086
backend_api_python/app/utils/cache.py
get
called by 1874
backend_api_python/app/services/strategy_runtime/state.py
get
called by 680
backend_api_python/app/data_sources/cache_manager.py
execute
called by 676
backend_api_python/app/utils/db_postgres.py
close
called by 455
backend_api_python/app/utils/db_postgres.py
cursor
called by 392
backend_api_python/app/utils/db_postgres.py
commit
called by 214
backend_api_python/app/utils/db_postgres.py
fetchone
called by 203
backend_api_python/app/utils/db_postgres.py

Shape

Function 2,543
Method 1,659
Route 291
Class 252

Languages

Python100%

Modules by API surface

backend_api_python/app/services/trading_executor.py116 symbols
backend_api_python/app/routes/ai_chat.py107 symbols
backend_api_python/app/config/data_sources.py82 symbols
backend_api_python/app/routes/user.py74 symbols
backend_api_python/app/services/strategy_script_runtime.py62 symbols
backend_api_python/app/services/backtest.py56 symbols
backend_api_python/app/routes/strategy.py46 symbols
backend_api_python/app/data_providers/economic_calendar.py45 symbols
backend_api_python/app/services/search.py44 symbols
backend_api_python/app/services/market_data_collector.py44 symbols
backend_api_python/tests/test_broker_market_policy.py42 symbols
backend_api_python/app/services/grid/engine.py41 symbols

Dependencies from manifests, versioned

Flask3.1.3 · 1×
PyJWT2.12.0 · 1×
PySocks1.7.1 · 1×
PyYAML6.0 · 1×
Werkzeug3.1.6 · 1×
akshare1.12.0 · 1×
alpaca-py0.30.0 · 1×
bcrypt4.1.0 · 1×
bip-utils2.9.0 · 1×
ccxt4.0.0 · 1×
certifi2024.2.2 · 1×
cryptography43.0.0 · 1×

Datastores touched

dbnameDatabase · 1 repos
quantdingerDatabase · 1 repos

For agents

$ claude mcp add QuantDinger \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact