awt_quant.forecast.stochastic package¶
Subpackages¶
Submodules¶
awt_quant.forecast.stochastic.pde_forecast module¶
- class awt_quant.forecast.stochastic.pde_forecast.SPDEMCSimulator(ticker, equation, start_date='2022-01-01', end_date='2022-03-01', dt=1, num_paths=1000, plot_vol=True)[source]¶
Bases:
objectStochastic Process & GARCH-based Forecasting Simulator.
- __init__(ticker, equation, start_date='2022-01-01', end_date='2022-03-01', dt=1, num_paths=1000, plot_vol=True)[source]¶
awt_quant.forecast.stochastic.run_simulations module¶
Run Stock Forecast Simulations using SPDEMCSimulator.
This script allows running single and multiple stock simulations with different configurations.
- Usage:
python run_simulations.py –symbol AAPL –mode single python run_simulations.py –mode multi
awt_quant.forecast.stochastic.stochastic_likelihoods module¶
Negative Log-Likelihood Functions for Stochastic Models
- This module provides:
neg_log_likelihood_ou: Log-likelihood for Ornstein-Uhlenbeck (OU) process.
neg_log_likelihood_cir: Log-likelihood for Cox-Ingersoll-Ross (CIR) process.
- awt_quant.forecast.stochastic.stochastic_likelihoods.neg_log_likelihood_ou(params, data, dt)[source]¶
Computes the negative log-likelihood for the Ornstein-Uhlenbeck (OU) process.
awt_quant.forecast.stochastic.stochastic_models module¶
- class awt_quant.forecast.stochastic.stochastic_models.StochasticSimulator(num_paths, N, dt, device)[source]¶
Bases:
object- estimate_cir_parameters(data)[source]¶
Estimates Cox-Ingersoll-Ross (CIR) process parameters via MLE.
Module contents¶
Stochastic Models
Contains implementations of Geometric Brownian Motion (GBM), Ornstein-Uhlenbeck (OU), Cox-Ingersoll-Ross (CIR), and Heston models for financial forecasting.
- class awt_quant.forecast.stochastic.StochasticSimulator(num_paths, N, dt, device)[source]¶
Bases:
object- estimate_cir_parameters(data)[source]¶
Estimates Cox-Ingersoll-Ross (CIR) process parameters via MLE.
- awt_quant.forecast.stochastic.neg_log_likelihood_ou(params, data, dt)[source]¶
Computes the negative log-likelihood for the Ornstein-Uhlenbeck (OU) process.
- awt_quant.forecast.stochastic.neg_log_likelihood_cir(params, data, dt)[source]¶
Computes the negative log-likelihood for the Cox-Ingersoll-Ross (CIR) process.
- awt_quant.forecast.stochastic.run_portfolio_simulation(portfolio, equation, start_date, end_date, train_test_split, num_paths=1000, plot_vol=False, plot_sim=False, num_sim=100)[source]¶
Runs a single portfolio simulation using the chosen stochastic differential equation.
- Parameters:
portfolio (dict) – Dictionary containing symbols, positions, and quantities.
equation (str) – Chosen stochastic model (CIR, GBM, Heston, OU).
start_date (str) – Start date for simulation.
end_date (str) – End date for simulation.
train_test_split (float) – Ratio of training data.
num_paths (int) – Number of simulation paths (default: 1000).
plot_vol (bool) – Whether to plot volatility models (default: False).
plot_sim (bool) – Whether to plot individual stock simulations (default: False).
num_sim (int) – Number of simulations for error estimation (default: 100).
- awt_quant.forecast.stochastic.compare_multiple_portfolio_simulations(portfolios, equation_classes, end_dates, forecast_periods, train_test_splits, num_paths=1000, num_sim=100, plot_vol=False, plot_sim=False)[source]¶
Compares multiple portfolio simulations across different stochastic models and settings.
- Parameters:
portfolios (list[dict]) – List of portfolios with stock symbols and positions.
equation_classes (list[str]) – List of stochastic models to test.
end_dates (list[str]) – End dates for different simulations.
train_test_splits (list[float]) – Different train-test split ratios.
num_paths (int) – Number of Monte Carlo paths (default: 1000).
num_sim (int) – Number of simulations for error estimation (default: 100).
plot_vol (bool) – Whether to plot volatility models (default: False).
plot_sim (bool) – Whether to plot individual stock simulations (default: False).
- Returns:
Dataframe containing forecast errors and summaries.
- Return type:
pd.DataFrame
- class awt_quant.forecast.stochastic.SPDEMCSimulator(ticker, equation, start_date='2022-01-01', end_date='2022-03-01', dt=1, num_paths=1000, plot_vol=True)[source]¶
Bases:
objectStochastic Process & GARCH-based Forecasting Simulator.
- __init__(ticker, equation, start_date='2022-01-01', end_date='2022-03-01', dt=1, num_paths=1000, plot_vol=True)[source]¶