Portfolio Optimization using five stocks in excel | FIN-ED

Поділитися
Вставка
  • Опубліковано 7 лют 2025
  • #fin-ed
    Portfolio Optimization using five stocks in excel | Calculating the Variance Covariance Matrix using stock Prices | FIN-ED
    In this video, using five stocks, I will show how to find out the optimal portfolio, which will maximize the return and minimize the risk. We are going to use Microsoft Excel, excel solver, and matrix multiplication to compute the variance and covariance matrix. If you are interested in only 2 stocks portfolio optimization, please check out my other video, the link of which is also given in the description below.
    In this demonstration, we are going to use 5 years of monthly stock price data for 5 companies such as MCD, SBUX, PFE, AMGN, and AXP. If you understand the process, you can do the same exercise using whatever many companies you like and whatever date range you want to use in your computation.
    Portfolio optimization using 2 stocks: • Markowitz Portfolio Op...

КОМЕНТАРІ • 84

  • @gulcinlarsen1328
    @gulcinlarsen1328 2 роки тому +7

    After seeing many videos i just can say that this is one of the best videos, which there are actually very few of them. THANKS

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

    thank you so much!!! This was so simple and no one could explain this except for show the first chart and not how to actually do it. I actually paid a tutor service and got the same nonsense answer. Thank you!!!

  • @PukeSkinwalker
    @PukeSkinwalker Рік тому +2

    The value is the most stable path for returns. The two are the least correlated with each other. That is why. Analyzing the why behind asset correlations is key.

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

    I think I love you, I can finally write my thesis

  • @faridfouad9638
    @faridfouad9638 Рік тому +1

    Thank you so much, this is my first ever project!

  • @demirc-w7s
    @demirc-w7s Місяць тому +1

    Thank you very helpful

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

    This is most easy understanding teaching video...tq a lot

  • @dameskytower1
    @dameskytower1 Місяць тому +1

    Thank you for your video. This is by far one of the most simple design layout that allows for east scaling. But i have a question: Why did you decide to use a 10yr risk free rate with 5 years of stock data? Would a 5yr risk free rate have been wrong? or maybe seven years? Thanks for your reply/

  • @dominodelivers
    @dominodelivers 2 роки тому +4

    I was hoping this video would go into detail on how to actually graph the efficient frontier curve/in particular the non-efficient portfolios as well. Do you have an video on graphing the curve? Or can anyone recommend a suitable one?

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

      all you have to do is use portfolio weights from 1-100 such that the assets add up to 100 and plot the return and standard deviation for each of those portfolios. If you want to include short selling include form -100% to 200%

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

      @@ianthompson31 there are many other YT videos out there on how to plot the Efficient Frontier graph.

  • @FIN-Ed
    @FIN-Ed  2 роки тому +4

    In my video, the diagonal elements of the variance-covariance matrix are not equal to the variances by a few points after the decimal. This is wrong in the sense that we must have these numbers exactly equal. If you have the same issue, it's because the excess return matrix has the wrong formula. Specifically, cell U62 is referring to an empty cell H63. It happened when we copied the formula down Just fix the formula manually (e.g., maybe delete the last row (U62 to Y62) of excess return), your problem will be solved.

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

    thanks for the explanation and the music !

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

    Great job. You did it a little different than the others I saw about this topic in that you used the Overage Returns instead of just Raw return rate. Why is that?

  • @danieledeleo1677
    @danieledeleo1677 3 роки тому +8

    Thank You for the video! is it possible to make a graphic representation of the efficient portfolio in excel?

    • @samirelzein1978
      @samirelzein1978 3 роки тому +6

      yes, this was the promise from the profile image, yet that point wasn't in the content...

  • @liampayne-ritchie8506
    @liampayne-ritchie8506 3 роки тому +2

    Fantastic video, thankyou so much!

  • @usernameXX00
    @usernameXX00 27 днів тому

    why do you multiply monthly variance by 12 to get the annual one? even if we assume we can just multiply by 12 to get annual (sufficient): Var(year) = Var(12 * Month) = 144 Var(Month) from prob theory

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

    Thank you. This video is very helpful!

  • @profarvind
    @profarvind 7 місяців тому

    Thanks, this is an excellent tutorial. Mind if I ask you, if this is still used in optimal portfolio management?

  • @thuytientran6248
    @thuytientran6248 Рік тому +1

    Thank you very very much~

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

    Hey great video. But I need to use all the stocks. In this example it only invests into 2 of your stocks. How would you add constraints to ensure use of all stocks. Even at the expense of maximisation

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

      bro your profile picture just got me tricked -_-

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

    superb....thank you

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

    Add to your winners with a limited amount of money, for example, $5,000. If they are at an all-time high after 5 years, add to them again with another limited amount of money.
    Sell the losers after six months.
    Continue buying as many winners with excellent fundamentals as possible. Repeat the above processes.
    This way, you'll acquire as many stocks with a competitive advantage as you can.

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

    Great video! Is the file available for download?

  • @reinalavictus7851
    @reinalavictus7851 2 місяці тому +2

    Why do we not use Adj Closing?

    • @FIN-Ed
      @FIN-Ed  2 місяці тому +1

      Adjusted closing prices are adjusted for splits and dividends. So, you are free to use any of those. Just be mindful when explaining your analysis outcomes.

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

    Fantastic. How would you integrate dividend yield + compound interest from that into this optimization problem in terms of total/expected returns?

    • @michaelmorris5758
      @michaelmorris5758 3 роки тому +6

      Adjusted close takes into account dividends received and any stock splits

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

      @@michaelmorris5758 Agree other YT videos by others use the ADJ close price instead of the Close prices

  • @reinalavictus7851
    @reinalavictus7851 26 днів тому +1

    Would daily prices work? Thank you

    • @FIN-Ed
      @FIN-Ed  26 днів тому

      daily prices should work. But, pay attention to how you annualize daily return and risk. it's also good to use an adequate time range such as one year or more.

    • @reinalavictus7851
      @reinalavictus7851 25 днів тому

      @@FIN-Ed Thank you!

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

    So it means that you only invest in 2 stocks?

  • @willyhm6258
    @willyhm6258 4 місяці тому

    thank you very much.

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

    Thanks. What do you do if one (or more) business was started during the period of your data? This would mean one or more of the data columns has missing values down to a certain row. How do you deal with this in the variance covariance matrix in particular?
    In this scenario, this business would have the same value (0 - average return) for many rows in the Excess Returns section. This means this business has a very low variance, so the solver will put a big weight on this business, which is not correct.

    • @FIN-Ed
      @FIN-Ed  2 роки тому

      Sorry, in that case, you may need to drop that company from your analysis. Alternatively, you can trim the observations (for all companies) to delete missed values and equal number of observations for all firms. Least favorite, you can use as short as one month daily data in your analysis, but the results may be biased.

  • @amazingjuan001
    @amazingjuan001 3 роки тому +10

    Why do you annualize by multipliying monthly return by 12 instead of using the compounf interest formula? Annual return=((1+monthly rate)^12)-1

    • @FIN-Ed
      @FIN-Ed  3 роки тому +3

      I just wanted to simplify the annual return calculation. If you want, you can use compound return formula as well. It's your choice. In fact, compound return, more often than not, is better than simple annual return.

  • @khoapham7029
    @khoapham7029 Рік тому +1

    If I caculate Average daily return, can I calculate Annual Return by Multilying by 365

    • @FIN-Ed
      @FIN-Ed  Рік тому

      conventional wisdom is to multiply by 252 because there are about 252 stock trading days in a year.

  • @Ramsai2323
    @Ramsai2323 Рік тому +1

    How can i find risk free rate from the internet...its showing 7.1 today so i should mention same number ?

    • @FIN-Ed
      @FIN-Ed  Рік тому

      If you use 3 month treasury as a risk free rate, you can visit: ycharts.com/indicators/3_month_t_bill
      Those who want to use 10 years treasury rate as risk free rate can visit: ycharts.com/indicators/10_year_treasury_rate

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

    Hello, and thank you for your video ! In the variance covariance matrix, why do you divide by 58 (you say it is N-1, but you have 60 months). So, shouldn't it be divided by 59 ?

    • @FIN-Ed
      @FIN-Ed  2 роки тому +4

      Last row of excess return should be deleted as it's refereing to a blank cells. I am sorry that my video doesn't fix it, but I made a comment on how to fix it. Basically, when you calculate returns, you loose one row. In short, when you delete the last row of excess return, the total number of row is 59. Therefore, N-1 is 58. I hope it helps.

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

    If there is a zero value in the data, how do you calculate the average return formula in excel cos when i run it, it gives an error.

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

    Thank you

  • @hakankosebas2085
    @hakankosebas2085 Рік тому +2

    why don't you use adjusted close price?? also I don't quite understand why you did it montly, some people on youtube makes it daily

    • @FIN-Ed
      @FIN-Ed  Рік тому

      yes, using adjusted close price is better. The result will not change much unless there is a stock split. you can also use daily price. Daily price is subject to much more fluctuation than monthly price. There is no set rule as to what to use. it's always about the preference and logic of analyst (i. e., you as analyst).

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

      @@FIN-Ed unfortunatly I am not quite analyst, and I am strugling to figure out which number should I multiply to make things annualized, they all multiply by 252 which is american stocks trade days in a year and we have holidays that are changing in every year

  • @andrewrender
    @andrewrender Рік тому +2

    why use excess returns calculation instead of just using the returns calculation table?

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

      because the formula for covariance is SIGMA[X-E(X)][Y-E(Y)]/n, so you need the excess return of x and y to be multiplied together

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

    thanks for your great work kindly when divide by 58 for N-1 from where 58 comes can you explan please

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

      Because there are 59 rows but he is doing n-1 so it’s 58.

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

    THANKS

  • @Daniel-ck8ii
    @Daniel-ck8ii 2 роки тому

    Hi, can you please help??
    If i use the solver, nothing happens.

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

    why do you divide by 58 for calculating the variance matrix???

    • @AgeOfWulinTV
      @AgeOfWulinTV 3 роки тому +4

      Because there are 58 lines in the Excess returns list

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

      number of observations

    • @FIN-Ed
      @FIN-Ed  2 роки тому

      the total number of rows is 59. You lost one row in calculating the return series.

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

    Add to your winners for a limited amount, sell the losers after six months. Buy as many stocks with a competitive advantage as you can.

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

    Why does your variance-covariance matrix output differ from excel data analysis software output???

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

    Why is the data for Pfizer diferent from your search on the video to today?

    • @FIN-Ed
      @FIN-Ed  2 роки тому

      maybe because of a price adjustment in yahoo's system that happened after I made the video. Even after the price adjustment, it should be significantly different.

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

    Great video!! I have one question: Great video!! I have 12 assets and their prices of 29 different weeks. I want to do portfolio optimization by minimizing the Mean Absolute Deviation. I have calculated r, E[r] , E[r-E[r]] and |E[r-E[r]]| using Excel . What do I have to do next?

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

    Hello and thank you for the video. I have a question. I would like to optimise my portfolio every month. What period for the historical data would you recommend?

    • @FIN-Ed
      @FIN-Ed  3 роки тому +1

      optimizing portfolio every month could be considered too frequent to many people. Although there is no transaction costs to rebalance a portfolio now a days, there could be some tax consequences (e.g., short term capital gain tax or wash sale issues). It all depends on investor's style of management. As for your question, although there is no one answer to this, you can try past 30 days data. thanks.

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

      @@FIN-Ed Thank you for your answer. I will try it out.

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

      @@FIN-Ed if you plan to do a lot of Buy / Sell then do it in your ROTH or Rollover IRAs instead of your taxable brokerage accounts so that you dont incur short term capital gains taxes. The Brokerage acct should be used for LONG TERM holding stocks/etfs that you dont touch (sell) until much after 1 year if ever. I learned this is the best way to reduce taxes as the Taxable acct is only taxed at 15% if the sevurity is held for >1 yr whereas taxed at your standard rate (22-32%) if sold before 1 year. There is no penalty if you buy and sell all day every day in your non-brokerage IRA accounts (Traditional or Roth) so have at it in those. The taxes penalty really adds up over time

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

    how can i calculate portfolio variance if I already have each asset's expected standard deviation and the portfolio is leveraged up over 100%?

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

    hello I just wanna ask how did you get the risk free rate?

  • @AstroidegitaTech
    @AstroidegitaTech 7 місяців тому +1

    following this guide using another datasets it's not equal

    • @FIN-Ed
      @FIN-Ed  7 місяців тому

      See the first comment where I explained why it's not equal and how to fix it. thanks.

  • @sayednab
    @sayednab Рік тому +1

    where is the graph??

    • @FIN-Ed
      @FIN-Ed  Рік тому

      The chart can be drawn manually if the optimization is done using two stocks. However, drawing a chart for 5 stocks optimization is really difficult.

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

      @@FIN-Ed but thats what you showed in the thumbnail?? and no, its not difficult!

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

    very nice video nice explanation do u have any contact number i need help in assignment which is on same topic please reply thanks

  • @SuperSergiobueno
    @SuperSergiobueno 10 місяців тому +2

    The annual variance is wrong, it should be the sqrt of 12, times de variance. That is the correct formula

    • @edwardfernandez2475
      @edwardfernandez2475 7 днів тому

      wrong, wrong TOTALLY WRONG... His calculation is correct. You multiply sqrt of 12 times STANDARD DEVIATION to annualize standard deviation, NOT VARIANCE...