
My StochasticModel python package is now publicly available on my GitHub and installable via PyPI. Install & use with:
pip install stochastic-modelIt provides a clean and modular framework for building and experimenting models with stochastic processes: stochastic volatility and jump diffusion.
from stochastic_model import StochasticModel
model = StochasticModel(ticker="TSLA", model="heston")
model.fetch_market_data(save_to_class=True, atm_threshold=0.10, min_open_interest=2000)
model.calibrate(model.data, r=0.0372, x0=[0.3,0.13,3,-0.5,0.03], print_report=True, print_step=100, error_type="mse")
model.batch_price_option(model.data, r=0.0372, params=model.best_params, return_column="Heston_predictions")The repository includes:
- A simple example use case notebook
- A step-by-step development notebook explaining the design and implementation
- Documentation
Feedback, suggestions, and contributions are welcome. The next steps that I have in mind are:
- Pricing American options, Asian options, and some other common exotics
- Generation and output Monte-Carlo paths
- Possibility to calibrate to implied volatility
- Sensitivity analysis and Greeks