AutoML framework for financial time-series with leakage prevention and finance-specific metrics.
Project description
README.md
# finance_automl
**finance_automl** is an end-to-end AutoML framework tailored specifically for financial time-series forecasting and backtesting. It combines robust leakage prevention, finance-native metrics, and seamless deployment hooks into a single, easy-to-use Python package.
## Project Description
Financial machine learning projects face unique challenges—rolling-window data splits, lookahead bias, non-standard evaluation metrics, and complex backtesting requirements. **finance_automl** addresses these pain points by providing:
- **Leakage-Proof Data Splitting**: Enforced rolling or expanding window splits with configurable purge gaps to eliminate lookahead bias.
- **Finance-Centric Metrics**: Built-in support for Sharpe ratio, max drawdown, Sortino ratio, and hit-rate, enabling model tuning on real-world performance measures.
- **Automated Hyperparameter Optimization**: Seamless integration with Optuna, optimized over chosen finance KPIs for robust model selection.
- **Ensembling with Weighted Blends**: Simple stacking ensemble that adaptively weights base models based on cross-period consistency.
- **Automated Reporting**: Generate P&L curves, drawdown tables, and portfolio turnover analysis with a single function call.
- **One-Click Deployment**: Docker exports and cron-based retrain scheduling to push your best model into production effortlessly.
## Key Features
1. **DataSplitter**: Rolling/expanding splits, purge gaps, and flexible train/test sizing.
2. **MetricEngine**: Sharpe, drawdown, Sortino, and hit-rate calculators.
3. **HyperOptimizer**: Optuna-driven search tuned to finance-specific objectives.
4. **Ensembler**: Stack and blend models with finance-aware weight assignment.
5. **ReportGen**: Auto-generate performance reports, charts, and tables.
6. **DeployHook**: Build Docker images and schedule retraining jobs via cron.
## Installation
```bash
pip install finance-automl
Quickstart
from finance_automl import AutoML, DataSplitter
from sklearn.ensemble import RandomForestRegressor
# 1. Configure a rolling split with a 5-day purge gap
splitter = DataSplitter(window_type="rolling", lookback=252, gap=5, test_size=0.2)
# 2. Initialize AutoML with your model, hyperparameter space, and Sharpe objective
automl = AutoML(
splitter=splitter,
metric_name="sharpe",
model_cls=RandomForestRegressor,
param_space={"n_estimators": [100, 200], "max_depth": [5, 10]},
n_trials=20
)
# 3. Fit on your dataset (X: features, y: target returns)
automl.fit(X, y)
# 4. Visualize cumulative P&L
automl.plot()
License
MIT
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
finance_automl-0.1.3.tar.gz
(7.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
File details
Details for the file finance_automl-0.1.3.tar.gz.
File metadata
- Download URL: finance_automl-0.1.3.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
044b14d5bee4a40fc426debb0e4f324c82e44a16ed69e315baf8c0c6289a40f5
|
|
| MD5 |
1c9a9f984199843e4ced9f3323962e11
|
|
| BLAKE2b-256 |
4a9a2672170829341d18efd9e6f865f5f6766f01d876299cbcadf248239213d3
|
File details
Details for the file finance_automl-0.1.3-py3-none-any.whl.
File metadata
- Download URL: finance_automl-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9be0b46f44951f63f23cc8e55511ac880b157007fbfc4c3f9441991bba5a08e
|
|
| MD5 |
526ed84ac78d363aa49789020fdae09c
|
|
| BLAKE2b-256 |
879a89dde2d691c2cbff2c80422f6367737c24dd5eb98cf527217ba724ee9dfa
|