A comprehensive Python quantitative finance library
Project description
DeltaFQ
Modern Python quantitative finance framework focused on strategy research, backtesting execution, and performance visualization.
Installation
pip install deltafq
- Requires Python ≥ 3.9.
- Optional components like Plotly and TA-Lib can be installed via
pip install deltafq[viz]andpip install deltafq[talib].
Overview
- Lightweight, modular quantitative research infrastructure covering the full pipeline: data → indicators → strategy → backtest → visualization.
- Built-in consistent signal standard (
Seriestype) for strategy reuse and component decoupling. - Suitable for desktop research workflows and script automation, supporting rapid validation and continuous integration.
Core Capabilities
- Data Access: Unified data fetching, cleaning, and validation processes.
- Indicator Library:
TechnicalIndicators/SignalGeneratorprovide mainstream indicators and various combination methods. - Strategy Layer:
BaseStrategyabstracts strategy lifecycle for easy extension and backtest reuse. - Backtest Execution:
BacktestEngineintegrates underlying execution, position management, and performance metrics. - Performance Visualization:
PerformanceReporter(bilingual) andPerformanceChart(Matplotlib / Plotly).
Module Architecture
deltafq/
├── data # Data acquisition, cleaning, storage interfaces
├── indicators # Technical indicators and factor calculations
├── strategy # Signal generators and strategy base classes
├── backtest # Backtest execution, performance metrics, reporting
├── charts # Signal/performance chart components
└── trader # Trading execution and risk control (ongoing expansion)
API Interfaces
- data:
DataFetcher(fetch Yahoo Finance data using yfinance),DataCleaner,DataStorage - indicators:
TechnicalIndicators(SMA/EMA/RSI/KDJ/BOLL/OBV/MACD, etc.),TalibIndicators(optional, requires TA-Lib),FundamentalIndicators - strategy:
BaseStrategy(strategy base class),SignalGenerator(signal generation and combination) - backtest:
BacktestEngine(backtest engine),PerformanceReporter(performance reports, bilingual support) - charts:
PerformanceChart(visualization using Matplotlib/Plotly),PriceChart,SignalChart - trader:
ExecutionEngine(trading execution engine),OrderManager,PositionManager,Broker(broker API not yet integrated)
Quick Start (BOLL Strategy)
import deltafq as dfq
symbol = "AAPL"
fetcher = dfq.data.DataFetcher()
indicators = dfq.indicators.TechnicalIndicators()
signals = dfq.strategy.SignalGenerator()
engine = dfq.backtest.BacktestEngine(initial_capital=100_000)
reporter = dfq.backtest.PerformanceReporter()
chart = dfq.charts.PerformanceChart()
data = fetcher.fetch_data(symbol, "2023-01-01", "2023-12-31", clean=True)
bands = indicators.boll(data["Close"], period=20, std_dev=2)
signal_series = signals.boll_signals(price=data["Close"], bands=bands, method="cross_current")
trades_df, values_df = engine.run_backtest(symbol, signal_series, data["Close"], strategy_name="BOLL")
reporter.print_summary(symbol, trades_df, values_df, title=f"{symbol} BOLL Strategy", language="en")
chart.plot_backtest_charts(values_df=values_df, benchmark_close=data["Close"], title=f"{symbol} BOLL Strategy")
Examples & Tools
01_fetch_yahoo_data.py: Fetch historical data from Yahoo Finance using yfinance02_compare_indicators.py: Technical indicator calculation and comparison03_compare_signals.py: Multi-indicator signal generation and combination04_backtest_execution.py: Single-strategy backtest execution workflow05_backtest_report.py / 05_backtest_charts.py: Performance reports and chart visualization06_base_strategy_demo.py: Moving average crossover strategy example based onBaseStrategy07_backtest_engine_tpl.py:BacktestEnginetemplate usage example08_deltafq_template.ipynb: Complete strategy template example (BOLL strategy, two implementation methods)09_multi_factor_strategy.ipynb: Multi-factor strategy example (SMA/EMA/RSI/KDJ/BOLL/OBV combination)
Community & Contributing
- Welcome to provide feedback and submit improvements via Issues / PRs.
- The project follows a clean code style; it's recommended to run basic lint/tests before submitting.
License
MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
deltafq-0.5.0.tar.gz
(40.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
deltafq-0.5.0-py3-none-any.whl
(47.6 kB
view details)
File details
Details for the file deltafq-0.5.0.tar.gz.
File metadata
- Download URL: deltafq-0.5.0.tar.gz
- Upload date:
- Size: 40.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f72fbb80f72976a25301115237c6398312eef8275032d8b315920310ba825d6f
|
|
| MD5 |
a0d518146d72e44dde95109dec0fc664
|
|
| BLAKE2b-256 |
3d5484b11c67b7ba60e97684dc58093c1300d7b63ecb2de6872fa77f9362cddd
|
File details
Details for the file deltafq-0.5.0-py3-none-any.whl.
File metadata
- Download URL: deltafq-0.5.0-py3-none-any.whl
- Upload date:
- Size: 47.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
adca90f815f9679fc41af0b7d276d7c8caddc3a0fbcb6366f166ee7d72419590
|
|
| MD5 |
66e4e3469550fec9a2e4708e5b0f712b
|
|
| BLAKE2b-256 |
3e6fff894ddad15b9a92bc6dfd6e6f389695d99a86cf23fb095d674718b87fbe
|