Tap to unmute

Markowitz Portfolio Solver from Scratch and Stock Market Analysis | Python # 17

  Рет қаралды 141,632

Ahmad Bazzi

Ahmad Bazzi

Күн бұрын

Пікірлер
@charlenestanton2237
@charlenestanton2237 3 жыл бұрын
You have explained in less than 50 minutes what my lecturer struggled to explain in 3 months. Thank you!
@daveframi5715
@daveframi5715 3 жыл бұрын
*The following content is created under an intellectual property license* Never have I ever seen such perfect and clear explanations.
@phoebegarret4594
@phoebegarret4594 3 жыл бұрын
ok
@brennarachelle4986
@brennarachelle4986 3 жыл бұрын
👍🏻
@tonettespector9383
@tonettespector9383 3 жыл бұрын
@Dave Frami *Please send me the IP license*
@mellissadays700
@mellissadays700 3 жыл бұрын
@aisha houra How did you put all outlines as clickable comments ?
@henriettaprestridge1402
@henriettaprestridge1402 3 жыл бұрын
Haha !
@leahprice1161
@leahprice1161 3 жыл бұрын
This lecture slaps harder than my dads belt.
@joelmarshall4989
@joelmarshall4989 3 жыл бұрын
I love the math flow starting at 06:40 
Thanks a lot Ahmad !
@karliefarrell6710
@karliefarrell6710 3 жыл бұрын
Mesmerizing insights and its for free!!.. Good job Ahmad !
@louisrobertson3698
@louisrobertson3698 3 жыл бұрын
This lecture will make your pocket rocket 🚀
@tubzzsheff
@tubzzsheff 3 жыл бұрын
It sure did pocket made 5K USD yesterday thanks to this opt problem.
@aishahoura2619
@aishahoura2619 3 жыл бұрын
00:00​ Introduction 00:47​ Markowitz Portfolio Optimization Problem (a recap) 03:08​ Lagrangian Function 05:38​ Optimal Weights 11:11​ Lagrangian Multiplier Solutions 21:35​ Our Portfolio Solver Equation 22:17​ Python Implementation: SciPy approach (method 1) 33:36​ Python Implementation: Our Solver (method 2) 37:28​ Comparisons: SciPy Solver vs Our Solver 41:00​ Summary 41:40​ Outro
@rebbeccagehl5602
@rebbeccagehl5602 3 жыл бұрын
Very helpful
@frankfernandez6424
@frankfernandez6424 3 жыл бұрын
Wow now I can use your equation to do my own solver. Thanks.
@aishahoura2619
@aishahoura2619 3 жыл бұрын
I just did and it works perfectly
@thomasyonsy3261
@thomasyonsy3261 3 жыл бұрын
Suppose two portfolios A and B have an expected return of 10% each. But A’s risk is 8% while that of B is 12%. Looking at these two portfolios you would think, both give the same returns, but A has lower risk, I’ll buy A. But if you’re adventurous, you’d say portfolio A can return between 2% and 18%, while B can give between -2% and 22%. You might choose B. Portfolio B offers a chance of getting 22% return but there’s also the possibility that instead of making gains, you might end up losing money. The additional return is compensation for additional risk. Hence the notion, the higher the risk the higher the return. How do you make an optimal portfolio? By selecting the right combination of assets. If two assets are similar, then their prices will move in a similar pattern. Say, two Exchange Traded funds or ETFs from the same economic sector tend to show similar price movement, while, ETFs from different sectors show dissimilar price movements, as they lack correlation, making them a suitable set of eggs for your basket. Correlation is measured on a scale of -1 to +1. +1 indicates positive correlation where prices of two assets move par-for-par, while -1 shows negative correlation; prices move in opposite direction. If you put two assets with correlation of +1 in a portfolio, the risk they bring to portfolio will be the sum of the weighed risk of individual assets. However, if you put a pair of assets with correlation of less than 1, then the risk of the resulting portfolio will be less than the sum of the weighed risk of individual assets. By selecting different asset combinations you can achieve every risk to return combination in a portfolio. And this brings us to the efficient frontier, which is a graphical representation of different combinations of assets to achieve an optimal level of return at any given level of Risk. With risk on X-axis and return on Y-axis, this hyperbola shows all outcomes for various portfolio combinations of risky assets. This Straight Line is the Capital Allocation Line, which represents a portfolio of all risky assets and the risk-free asset, like government bonds. Tangency Portfolio is the point where the portfolio of risky assets meets the combination of risky and risk-free assets. And this portfolio maximizes return for a given level of risk. As you move towards the right along the lower part of the hyperbola you get lower returns at higher risk. Do the same along the upper part and you get higher returns at higher risk. The take away is that an asset's risk and return should not be assessed by itself, but by how it contributes to a portfolio's overall risk and return. We utilize Modern Portfolio Theory in our module 1, which has allowed us to achieve such returns…
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Some good argument I see
@aishahoura2619
@aishahoura2619 3 жыл бұрын
@@AhmadBazzi lol wow
@millielaw1195
@millielaw1195 3 жыл бұрын
This video sums up what took me about 4 years of gradual self learning to know in only 42 minutes!
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Wow glad it did
@emiliacofer549
@emiliacofer549 3 жыл бұрын
28:45 Thanks for showing me how to use scipy minimize function. Always had troubles with it.
@jeromehebert6798
@jeromehebert6798 3 жыл бұрын
I have never seen anybody teach so clearly
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Oh wow, thanks Jerome !
@allisonwhitten3313
@allisonwhitten3313 3 жыл бұрын
This man is amazing.. very knowledgeable & good at explaining. Well done KZbin for recommending me here.
@turkuevievi9005
@turkuevievi9005 3 жыл бұрын
I have so much respect for how a good explainer you are. This video is amazing. Very clear, structured and most importanty calm (good comfort for ones who find these processes taunting already).
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Wow, thank you!
@cameronwoodward2026
@cameronwoodward2026 3 жыл бұрын
Your explanation makes it much easier to understand. Thanks.
@klaraprice2355
@klaraprice2355 3 жыл бұрын
Brilliantly articulated multiple concepts within limited time, Thank you.
@tracemckenzie8322
@tracemckenzie8322 3 жыл бұрын
I think one needs to be a genius in order to be able to explain such an incredibly complex thing in such a beautifully simple way.
@vtoroy122
@vtoroy122 3 жыл бұрын
Интересная информация, благодарю за нее
@ДенисКожин-е5ш
@ДенисКожин-е5ш 3 жыл бұрын
Clear lecture. Disclaimer: No student debt was created during the watching of this video.
@velmaaronson9694
@velmaaronson9694 3 жыл бұрын
Amazing video needs to be shown in universities thank you for the development of this video.
@БеняКузин
@БеняКузин 3 жыл бұрын
Oh my GOSHHH. I am going to watch this so many times
@emilybird9761
@emilybird9761 3 жыл бұрын
I swear I’ve learnt more during this quarantine than all the years I was in school 🙌🏽 I’m a new person now lol
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Wow that is awesome. Keep up the KZbin learning Emily. KZbin is a very rich source where you could learn almost anything.
@tedsmith6075
@tedsmith6075 3 жыл бұрын
Learnt more in this four lecture than in the 4 months in class ✌🏻
@thejoker9418
@thejoker9418 3 жыл бұрын
Thank you very much Ahmad !
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
You are very welcome
@ericritchie9363
@ericritchie9363 3 жыл бұрын
I wish my Professors approach their lectures like this.
@aishahoura2619
@aishahoura2619 3 жыл бұрын
Lmfao mine as well they suck
@bobbieosborne7479
@bobbieosborne7479 3 жыл бұрын
A brilliant explanation of MPT. Wish I had come across this sooner. Thank you !
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Glad it was helpful!
3 жыл бұрын
MPT which is Modern Portfolio Theory considers how an investor should choose a portfolio with a good trade-off between risk and expected return. Markowitz showed that the set of possible expected returns and risks.
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Correct
@eneserdogan1626
@eneserdogan1626 3 жыл бұрын
In finance, the Markowitz model - put forward by Harry Markowitz in 1952 - is a portfolio optimization model; it assists in the selection of the most efficient portfolio by analyzing various possible portfolios of the given securities. Here, by choosing securities that do not 'move' exactly together, the HM model shows investors how to reduce their risk. The HM model is also called mean-variance model due to the fact that it is based on expected returns (mean) and the standard deviation (variance) of the various portfolios. It is foundational to Modern portfolio theory.
@Ondermuhabbetkusu
@Ondermuhabbetkusu 3 жыл бұрын
Portfolio management can be painful because it's all about making decisions about investment mix and policy, matching investments to objectives, asset allocation for individuals and institutions, minimising risk while keeping good returns and balancing risk against performance and not everyone could handle this successfully. Ahmad did an excellent job in clarifying all concepts jointly.
@canerozturk8087
@canerozturk8087 3 жыл бұрын
you explained it as simple as possible.. thanks
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
You are welcome
@kalicorkery8274
@kalicorkery8274 3 жыл бұрын
This was extremely helpful and needed. Thank you so much.
@gurhan_aydn-edits8661
@gurhan_aydn-edits8661 3 жыл бұрын
Thanks alot sir I really do appreciate your help with this video, I started off in this market not seeing the results I expected
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Glad it helped
@Timofte_ATB
@Timofte_ATB 3 жыл бұрын
An excellent video with useful information.
@trevormasters722
@trevormasters722 3 жыл бұрын
Underrated GURU !
@aishahoura2619
@aishahoura2619 3 жыл бұрын
The lectures he gives are priceless
@felicitasadkison33
@felicitasadkison33 3 жыл бұрын
Best lecture on planet earth
@lethansscroggins3655
@lethansscroggins3655 3 жыл бұрын
Definitely will add this to my playlist for later! 🤙
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Awesome! Thank you!
@peterashton391
@peterashton391 3 жыл бұрын
Informative tutorial.
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Glad you think so!
@elisabethgraham866
@elisabethgraham866 3 жыл бұрын
Funny. I understood most by a guy that does not look like people from Goldman Sachs
@johanaclutts978
@johanaclutts978 3 жыл бұрын
A true definition of a Guru
@dominiquedefrasne2695
@dominiquedefrasne2695 3 жыл бұрын
Ahmad is the best !
@desmondblattner6791
@desmondblattner6791 3 жыл бұрын
Better than any youtuber out here ❤️
@lorindaheadley9335
@lorindaheadley9335 3 жыл бұрын
Yes
@dalesalazar3831
@dalesalazar3831 3 жыл бұрын
AMAZING AHMAD !
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
YOU ARE DALE. !
@williamchristmas6581
@williamchristmas6581 3 жыл бұрын
Superb.. thnk you Sir :)
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
So nice of you
@janehessel4047
@janehessel4047 3 жыл бұрын
incredible! thank you
@alexaoberbrunner3307
@alexaoberbrunner3307 3 жыл бұрын
Nice explanation, thanks for sharing
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Thanks for watching!
@francescanicolas7780
@francescanicolas7780 3 жыл бұрын
Love the part about making money from mathematical Convex Optimization.
@judygeorge5739
@judygeorge5739 3 жыл бұрын
Very nicely explained. Great !!!!
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Glad you liked it!
@johnmatthews8639
@johnmatthews8639 3 жыл бұрын
Thanks for the video.
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
You bet
@brookscruickshank6367
@brookscruickshank6367 3 жыл бұрын
2:04 relative price changes are ratio of current period vs previous one ?
@georgekrug4594
@georgekrug4594 3 жыл бұрын
Your content is freaking awesome
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
I am happy that you find it awesome
@williammitchell4660
@williammitchell4660 3 жыл бұрын
great teacher really helped, thanks
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Glad it helped!
@shawnglover5150
@shawnglover5150 3 жыл бұрын
Great presentation skills.
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Thanks for watching
@karimlamine8774
@karimlamine8774 Жыл бұрын
thank you so much for this clear explanation
@gurkanoyunda6419
@gurkanoyunda6419 3 жыл бұрын
You are a genius. Thank you sir.
@tylergardner4781
@tylergardner4781 3 жыл бұрын
VERY GOOD explanation...
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Glad it was helpful!
@donnaratke3627
@donnaratke3627 3 жыл бұрын
it was very helpful. Thanks a lot!
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Glad to hear that!
@leonardvigil6892
@leonardvigil6892 3 жыл бұрын
29:52 Sir, is the bounds necessary because it not part of the optimization problem.
@susanpichardo5177
@susanpichardo5177 3 жыл бұрын
This video is very clear!
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Glad you think so!
@freelancer8917
@freelancer8917 3 жыл бұрын
Интересно, спасибо за видео)
@christran9448
@christran9448 3 жыл бұрын
Great lecture from UCLA USA
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Thanks and welcome. Pleasure it is !
@kattiedeckow8966
@kattiedeckow8966 3 жыл бұрын
29:21 Wow, never knew we could model the cost function as a python function
@michelleezell4755
@michelleezell4755 3 жыл бұрын
A solver using 7 lines of python code at 37:22 got me going nuts ! How did you do that Ahmad !?
@teresamiller1918
@teresamiller1918 3 жыл бұрын
awesome quality useful content
@leventpehlivanoglu5187
@leventpehlivanoglu5187 3 жыл бұрын
2:33 How is minimum accepted return an input to the problem ?
@leonchao7692
@leonchao7692 3 жыл бұрын
Great lecture, well done! I do have a question, for the Lagrangian function, with only a handful stocks, it suggests negative weights. Is there a way to set a constraint for long only approach? Appreciated much.
@beketyermek6853
@beketyermek6853 10 ай бұрын
Hi! I have also faced the same problem. Were you able to fix it?
@michaelbeamon8757
@michaelbeamon8757 3 жыл бұрын
Brilliant explanation
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Glad you think so!
@meraklkardesler8047
@meraklkardesler8047 3 жыл бұрын
The Efficient Frontier takes a portfolio of investments and optimizes the expected return in regards to the risk. That is to find the optimal return for a risk.
@grettahicks4118
@grettahicks4118 3 жыл бұрын
Gem of a lecture thank you
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Glad you think so, Gretta ! I'm very happy for you
@kenyafadel6142
@kenyafadel6142 3 жыл бұрын
great! please upload more videos about portfolio theory
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
More to come!
@reyeshyatt8329
@reyeshyatt8329 3 жыл бұрын
YEAH, QUARANTINE VIDSSSSSS 2021 !!
@charlesross5898
@charlesross5898 3 жыл бұрын
Wow! It should have been atleast 3 hours. Tuned me in like a netflix show.
@kaylahreichert2927
@kaylahreichert2927 3 жыл бұрын
Excellent professor!!!!!!!
@Faruk.00
@Faruk.00 3 жыл бұрын
As investopedia points out, it assumes that asset returns follow a normal distribution, but in reality returns can be more the 3 standard deviations away. Also, the theory builds upon that investors are rational in their investment, which is by most considered a flawed assumption, as more factors play into the investments.
@janiyarenner5349
@janiyarenner5349 3 жыл бұрын
Thanks a-lot sir I really do appreciate your help with this video
@bellarose1442
@bellarose1442 3 жыл бұрын
Well done boss. 💪🏻
@delphakihn9314
@delphakihn9314 3 жыл бұрын
love your videos! keep it up:)
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Thank you! Will do!
@leobates5395
@leobates5395 3 жыл бұрын
Thanks a lot...it was really helpful :)
@erdem_demirbas
@erdem_demirbas 3 жыл бұрын
The Markowitz Portfolio Theory is no other than a combination of assets, i.e. a portfolio, is referred to as "efficient" if it has the best possible expected level of return for its level of risk usually proxied by the standard deviation of the portfolio's return
@colemanjerde2040
@colemanjerde2040 3 жыл бұрын
Nice handwriting I see it has improved compared to your last tutorials.
@aishahoura2619
@aishahoura2619 3 жыл бұрын
agreed
@alperenbuyuk4837
@alperenbuyuk4837 3 жыл бұрын
I always thought of Markowitz efficient frontier as a parabola where the optimal values lie along the upper half of the parabola line. Anyways, the Efficient Frontier gives you a way to balance your portfolio.
@edwardstorey5525
@edwardstorey5525 3 жыл бұрын
15:01 How its scalar a, b and c ?
@francescamistry2039
@francescamistry2039 3 жыл бұрын
Very clear, thank you so much :-)
@emmaconway5842
@emmaconway5842 3 жыл бұрын
Well done 👍🏻
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Thanks for the visit
@venuspapineau2719
@venuspapineau2719 3 жыл бұрын
2:54 How come 1^T w = 1 is the same as sum of all wi ?
@evefrancis848
@evefrancis848 3 жыл бұрын
23:39 Can we use google API ?
@emremrn1907
@emremrn1907 3 жыл бұрын
The Markowitz solution can easily find highly leveraged portfolios (large long positions in a subset of investable assets financed by large short positions in another subset of assets)
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Nice way of putting it
@kawabiker2655
@kawabiker2655 3 жыл бұрын
fantastic video !
@OyunAten
@OyunAten 3 жыл бұрын
Hi Ahmad. Just one question, if we get w = [0.2, 0.3, 0.4, 0.1], does that mean we have 20% in the first stock, 30% in the second, 40% in the third, and 10% in the final stock. It all sums up to 100% ? Thank you for awesome lecture.
@muhabbetkusutv7979
@muhabbetkusutv7979 3 жыл бұрын
A portfolio that gives maximum return for a given risk, or minimum risk for given return is an efficient portfolio. Thus, portfolios are selected as follows:(a) From the portfolios that have the same return, the investor will prefer the portfolio with lower risk, and (b) From the portfolios that have the same risk level, an investor will prefer the portfolio with higher rate of return.
@doganirmak320
@doganirmak320 3 жыл бұрын
Thanks Ahmad !
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
Anytime Dogan !
@rebaziemann3526
@rebaziemann3526 3 жыл бұрын
Now I think I’d like to see a video on Gold’s role in “Deleveraging”
@louisemcleod458
@louisemcleod458 3 жыл бұрын
awesome tutorial....
@elizabethspencer9829
@elizabethspencer9829 3 жыл бұрын
Pretty awesome world we live in: I can learn all this for free.
@mathieuadebowale9754
@mathieuadebowale9754 2 жыл бұрын
How do you work out the optimization problem using Langrange?
@brookegardner5836
@brookegardner5836 3 жыл бұрын
Portfolios that cluster to the right of the efficient frontier are also sub-optimal, because they have a higher level of risk for the defined rate of return
@fatihbugraozcan7556
@fatihbugraozcan7556 3 жыл бұрын
How to determine the optimal asset weights for a risky portfolio and how to allocate a portfolio between the optimal risky portfolio and the risk-free asset ?
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
It is the w vector derived and implemented in the video.
@leoburns7197
@leoburns7197 3 жыл бұрын
I coded one myself, but for mutual funds. This would help if you extended this functionality for that cause.
@AhmadBazzi
@AhmadBazzi 3 жыл бұрын
It could definitely be extended and applied to hedge fund analysis.
@OneSong0
@OneSong0 3 жыл бұрын
Please help with this problem I have homework An investor wants to put together a portfolio consisting of up to 5 stocks. Using the Markowitz method, what is the best combination of stocks to minimize risk for a given return? In this model, we calculate stock returns, the variance of each stock, and the covariances between stocks, using the Excel functions AVERAGE, VARP and COVAR.
@seromen5228
@seromen5228 3 жыл бұрын
Altyazılar için teşekkürler
@zaquew5002
@zaquew5002 3 жыл бұрын
@Mallie Bayes, yes increasing
@lagendgamer0942
@lagendgamer0942 3 жыл бұрын
You are an Econ God 🇻🇦
@aishahoura2619
@aishahoura2619 3 жыл бұрын
yes
@chrisnilles6019
@chrisnilles6019 3 жыл бұрын
Subscribed 👍🏽
@aishahoura2619
@aishahoura2619 3 жыл бұрын
Me long time ago
@cozmatitradulf7012
@cozmatitradulf7012 3 жыл бұрын
Al Khawarizmi re-incarnated !
Python monitors my plants via Tuya Python IoT
48:45
Ahmad Bazzi
Рет қаралды 77 М.
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 16 МЛН
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН
Stock Market Analysis with Pandas Python Programming | Python # 6
55:02
The Most Important Algorithm in Machine Learning
40:08
Artem Kirsanov
Рет қаралды 543 М.
Wavelets: a mathematical microscope
34:29
Artem Kirsanov
Рет қаралды 654 М.
Visualizing transformers and attention | Talk for TNG Big Tech Day '24
57:45
Asking The Uncomfortable Questions About Vaccines | Dr. Paul Offit
1:33:34
But what is a convolution?
23:01
3Blue1Brown
Рет қаралды 2,8 МЛН
Sliding Window Technique - Algorithmic Mental Models
36:45
Ryan Schachte
Рет қаралды 366 М.
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН