Skip to main content

DeltaFQ

中文 | English

Version Platform Python Build License

Python Open-source Quantitative Framework: Covering the full "Research, Backtest, Trade" lifecycle, building an industrial-grade closed-loop quantitative workflow from scratch to production.

Strategy Signals Backtest Overview

🎓 Official Tutorials

iMOOC - AI Quantitative System Course

Official Course: Deeply deconstructing the framework's architecture from 0 to 1, covering live trading logic and industrial-grade quantitative development. An essential course for mastering DeltaFQ.

📦 Installation

pip install deltafq

For previous version source code, visit: https://pypi.org/project/deltafq/#history

✨ Key Features

  • 📥 Multi-source Data - Global multi-market historical/real-time data, ready to use
  • 🧠 Rapid Development - Signal-driven architecture, fast implementation with strategy templates
  • 📉 Professional Backtesting - High-performance matching engine, deep performance metrics and analysis
  • ⚡ Event-driven - Second-level market data distribution, millisecond-level Tick signal processing
  • 🤖 Live Gateway - Pluggable adapters, seamless switching between simulation and live trading

⚡ Quick Start

import deltafq as dfq

# 1. Define strategy logic
class MyStrategy(dfq.strategy.BaseStrategy):
    def generate_signals(self, data):
        bands = dfq.indicators.TechnicalIndicators().boll(data["Close"])
        return dfq.strategy.SignalGenerator().boll_signals(data["Close"], bands)

# 2. Minimal backtest & results
engine = dfq.backtest.BacktestEngine()
engine.set_parameters("GOOGL", "2025-07-26", "2026-01-26")
engine.load_data()
engine.add_strategy(MyStrategy(name="BOLL"))
engine.run_backtest()
engine.show_report()
engine.show_chart(use_plotly=False)

🚀 Application Example

DeltaFStation is an open-source quantitative trading cloud platform based on deltafq, integrating data services, strategy management, and trading access with paper and live support. Project: https://github.com/Delta-F/deltafstation/

DeltaFStation Architecture DeltaFStation Backtest Engine

🔌 Interface Integration

  • [Data] yfinance ✅ - US, A-shares, HK, Crypto, Indices
  • [Data] eastmoney ✅ - OTC Funds (Index, QDII, Stock, Bond, Mixed)
  • [Data] baostock ✅ - A-share historical K-line + polled 5m quotes (BaostockDataGateway)
  • [Data] miniQMT ✅ - A-share market data integration (see live trading section in the course)
  • [Trade] PaperTrade ✅ - Local simulation, tick-driven order matching, position and order management
  • [Trade] miniQMT Trade ✅ - A-share live trading (see live trading section in the course)

Minimal miniQMT live trade setup

from deltafq.live import LiveEngine

engine = LiveEngine(symbol="000001.SZ", signal_interval="1m")
engine.set_data_gateway("miniqmt", interval=3.0, mode="poll")
engine.set_trade_gateway(
    "miniqmt",
    userdata_mini_path=r"D:\BrokerQMT\userdata_mini",
    account_id="1234567890",
)

See details:

  • documents/LiveEngine.md
  • documents/MiniQmtTrade.md
  • documents/MiniQmtLiveEngine.md

🏗️ Project Architecture

deltafq/
├── core/                          # Base classes, config, logging
│   ├── base.py
│   ├── config.py
│   └── logger.py
├── data/                          # Fetch orchestration, clean, store, source mapping
│   ├── fetcher.py
│   ├── cleaner.py
│   ├── storage.py
│   └── source_map.py
├── indicators/                    # Technical & fundamental factors
│   ├── technical.py
│   ├── fundamental.py
│   └── talib_indicators.py
├── strategy/                      # Strategy base & signal generation
│   ├── base.py
│   └── signals.py
├── backtest/                      # Backtest engine, metrics, reporting
│   ├── engine.py
│   ├── metrics.py
│   └── performance.py
├── live/                          # Event engine, gateways, LiveEngine
│   ├── event_engine.py
│   ├── gateways.py                # DataGateway / TradeGateway abstractions
│   ├── gateway_registry.py        # Gateway factory & registry
│   ├── engine.py                  # LiveEngine orchestration
│   └── models.py                  # TickData, OrderRequest, …
├── adapters/                      # Pluggable data / trade adapters
│   ├── data/                      # Source adapters (historical bars + live gateways)
│   │   ├── baostock_bars.py       # baostock historical K-line
│   │   ├── baostock_gateway.py    # baostock polled 5m quotes
│   │   ├── miniqmt_bars.py        # miniQMT / xtquant historical K-line
│   │   ├── miniqmt_gateway.py     # miniQMT live quotes
│   │   └── yfinance_gateway.py    # yfinance live quotes
│   └── trade/                     # Trade gateways (Paper, miniQMT, …)
│       ├── paper_gateway.py
│       ├── miniqmt_client.py      # xttrader client wrapper
│       └── miniqmt_gateway.py     # Limit orders / cancel for LiveEngine
├── trader/                        # Matching, orders, positions
│   ├── engine.py
│   ├── order_manager.py
│   └── position_manager.py
└── charts/                        # Signal, price & performance charts
    ├── signals.py
    ├── price.py
    └── performance.py
Project Architecture Workflow

🤝 Contributing

  • Feedback: Bug reports and contributions are welcome via Issue or Pull Requests.
  • WeChat Official Account: Follow DeltaFQ开源量化 for updates, strategies, and quantitative resources.

WeChat Official Account

📄 License

MIT License. See LICENSE for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deltafq-1.1.1.tar.gz (59.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deltafq-1.1.1-py3-none-any.whl (71.3 kB view details)

Uploaded Python 3

File details

Details for the file deltafq-1.1.1.tar.gz.

File metadata

  • Download URL: deltafq-1.1.1.tar.gz
  • Upload date:
  • Size: 59.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for deltafq-1.1.1.tar.gz
Algorithm Hash digest
SHA256 a939ab5db95d64cfa005e41b58d931232950a247b40b6db6666e46c908a434e5
MD5 345a202d4eb07ea436dd7721e2812ced
BLAKE2b-256 2c97229b93106e605a0897592a5f53403651f1645d06578b94a443b801938a20

See more details on using hashes here.

File details

Details for the file deltafq-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: deltafq-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 71.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for deltafq-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e6867b896894c0a46c15f196845280ace241d68830f2e1632a6841d4007847c2
MD5 bbb61c01176362410f58f0e069cff725
BLAKE2b-256 a609c4a95dbf5668a24f9ff91ff14cfa43ee3046562c4c9a9fb1ebf11c09b0ab

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 files

1.1.0

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.9.1

2 files

0.9.0

2 files

0.8.3

2 files

0.8.2

2 files

0.7.9

2 files

0.7.8

2 files

0.7.7

2 files

0.7.6

2 files

0.7.5

2 files

0.7.4

2 files

0.7.3

2 files

0.7.2

2 files

0.7.0

2 files

0.6.5

2 files

0.6.4

2 files

0.6.3

2 files

0.6.2

2 files

0.6.1

2 files

0.6.0

2 files

0.5.3

2 files

0.5.2

2 files

0.5.0

2 files

0.4.3

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page