Calculating Historical Stock Volatility with Python and Excel

Поділитися
Вставка
  • Опубліковано 5 жов 2024
  • A viewer asked if I could do a video on how to calculate historical volatility of a stock in Excel. In this video, I will explain how to do so using Python’s pandas package as well as Numpy. I will, of course, show the same thing in Excel.
    Github Jupyter Notebook: github.com/kpm...
    Github Excel Sheet: github.com/kpm...
    Tip Jar: paypal.me/kpmo...

КОМЕНТАРІ • 9

  • @CompilerZ
    @CompilerZ 3 роки тому +3

    This channel deserve more subs 🚨🚨🚨🚨
    Thanks Kevin , Thumb up as usual 🎉

  • @user-eu9uf3sz8h
    @user-eu9uf3sz8h 3 роки тому +1

    Kevin,
    Great content as always.
    You might think about presenting vol on the basis of log-returns (instead of percent price change) this is the universally accepted approach and consistent with models like Black-Scholes. Simply taking ln(1+pct_change) will do the trick.
    Separately, in order to compare time intervals of different length, vol is almost always quoted on an annualized basis. Here you are describing daily volatility. Because the central moments are linear in time, volatility (i.e. standard-deviation defined as the square root of the variance) is linear in root-time. Therefore multiplying by SQRT(252) (where 252 = the number of trading days in a year) should be the last step.

    • @kpmooney
      @kpmooney  3 роки тому +1

      Yes, these are valid points.

  • @Highlandcorp
    @Highlandcorp 3 роки тому +2

    Thanks for the video! Would this be useful for crypto as well?

    • @kpmooney
      @kpmooney  3 роки тому +1

      Yes, the same math would apply to crypto. It is just a backward-looking measurement of how much an underlying has moved in a specific time window.

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

    Hello and big thanks for the video!
    May I can ask where one can get the historical data from? And perhaps not only for SPY, but lets say individual stocks or NQ?

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

      The data here is from Yahoo finance. I don't think they have futures data though you can use QQQ instead of /MQ if needed.

  • @chenjin-v7h
    @chenjin-v7h Рік тому

    Hi, Thank you so much for ur video. May I ask what difference between historical volatility and Realized volatility in term of calculation