Thank the KZbin algorithm for finding you, and thank you for giving us this gold for free
@MattMacarty15 сағат бұрын
Glad it helped. I have a number of other algo trading videos you might like.
@kannansingaraveluКүн бұрын
How does the option backtesting work in PandasDataBacktesting? Can you do a video on how such backtesting can be done on custom option data?
@MattMacartyКүн бұрын
The difference there is you have to get the data ahead of time from some API and store in CSV then read into a DataFrame.
@daddy34093 күн бұрын
😢
@mali42825 күн бұрын
Thank you Matt!
@MattMacarty4 күн бұрын
Glad it helped
@jacksongod02265 күн бұрын
Thanks for the video, if we can only see the log_message on live testing , how would we test the code itself outside the stock time ? personally I would only doing this during night or weekend time that seems have no way to test this ..?
@MattMacarty4 күн бұрын
You use the back testing functionality to both evaluate the strategy and whether what you think is happening is actually happening. I usually write some test code independently of lumibot to test the logic, and then make it work with lumibot.
@Berghiker6 күн бұрын
Are you using backtrader with Alpaca?
@MattMacarty4 күн бұрын
It's Quantstats
@Berghiker6 күн бұрын
Do you have specific python code for making a chart with the timeline at the bottom and the price scale to the right with mouse scroll up/down to change the height of the candles? I also want the horizontal line at the bottom to connect at the bottom right corner to the vertical price line and stay like that even when I use the mouse scroll. Sometimes chatGPT doesnt always understand exactly what I want. Can you help?
@MattMacarty4 күн бұрын
I do not, but this sounds like a job for plotly and NumPy finance
@compeng20136 күн бұрын
I built something similar from scratch and currently back testing n and paper trading. Have you deployed yours live yet in production with real time data? What’s your source for data? Currently using yfinance until I decide it’s time to use something real time
@MattMacarty4 күн бұрын
No, I don't have this running live. For realtime data, you likely will have to pay a vendor. Lumibot integrates directly with polygon (polygon.io)
@erhan41237 күн бұрын
If $10,000 was invested on January 1 2020 with this strategy, it would be worth $16,546 as of December 31, 2024, representing a cumulative return of 65.46%. Over the same period, the SPDR S&P 500 ETF Trust would be worth $19,653, representing a cumulative return of 96.53%.
@MattMacarty4 күн бұрын
Sure, but a couple things to keep in mind. 1. The purpose of this video is to show you how to optimize; 2. Having an optimally allocated portfolio based on past metrics won't guarantee some market beating return; 3. Finance professors have been telling us for years "you can't beat the market"
@erhan41234 күн бұрын
@@MattMacarty It's just fun to watch from KZbin after 5 years with all the data available. Thanks for the video, btw.
@markcolumbretis5111 күн бұрын
Hi. is the api_key acquired on the website? Or you can create it on your own?
@MattMacarty10 күн бұрын
You need to get the API key from EOD. You can signup for a free accounta and then see your API key on the profile page.
@floofxfloof16 күн бұрын
I NEEDED THIS THANK YOU!
@MattMacarty15 күн бұрын
Glad it helped
@JDARRASVP17 күн бұрын
Very nice vidéo ! Thanks Your voice is perfect to learn !
@JDARRASVP17 күн бұрын
But I'm sorry, I'm watching your playlist and I don't see video about to update a row ! Did you do that ?
@MattMacarty16 күн бұрын
Thank you. Glad it helped.
@MattMacarty16 күн бұрын
I don't think I did cover update. The general syntax is: UPDATE [table_name] SET [column_name] = [new_value] WHERE [condition list];
@Shinare73Ай бұрын
Thank you for this.
@MattMacartyАй бұрын
Glad it helped
@Naz-yi9bsАй бұрын
too bad they don't have greek data for free tier, maybe it's a big ask 😢, thanks for video
@MattMacartyАй бұрын
Glad it helped. You can likely write a script to calculate and add Greeks to your data frame. Hmmm maybe I will do a video.
@marycortez9455Ай бұрын
blurry
@MattMacartyАй бұрын
Try switching your preference to HD
@BuomJanguanMiyoangАй бұрын
Good explanation
@MattMacartyАй бұрын
Glad it helped
@heeteeshadevibaulah9117Ай бұрын
Interesting video really helped me a lot, but I did not understand the volatility formula used for the portfolio. what is the purpose of using indirect formula?
@MattMacartyАй бұрын
The indirect function returns a cell reference rather than a value in the cell. I used it in conjunction with named ranges to facilitate calculating the variances. If I hadn't I have have ended writing the same formula multiple times.
@claudiotomasvaldespinuer4588Ай бұрын
excelent video pal, pls keep doing this kind of videos. The black and litterman model should be amazing if u can do it . regards from chile
@MattMacartyАй бұрын
Thanks, glad it helped. Let me see what I can do.
@HamdiFrehАй бұрын
WHAT DOUBLE MEAN ?
@MattMacartyАй бұрын
DOUBLE refers to a 64-bit floating decimal precision number
@bhavasindhuАй бұрын
very clear and most useful video!! thanks Matt
@MattMacartyАй бұрын
Glad it helped
@rabidlenny7221Ай бұрын
0:57 okay so what program am I looking at right now? I’m really confused. It be very helpful if you had a video on just how to get to this point
@MattMacartyАй бұрын
That is output from Quantstats. Here's the quantstats stand alone: kzbin.info/www/bejne/nIWQZIluqZVkeqc
@MattMacartyАй бұрын
Oops, I think that was the wrong link: kzbin.info/www/bejne/jKuoY6GMaJ6Wh8k
@rabidlenny7221Ай бұрын
@@MattMacarty thanks Matt! I will check it out in a few!
@piphunterАй бұрын
Thank you for taking the time to do these videos. As someone learning python to automate my trading, it's motivating.
@MattMacartyАй бұрын
Glad it helped.
@SquashmalioАй бұрын
8:40 why is he using 2 'where' calls here? Isn't it the exact equivalent of using only one line, with 1 and -1 being the 2nd and 3rd parameters respectively? THe first line he's using here sents the signal value to 1 when the 9day is greater than the 21day, and 0 if that is not true. The 2nd line sets it to -1 when the 9day is LESS than the 21day, and sets it to whatever it previously was(1) if not. Basically, the first line is setting 1 when 9day is greater and 0 when it's less. Then the 2nd line is going through again and setting the value to -1 when it's less, and keeping it the same when it's greater. But if the 3rd argument in the first line was -1 instead of 0, then it'd accomplish the same thing in a single line.
@MattMacartyАй бұрын
I don't want to keep buying or selling when a condition is met, I want to buy (or sell) and then wait for the next signal. It is also possible to be flat as well as long or short. You can download the code and try it to get a better look.
@joeryder5739Ай бұрын
Thank you Matt.
@MattMacartyАй бұрын
Glad it helped
@shadorainАй бұрын
Hey Matt thank you for this video! I have been playing around with lumibot and its been really enjoyable. Would you do a video integrating it with indicators using TA lib or something similar? and maybe some more advanced data handling with pandas and the like? I think that would go a long ways and set you further than alot of other channels. You already are ahead of the game! God bless you man!
@MattMacartyАй бұрын
Thanks. Yes I am working on a simple MA crossover that uses pandas data handling to generate a signal. It won't use TALib but it should generalize
@shadorainАй бұрын
@@MattMacarty Wow man!! That sounds perfect! Can't wait for that to come out! Thanks so much, God bless :D
Thank you, this is the quickest way of using Excel to calculate volatility of a portfolio of stocks.
@MattMacarty2 ай бұрын
Glad it helped
@pghimire2 ай бұрын
Great video Matt! Do you have a video (or resource) for how you are analyzing / viewing the backtesting reports?
@MattMacarty2 ай бұрын
You mean something that talks about the metrics generated? No I don't have anything like that. I think there are a few metrics that are widely used to evaluate or compare strategies at a high level. Sharpe and Max Drawdown are probably the most common.
@pranithreddy2 ай бұрын
I have to do this in c++ any tips to start please.I should be able to see all the real time data as well
@MattMacarty2 ай бұрын
I think Alpaca may have some documentation to help you
@waltere.poquioma3251Ай бұрын
Out of curiosity why are you using C++? Is it algo trading for an institution or you are trying to squeeze for time
@pranithreddyАй бұрын
@@waltere.poquioma3251 Its not related to this. Actually I wanted to try my own.I thought to reduce the latency while trading .So using c++ is a good option.
@batteriesincluded71882 ай бұрын
Remove your API keys from the video.
@MattMacarty2 ай бұрын
Thanks those API keys are no longer valid.
@elsxmpo2 ай бұрын
hey matt, great video. i was just wondering if you had a tutorial somewhere on how to generate summary statistics for the stock prices of different companies?
@MattMacarty2 ай бұрын
You mean a single stock at a time or what did you have in mind?
@elsxmpo2 ай бұрын
@MattMacarty it's for a university coursework project, just creating general summary statistics (e.g. mean, volatility, median ect.) prior to doing more in-depth analysis and trading strategies on the stocks, either for a single stock at a time or multiple at once would both be ok
@MattMacarty2 ай бұрын
@@elsxmpo This is more than you need but should do the trick: kzbin.info/www/bejne/hpzdh4htgNGcmZIsi=b5NeAWbaXL_Yy-KT
@dominikrebej12602 ай бұрын
great video thanks
@MattMacarty2 ай бұрын
Glad it ehlped
@Barry-dy3mn2 ай бұрын
Matt, you made installation a doddle. Thanks for the beginner friendly walk through.
@MattMacarty2 ай бұрын
Glad it helped
@laixdy98192 ай бұрын
I just started looking for info like this and this video pop out, amazing content! :D
@MattMacarty2 ай бұрын
Thanks. Glad it helped
@bryanruiz96732 ай бұрын
I am new to Python programming. Watching your vids motivates me. What advice would you give to a newbie?
@MattMacarty2 ай бұрын
Thanks. It's a bit of a journey, but I think I would at least do an online introductory Python course from a reputable source. If you want to go the book route I would suggest "Python Crash Course".
@bryanruiz96732 ай бұрын
@@MattMacarty Thanks!
@james91642 ай бұрын
Good to see you back Matt, only found your stuff a few months ago but have really found it helpful!
@MattMacarty2 ай бұрын
Glad it helped
@calebeldredge9252 ай бұрын
Been following you for a while, really enjoy your content. Tell me, do you think it's possible for a retail trader to create algo's that beat the market consistently? I enjoy coding them up as a hobby, but am curious if it would be possible to uncover alpha if taken seriously.
@james91642 ай бұрын
Yes, but. the but being that you will probably have to do it in murky/constrained/new markets where the big boys have trouble operating or getting access. Think the small cap shorting craze a few years ago and on-chain crypto, for example.
@MattMacarty2 ай бұрын
I mean it's not easy and it's likely if you find something that works, it will need constant monitoring and revision. I guess you only need need to "win" more than 50% of the time and minimize the size of your losses. The question always becomes is my effort worth it? In other words do I beat buy and hold?
@BrennanVest2 ай бұрын
I’m going to upload a video here soon but I started learning machine learning like rentech to have my algorithms adjust a bit better than manual analysis. However it’s extremely hard to beat buy&hold consistently. To Matt’s point you’ll need to constantly backtest and re adjust accordingly. Right now my algo is at 62% win rate so I’ll take it but it’s also conservative. What I’m doing now is more complex and I had to buy a second computer just to compute everything I needed.
@k.chriscaldwell41412 ай бұрын
Superb. Thanks.
@MattMacarty2 ай бұрын
Thank you. Glad it helped
@edujones46342 ай бұрын
nice presentation
@MattMacarty2 ай бұрын
Glad it helped
@DSizykh2 ай бұрын
Thanks a lot, code is clean and good.
@MattMacarty2 ай бұрын
Thanks. Gald it helped
@neuvocastezero18382 ай бұрын
Thanks for the vid, there's apparently a lot of ways to do this, I've been watching some channels that implement "cast" methods and "json" interpretation, but they're giving me errors. This method is more straightforward and reliable. For some reason, "agg.close, agg.open...etc" wasn't working, but "day.close, day.open..." did.
@MattMacarty2 ай бұрын
Glad it helped. Yes, "day" was what I used for for loop index variable name. So each agg in aggs is day in the loop.
@SpaceForceCooks2 ай бұрын
Do you create an individual account or entity account?
@MattMacarty2 ай бұрын
Individual
@ankitpradeep342 ай бұрын
Thank you for putting so much effort into this
@MattMacarty2 ай бұрын
Glad it helped
@AlexOsorio-x3l2 ай бұрын
2024, still a great video. Thanks!
@MattMacarty2 ай бұрын
Glad it helped. Only the interface has changed.
@k.chriscaldwell41412 ай бұрын
Thank you.
@MattMacarty2 ай бұрын
Glad it helped
@murraylamb44803 ай бұрын
Hello when you do the Var calculation you say confidence level but you click on stress event ? is that correct ?
@MattMacarty3 ай бұрын
So they are related. I am saying a 99% CI represents a 2.33 st dev move away from the mean.
@murraylamb44803 ай бұрын
hey mate great vid. question if you have lets say 5 years worth of data instead of x 252 would it then be 1260 ? as i have to anylise data over 5 years
@MattMacarty3 ай бұрын
So you could still multiply by 252 to get one year approximation, but I probably would just use one year of data instead.
@debo40643 ай бұрын
can you make course on algorithm trading
@MattMacarty3 ай бұрын
Yes I will being putting some algo trading videos out.
@Josh-ov7td3 ай бұрын
Im a bit confused on why the look ahead was profitable but the shifting forward 1 day to catch the close was not profitable. Is shifting forward different then a cross over of the 10 and 22 for this example?
@MattMacarty3 ай бұрын
Sure you can try that. I think what we are basically seeing is that the entry and exit are critical in this strategy. Remember it's just for demonstration purposes