Volatility trading research
Project description
Volatility Trading on Equity Options
This project develops and evaluates daily options-volatility strategies on index and single-stock underlyings. Research spans the full pipeline: data engineering and quality checks, implied-volatility surface modelling, volatility forecasting, and strategy backtesting. Backtests use realistic execution assumptions (bid/ask, slippage, commissions, position sizing, and risk limits) and are documented with reproducible notebooks and published reports.
Notebook reports (GitHub Pages): https://anthonymakarewicz.github.io/volatility-trading/
Quickstart
- Clone the repository:
git clone https://github.com/anthonymakarewicz/volatility-trading.git
cd volatility_trading
- Create a virtual environment (Python 3.12+):
python -m venv .venv
source .venv/bin/activate
pip install -U pip
- Install dependencies:
Primary contributor setup (editable package + dev tooling):
pip install -e ".[dev]"
Secondary options:
- Runtime-only install (users running package code without dev tools):
pip install .
- Editable runtime-only install (local source edits, no dev tools):
pip install -e .
- Set credentials (ORATS):
cp .env.example .env
Then set ORATS_API_KEY, ORATS_FTP_USER, and ORATS_FTP_PASS in .env.
ORATS ETL Pipeline (End-to-End)
Pipeline steps:
- API download
- API extract
- FTP download
- FTP extract
- Build options chain
- Build daily features
- QC options chain
- QC daily features
Use --dry-run to validate config, paths, and credentials before running writes/network.
orats-api-download --config config/orats/api_download.yml --dry-run
For the full command sequence, see Data pipeline.
Current Data Support Status
- Options ETL (options chain + daily features) is currently supported through the ORATS pipeline.
- External feed sync (
fred-sync,yfinance-sync) currently covers rates/market time series, not a full generic options ETL path. - The options backtesting runtime expects the current project options-chain schema (for example quotes/Greeks fields used by entry, sizing, and lifecycle).
- You can run backtests with non-ORATS data if it is pre-normalized to the expected schema.
Stability
- Current release line is
0.3.x(alpha / pre-1.0). - Public APIs, data contracts, and configuration surfaces may evolve between minor versions.
- For reproducible research, pin exact package versions and review CHANGELOG.md before upgrading.
- Public vs internal boundaries are defined in API Scope.
Data Contract / Supported Inputs
| Source | Input expected by backtester | Support status | Adapter path |
|---|---|---|---|
| ORATS ETL output | Canonical long-format options chain | First-class | CanonicalOptionsChainAdapter (or mode canonical) |
| OptionsDX ETL output | Cleaned long-format panel (reshape='long') |
Supported | OptionsDxOptionsChainAdapter |
| Custom/vendor dataset | Long-format panel mapped to canonical fields | Supported with mapping | ColumnMapOptionsChainAdapter |
Notes:
- Raw wide OptionsDX vendor format (
c_*/p_*) is not accepted directly by the backtester. - Contract details and adapter behavior: Options Data Adapters
- ORATS pipeline reference: Data Pipeline
- OptionsDX onboarding: OptionsDX Setup
Quick VRP Backtest Example
Assume you already prepared:
options: long-formatpandasoptions panel indexed bytrade_date
- Import strategy and backtesting types:
from volatility_trading.backtesting import (
AccountConfig,
BacktestRunConfig,
BrokerConfig,
ExecutionConfig,
HedgeMarketData,
MarginConfig,
OptionsBacktestDataBundle,
print_performance_report,
to_daily_mtm,
)
from volatility_trading.backtesting.engine import Backtester
from volatility_trading.options import RegTMarginModel
from volatility_trading.signals import ShortOnlySignal
from volatility_trading.strategies import VRPHarvestingSpec, make_vrp_strategy
- Build the backtest data bundle:
hedge_mid = options.groupby(level=0)["spot_price"].first().astype(float)
data = OptionsBacktestDataBundle(
options=options,
features=None,
hedge_market=HedgeMarketData(mid=hedge_mid),
)
- Define strategy spec and run configuration:
vrp_spec = VRPHarvestingSpec(
signal=ShortOnlySignal(),
rebalance_period=10,
risk_budget_pct=0.03,
margin_budget_pct=0.4,
)
strategy = make_vrp_strategy(vrp_spec)
cfg = BacktestRunConfig(
account=AccountConfig(initial_capital=50_000),
execution=ExecutionConfig(commission_per_leg=0.0),
broker=BrokerConfig(
margin=MarginConfig(model=RegTMarginModel(broad_index=False))
),
)
- Run the backtest and compute daily MTM/performance metrics:
bt = Backtester(
data=data,
strategy=strategy,
config=cfg,
)
trades, mtm = bt.run()
daily_mtm = to_daily_mtm(mtm, cfg.account.initial_capital)
metrics = print_performance_report(
trades=trades,
mtm_daily=daily_mtm,
risk_free_rate=0.02,
)
For a full scriptable workflow (data loading + backtest run), see VRP end-to-end example. For focused hedging configuration examples (fixed band, WW band, cost baselines), see examples/README.md. For hedging model semantics and WW/fixed-band configuration details, see hedging.md. For option execution model behavior and option-cost attribution fields, see option_execution.md. For the research-style workflow and reporting exploration, see VRP notebook.
Advanced Option Execution Injection
Backtester intentionally keeps a stable high-level API and does not expose an
option_execution_model argument.
If you want to override option execution behavior, inject the model at plan-build time:
from volatility_trading.backtesting.engine import run_backtest_execution_plan
from volatility_trading.backtesting.options_engine import (
MidNoCostOptionExecutionModel,
build_options_execution_plan,
)
plan = build_options_execution_plan(
spec=strategy,
data=data,
config=cfg,
capital=cfg.account.initial_capital,
option_execution_model=MidNoCostOptionExecutionModel(),
)
trades, mtm = run_backtest_execution_plan(plan)
Tests
Run unit tests (default):
pytest -q
Run integration tests:
pytest -q -m integration
See Testing guide for layout and conventions.
Continuous Integration (CI)
GitHub Actions runs:
- Ruff lint + format checks
- Pyright type checks
- Unit tests by default
- Integration tests on PRs and pushes to
main(and manual runs)
See CI workflow.
Developer Workflow
Common commands are available via Makefile:
make lint
make format
make check
make typecheck
make test
make test-unit
make test-integration
make package-check
make sync-nb
make sync-nb-all
make ci
For full setup and tooling details, see the Documentation index. Notebook HTML reports are built in GitHub Actions and published to GitHub Pages.
Docs
See Documentation index for the full docs map. Most-used pages:
Research Highlights
We publish research notebooks and strategy diagnostics as HTML reports on GitHub Pages.
- RV forecasting: HAR-RV-VIX reaches about 30% OOS R² vs a naive baseline.
- IV surface modelling: parametric vs non-parametric surface comparison workflows.
- Skew trading: delta-hedged RR strategy with realistic costs and risk controls.
Explore details here:
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
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 volatility_trading-0.3.0.tar.gz.
File metadata
- Download URL: volatility_trading-0.3.0.tar.gz
- Upload date:
- Size: 215.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
684ce6cb3827ab6f4874f633b2018ec0d7d2bed1e49c3f3501d4fd484afae7b3
|
|
| MD5 |
6880b943b7a5d40813ce4929f477ab4e
|
|
| BLAKE2b-256 |
9d314237a142b60b4bed8cf8ba0f5e11e218161d483b89e6b341adf5b77b99b4
|
Provenance
The following attestation bundles were made for volatility_trading-0.3.0.tar.gz:
Publisher:
publish-pypi.yml on anthonymakarewicz/volatility-trading
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
volatility_trading-0.3.0.tar.gz -
Subject digest:
684ce6cb3827ab6f4874f633b2018ec0d7d2bed1e49c3f3501d4fd484afae7b3 - Sigstore transparency entry: 1060256143
- Sigstore integration time:
-
Permalink:
anthonymakarewicz/volatility-trading@95053ede297b975ce8769e907c6154cbaca8644d -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/anthonymakarewicz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@95053ede297b975ce8769e907c6154cbaca8644d -
Trigger Event:
release
-
Statement type:
File details
Details for the file volatility_trading-0.3.0-py3-none-any.whl.
File metadata
- Download URL: volatility_trading-0.3.0-py3-none-any.whl
- Upload date:
- Size: 328.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc5b2ca261a178a54cd0c615ecd33fd45b06c78f8d8bacfbc731a765b6395c2b
|
|
| MD5 |
d85fe101398d71efa46045ffa6ee39dd
|
|
| BLAKE2b-256 |
18930a25f9d939d7bdacd34acea7065a5d85cb2248aaf755ab3e95f58f996615
|
Provenance
The following attestation bundles were made for volatility_trading-0.3.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on anthonymakarewicz/volatility-trading
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
volatility_trading-0.3.0-py3-none-any.whl -
Subject digest:
dc5b2ca261a178a54cd0c615ecd33fd45b06c78f8d8bacfbc731a765b6395c2b - Sigstore transparency entry: 1060256182
- Sigstore integration time:
-
Permalink:
anthonymakarewicz/volatility-trading@95053ede297b975ce8769e907c6154cbaca8644d -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/anthonymakarewicz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@95053ede297b975ce8769e907c6154cbaca8644d -
Trigger Event:
release
-
Statement type: