Code and data
All the raw data comes from EOD Historical Data. It is not perfect, but is the best source of data I have found outside of having a Bloomberg terminal on my server. If you know of a better data source, please drop me a line. The server, by the way, is a Ubuntu on a Hetzner.
All the downloading and cleaning (yes, It seems to be impossible to get error-free price data without Bloomberg) is done in Python. It downloads the latest data from EOD every morning, cleans it and saves a CSV file for each asset.
It would be an exercise in masochism to fit all the models in Python. Numpy is simply not fit for purpose, and Pandas, while very useful for cleaning and moving data around, is horrible for the types of iterative analysis I need to do here.
I used to use R for my risk estimation, but now use Julia and have no regrets. It is the best language for this sort of thing. It checks for new or changed data and runs the risk algos. All forecasts are kept in parquet files, the best way for reliability and interchangeability.
Alas, Julia is horrible for plotting, so I use R to make the SVG plots. The bar plots and the global market risk plot are made in chartjs.
p.s. I don't have a two-language problem in this project but a three language problem. Python for data and to ensure the overall project runs automatically and without issues every day, Julia for computations and R for plots.
Extreme riskDaily market risk forecasts and analysis
© All rights reserved, Jon Danielsson,