← About me & projects
Shared library
func_lib.py
One library, so every project is built and judged the same way.
About 1,500 lines of Python shared by all seven notebooks: data handling, date-safe splits, backtests, performance statistics, the DQN agent and environments, option pricing, volatility models and the dark Plotly theme.
1,523lines of Python
7notebooks use it
7sections
0look-ahead shortcuts
How it works
- Plotly theme. The shared dark template and palette behind every chart.
- Cross-sectional tools. Prices, momentum features, chronological splits, train-only scaling, date-ordered CV folds, benchmark and strategy backtests.
- Time-series tools. Downloads, indicators (moving averages, Bollinger Bands, Wilder RSI) and chart builders.
- RL core. The DQN agent with replay, target network and action masking; the episode runner; trade reports and statistics.
- Options and volatility. Black-Scholes and Greeks, implied volatility, GBM paths, Monte Carlo pricing, GARCH and HAR-RV forecasters, risk parity weights.
- Options RL. The options environment with bid/ask pricing, margin, margin calls and per-position trade statistics.
Results
| Check | Result |
|---|---|
| Monte Carlo vs Black-Scholes | within the confidence interval |
| Greeks vs finite differences | match to 1e-6 |
| Put-call parity, implied-vol round trip | exact |
| GARCH parameter recovery | recovered on simulated data |
| RSI vs the ta library | identical |
| Options account equity vs trade P&L | equal to the cent |
Verified, not just written
Each numerical routine was checked against an independent answer before it was used in a notebook.
Takeaways
- Comparable results. Every strategy is split, scaled, backtested and charted the same way.
- Fewer bugs. One tested implementation replaces copies spread across notebooks.