Metadata-Version: 2.4
Name: deltafq
Version: 0.4.0
Summary: A comprehensive Python quantitative finance library
Author-email: DeltaF <leek_li@outlook.com>
License: MIT
Project-URL: Homepage, https://github.com/Delta-F/deltafq
Project-URL: Repository, https://github.com/Delta-F/deltafq
Project-URL: Issues, https://github.com/Delta-F/deltafq/issues
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Office/Business :: Financial :: Investment
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.21.0
Requires-Dist: pandas>=1.3.0
Requires-Dist: scipy>=1.7.0
Requires-Dist: matplotlib>=3.4.0
Requires-Dist: yfinance>=0.1.70
Requires-Dist: requests>=2.25.0
Provides-Extra: viz
Requires-Dist: plotly>=5.0.0; extra == "viz"
Provides-Extra: talib
Requires-Dist: TA-Lib>=0.4.24; extra == "talib"
Provides-Extra: dev
Requires-Dist: pytest>=6.2.0; extra == "dev"
Requires-Dist: pytest-cov>=2.12.0; extra == "dev"
Requires-Dist: black>=21.0.0; extra == "dev"
Requires-Dist: flake8>=3.9.0; extra == "dev"
Requires-Dist: sphinx>=4.0.0; extra == "dev"
Dynamic: license-file

# DeltaFQ

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

## Highlights

- **Clean architecture**: `data` → `strategy` (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

```bash
pip install deltafq
```

## 60-second Quick Start (Bollinger strategy)

```python
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](LICENSE).
