Predicting Stock Prices and Making $$$ Using the ARMA Model

  Рет қаралды 58,390

ritvikmath

ritvikmath

3 жыл бұрын

Can we use the ARMA model in time series to make $$$ trading stocks?
Link to Code : github.com/ritvikmath/KZfaq...
My Patreon : www.patreon.com/user?u=49277905

Пікірлер: 83
@user-wc7em8kf9d
@user-wc7em8kf9d 3 жыл бұрын
Who votes for this has the coolest video on trading with python? I definitely do.
@MlleNnCo
@MlleNnCo 3 жыл бұрын
Really appreciate your effort to teach/demystify all these models! And always going straight to the point. Keep them coming 🙏
@ResilientFighter
@ResilientFighter 3 жыл бұрын
Great job ritvik! Always a pleasure to watch your videos
@gracehui237
@gracehui237 11 ай бұрын
I was playing around with arima for weeks and never got any progress. Thank you so much for this. It's really important and thankful to have a guide along the way!!
@Thahid
@Thahid 2 жыл бұрын
Very insightful! Especially the part about overfitting. Definitely something I might’ve overlooked.
@HenningPhysics
@HenningPhysics 3 жыл бұрын
Amazing Video! I sometimes play with ARMA models and stock prices to see how it works and indeed after some dense exploratory data analysis oen could combine some "features" in the decision making which increases a lot a the result!! Super cool man, if you could do that more of these videos would be amazin!
@spytheman
@spytheman 3 жыл бұрын
As usual great video! Really love your explanation and passion in these!
@ritvikmath
@ritvikmath 3 жыл бұрын
Glad you like them!
@RoahanRoy
@RoahanRoy Жыл бұрын
Started watching these videos for my Financial Econometrics exam, now hooked on to the practicality of it. Thanks a lot!!!
@ritvikmath
@ritvikmath Жыл бұрын
Great to hear!
@vulcan0eric
@vulcan0eric 2 жыл бұрын
Hitting the like button wasn't enough... awesome video! thanks!
@simomoforever
@simomoforever 2 жыл бұрын
Well planned and presented!!
@nishadseeraj7034
@nishadseeraj7034 3 жыл бұрын
you're a great teacher man! really appreciate all the material
@ritvikmath
@ritvikmath 3 жыл бұрын
I appreciate the kind words!
@joysun53
@joysun53 2 жыл бұрын
This is really interesting! Instructive but also practical. Love it! In addition, I'm learning time series analysis and is confused about how to determine the orders for ARMA model❓ The way I am doing it now is just trying out different combinations of the orders, with no idea what I am doing. Hope there is a video explaining it
@AZOZTheFake
@AZOZTheFake 6 ай бұрын
Thanks for this informed video.
@khalmouhajir8888
@khalmouhajir8888 10 ай бұрын
Great and concise video. Trying to implement a similar model using a non-parametric Garch Model.
@arunstartupgur
@arunstartupgur 2 жыл бұрын
Very nice and concise implementation. I will implement in my trading
@prathameshdinkar2966
@prathameshdinkar2966 2 жыл бұрын
Nice work!
@user-or7ji5hv8y
@user-or7ji5hv8y 3 жыл бұрын
this was a really interesting video. can you do more applied videos, as a recommendation.
@happykutty
@happykutty 3 жыл бұрын
Nice, in my senior project we used ARIMA and Prophet to predict stock and bond prices.
@AssMass13
@AssMass13 3 жыл бұрын
Did you make some profits?)
@ResilientFighter
@ResilientFighter 3 жыл бұрын
Curious to hear if successful
@loluser124
@loluser124 3 жыл бұрын
pls say something bart senpai
@Darth_Cassius_
@Darth_Cassius_ 4 ай бұрын
Amazing video, I will start with ARMA model but I want my main model to be NN model, can not wait to start losing money
@mama2e99
@mama2e99 3 жыл бұрын
Nice Video, It was very clear. I was wondering, have you tried to run a simulation with only a MA(5) model ?
@mohamedelhilaltekouk902
@mohamedelhilaltekouk902 Жыл бұрын
really appreciate thanks a lot
@kamil7165
@kamil7165 2 жыл бұрын
Great video! I have just 1 remark. The language of selected language of autogenerated subtitles is selected incorrectly. It is really helpful for people that learn English using youtube videos and sometimes don't hear exactly your words.
@hpix123
@hpix123 3 жыл бұрын
Nice video! Is the model doing well partly because we're backtesting it on the same set we ran the acf plot on? Presumably you'd have to split your data to estimate its performance out of sample?
@benjaminhorvath2078
@benjaminhorvath2078 Жыл бұрын
You are 100% correct, this video demonstrates the process, it does not prove a simple ARMA will get you 10% return
@gioragazzi3763
@gioragazzi3763 3 жыл бұрын
You are the GOAT
@lucasdanielalvesdeoliveira9521
@lucasdanielalvesdeoliveira9521 3 жыл бұрын
Could you explain Hierarchical Risk Parity in a video and give an example pls? Congratulations for the great job
@nathannoetic5348
@nathannoetic5348 Жыл бұрын
hi thanks for the explanation in this great video.. by the way is it possible to combine volume change (stationary data) besides price variable? so that it will be multivariete i hope you could make another video about it..
@Spijy369
@Spijy369 3 жыл бұрын
Awesome! Is there any particular reason why you take the data after the 14th period? 00:31
@desmondlai5714
@desmondlai5714 3 жыл бұрын
May worth looking at not only long the stock but also short it
@jiachengli9061
@jiachengli9061 3 жыл бұрын
Just curious, why don't you check the model fitting before you applying ARMA(5,5). It's also possible that the model doesn't fit well. And it seems that you use the same model to predict all the coming values, I always wondering if it's more reasonable to update the data when time goes and use the updated model to predict the nearest data point. But that would be not efficient as using the same model.
@banaiviktor6634
@banaiviktor6634 Жыл бұрын
Thanks your super videos, I am a real fan of all :). I saw in many videos that we produce returns so as to have stationary data. I think in this case we get a white noise which has no autocorrelation (I checked it with Durbin -Watson test getting around 2) and no use for predicting. Can you help if it is true, or if I am wrong?
@arasafaryan73
@arasafaryan73 8 ай бұрын
Very interesting, good job! However, do you always have to buy and sell every day? Did you also try it for different time periods? If so, how did it go?
@VadimChes
@VadimChes 3 жыл бұрын
As example it's fine, but not for real trading, which has spread between best buy and best sell price, commissions for deals and impossibility to get strict open market price and close price. I spent much time to find something stable method to trade - Q-learn, random forest, ARIMA, cointegration, simple moving averages and their combinations... But it seems that trading is more about risk control, when you simultaneously have several positions, each of specific size depending on volatility and correlation between stock in your portfolio. But now I look at fundamental data like companies financial reports and P/E and so on... The less trading the better results as for me ) I think high frquency trading is something possible to earn with models of order book behaviour, but you need huge amounts of money to get profit (making thousands deals every day with minimal profit each one) and build trading architecture like computers near exchenge and super optimized, well tested code.
@kylehammerberg3875
@kylehammerberg3875 2 жыл бұрын
any tips for adding a sharpe ratio to the output of the simulations?
@k2icc
@k2icc 2 жыл бұрын
Very nice and tested fine. Windows 11, latest Python version.
@sanjaisrao484
@sanjaisrao484 3 ай бұрын
Thanks
@chougaghil
@chougaghil 2 ай бұрын
To compare the performance of the models you can check the information criterias (bic, Aic) of each model, select the lowest, check the noise level, check the normality of the distribution, p- value of each coefficient, plot the predicted values against real ones, use Error metrics, try arima to integrate the original time serie...some basic stuff I learnt during my DS training I wonder why you didn't do it, or simply suggest it to keep your video short Nevertheless, it was a nice introduction for complete beginners in the field
@chougaghil
@chougaghil 2 ай бұрын
Just saw you made many videos on time series. You probably mentioned the model selection methods in on of them. I keep watching
@GohOnLeeds
@GohOnLeeds 7 ай бұрын
You know in this model you picked a down trend right i.e. a bear market? It's very difficult for any buying scheme to work in a down market :-) My guess is that the ar(5) model happened to work because it bought less often than the other models. When you buy less, the variance is much greater and you happened to get lucky on the days you bought. Run the same ar(5) on a different stock and it will likely lose in a bear market as well. Which brings me to one big issue. When choosing historical data points, it's obvious you get to choose whether you were in a bull or bear or trending market. If you had happened to choose a bull market, then all of these models would have likely made money. So the key to stock trading is not so much the model, it's when you put your money in :-) Peace
@fosheimdet
@fosheimdet 19 күн бұрын
Did you do training-test split on the data?
@adityaagrawal4632
@adityaagrawal4632 Жыл бұрын
what is indicated by the width of the green and red bars in the graphs
@MrAzrai99
@MrAzrai99 Жыл бұрын
Can I know how this code helps forecasting the stock? It seems like it is used to analyzed the past stock instead. Sorry for my insufficient knowledge in advance.
@user-or7ji5hv8y
@user-or7ji5hv8y 3 жыл бұрын
How can you have a 1,000 runs if we only have the luxury to observed one realization of apple stock time series?
@junechu9701
@junechu9701 Жыл бұрын
Thanks so much for the video!!! I just come across a problem when running the code. When the type of order is tuple, the graphs plotted always show that return=0 and there is no red or green window in the graph. However, when I change the order type to float or change "pred>thresh" in simulation part to "pred
@mohamedelkheir
@mohamedelkheir Жыл бұрын
I have the same issue
@ansylpinto2301
@ansylpinto2301 Жыл бұрын
Can we fit ARMA to non stationary data though?
@qiguosun129
@qiguosun129 2 жыл бұрын
Cool!
@zsomborveres-lakos
@zsomborveres-lakos 24 күн бұрын
nice
@farbodba
@farbodba 3 жыл бұрын
Stock prices follow geometric browning motion process. Btw, just because you have poor returns does not mean you had a "bad" model. Bad in what context? Making money, or bad in terms of your residual not being normally distributed and having p values of your ARIMA above 0.05? P.S I like your chanel and the scientific content you produced previously such as those ARIMA model videos you have mentioned in the video, but I feel videos like this is just a way to get more views for the chanel and catch audience attention. Anyway, I wish you all luck beating the market and if you did, make a proposal to join Renaissance Technologies or compete with them.
@danieldaniel-ri2mu
@danieldaniel-ri2mu 3 жыл бұрын
What’s threshold
@sborkes
@sborkes 3 жыл бұрын
Hey @ritvikmath, where can I download the notebook?
@ritvikmath
@ritvikmath 3 жыл бұрын
Linked now!
@Cmoney572
@Cmoney572 3 жыл бұрын
If you take the ln of prices does that sorta kinda represent growth?
@jiachengli9061
@jiachengli9061 3 жыл бұрын
It might help the stationarity assumption of the data, but it also increases the difficulty when you try to interpret the final model.
@TheViportsPYN
@TheViportsPYN 2 жыл бұрын
Why aren't you considering the first lags of ACF and PACF?
@user-oz3lm2ky5x
@user-oz3lm2ky5x 3 жыл бұрын
in forex trading ARIMA/GARCH does not work, becouse all ACF and PACF samples, excluding zero lag, is equal to zero
@riosaputra2979
@riosaputra2979 2 жыл бұрын
Hi thanks for the explanation, However, I have a question, what does it mean AR(5)? Does it mean, if the predicted returns is bigger than the threshold then we will buy the stock the next day and sell it on the following next 5 days?
@brtwva11
@brtwva11 2 жыл бұрын
AR(5) indicates an autoregressive model with 5 lags.
@LJ-ph4hg
@LJ-ph4hg 3 жыл бұрын
Nice! Collab link?
@ritvikmath
@ritvikmath 3 жыл бұрын
Linked now!
@qiguosun129
@qiguosun129 2 жыл бұрын
In my understanding, ARMA and AR are both built upon linear transformations, right? So why don't we apply some non-linear tech on it to achieve super cool performance such as RNN, LSTM, ATTENTION-LSTM... So the question is whats differences between DL methods and time series models?
@ritvikmath
@ritvikmath 2 жыл бұрын
Great question. Also good timing. I'm planning some videos on exactly this topic soon.
@sashacooper9326
@sashacooper9326 8 ай бұрын
I know this isn't the point of the video, I'm confused about why the random model would have reliably performed so badly. Was this a period where the entire stock market was in decline? Otherwise it seems like if you did this on average, and didn't account for transaction fees (which it looks like you don't), your return would tend to be slightly positive (since the stock market usually goes up over time). Also wouldn't a simpler baseline be 'for each of the N stocks in our list, put 1/N of our cash into it on day one, then sell them all on the last day'?
@nicolaiovergaardlarsen2214
@nicolaiovergaardlarsen2214 2 жыл бұрын
I absolutely love your videos on time series, but in these plots you really put in a tripwire for the colorblind. Those nuances of red and green are impossible for me to distinguish.
@ritvikmath
@ritvikmath 2 жыл бұрын
Hey I'm sorry about that and I appreciate you pointing that out. I'll be more conscious of color choices in the future. If you happen to have any references on accessible color schemes I'd love to learn, but will also research this myself.
@nicolaiovergaardlarsen2214
@nicolaiovergaardlarsen2214 2 жыл бұрын
​@@ritvikmath I have not done any research about it, but I know that there are color schemes for color blind used in gaming etc. I am sure you can find them at least as good as I could. Thanks again for your awesome work. You are making really complicated topics immensely clear and digestible.
@Thejohnster1012
@Thejohnster1012 2 жыл бұрын
surely overfitting the model here would lead to fantastic returns as you are testing it on the data you used to make the model? Overfitting generally only leads to problems when you go outside the training data no?
@maxfinnian
@maxfinnian 2 жыл бұрын
This should not be the case since for each time step he is fitting an ARIMA on data from day 0 to day (step - 1) in his run_simulation function. This is still not the best practice though as each training set is gradually getting larger from 14 days up to the length of his data set, typically you would want to use a fixed size rolling/sliding window with sufficient length to ensure the time series models fit at each window are receiving the same amount of data which will lead to a more informed comparison of the model parameters. He should also be using a validation time period in which the training window will slide to train each time step of an ARIMA structure. This scheme should be used when optimizing the ARIMA parameters before leading up to a final test of the best ARIMA parameters using an out of sample test set which begins after the last datapoint on the validation window.
@OskarBienko
@OskarBienko Жыл бұрын
You didn't look at p-values tho...
@user-or7ji5hv8y
@user-or7ji5hv8y 3 жыл бұрын
Would it make sense to do the opposite if the ARMA model shows us losing money, given that if we do the opposite, then we should be making money?
@sonsangsom
@sonsangsom 2 жыл бұрын
Transaction fees eat up all of those profit already
@muzamilshah8028
@muzamilshah8028 3 жыл бұрын
Hahahaha
@anupamc3510
@anupamc3510 Ай бұрын
i make more percentage gains using simple technical analysis...this mumbo jumbo is making things only complicated
@thechoosen4240
@thechoosen4240 10 ай бұрын
Good job bro, JESUS IS COMING BACK VERY SOON; WATCH AND PREPARE
@pineapple3832
@pineapple3832 Жыл бұрын
Okay but if you have a working model, by making a video you’ve lost your edge, and if this isn’t legit then why watch. Either way I’m not gaining much from this.
@zollen123
@zollen123 3 жыл бұрын
I am thinking of using scipy.fft() for decomposing the entire stock data and use the base frequencies for the exog of SARIMAX, do you think it would help minimize the mean error?
Time Series Talk : ARIMA Model
9:26
ritvikmath
Рет қаралды 316 М.
Stock Price Prediction Using Python & Machine Learning
49:48
Computer Science
Рет қаралды 1,2 МЛН
Despicable Me Fart Blaster
00:51
_vector_
Рет қаралды 19 МЛН
KINDNESS ALWAYS COME BACK
00:59
dednahype
Рет қаралды 152 МЛН
Predicting Stock Prices in Python
29:14
NeuralNine
Рет қаралды 527 М.
Predict The Stock Market With Machine Learning And Python
35:55
Dataquest
Рет қаралды 649 М.
Time Series Talk : ARMA Model
7:12
ritvikmath
Рет қаралды 160 М.
I Used Data Science to Buy the Dip
19:32
ritvikmath
Рет қаралды 7 М.
AES Explained (Advanced Encryption Standard) - Computerphile
14:14
Computerphile
Рет қаралды 1,2 МЛН
Despicable Me Fart Blaster
00:51
_vector_
Рет қаралды 19 МЛН