Using Implied Volatility for Portfolio Optimization

Discussion in 'Trading' started by pelman08, Jan 23, 2020.

  1. pelman08

    pelman08

    Hello I am interested in portfolio optimization . Previously I when I have done portfolio optimization I would take the historical returns of a stock and use them to perform a mean variance optimization, however I was just recently introduced to the idea of using the implied volatility of options to perform a mean variance optimization because option implied volatility is forward looking unlike historical volatility . I would like to know if I were to use implied volatility to solve this problem how would I go about doing this . Would I take the for example one year of future volatility of different stocks and put that into a mean variance optimization instead of taking the historical returns of different assets and putting them into a mean variance optimization problem ?
     
  2. I don't know the answer to your question but is this for your own portfolio?
     
  3. pelman08

    pelman08

    yes as well as potentially others
     
  4. Ayn Rand

    Ayn Rand

    All of the big words sound great, mean/variance optimization, implied vs historic. You should have a feel for these sort of things but in and of themselves they add very little value.

    Let’s take implied option volatility. This is supposes to be what the Vix is for the index. The problem is how do you actually calculate this?

    For any given stock there are 100’s of different options series. What option prices are you using and why? And then the whole Black/Scholes Greek thing is actually globbedly gook.

    Do you know how they calculate the implied variance on a stock in an option pricing model. They plug in all the other variables and then whatever value for the variance that yields the spot option price is inferred to be the implied variance.

    A better approach is
    1. Understand that as the price of the asset goes up its variance in absolute terms goes up. Using log linear will dampen this effect.
    2. Vol traded is a big determinator of variance Low vol usually great variance around stock moving events.

    3. Institutional holdings should be acknowledged.

    And the list goes on and on.

    Just trade. There is no secret sauce. All the flashy stuff only makes any difference if you are trading very large accounts like hedge funds.
     
    .sigma and guru like this.
  5. Unconstrained mean/variance optimization usually requires a covariance matrix and a mean vector. So, to sub in IV's, assuming your historical covar matrix is CV and your IV vector is V, you would extract a correlation matrix C from CV, a diagonal matrix D from V, and create a new covar matrix NCV by pre and post multiplying
    C by D:

    NCV = D * C * D

    Then do your mean/var fit using NCV instead of CV.

    Relevant Python code;
    Code:
    def covarToCorrM(cv):
      d = invM(sqrtM(diagonalM(cv)))
      return d*cv*d
    
    """ d is sqrt of diagonal of covar matrix or col sigmas"""
    def corrToCovarM(cr,d):
      if type(d) == list:
        dP = diagM(d)
      else:
        dP = d
      return dP*cr*dP
    

    Are you sure you understand what you are trying to do? The vol is in the covar matrix and the returns are in the mean vector -- different parts of the equation. The words "instead of" make no sense here.


    Edit: just in case you weren't aware of it, the unconstrained m/v optimization is one line:

    weights = numpy.linalg.solve(CV,mu)

    where CV is covar matrix and mu is mean vector
     
    Last edited: Jan 23, 2020
    .sigma and tommcginnis like this.
  6. pelman08

    pelman08







    Wow I gotta say it is so cool to get a response from the legendary @Kevin Schmit , @TheBigShort and I go to the same university he is sort of like my mentor , he talks about you all the time . Thank you for the answer it makes a lot more sense now . I hope this isn't too much of a hassle but how would this work for a constrained optimization problem for example a long only problem and if you don't mind do you think you can share some R code for this problem like @TheBigShort i'm a big R guy . Thank you so much for your help
     
  7. Generally you would use a quadratic solver like quadprog::solve.QP (or, for more complex constraints, a more advanced solver such as Rsolnp) rather than a simple solve to fit the m/v tangency weights.

    for my post above, use cor2cov, psych::cov2cor, and solve, all with the same inputs as above.

    For R code for fits constrained to long only, the functions defined here:

    https://faculty.washington.edu/ezivot/econ424/portfolio_noshorts.r

    are simple, well documented and easy to understand (unlike my own code on the subject). The function you want is "tangency.portfolio."

    Also, instead of using raw IV in place of historical vols, use a Corsi-style HAR-X estimate with IV as your exogenouse (X) RHS variable.
     
    Last edited: Jan 23, 2020
  8. TheBigShort

    TheBigShort

    LOL. Little does Kevin know about his shrine our schools trading team visits every Sunday to pay tribute.

    "The Legendary Kevin Schmit".

    When you are at the terminals next week, we can go over some of what Kevin wrote. I'll do a bit of research over the weekend (as I am not very familiar with portfolio optimization).

    @Kevin Schmit to put into context what @pelman08 is trying to do - Our schools trading team manages a small fund that is only allowed to be long equity. Up until recently the club made decisions based on DCF's (as Schulich is full of investment bankers and this is what we are taught). @pelman08 is trying to bring a quantitative approach to the team and thinks it's a good idea to start with portfolio optimization. He's currently using Portfolio Analytics (R package) to find optimal weights/holdings for a long equity portfolio. I pitched to him the idea of shrinking the covar matrix http://www.ledoit.net/honey.pdf and using implied vars instead of historical vars in the covar matrix http://faculty.london.edu/avmiguel/DPUV-2012-06-11.pdf. However, I did not know exactly how to do it so I left that for him to work on.


    Taking a look at the github page for Portfolio Analytics it looks like we can extract the covariance matrix from our optimization and then proceed to do what you mentioned in your first post https://github.com/R-Finance/PortfolioAnalytics/blob/master/man/extractCovariance.Rd
     
    Last edited: Jan 24, 2020
    .sigma likes this.
  9. ironchef

    ironchef

    It is really depressing reading this thread because I am clueless what you folks are talking about. How and where can I go to learn some of that? :banghead:

    I can't program in Python, R or what not, don't understand your math or the math in BSM, don't have any formal financial training, don't know how to trade combinations.... :(

    Guys like me are doomed to fail. But I can't give up, can't I?
     
    .sigma likes this.
  10. You already have the tools for it. You took a Matlab (short for Matrix Laboratory) course. Once you've read in a CSV file of, say, FAANG historical returns, it is only a couple of lines of Matlab code to fit a mean/variance-optimal portfolio (of just those FAANG names) and obtain a vector (list of decimal numbers) of portfolio weights.

    If I have time over the weekend I will code something up in Matlab illustrating the calculation of mv-optimal (tangency), minimum variance, and risk-parity (Dalio's All-Weather) portfolios, and post it here. Each portfolio is only a single short line of code. Take the code one line at a time and I am sure you will get it.
     
    #10     Jan 24, 2020
    ironchef likes this.