Monte Carlo Simulation with value at risk (VaR) and conditional value at risk (CVaR) in Python

Поділитися
Вставка
  • Опубліковано 24 бер 2021
  • In today's video we follow on from the Monte Carlo Simulation of a Stock Portfolio in Python and calculate the value at risk (VaR) and conditional value at risk (CVaR).
    For the existing Monte Carlo Code, please refer to our last video • Monte Carlo Simulation...
    ★ ★ Code Available on GitHub ★ ★
    GitHub: github.com/TheQuantPy
    Specific Tutorial Link: github.com/TheQuantPy/youtube...
    ★ ★ 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.

КОМЕНТАРІ • 18

  • @LuongBinh-pu9pq
    @LuongBinh-pu9pq 9 годин тому

    thanks you a ton , I have been trying my best to learn but none of the videos strategies worked well from UA-cam , but you are a gem .....salute to you as your strategy gave me confidence and growing a lot on demo account and soon I will switch to live account

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

    awesome video. I am even struggling reading your code and understanding it, it is just admirable how you came up with this code

  • @TheChievovr
    @TheChievovr 3 роки тому

    you are back! Great!

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

    Very well done, many thanks!

  • @2255.
    @2255. 5 місяців тому

    very helpful thank you

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

    Thanks for this great video ! Would be awesome if you could also explain the differences in interpreting Historical vs Parametric vs MC VaR and CVaR. From what I understood they measure the same thing but don't have exactly the same meaning.

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

      Thanks, will definitely make a video summarising this one.
      Essentially these are three different models to asses the possible distribution of future returns. The difference between the models are the assumptions on the asset distributions.
      Historical VaR, makes no assumptions about the distribution (uses historical distribution). Parametric VaR uses a distribution defined by you, and is parametrised in terms of mean and covariance matrices. MC VaR, is a flexible methodology, whereby you could combined various assumptions for each asset.

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

    What would we do if we wanted to calculate min, median, max, and avg return from the 100 simulations?

  • @stevealmond7460
    @stevealmond7460 5 місяців тому

    hello. aren't we assuming returns are normally distributed tho?

  • @giulioc.6066
    @giulioc.6066 2 роки тому

    Thanks for your videos, they are very useful!
    Could you tell me how to calculate the contribution to the VaR of each individual asset? For example, if the portfolio is made up of 2 assets and the portfolio VaR is 10%, the first asset contributes 3% of VaR to the second asset 7%.

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

      Thanks for your question. The way I would visualise the contribution to VaR as you are describing is the same as major trading/market making companies visualise risk contribution.
      1. This is by separating VaR by particular classes, so in your example Asset A and then Asset B.
      2. Run VaR separately.
      3. Run VaR together.
      4. The reduction/increase is called 'Diversification Effect'
      Please see page 98 on Goldman Sachs 2020 Form 10-K for an example where they have separated VaR into asset classes.
      www.goldmansachs.com/investor-relations/financials/current/annual-reports/2020-annual-report/multimedia/2020/annual-report-2020.pdf

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

    Helpful video. Please make a video of calculating VaR using Genetic Algorithm in Python. Thanks!

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

      Great suggestion! Haven't heard of common use cases for Genetic Algorithm (GA) approach for producing a static portfolio. Just having a quick search in the literature, seems like GA can be used to reduce computation time compared to Linear Programming (LP) methods, over large time horizons for allocation problems.

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

      @@QuantPy The code isn't working. It says no data could be fetched using YahooDailyReader. Any idea how to make it work? Thanks.

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

      pip install -upgrade pandas-datareader

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

      Gillespie's Algorithm is a great example

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

    Hi - is there a quick adjustment for me to replicate this code but only for a single security with a specified estimate on volatility?