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.

Metadata

Release files for deltafq 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for deltafq 1.1.1
File Size Uploaded Provenance Actions
deltafq-1.1.1.tar.gz 59.0 kB Without provenance Details for deltafq-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for deltafq 1.1.1
File Interpreter ABI Platform Actions
deltafq-1.1.1-py3-none-any.whl Python 3 none any Details for deltafq-1.1.1-py3-none-any.whl

Total release size: 130.2 kB

Release files / deltafq-1.1.1.tar.gz

Download URL deltafq-1.1.1.tar.gz
Size 59.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a939ab5db95d64cfa005e41b58d931232950a247b40b6db6666e46c908a434e5
BLAKE2b-256 checksum
How to use checksums
2c97229b93106e605a0897592a5f53403651f1645d06578b94a443b801938a20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / deltafq-1.1.1-py3-none-any.whl

Download URL deltafq-1.1.1-py3-none-any.whl
Size 71.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e6867b896894c0a46c15f196845280ace241d68830f2e1632a6841d4007847c2
BLAKE2b-256 checksum
How to use checksums
a609c4a95dbf5668a24f9ff91ff14cfa43ee3046562c4c9a9fb1ebf11c09b0ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for deltafq 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files No provenance

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