Skip to main content

A comprehensive Python quantitative finance library

Project description

DeltaFQ

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

Highlights

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

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=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)
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")

# Text summary (zh/en available)
reporter.print_summary(
    symbol=symbol,
    trades_df=trades_df,
    values_df=values_df,
    title=f"{symbol} BOLL Strategy",
    language="en",
)

# Optional performance dashboard (Matplotlib by default; set use_plotly=True for interactive charts)
chart.plot_backtest_charts(values_df=values_df, benchmark_close=data["Close"], title=f"{symbol} BOLL Strategy")

What’s inside

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

Examples

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

  • 04_backtest_result.py: Bollinger strategy summary + charts
  • 05_visualize_charts.py: standalone visualization demos
  • 06_base_strategy: implement a moving-average cross using BaseStrategy

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.4.0.tar.gz (38.7 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.4.0-py3-none-any.whl (47.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for deltafq-0.4.0.tar.gz
Algorithm Hash digest
SHA256 acbdc84b9944e8b33113a55b64a145c8599b958ec6b6300feef6ab370246b186
MD5 c7ac4cd63ee45ec0a45756f4d0bb1b5f
BLAKE2b-256 a0c609bd7123cf42149ce649cad6d18d67d5f1849b3b1090896b04fc87845205

See more details on using hashes here.

File details

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

File metadata

  • Download URL: deltafq-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 47.0 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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4775785bfdd9e1a2c5a78fdb7b319166f5b183c3e4fd207adc617e2de738e127
MD5 a38b2f03f5a97dfb8661fe180e291948
BLAKE2b-256 cbdae4087e41d26bd91a095e4693139caea838b194a5a4f21f5078b672fd8d81

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