A universal backtesting framework for financial strategies using the IVolatility API.
Project description
IVolatility Backtesting
A universal backtesting framework for financial strategies using the IVolatility API.
Installation
pip install ivolatility_backtesting
Usage
from ivolatility_backtesting import run_backtest, init_api
# Initialize API
init_api("your-api-key")
# Define your strategy
def my_strategy(config):
# Strategy logic
return BacktestResults(
equity_curve=[100000, 110000],
equity_dates=["2023-01-01", "2023-01-02"],
trades=[{"pnl": 1000, "entry_date": "2023-01-01", "exit_date": "2023-01-02"}],
initial_capital=100000,
config=config
)
# Run backtest
CONFIG = {
"initial_capital": 100000,
"start_date": "2023-01-01",
"end_date": "2024-01-01",
"strategy_name": "My Strategy"
}
analyzer = run_backtest(my_strategy, CONFIG)
# Access metrics
print(f"Sharpe Ratio: {analyzer.metrics['sharpe']:.2f}")
Requirements
- Python >= 3.8
- pandas >= 1.5.0
- numpy >= 1.21.0
- matplotlib >= 3.5.0
- seaborn >= 0.11.0
- ivolatility >= 1.8.2
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
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 ivolatility_backtesting-1.29.tar.gz.
File metadata
- Download URL: ivolatility_backtesting-1.29.tar.gz
- Upload date:
- Size: 85.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1544033f3ece9c10dc13d909683ad63a9d38231490f1713cd6cb9f416c411ad4
|
|
| MD5 |
c0ac3dd1e23d2a799288a90bec4e902d
|
|
| BLAKE2b-256 |
3c3a62e06ee1eabee0926039e1b83e11bc2284be56e8b561423cc4676e2332c3
|
File details
Details for the file ivolatility_backtesting-1.29-py3-none-any.whl.
File metadata
- Download URL: ivolatility_backtesting-1.29-py3-none-any.whl
- Upload date:
- Size: 86.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c89be2a3e06ae3749566373a38325569ea7c44770653171d567bf1cb4b5f716d
|
|
| MD5 |
552974d4aff011c860bee465224a39a2
|
|
| BLAKE2b-256 |
96baf1e74240981eee1c92ea088cc9a2942c655fd121051eaf022d82b3e110dc
|