Skip to main content

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

Metadata

Release files for finance-automl 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for finance-automl 0.1.3
File Size Uploaded Provenance Actions
finance_automl-0.1.3.tar.gz 7.0 kB Without provenance Details for finance_automl-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for finance-automl 0.1.3
File Interpreter ABI Platform Actions
finance_automl-0.1.3-py3-none-any.whl Python 3 none any Details for finance_automl-0.1.3-py3-none-any.whl

Total release size: 15.0 kB

Release files / finance_automl-0.1.3.tar.gz

Download URL finance_automl-0.1.3.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
044b14d5bee4a40fc426debb0e4f324c82e44a16ed69e315baf8c0c6289a40f5
BLAKE2b-256 checksum
How to use checksums
4a9a2672170829341d18efd9e6f865f5f6766f01d876299cbcadf248239213d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.7

Release files / finance_automl-0.1.3-py3-none-any.whl

Download URL finance_automl-0.1.3-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9be0b46f44951f63f23cc8e55511ac880b157007fbfc4c3f9441991bba5a08e
BLAKE2b-256 checksum
How to use checksums
879a89dde2d691c2cbff2c80422f6367737c24dd5eb98cf527217ba724ee9dfa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.7

Security for finance-automl 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page