This releases introduces the GARCH model including volatility forecasting. Next to that, it includes a bugfix for the currency conversion.
Designed by northern-64bit ([LinkedIn](https://www.linkedin.com/in/fabian-farestam/)) in #82, this release introduces GARCH (Generalized autoregressive conditional heteroskedasticity) which is stochastic model for time series, which is for instance used to model volatility clusters, stock return and inflation. It is a generalisation of the ARCH models.
It can be found inside the `risk` module and can be ran with the following code:
python
from financetoolkit import Toolkit
toolkit = Toolkit(["AMZN", "TSLA"], api_key=FMP_KEY)
toolkit.risk.get_garch()
Which produces the following result:
| Date | AMZN | TSLA | Benchmark |
|:-------|-------:|--------:|------------:|
| 2012 | 0 | 0 | 0 |
| 2013 | 0.2038 | 5.027 | 0.024 |
| 2014 | 0.4016 | 10.2307 | 0.0537 |
| 2015 | 0.53 | 13.2345 | 0.0688 |
| 2016 | 0.7664 | 15.6152 | 0.079 |
| 2017 | 0.8181 | 17.5204 | 0.0887 |
| 2018 | 0.8896 | 19.0642 | 0.0997 |
| 2019 | 0.9235 | 20.2789 | 0.104 |
| 2020 | 0.9479 | 21.2567 | 0.1169 |
| 2021 | 1.0203 | 27.5585 | 0.1209 |
| 2022 | 1.0201 | 27.0986 | 0.129 |
| 2023 | 1.0445 | 26.7482 | 0.1305 |
You can also forecast in the future for any period and for any interval. For example, the quarterly expected volatility estimations can be shown with:
python
from financetoolkit import Toolkit
toolkit = Toolkit(["AMZN", "TSLA"], api_key=FMP_KEY)
toolkit.risk.get_garch_forecast(period='quarterly')
Which returns:
| | AMZN | TSLA | Benchmark |
|:-------|-------:|-------:|------------:|
| 2024Q1 | 0 | 0 | 0 |
| 2024Q2 | 0 | 0 | 0 |