awt_quant.forecast package¶
Subpackages¶
- awt_quant.forecast.stochastic package
- Subpackages
- Submodules
- awt_quant.forecast.stochastic.pde_forecast module
SPDEMCSimulatorSPDEMCSimulator.tickerSPDEMCSimulator.equationSPDEMCSimulator.start_dateSPDEMCSimulator.end_dateSPDEMCSimulator.dtSPDEMCSimulator.num_pathsSPDEMCSimulator.__init__()SPDEMCSimulator.download_data()SPDEMCSimulator.simulate()SPDEMCSimulator.backwards()SPDEMCSimulator.plot_simulation()SPDEMCSimulator.error_estimation()SPDEMCSimulator.backtest()
- awt_quant.forecast.stochastic.run_simulations module
- awt_quant.forecast.stochastic.stochastic_likelihoods module
- awt_quant.forecast.stochastic.stochastic_models module
StochasticSimulatorStochasticSimulator.__init__()StochasticSimulator.simulate_gbm()StochasticSimulator.estimate_ou_parameters()StochasticSimulator.simulate_ou()StochasticSimulator.estimate_cir_parameters()StochasticSimulator.simulate_cir()StochasticSimulator.estimate_heston_parameters()StochasticSimulator.simulate_heston()
- Module contents
StochasticSimulatorStochasticSimulator.__init__()StochasticSimulator.estimate_cir_parameters()StochasticSimulator.estimate_heston_parameters()StochasticSimulator.estimate_ou_parameters()StochasticSimulator.simulate_cir()StochasticSimulator.simulate_gbm()StochasticSimulator.simulate_heston()StochasticSimulator.simulate_ou()
neg_log_likelihood_ou()neg_log_likelihood_cir()run_portfolio_simulation()compare_multiple_portfolio_simulations()SPDEMCSimulatorSPDEMCSimulator.tickerSPDEMCSimulator.equationSPDEMCSimulator.start_dateSPDEMCSimulator.end_dateSPDEMCSimulator.dtSPDEMCSimulator.num_pathsSPDEMCSimulator.__init__()SPDEMCSimulator.backtest()SPDEMCSimulator.backwards()SPDEMCSimulator.download_data()SPDEMCSimulator.error_estimation()SPDEMCSimulator.plot_simulation()SPDEMCSimulator.simulate()
Submodules¶
awt_quant.forecast.garch_forecast module¶
GARCH Model Optimization and Volatility Forecasting.
This module finds the best GARCH-like model for a given time series, fits it, and visualizes its conditional volatility.
- Classes:
GARCHOptimizer: Handles GARCH model selection, fitting, and volatility forecasting.
- Usage:
garch = GARCHOptimizer(series, dates_train, ticker) best_model = garch.fit() fig = garch.plot_volatility() fig.show()
- class awt_quant.forecast.garch_forecast.GARCHOptimizer(series, dates_train, ticker, plot_vol=True)[source]¶
Bases:
objectA class to find and optimize a GARCH-like model for a given time series.
- fit()[source]¶
Finds the best GARCH model using Bayesian Information Criterion (BIC).
- Returns:
The fitted optimal GARCH model.
- Return type:
arch.univariate.base.ARCHModelResult
awt_quant.forecast.lag_llama_forecast module¶
awt_quant.forecast.macro_forecast module¶
Macro Data Forecasting and Visualization
This module provides functionality for forecasting macroeconomic time series data using AutoTS and TimeGPT. It includes preprocessing utilities, automated forecasting methods, and visualization tools.
- Functions:
MacroDataForecasting: A class for managing time series data and forecasting.
convert_numpy_floats(obj): Converts NumPy float64 values to native Python floats.
api_forecast(series_id): Fetches macroeconomic data and forecasts future values using TimeGPT.
- Usage:
time_series_data, meta_data = get_macro(“GDP”) forecasting = MacroDataForecasting(time_series_data) forecast_results = forecasting.execute_forecasts()
- class awt_quant.forecast.macro_forecast.MacroDataForecasting(time_series, meta_data=None)[source]¶
Bases:
objectA class for forecasting macroeconomic time series data using AutoTS.
- __init__(time_series, meta_data=None)[source]¶
Initializes the MacroDataForecasting class.
- Parameters:
time_series (pd.DataFrame) – The macroeconomic time series data.
meta_data (dict, optional) – Metadata related to the time series.
- preprocess_data(method='average', normalize=False, return_type=None, na_method='drop')[source]¶
Preprocesses the time series data by handling missing values and formatting dates.
- Parameters:
method (str, optional) – Method to handle missing values (‘average’, ‘interpolate’). Defaults to ‘average’.
normalize (bool, optional) – Whether to normalize the data. Defaults to False.
return_type (str, optional) – Type of return calculation (‘log’, ‘percent’) or None. Defaults to None.
na_method (str, optional) – Method to handle missing values (‘drop’, ‘ffill’, ‘interpolate’). Defaults to ‘drop’.
- forecast_with_autots(forecast_length=30, frequency='infer', prediction_interval=0.9, model_list='superfast', transformer_list='superfast', ensemble='distance', max_generations=4, num_validations=1, validation_method='backward', metric_weighting={'mae_weighting': 0.5, 'smape_weighting': 0.5}, drop_most_recent=0, n_jobs='auto')[source]¶
Generates forecasts using the AutoTS library with enhanced parameterization.
- Parameters:
forecast_length (int, optional) – Number of periods to forecast. Defaults to 30.
frequency (str, optional) – Frequency of the time series data. Defaults to ‘infer’.
prediction_interval (float, optional) – Prediction interval for the forecast. Defaults to 0.9.
model_list (list or str, optional) – Models to be used in the search. Defaults to ‘superfast’.
transformer_list (list or str, optional) – Data transformations to be applied. Defaults to ‘superfast’.
ensemble (str, optional) – Ensemble method to use. Defaults to ‘distance’.
max_generations (int, optional) – Number of generations for the model search. Defaults to 4.
num_validations (int, optional) – Number of validation sets used in model selection. Defaults to 1.
validation_method (str, optional) – Method for time series cross-validation. Defaults to ‘backward’.
metric_weighting (dict, optional) – Weighting of different performance metrics. Defaults to {‘smape_weighting’: 0.5, ‘mae_weighting’: 0.5}.
drop_most_recent (int, optional) – Number of most recent data points to drop. Defaults to 0.
n_jobs (int or str, optional) – Number of jobs to run in parallel. Defaults to ‘auto’.
- Returns:
Dictionary containing forecast results, lower and upper bounds.
- Return type: