Trading stock volatility with the Ornstein-Uhlenbeck process
Вставка
- Опубліковано 12 чер 2024
- Understanding and modelling volatility accurately is of utmost importance in financial mathematics. The emergence of volatility clustering in financial markets can make estimating volatility very difficult.
Here we explain how to use a stochastic model called Ornstein-Uhlenbeck process to model volatility. We explain the mathematics of using a method called Maximum Likelihood Estimation (MLE) to estimate the parameters of the Ornstein-Uhlenbeck process based on S&P500 historical/realised volatility.
We also explain how to derive the dynamics of the stochastic process using Ito Calculus, this is required for deriving the Probability Density Function (PDF) of the Ornstein-Uhlenbeck process used in the MLE method.
Finally, we simulate the volatility using the continuous-time stochastic process at a particular time step with no approximations, and also create sample paths using Euler method to discretize the stochastic differential equation (SDE).
★ ★ Code Available on GitHub ★ ★
GitHub: github.com/TheQuantPy
Specific Tutorial Link: github.com/TheQuantPy/youtube...
00:00 Intro
01:43 Volatility Clustering
04:20 Using MLE for estimating model parameters
11:00 Determining distribution of Ornstein-Uhlenbeck process
14:51 Using MLE for Ornstein-Uhlenbeck Volatility Model
18:36 Simulating Volatility Model in Python
★ ★ QuantPy GitHub ★ ★
Collection of resources used on QuantPy UA-cam channel. github.com/thequantpy
★ ★ Discord Community ★ ★
Join a small niche community of like-minded quants on discord. / discord
★ ★ Support our Patreon Community ★ ★
Get access to Jupyter Notebooks that can run in the browser without downloading python.
/ quantpy
★ ★ ThetaData API ★ ★
ThetaData's API provides both realtime and historical options data for end-of-day, and intraday trades and quotes. Use coupon 'QPY1' to receive 20% off on your first month.
www.thetadata.net/
★ ★ Online Quant Tutorials ★ ★
WEBSITE: quantpy.com.au
★ ★ Contact Us ★ ★
EMAIL: pythonforquants@gmail.com
Disclaimer: All ideas, opinions, recommendations and/or forecasts, expressed or implied in this content, are for informational and educational purposes only and should not be construed as financial product advice or an inducement or instruction to invest, trade, and/or speculate in the markets. Any action or refraining from action; investments, trades, and/or speculations made in light of the ideas, opinions, and/or forecasts, expressed or implied in this content, are committed at your own risk an consequence, financial or otherwise. As an affiliate of ThetaData, QuantPy Pty Ltd is compensated for any purchases made through the link provided in this description.
I got my Master in Financial Engineering. And in my opinion this content is of high quality and rare. Thank you for sharing such valuable knowledge on UA-cam.
my PhD is in stochastic processes, and yes, he does good work.
Thank you so much for the detailed explanations. Been trying to connect the worlds of Stochastic Process & Computer Science for quite some time. Contributions like these help people like us break barriers which seemed almost impossible (until now). Thanks again and keep up the great work !! Respect !! Go Feynman !! ✌🏽👍🏽🙏🏽
This channel is precious. Thank you very much
Pure gold. My respect.
I love your videos dude!!! You put in so much work and effort in them! thank you for this. Can you suggest any readings for deciding a stocks weight in a portfolio(maybe include this volatility aspect too). Thanks!
This video is simply amazing
really outstanding content. keep it up!
Although I'm not a quant, I watch your videos for fun. I'm a math student right now, but I hope to become a quant one day.
Thanks for the video!
Really good - thank you!
İt's awesome lecture. Thanks a lot dude 👍
Cheers, feel free to suggest ideas for future videos anytime
I implement the RFSV model last year, it also uses a similar OU process in there
Thanks for this video , in the past you created a video on statistical properties of the bars by the work of Marcoz Lopez De Prado (Advances In Financial Machine Learning) could you perhaps create a few more videos showing implementation of something like meta-labelling etc...
Very cool video and project. I tried to replicate the notebook myself from your site. I am working on a project where I want to find SV under P so its what I am looking for. But shouldn't you use Cox-Ross Model for Volatility? I would like to see a follow-up video on this topic! On calculating these parameters on historical data
Excellent Tutorial! Had two conceptual questions:
1) Do you happen to know why the OU process the natural choice to incorporate volatility clustering (what is the connection between mean reversion in OU and the volatility autocorrelation found by Mandelbrot)? Would a simple AR(1) process for volatility work too?
2) Do I understand it right that OU addresses only the volatility clustering property, but not the heavy tails and excess volatility pptys of stock returns?
Thanks for any feedback!
This is very good content! I am in the process of migrating from Excel to Python. How do you plot the text and algebra notation (at around 5 min. for instance) in your notebooks?
He is using LaTEX typed into a markdown cell within Jupyter Notebook. Hope that helps!
Awesome Content dude! Love this channel a lot. Could you consider to make a video related to term structure models?
Definitely will get to these videos
that little bit of correlation is there because outliers
Can I ask a serious question? How often are you actually correct with this model? Meaning, how close does the model actually come to accurately measuring realized volatility?
Can potentially use scoring algorithm to estimate MLE parameters. But great video.
Great suggestion, that would be an improvement. Next time I’ll use the fisher scoring algorithm if I’m doing MLE 👍
can you explain too me, please, why would you use OU proces to model variance, im not an expert, i just like math and coputer science, i'm been using, garch model to model and forecast variance
OU process is a mean-reverting process commonly used to model processes pulled back towards a central value (like interest rates or a dampened spring)
Why do we square the log returns instead of getting the absolute value?
I had this same question. I think square of log returns refers to variance of log returns (ie it is a measure of volatility).
This is super quant stuff. I'm a trader. Look, can you just put a flashing pop up on my screen that says "Buckle up, we're about to get volatile" Can a quant do that? They must be able to if a human brain can do it, right?
If kappa is significantly different from zero then your daily log returns should be correlated.
This is literally rocket science
Dude, you pronounce all names totally wrong.
Thanks, I also struggle in pronouncing peoples names as well - I prefer numbers