Skip to main content

A comprehensive Python quantitative finance library

Project description

DeltaFQ

Modern Python library for strategy research, backtesting, paper/live trading, and beautiful reporting.

Highlights

  • Clean architecture: datastrategy (signals) → backtest (execution) → performance (metrics) → reporter (text + charts)
  • Execution engine: Unified order execution for paper/live trading via a Broker abstraction
  • Indicators: Rich TechnicalIndicators (SMA/EMA/RSI/KDJ/BOLL/ATR/…)
  • Signals: Simple, composable SignalGenerator (e.g., Bollinger touch/cross/cross_current)
  • Charts: Matplotlib by default, optional Plotly interactive performance charts
  • Reports: Console-friendly summary with i18n (Chinese/English) + visual charts

Install

pip install deltafq

60-second Quick Start (Bollinger strategy)

import deltafq as dfq

symbol = 'AAPL'
fetcher = dfq.data.DataFetcher(); indicators = dfq.indicators.TechnicalIndicators()
generator = dfq.strategy.SignalGenerator()
engine = dfq.backtest.BacktestEngine(initial_capital=100000)
perf = dfq.backtest.PerformanceAnalyzer(); reporter = dfq.backtest.BacktestReporter()

data = fetcher.fetch_data(symbol, '2023-01-01', '2023-12-31', clean=True)
bands = indicators.boll(data['Close'], period=20, std_dev=2)
signals = generator.boll_signals(price=data['Close'], bands=bands, method='cross_current')

trades_df, values_df = engine.run_backtest(symbol, signals, data['Close'], strategy_name='BOLL')
values_df, metrics = perf.get_performance_metrics(symbol, trades_df, values_df, engine.initial_capital)

# Text + charts; pass use_plotly=True inside reporter if you want interactive charts
reporter.generate_visual_report(metrics=metrics, values_df=values_df, title=f'{symbol} BOLL Strategy')

What’s inside

  • deltafq/data: fetching, cleaning, validation
  • deltafq/indicators: classic TA indicators
  • deltafq/strategy: signal generation + signal combination
  • deltafq/backtest: execution via ExecutionEngine; performance via PerformanceAnalyzer; reporting via BacktestReporter
  • deltafq/charts: signal and performance charts (Matplotlib + optional Plotly)

Examples

See the examples/ folder for ready-to-run scripts:

  • Compare indicators and signals
  • Run a Bollinger strategy and generate a full report

Contributing

Contributions are welcome! Please open an issue or submit a PR.

License

MIT License – see LICENSE.

Project 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-0.3.0.tar.gz (41.2 kB view details)

Uploaded Source

Built Distribution

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

deltafq-0.3.0-py3-none-any.whl (51.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for deltafq-0.3.0.tar.gz
Algorithm Hash digest
SHA256 116a848f4be958e0f3a0d324ab3151e16c33fa2a2ba6a510dd1d55182c80127d
MD5 a8c8e96bfa6fb1c294276099f68f2465
BLAKE2b-256 ec4293d780b843c780cc3e07825577cdab4486aa7a44d69e3af8600102d33893

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for deltafq-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e5604a57afde0e9ed61790782e47ec9319aa416b7ef6b7858c5f2649a64fcbd1
MD5 3f640ca1b873b830da9f99261e3acbd7
BLAKE2b-256 8bc5eb4caf02bf2c2327eb6307dcf8a4301304739d3fc6ec5dd34b8c34c46d1c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page