PromptHub
Back to Blog
Developer Tools Fintech

brokermr810/QuantDinger: Self-Hosted AI Trading OS for Python Strategies

B

Bright Coding

Author

10 min read 33 views
brokermr810/QuantDinger: Self-Hosted AI Trading OS for Python Strategies

Introduction

Most quantitative traders today stitch together fragmented tools: ChatGPT for code generation, Jupyter for backtests, TradingView for charts, and separate bots for execution. API keys sit on third-party servers. Audit trails are nonexistent. And when an AI agent suggests a trade, there's no guarantee it runs against paper markets first.

brokermr810/QuantDinger addresses this directly. It's a self-hosted, local-first AI trading operating system that unifies research, strategy development, backtesting, and live execution in a single Docker↗ Bright Coding Blog Compose stack. With 9,598 GitHub stars and 2,019 forks, it's gained significant traction among developers who want control over their infrastructure, their exchange keys, and their strategy code. This article examines what QuantDinger actually delivers, how to deploy it, and where it fits in the quant tooling landscape.

What is brokermr810/QuantDinger?

QuantDinger is an open-source AI quantitative trading platform maintained by Open Byte Inc, licensed under Apache License 2.0 for the backend. The project ships as a full-stack Python↗ Bright Coding Blog application with a Vue.js↗ Bright Coding Blog frontend, PostgreSQL↗ Bright Coding Blog 18 state store, Redis 8 caching layer, and direct exchange adapters for both crypto and traditional markets.

The core value proposition is straightforward: your infrastructure, your keys, your code. Unlike SaaS platforms that hold API credentials, QuantDinger runs entirely on hardware you control. The backend is Flask/Gunicorn with a modular service architecture—AI analysis, strategy engine, execution layer, and billing/membership services are cleanly separated.

The project is explicitly designed for three audiences: independent Python strategy authors, small trading teams, and operators building white-label AI trading products. Its Agent Gateway (/api/agent/v1) and MCP server (quantdinger-mcp on PyPI) make it unusually agent-native—Cursor, Claude Code, and Codex can read markets, run backtests, and trade (paper-only by default) with scoped tokens and full audit logging.

Version tags follow semantic releases (e.g., v4.0.4), with multi-arch GHCR images for amd64 and arm64. The last commit timestamp shows active development through July 13, 2026.

Key Features

Dual Strategy Runtimes. QuantDinger supports two distinct authoring models: IndicatorStrategy for dataframe-based four-way signal generation (open_long, close_long, open_short, close_short) with chart overlays, and ScriptStrategy for event-driven on_bar execution with explicit ctx.buy() / ctx.sell() calls. Research and production share the same codebase.

Multi-Venue Execution. Direct adapters cover Binance, OKX, Bitget, Bybit, Gate, HTX, Coinbase, Kraken for crypto, plus IBKR and Alpaca for US stocks and ETFs. A unified Broker Accounts page manages per-broker sessions with isolated multi-tenant safety.

Agent-Native Architecture. The Agent Gateway plus MCP server enables AI clients to interact with markets without ever seeing exchange keys or admin JWTs. Every call is audit-logged; trading-class tokens default to paper-only. Live execution requires both paper_only=false on the token and AGENT_LIVE_TRADING_ENABLED=true server-side.

Production Infrastructure. PostgreSQL 18 with idempotent schema bootstrap, Redis 8 for cache and worker coordination, background workers for orders, portfolio monitoring, and reflection. Gunicorn production server with nofile set to 65535. GHCR images with optional zero-repo deployment.

Operator-Ready Platform Features. OAuth, multi-user RBAC, credits/membership/USDT billing toggles, 11-language web UI, and multilingual documentation. The stack is explicitly designed for commercial deployment, not just hobby trading.

Use Cases

Independent Quant Research. A Python developer can iterate on indicator logic using the dataframe-based IndicatorStrategy, run server-side backtests with equity curves and drawdown metrics, then promote the same code to paper trading without rewriting for a different runtime.

AI-Assisted Strategy Development. Using the NL→Indicator/strategy generation flow, a trader drafts strategy logic with natural language, receives Python code as a starting point, and edits directly. The MCP server enables Cursor or Claude Code to run backtests iteratively without context switching.

Multi-Asset Fund Operations. A small team runs crypto futures on Binance and Bybit alongside US equity positions via IBKR and Alpaca—all from one deployment, one database, with per-user session isolation and unified P&L monitoring.

White-Label Product Deployment. An operator forks the backend (Apache 2.0), customizes billing and membership tiers, and deploys a branded trading product. The frontend and mobile repos are source-available with separate commercial licensing from Open Byte Inc.

Regulated Environment Compliance. The append-only audit trail for agent calls, paper-default trading tokens, and explicit server-side live unlock provide guardrails for environments requiring trade automation logging and risk controls.

Installation & Setup

The fastest path requires only Docker with Compose v2. No git clone, no Node.js, no Vue source tree.

Linux/macOS:

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

This installs to ~/quantdinger (Linux/macOS) or $HOME\quantdinger (Windows), prompts for admin credentials, generates a secure SECRET_KEY, pulls GHCR images, and starts Docker Compose.

Manual clone path (for customization or development):

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:
#   ADMIN_USER=your_admin_user
#   ADMIN_PASSWORD=your_secure_password
docker compose pull
docker compose up -d

The script generate-secret-key.sh overwrites SECRET_KEY using Python's secrets module. The API refuses to start if the placeholder remains—this blocks accidental insecure deployments.

Services start on: http://localhost:8888 (web UI), http://localhost:8889 (mobile H5), and http://localhost:5000 (API, loopback-bound). Verify with:

curl -fsS http://127.0.0.1:5000/api/health
docker compose logs -f backend

Zero-repo GHCR-only alternative (lightest, no git):

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 with admin credentials
docker compose -f docker-compose.ghcr.yml pull
docker compose -f docker-compose.ghcr.yml up -d

The backend entrypoint auto-generates SECRET_KEY and applies schema migrations idempotently. Pin versions via IMAGE_TAG or per-side tags (BACKEND_TAG, FRONTEND_TAG, MOBILE_TAG) in a root .env.

Real Code Examples

IndicatorStrategy: Dual Moving Average Crossover

This is the dataframe-based pattern for signal generation with chart overlays:

# @param sma_short int 14 Short moving average
# @param sma_long int 28 Long moving average

sma_short_period = params.get('sma_short', 14)
sma_long_period = params.get('sma_long', 28)

my_indicator_name = "Dual Moving Average Strategy"
my_indicator_description = f"SMA {sma_short_period}/{sma_long_period} crossover"

df = df.copy()
sma_short = df["close"].rolling(sma_short_period).mean()
sma_long = df["close"].rolling(sma_long_period).mean()

def edge(signal):
    signal = signal.fillna(False).astype(bool)
    return signal & ~signal.shift(1).fillna(False)

open_long = (sma_short > sma_long) & (sma_short.shift(1) <= sma_long.shift(1))
open_short = (sma_short < sma_long) & (sma_short.shift(1) >= sma_long.shift(1))

df["open_long"] = edge(open_long)
df["close_long"] = edge(open_short)
df["open_short"] = edge(open_short)
df["close_short"] = edge(open_long)

output = {
    "name": my_indicator_name,
    "plots": [
        {"name": "SMA Short", "data": sma_short.fillna(0).tolist(), "color": "#FF9800", "overlay": True},
        {"name": "SMA Long", "data": sma_long.fillna(0).tolist(), "color": "#3F51B5", "overlay": True},
    ],
    "signals": [],
}

The edge() helper ensures signals fire only on state transitions, not every bar where the condition holds. The output dictionary feeds chart rendering and backtest engines. Parameters are exposed via decorators for UI adjustment.

MCP Server Configuration for Cursor

To connect an AI agent to your QuantDinger instance:

{
  "mcpServers": {
    "quantdinger": {
      "command": "uvx",
      "args": ["quantdinger-mcp"],
      "env": {
        "QUANTDINGER_BASE_URL": "http://localhost:8888",
        "QUANTDINGER_AGENT_TOKEN": "qd_agent_xxxxxxxx"
      }
    }
  }
}

Install quantdinger-mcp from PyPI, issue a scoped agent token via Profile → My Agent Token, and place this in .cursor/mcp.json. The agent can then read markets, manage strategies, and run backtests—trading remains paper-only unless both token and server explicitly permit live execution.

Docker Compose Verification

Post-deployment health check:

# Check container limits and runtime
docker exec quantdinger-backend sh -lc 'echo "ulimit -n=$(ulimit -n)"; cat /proc/1/cmdline | tr "\0" " "; echo'

# Expected: nofile ~65535, command line contains gunicorn
# Then verify API response:
curl -fsS http://127.0.0.1:5000/api/health

This validates production-grade configuration. Running python run.py directly is explicitly discouraged for public deployments—it inherits low file-descriptor limits and lacks Gunicorn's process management.

Advanced Usage & Best Practices

Schema Migrations and Postgres Version Locking. When reusing existing PostgreSQL data directories, the major version must match exactly. Check PG_VERSION in the data path before mounting. Never mount PostgreSQL 16 data into a PostgreSQL 18 image—the server will refuse to start with database files are incompatible with server.

AI Provider Configuration. The backend supports multiple LLM providers: OpenRouter, OpenAI, AtlasCloud, and others. Configure via LLM_PROVIDER and corresponding API keys in backend_api_python/.env. Restart the backend after changes; AI analysis flows fail gracefully to disabled states when unconfigured.

Frontend Development↗ Bright Coding Blog vs. Production. The default docker-compose.yml pulls prebuilt GHCR images for web and mobile UIs. Source builds require cloning sibling repos (QuantDinger-Vue, QuantDinger-Mobile) and using docker-compose.build.yml. Node.js 22 LTS is the shared target; the mobile H5 specifically requires Node 20.19+ or 22.12+ for Vite 7 compatibility.

Security Hardening. Beyond the mandatory SECRET_KEY, set FRONTEND_URL to your actual public origin (including https://) for correct CORS and redirect behavior. Enable OAuth (GOOGLE_CLIENT_ID, GITHUB_CLIENT_ID) for federated authentication in multi-user deployments. Review AGENT_LIVE_TRADING_ENABLED carefully—this is the server-side kill switch for agent-driven live execution.

Comparison with Alternatives

Dimension QuantDinger TradingView + Jupyter + Custom Bots SaaS Platforms (e.g., 3Commas, Kryll)
Hosting Self-hosted, full data sovereignty Fragmented; data scattered across services Third-party hosted; API keys held by operator
AI Integration Native Agent Gateway + MCP server Manual; copy-paste between ChatGPT and Jupyter Limited or proprietary AI features
Strategy Runtime Dual: dataframe (IndicatorStrategy) + event-driven (ScriptStrategy) Jupyter for research, separate bot framework for execution Typically visual builders or limited scripting
Asset Coverage Crypto (8 venues) + IBKR/Alpaca stocks/ETFs Depends on broker integrations Usually crypto-only or limited traditional markets
Audit & Compliance Append-only agent call logs, paper-default tokens Ad-hoc logging, inconsistent Platform-dependent, often opaque
Licensing Backend Apache 2.0; frontend source-available Varies per component Proprietary, subscription-locked

QuantDinger trades the convenience of fully managed SaaS for control and auditability. It's heavier to operate than a single-purpose bot but lighter than maintaining separate research, backtest, and execution infrastructures. The agent-native design is currently uncommon in open-source quant tooling.

FAQ

Is QuantDinger actually self-hosted? Yes. Default deployment is your own Docker Compose stack with your database, Redis, credentials, and configuration.

Does it require Node.js? No for standard deployment—GHCR images include prebuilt UIs. Node.js 22 LTS is only needed for source-level UI development.

Can I trade traditional markets, or only crypto? Both. IBKR and Alpaca adapters support US stocks and ETFs. Alpaca additionally covers crypto.

What prevents an AI agent from losing money? Agent tokens default to paper-only. Live execution requires explicit paper_only=false on the token plus AGENT_LIVE_TRADING_ENABLED=true server-side. Every call is audit-logged.

Is the frontend open source? The backend is Apache 2.0. Frontend and mobile sources are available under a source-available license; commercial use requires separate authorization from Open Byte Inc.

How do I upgrade versions? Set IMAGE_TAG (or per-side tags) in root .env, run docker compose pull && docker compose up -d. Pin tags for reproducible deployments.

What if Docker pull fails behind a firewall? Set IMAGE_PREFIX=docker.m.daocloud.io/library/ in root .env, or configure Docker Desktop proxy settings. System VPN alone is often insufficient.

Conclusion

brokermr810/QuantDinger occupies a specific niche: developers and small teams who want Python-native quant workflows, AI-assisted strategy development, and live execution—all under their own infrastructure and compliance controls. It's not a managed service, and it requires operational investment in Docker, database management, and security configuration.

The project is best suited for: Python-literate traders comfortable with self-hosting, teams building white-label trading products, and organizations with regulatory requirements around audit logging and key custody. The 9,598-star traction suggests the approach resonates with a substantial developer audience.

If you're currently stitching together ChatGPT, Jupyter, and exchange APIs, QuantDinger offers a credible path to integration. Start with the one-line installer, verify with a paper-trading strategy, and evaluate whether the dual runtime model fits your research-to-production workflow.

→ Explore the repository: https://github.com/brokermr810/QuantDinger

Comments (0)

Comments are moderated before appearing.

No comments yet. Be the first to share your thoughts!

Recommended Prompts

View All
All tools