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 (daily/weekly/monthly and 5/15/30/60m)
  • [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
│   │   ├── 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.0.tar.gz (58.1 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.0-py3-none-any.whl (68.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: deltafq-1.1.0.tar.gz
  • Upload date:
  • Size: 58.1 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.0.tar.gz
Algorithm Hash digest
SHA256 bc3f70245e1cb716ab2879e69b078efc90cc155227201c1dd2e81831060f8a5f
MD5 bebe5b937e7bc90bb031ba1a9147b48f
BLAKE2b-256 e09d83a029f5faadabe6bbad4a307f8aaa9046696157b246a3a7138b94e1ace8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: deltafq-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 68.2 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 360b6a6d88687d92d0fb7ee812e89713785ed532546f19352c234d3f684bf269
MD5 17fba477a82798fbe5451fb18edc863b
BLAKE2b-256 61c6bb9bd3084df45ba438e74ceccf9b222ba600e694aa8cf13462b169dbba30

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.1

2 files

This release

1.1.0 This release

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