Тёмный
Matt Macarty
Matt Macarty
Matt Macarty
Подписаться 28 тыс.
Welcome to my channel where we take complex concepts in statistics, data science analytics and break them down to their essentials. My goal is to help you better understand topics that might at first seem confusing. Examples demonstrate concepts in an applied manner with my tools of choice being Python and Excel, but you will also find tutorials on MySQL, R, minitab and SPSS. Whether you are looking for an explanation of hypothesis testing or want to know how to use tools like matplotlib, you have to come the right place.
Most of the content used in my tutorials is available for download at: alphabench.com/resources.html
Комментарии
@ksriniva
@ksriniva 2 дня назад
A problem with your approach is that stock prices are lognormally distributed. This becomes problematic for stock prices with a starting point closer to the zero bound, particularly if their standard deviation is high. Any thoughts on how to make that adjustment?
@MattMacarty
@MattMacarty День назад
That's true, however by iterating each day you end up the with a log normal distribution x days out. But really the video is meant to demonstrate Monte Carlo techniques, not necessarily the best way to simulate a stock price action. I have several other videos that you may like better for simulating price action. There is an option pricing sim and VaR sim on my channel.
@ksriniva
@ksriniva 22 часа назад
@@MattMacarty Fair enough. I was able to use Gen AI to get the right Excel coding for my task. I had to assume a lognormal distribution because the starting price for the asset I was modeling is close to zero (crypto token).
@bpg9235
@bpg9235 3 дня назад
Possible to get the template ?
@MattMacarty
@MattMacarty 23 часа назад
Yes: alphabench.com/data/excel-npv-irr-tutorial.html
@azar77840
@azar77840 7 дней назад
how we did not forecasting for 1/1/18, this there specific reason for it ?
@MattMacarty
@MattMacarty День назад
Yes. If you forecast 1/1, you will incorporate look ahead bias. Your first 5-period MA forecast will occur at the 6th obsevation.
@TomislavLukic-sl9gx
@TomislavLukic-sl9gx 9 дней назад
In shortest possible time you said all important things. Thanks!
@MattMacarty
@MattMacarty День назад
Glad it helped
@NewClips-yv9rl
@NewClips-yv9rl 12 дней назад
Nicely Explained. I have a question - How can we utilize MAD, MAPE to improve our model ?
@MattMacarty
@MattMacarty День назад
You will would try several different MA periods, say 5, 10, etc. and look for the model that minimizes the error measurements
@nasimaparvin6960
@nasimaparvin6960 13 дней назад
What is population mean?
@MattMacarty
@MattMacarty День назад
It's the average value calculating from the population of whatever you are looking at. I just made it up for this example. In practice, you probably don't know the population mean but would estimate it from a sample measurement
@audreylubis
@audreylubis 17 дней назад
thank you for your explanation! May I know what is the reference for calculating the iteration? (referencing purpose)
@MattMacarty
@MattMacarty 15 дней назад
You mean a reference for the formulation? Value at Risk. Jorion.
@fatmaalnajjar6222
@fatmaalnajjar6222 20 дней назад
lifesaver. this was great thank you
@MattMacarty
@MattMacarty 15 дней назад
Glad it helped!
@niekvogel
@niekvogel 20 дней назад
Hi Matt, thank you for this clear and helpful video! I have 2 questions you can hopefully help me out with: 1. Can you please explain why you use instantaneous returns and not simple daily returns ((p1/p0)-1)? 2. And how would you calculate the annual average returns? I ask because I would like to compare annual average returns and volatility for different portfolios (by changing the weights). Hope to hear from you, thank you!
@MattMacarty
@MattMacarty 15 дней назад
This is typically how finance applications formulate returns. it has the benefit of being summable. The standard percent change over estimates returns. I would use instantaneous for annualized returns too.
@helenamaniero214
@helenamaniero214 27 дней назад
Hey, the link to download the data does not work
@MattMacarty
@MattMacarty 22 часа назад
Sorry it took me so long! Try this: alphabench.com/data/scatter-plot-excel.html
@gabrielbarwick9547
@gabrielbarwick9547 29 дней назад
Hi, great video, for the last one, would you need to add shift() after the mean() so that it doesnt use future data?
@MattMacarty
@MattMacarty 15 дней назад
Glad it helped. I don't thinnk there is any look ahead bias there.
@user-lu5jj8qs3h
@user-lu5jj8qs3h Месяц назад
You could simplify a bit by using monthly returns and basically get the same result.
@MattMacarty
@MattMacarty 26 дней назад
For sure
@pz1430
@pz1430 Месяц назад
Very nicely done.
@MattMacarty
@MattMacarty 26 дней назад
Thank you. Glad it helped
@SRHarkreader
@SRHarkreader Месяц назад
Excellent! Clear verbal instructions with demonstrations of exactly what I needed to know. Thank you!
@MattMacarty
@MattMacarty Месяц назад
Great. Glad it helped
@grandsroisverifiedproperti9286
@grandsroisverifiedproperti9286 Месяц назад
Ho i am implenting a trading application with REST. Stream and Websockets. It supoort live and paper use cases for allpaca users I am stock with the get_account() initialize_api_client since its Ouath 2.0 how do we ensure the api calls are made to ensure the alpaca user information is fetch. Will this be done woith headers annd base_url or access_token and base_url
@yuxuanlin1971
@yuxuanlin1971 Месяц назад
Thank you for sharing Matt! I have one question - It's very cool to generate a Plotly interactive graph from Lumibot. I wanted to dig into the package and find the code that generated the graph but I couldn't find it. Do you know where in Lumibot embedded this function? It'll be so much easier to leverage it on other data visualization projects.
@MattMacarty
@MattMacarty Месяц назад
Sorry. I haven't examined their code. Try holding control key and click on the lumibot class to open the underlying code.
@yuxuanlin1971
@yuxuanlin1971 Месяц назад
@@MattMacartyYea, that's what I did. I was guessing it's in lumibot.strategies but I only found matplotlib library but the graph is generated by plotly. Also, I didn't find where in lumibot is embedded QuantStats neither. Appreciate it if you could help provide some clues.
@kakhatabatadze5106
@kakhatabatadze5106 Месяц назад
Thanks but download link does not work.
@MattMacarty
@MattMacarty Месяц назад
Seems to be working. Can you try again?
@Donxkelo
@Donxkelo Месяц назад
I can’t get the file for the data. I NEED HELP
@MattMacarty
@MattMacarty Месяц назад
Trey cloning the github repository to your computer
@jacquesmieny1705
@jacquesmieny1705 Месяц назад
what is the maximum amount of iterations you can run on Excel for something such as this? I have a project similar but must run about 1 000 000 iterations
@MattMacarty
@MattMacarty Месяц назад
Technically you can do 1,000,000 but I think it will be quite slow.
@jacquesmieny1705
@jacquesmieny1705 Месяц назад
@@MattMacarty thanks!
@lokeshsomu5444
@lokeshsomu5444 2 месяца назад
great job sir👏
@MattMacarty
@MattMacarty Месяц назад
Glad it helped
@monkeyhanger115
@monkeyhanger115 2 месяца назад
For some reason, mine won't work when applying column B3 into the formulae at 2:00
@MattMacarty
@MattMacarty 2 месяца назад
You can download the file I used by following the link in the description
@monkeyhanger115
@monkeyhanger115 2 месяца назад
@@MattMacarty ah okay great thank you
@raphaelbonillo2192
@raphaelbonillo2192 2 месяца назад
This is not a forecast. Where is the extrapolation with the data? You are just drawing the trend
@MattMacarty
@MattMacarty 2 месяца назад
This kind of model will forecast out one period into the future. Most of the work is to fit the model and measure how well it can be expected to forecast.
@ElCidPhysics90
@ElCidPhysics90 2 месяца назад
Thank you for these videos.
@MattMacarty
@MattMacarty 2 месяца назад
Glad it helped
@HisyamHilmiOmar-jx7mx
@HisyamHilmiOmar-jx7mx 2 месяца назад
Hi, great tutorial! Just one quick question, for the value of the moving average, what does 21 stand for, is it the length of the moving average or the actual value of the moving average? Can you elaborate further on how you derived the value of 21 for the moving average?
@MattMacarty
@MattMacarty 2 месяца назад
21 is the number of periods in the moving average. This is the number of trading days in a month.
@vivig7727
@vivig7727 2 месяца назад
Can you elaborate more on why you multiplied the variance of AAPL by 252? I downloaded data for a stock of the past 3 years, what would i do there to adjust the variance? Also multiply by 252? If I do this, is my VaR having the same interpretation as yours?
@MattMacarty
@MattMacarty 2 месяца назад
I calculated the daily variance for one year of data (252 days). To annualize the variance multiply by 252.
@JanWestend
@JanWestend 2 месяца назад
Great video! Can you tell me how to stop the bot/ the run_all function for the Trader? I know there is a function called stop_all, but once I started run_all, it runs forever
@MattMacarty
@MattMacarty 2 месяца назад
You can just stop in the IDE or close the program
@jacobjones4387
@jacobjones4387 2 месяца назад
Really helpfull. Thanks!
@MattMacarty
@MattMacarty 2 месяца назад
Glad it helped
@EricNsi
@EricNsi 3 месяца назад
You sound like the dude from ru-vid.com/show-UCmrLCXSDScliR7q8AxxjvXg
@MattMacarty
@MattMacarty 2 месяца назад
Yeah sort of I guess
@MattMacarty
@MattMacarty 2 месяца назад
But gosh I don't push propaganda do I?
@EricNsi
@EricNsi 2 месяца назад
@@MattMacarty SQL propaganda I guess
@munivoltarc
@munivoltarc 3 месяца назад
Hi, try not to use price, lagging indicators, instead use price action strategy, will give accurate results, can you do this, many viewers are fed-up seeing these price lagging indicators usage in different channels of youtube.
@MattMacarty
@MattMacarty 2 месяца назад
This is for demonstrating how to write a simple back tester, not really interested in a strategy. Any strategy worth anything will not be found on RU-vid.
@kamalkushwah2659
@kamalkushwah2659 3 месяца назад
Thank you so much for this type of detailed video you save me...
@MattMacarty
@MattMacarty 2 месяца назад
Glad it helped
@greenblue980
@greenblue980 3 месяца назад
thanks alot! i forgot about that lightning thing 😂
@MattMacarty
@MattMacarty 2 месяца назад
Glad it helped
@imnitin97
@imnitin97 3 месяца назад
Hi , I have a doubt about the calculation, The covar. Between SPY and SPY should be 1 but why we have such a less number in the calculation
@MattMacarty
@MattMacarty 2 месяца назад
The COVAR of SPY vs SPY is the variance
@possessedbear651
@possessedbear651 3 месяца назад
i get an error now saying endpoint in my config file is deprecated and should be replaced with "PAPER"... however... then it wont run the program
@MattMacarty
@MattMacarty 2 месяца назад
It looks like the lumibot package has been updated since making the video. Check their documentation
@gaurav2979
@gaurav2979 3 месяца назад
Thanks for sharing Man, keep up the good work
@MattMacarty
@MattMacarty 2 месяца назад
Thanks. Glad it helped
@adindahumairah1511
@adindahumairah1511 3 месяца назад
Thank youuu
@MattMacarty
@MattMacarty 3 месяца назад
Glad it helped
@BrianGarside
@BrianGarside 3 месяца назад
Helpful, but take too long to make a point like when creating a foreign key.
@MattMacarty
@MattMacarty 3 месяца назад
OK
@gustavorosas-dev
@gustavorosas-dev 3 месяца назад
Thank you so muuuuch!
@MattMacarty
@MattMacarty 3 месяца назад
Glad it helped
@zoeorlich5445
@zoeorlich5445 3 месяца назад
Was so frustrated trying to remember what I did in excel for a certain problem in my finance class and this helped me so much thank you!!!
@MattMacarty
@MattMacarty 3 месяца назад
Glad it helped
@vyetundebello810
@vyetundebello810 3 месяца назад
This is the most explainative and concise MYSQL, thanks so much, really appreciate and will definitely follow u all the way.🙏🏽
@MattMacarty
@MattMacarty 3 месяца назад
Glad it helped
@mdawg998
@mdawg998 3 месяца назад
I'm new to coding. I straight up cannot figure out how to get Lumibot available for this program. I went to terminal. Did the pip install. Now what? I cannot find out to actually include it.
@MattMacarty
@MattMacarty 3 месяца назад
You can follow the link in the description to get the code. You just need to import lumibot in your code
@gtrdotone3735
@gtrdotone3735 3 месяца назад
@ 11:27 should the square of cell I5 equal to cell D5 since SPY to SPY is variance of SPY? Square of .3204=.1017 which is not what is shown in cell D5!!!
@MattMacarty
@MattMacarty 3 месяца назад
These are daily values and need to get adjusted to annualize ( x 252)
@jameskydd459
@jameskydd459 3 месяца назад
Hi Matt, thanks for the really useful tutorial, wondered if you are able to add a variable to this calculations if you invest an extra amount each month? i would assume to use an average of the month beg or month end price, or just by picking month end or month beginning. if you have a video on that already or a way to add it to the model this would be great.
@MattMacarty
@MattMacarty 3 месяца назад
Thanks. Yes you can do it that way , or just add money at the end of each month where you have a data point that is closer to where you can buy. Just remember these models are approximations.
@chentomerify
@chentomerify 3 месяца назад
hey matt!, loved the video! i have trouble installing pip lumibot. it says there is something wrong with the package itself(not pip). is it possible that lumibot isnt working with my python version (3.12.12)? thank you!
@MattMacarty
@MattMacarty 3 месяца назад
My guess is it is one of the dependencies such as pandas that is causing the problem. You likely havea newer version of pandas than is supported by lumibot. You can try downgrading to something like 1.5 and see if that solves the probelm. ALso you can contact lumiwealth and they will get you going.
@dikshamatia1962
@dikshamatia1962 3 месяца назад
Is it possible to do it on google sheets?
@MattMacarty
@MattMacarty 3 месяца назад
I don't think there is an extension that does this in Sheets
@robbiefelts6895
@robbiefelts6895 3 месяца назад
12 Years later and still helps, Thanks.
@MattMacarty
@MattMacarty 3 месяца назад
Yeah, this stuff doesn't really change, just the interface looks a little different
@AleksOMFG
@AleksOMFG 4 месяца назад
I can't get the data ( TypeError: string indices must be integers, not 'str' ) I tryied the override of yfinance but it doesn't work neither.
@MattMacarty
@MattMacarty 4 месяца назад
Try using yfinance directly: yf.download(...)
@AleksOMFG
@AleksOMFG 4 месяца назад
@@MattMacarty Just finished doing a program with tkinker with it thank you, Im new in coding. 😂 Great tutorial keep it up!!!
@mrityunjaypathak8792
@mrityunjaypathak8792 4 месяца назад
You saved my time. Was looking for this for my project ! Thank you Matt.
@MattMacarty
@MattMacarty 4 месяца назад
Glad it helped.
@hackerborabora7212
@hackerborabora7212 4 месяца назад
I just find this channel waw you are amazing put more videos
@MattMacarty
@MattMacarty 4 месяца назад
Glad it helped
@LeonardoZ-wq8vr
@LeonardoZ-wq8vr 4 месяца назад
Can someone explain what's the difference between Buy/Hold (blue line) and System line (orange one) at 14:31?
@MattMacarty
@MattMacarty 4 месяца назад
So the blue line shows what would happen if you bought in 2016 and just held gold without any adjustments. The orange line is what would have happened if you tried to catch the swings in prices based on a simple moving average.
@zirusgaming3245
@zirusgaming3245 4 месяца назад
I am using a mac and for some reason the tools to create the relationship is not there. How do I get the tools on the left hand side. Thank you
@MattMacarty
@MattMacarty 4 месяца назад
I think the tools are just not super obvious in MAC. They should run down left edge of the diagram window.