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.

КОМЕНТАРІ • 35

  • @dangkhoatrannguyen6734
    @dangkhoatrannguyen6734 Рік тому +19

    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.

    • @deadduck8307
      @deadduck8307 10 місяців тому

      my PhD is in stochastic processes, and yes, he does good work.

  • @KrishnenduSKar
    @KrishnenduSKar 2 роки тому +2

    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 !! ✌🏽👍🏽🙏🏽

  • @Notwhoyouthink_23
    @Notwhoyouthink_23 Рік тому

    This channel is precious. Thank you very much

  • @michaelnovik270
    @michaelnovik270 2 роки тому +1

    Pure gold. My respect.

  • @Anyone.c
    @Anyone.c 2 роки тому +2

    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!

  • @alessandrolodi8951
    @alessandrolodi8951 2 роки тому

    This video is simply amazing

  • @amitpashine1189
    @amitpashine1189 8 місяців тому

    really outstanding content. keep it up!

  • @nolann2382
    @nolann2382 2 роки тому

    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.

  • @ps3265
    @ps3265 2 роки тому

    Thanks for the video!

  • @saremseitz5715
    @saremseitz5715 Рік тому

    Really good - thank you!

  • @gokhanozbay4349
    @gokhanozbay4349 2 роки тому

    İt's awesome lecture. Thanks a lot dude 👍

    • @QuantPy
      @QuantPy  2 роки тому +2

      Cheers, feel free to suggest ideas for future videos anytime

  • @powerfuel297
    @powerfuel297 8 місяців тому

    I implement the RFSV model last year, it also uses a similar OU process in there

  • @randomdude79404
    @randomdude79404 2 роки тому +1

    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...

  • @Alexander-pk1tu
    @Alexander-pk1tu Рік тому

    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

  • @ArunGupta-du2de
    @ArunGupta-du2de 5 місяців тому

    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!

  • @Rndhld
    @Rndhld 2 роки тому

    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?

    • @lking8819
      @lking8819 Рік тому

      He is using LaTEX typed into a markdown cell within Jupyter Notebook. Hope that helps!

  • @harrystefans9797
    @harrystefans9797 2 роки тому

    Awesome Content dude! Love this channel a lot. Could you consider to make a video related to term structure models?

    • @QuantPy
      @QuantPy  2 роки тому

      Definitely will get to these videos

  • @alejandrovillalobos1678
    @alejandrovillalobos1678 2 роки тому

    that little bit of correlation is there because outliers

  • @malcolmharris7363
    @malcolmharris7363 Місяць тому

    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?

  • @2paccThug
    @2paccThug 2 роки тому

    Can potentially use scoring algorithm to estimate MLE parameters. But great video.

    • @QuantPy
      @QuantPy  2 роки тому

      Great suggestion, that would be an improvement. Next time I’ll use the fisher scoring algorithm if I’m doing MLE 👍

  • @alejandrovillalobos1678
    @alejandrovillalobos1678 2 роки тому

    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

    • @daviddelvalle2458
      @daviddelvalle2458 Місяць тому

      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)

  • @ar-4775
    @ar-4775 Рік тому

    Why do we square the log returns instead of getting the absolute value?

    • @DashboardTrader
      @DashboardTrader Місяць тому

      I had this same question. I think square of log returns refers to variance of log returns (ie it is a measure of volatility).

  • @bluebull399
    @bluebull399 Рік тому

    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?

  • @jonathanbaxter5821
    @jonathanbaxter5821 10 місяців тому

    If kappa is significantly different from zero then your daily log returns should be correlated.

  • @luketesta7310
    @luketesta7310 Рік тому

    This is literally rocket science

  • @larskuehn2157
    @larskuehn2157 8 місяців тому

    Dude, you pronounce all names totally wrong.

    • @QuantPy
      @QuantPy  8 місяців тому +1

      Thanks, I also struggle in pronouncing peoples names as well - I prefer numbers