No video

Stock Forecasting with GARCH : Stock Trading Basics

  Рет қаралды 70,536

ritvikmath

ritvikmath

4 жыл бұрын

How do you use the GARCH model in time series to forecast the volatility of a stock?
Code used in this video:
github.com/ritvikmath/Time-Se...
Theory of GARCH video:
• GARCH Model : Time Ser...
Coding in GARCH video:
• Coding the GARCH Model...

Пікірлер: 68
@MildlyAmusingComedyC
@MildlyAmusingComedyC 4 жыл бұрын
By far the best time series related videos available on KZbin! Keep it up!
@cristipopescu1638
@cristipopescu1638 3 жыл бұрын
So clearly explained. Thanks a lot for your work, it really helped me understading the GARCH model!
@ritvikmath
@ritvikmath 3 жыл бұрын
Glad it helped!
@gabriellaurin2717
@gabriellaurin2717 4 жыл бұрын
Once again, another great video !
@taskmaster8869
@taskmaster8869 2 жыл бұрын
Great video mate. I appreciate your work.
@user-fm8ru3cy5w
@user-fm8ru3cy5w 4 жыл бұрын
SUBSCRIBED !! The best python + time series model !!
@spytheman
@spytheman 3 жыл бұрын
Did some testing using GME, using ARCH(2,0): Prior to the WSB army, 1) if we incorporate the whole data from same start date as ritvik to 2021 Jan 13th when we first witness the spike, the volatility prediction for the next 7days predict that volatility should move lower subsequently. 2)training from same start date to any dates after that, it always predict volatility to be lower the next 7 days! Thats why stock market is so tough ...
@Art_Blue_Liberalism
@Art_Blue_Liberalism Ай бұрын
Very precisely explained material. Thanks!
@ritvikmath
@ritvikmath Ай бұрын
You are welcome!
@MusicMonster26000
@MusicMonster26000 4 жыл бұрын
This is pure gold! Awesome video. Could you show us EWMA volatility in a similar fashion through pandas too and the determination of Lambda?
@yourswimpal
@yourswimpal 3 жыл бұрын
for ritvikmath, i click like before even watching the entire video cause I know it will be good. (prediction using ARCH on average like percentage :p )
@paul-edou
@paul-edou 4 жыл бұрын
Great content, as always. My grain of salt: it would be more relevant to plot the forecast vs actual volatility rather than vs return
@olivermohr417
@olivermohr417 3 жыл бұрын
But you don't have the actual volatility
@sgpleasure
@sgpleasure 3 жыл бұрын
Why not? One can calculate, in this example, the $DIS daily volatility from the daily stock price.
@AlexHendershot
@AlexHendershot 2 жыл бұрын
Maybe he doesn’t want to overfit? I had the same thoughts as you
@frenchmarty7446
@frenchmarty7446 2 жыл бұрын
@@olivermohr417 Yes you do. What do you think the model is being trained against? Simply take the absolute difference between Xt and Xt-1
@walterreuther1779
@walterreuther1779 2 жыл бұрын
Might help to put into the maths-equasion: Actual volatility is sqrt(Var(r)) Var(r) = E((r-E(r))²) = E(r²) - E(r)² If we assume E(r)²=0 (which is a valid assumption, as expected returns must be very small, otherwise it's a money mashiene (or drain)), so we have volatility = sqrt(E(r²)), so very similar to the absolute returns which is deducable from what he is plotting. (If I'm not mistaken :P)
@dinhnguyenvo3040
@dinhnguyenvo3040 3 жыл бұрын
Dear Ritvikmath, I am grateful for your work, I have learned a lot. Thank you so much. Can you do a ARMA-GARCH model with stock forecasting?
@droga333
@droga333 4 жыл бұрын
I'd like to see the difference between the predicted vol and the actual vol. Also, the orange line is always lagging in making predictions, so I don't know why would it be useful for. Anyway, interesting. I don't know shit about coding, but I know about how the markets behave.
@mogli546
@mogli546 4 жыл бұрын
This was great and very simple to understand...!!! Could you please explain the TBATs model as well the same way
@pulkitnijhawan653
@pulkitnijhawan653 4 жыл бұрын
Thanks bro..can you please make more videos on stock markets.....pls......pls......pls
@yanzhouzhu7753
@yanzhouzhu7753 3 жыл бұрын
Many thanks!!!
@ritvikmath
@ritvikmath 3 жыл бұрын
You're welcome!
@Asparuh.Emilov
@Asparuh.Emilov 2 жыл бұрын
Thank you for the great content! Is it possible to add the volatility effect to a simple seasonal model so that the seasonality might jump stronger based on that forecast?
@ManmeetKaur-xv3mh
@ManmeetKaur-xv3mh 3 жыл бұрын
You are simply great, Please make more videos on stock market course.
@ritvikmath
@ritvikmath 3 жыл бұрын
Thanks!
@69nukeee
@69nukeee 7 ай бұрын
Awesome, awesome tutorial, thanks for taking the time to do it and sharing! One quick question though: if I understand correctly, ARCH/GARCH basically are used to predict volatility (which is variance - in the financial case the 'squared returns') but we are actually using the returns (being the daily percentage change in stock prices) as data to feed the ARCH/GARCH models. Is this correct? Thank you again!
@fernandosuzuki9905
@fernandosuzuki9905 4 жыл бұрын
Hey, I really appreciate your work and your channel is amazing. Regarding the volatility predicted by the model, how can I backtest these values to confirm the reliability?
@user-fu7hh3rl3p
@user-fu7hh3rl3p 3 жыл бұрын
Great Video! And simple to understand! I have some questions of measuring performance of your garch model, why did you plot with return, not with real volatility of data? And can I apply RMSE for prediction of volatility and real volatility as performance measure?
@jary1350
@jary1350 2 жыл бұрын
Thank you for the content. Best video I have seen on the topic. Does anyone know why 31 and 32 when trying to pick and fit model, that is operated on entire set NOT a training set instead to avoid look ahead bias? So if you hide the last 100 data point from fitting, I got a different model. Would love to see some comments on R2 value, and how that is used all in comparison of other models/ stocks?
@lucareichelt7338
@lucareichelt7338 4 жыл бұрын
Currently trying to use this for a time-varying beta, but having problems
@Raven-bi3xn
@Raven-bi3xn 3 жыл бұрын
In your arch video, you said that you'd try to fit the best model you can and fit arch/garch with the residual. So, what not using ARMA model here first and then apply garch to the residual?
@Le_MarcoPolo
@Le_MarcoPolo 3 жыл бұрын
I read a paper that indicated that we could estimate the Beta of the Capm could be estimated thanks to garch . But I do not see at all the link between the Capm and the garch model
@palashsrivastava7711
@palashsrivastava7711 4 жыл бұрын
@ritvikmath Can I additionally use other stock prices (of different companies) to forecast for Disney's stock prices and simultaneously capture the spill-over effect? If yes, how do I go about it?
@LeO96Aq
@LeO96Aq 3 жыл бұрын
Great video! i´ve got two questions, can I use GARCH + SARIMA to predict the whole time series? and the other one in my fit, only beta7 and alfa 7 are relevant, can I drop the others?
@tombic6373
@tombic6373 4 жыл бұрын
If you recall, did you use adjusted close values to calculate returns from 2jan2015-9jun2020? Thanks. I ask because I was unable to replicate your pac for returns.
@user-wx9dv5uu4h
@user-wx9dv5uu4h 4 жыл бұрын
Great video! Could you please clarify what is the time frame the volatility prediction is expressed in? If it is daily then based on the plot for the first time period is between 2.5% and 5%. What is the best way in your opinion to annualize the values? Also, do you know what is the syntax for an EGARCH(1,1) model so I can adjust the below line? "model = arch_model(returns, p=1, q=1)" Thanks!
@kishorkukreja7733
@kishorkukreja7733 2 жыл бұрын
Hello Ritvik, Great content. Loved how in simple words you explained GARCH. A question here, I did understand that the orange line is the volatility and not the prediction of returns . How do we get the predictions then from here ? Would it be okay to say, model an ARIMA model and then for a GARCH on the same model. Extract the volatility as you showed and sum them to ARIMA predictions ? Thanks !!
@adityakadrekar1196
@adityakadrekar1196 2 жыл бұрын
Hey Ritvik, thanks for posting this video. I have some questions: 1. Why are you using the pacf plot of the 'square of returns' and not just the returns? 2. From my understanding, PACF plots help you understand the Auto regressive term which is p in this case. How do you determine the lag of the volatility (q)? I am not sure to follow why did you take q as 3 after plotting the PACF chart.
@TheSambita20
@TheSambita20 Жыл бұрын
I would also like to know the answer of this second question if anyone can help.
@hardbass_crew_hauptschule8236
@hardbass_crew_hauptschule8236 Жыл бұрын
at 4:40 you say that the predicted volatiry gets higher exactly when the returns get more jumpy. But to me it looks like the line is really just following the blue line and lagging behind, which seems to indicate overfitting. How do we know this prediction is any good?
@LimeObeans
@LimeObeans 3 жыл бұрын
u r doing the www a great service
@stephenhobbs948
@stephenhobbs948 7 ай бұрын
The graph of the code in the video at 6:56 shows plots for June 13 and June 14, 2020. Both of those days are weekends. Your code does not take weekends into consideration and probably not holidays, either.
@daiane_2310
@daiane_2310 3 жыл бұрын
Hi from Brazil, I want to analysis volatility of stocks and add accounting variables as independent variables… garch/Midas seems to be perfect to this… have you ever used this in R or eviews?
@traderdescomplicado3167
@traderdescomplicado3167 4 жыл бұрын
Hi Ritvikmath, please could you tell me wich model is best fit for the ticker ^BVSP between 2020,1,1 and 2020,8,10? I couldn't find any good model observing the PACF, maybe I missed something in your video as I not native in english. Thank you
@zollen123
@zollen123 3 жыл бұрын
May I ask why would we want to predict a stock volatility instead of the stock price? Using ARCH would mean I have to mathematically reverse the predicted volatility to get back the predicted price?
@jow43
@jow43 4 жыл бұрын
Did you have any issue installing the arch package? I'm able to install it with no problem, but I always get a Value Error when I try to use the package.
@yourswimpal
@yourswimpal 3 жыл бұрын
@ritvikmath can i check if my ARC and PARC test of lag 1 is highly negatively correlated, can i throw away ARCH/GARCH model straightaway ?
@drakecody3129
@drakecody3129 3 жыл бұрын
I'm curious to know why you did not use the pyflux library? Do you think your approach is better?
@Smarttradingchannel
@Smarttradingchannel Жыл бұрын
Like all models of this type, the predictions values are always delayed, so when you look at the big picture that seems good, but to predict value for tomorrow that will not be correct at all
@abhirajmandal9782
@abhirajmandal9782 2 ай бұрын
hello hi ,how did u find the value of q in GARCH model,from the pacf plot i understand it to be an ARCH (3 ) model ,but how did u say that its a GARCH(3,3) model, could u have used an ARCH(3,0) model
@hyunpang8267
@hyunpang8267 Жыл бұрын
Hi anyone know how he determine how to transform the return to compare against volatility? on the part where there is a *5
@sahanasarkar5562
@sahanasarkar5562 2 жыл бұрын
Hi ! How do I go back to forecasting the price after forecasting the volatility ? Coz my end objective is to forecast the price. Can anyone please answer.
@bryan-9742
@bryan-9742 Жыл бұрын
interesting in the prediction you don't elect to try and fit with changing the dist='StudentsT'. The distribution of a random variable should be completed before one applies forecasted volatility no? (Like how do you know that this distribution is normal? My understanding is that the KDE approach is useful for pinning down the distribution/easier to do than max liklihood for a stock series.). Your thoughts would be greatly appreciated. My original sentiment is that many stocks have a student T distribution for their 'regular' and log returns.
@mohammadrezanargesi2439
@mohammadrezanargesi2439 Жыл бұрын
Hi Can you please explain how we can plot the actual index as well? I know volatility in fact is an estimate for STD of the changes and using this std we may have two boundaries for positive movements and negative movements. For example price is 100$ And GARCH predictions are around 2 percent for the next three days Then we would have two boundaries, one above, around 102$ and the other around 98$ for the next three days. I kindly ask for this plot to see how well the predictions did in practice. I would appreciate if you explain how wd can transform these volatility to actual index values.
@castro_hassler
@castro_hassler 3 жыл бұрын
So in this case, is it a good idea to forecast with some model (lets say a linear regression) the returns and then forecast the volatility over regression residuals using a GARCH model, add the two forecasts to get the actual prediction?
@castro_hassler
@castro_hassler 3 жыл бұрын
I have another question, if I do what I proposed in the question above, should I be worry about the negative peaks? for example if I am forecasting value at risk, I want to be more certain about the volatility in the lower band, so how do I forecast it?
@castro_hassler
@castro_hassler 3 жыл бұрын
Multiply the serie by -1 ? and the go back to the original form? sorry if the question is dumb
@vidithshetty544
@vidithshetty544 3 ай бұрын
Which site can I use to backtest a trading strategy ? Im also trying to implement a strategy with a stocks open close and higher and lower wicks but am unable to find numbers in specific time frames ( for eg: weekly or monthly ) could you help me with the above two queries ?
@hiteshrajbongshi6752
@hiteshrajbongshi6752 10 ай бұрын
Sir, imagine there is a billboard which reflects a random 2 digit numbers everyday at 12pm. If i have last 2 years everyday data. Which model will be effective to predict the number for upcoming days? Kindly reply.
@luizscheuer670
@luizscheuer670 3 жыл бұрын
Is the ACF useful for identifying anything for your GARCH model? Or only the PACF to find out the order of the model?
@Le_MarcoPolo
@Le_MarcoPolo 3 жыл бұрын
ACF = detect the order of the auto regressive process, PACF = detect the order of the MA process
@orkhanamrullayev3966
@orkhanamrullayev3966 2 жыл бұрын
@@Le_MarcoPolo isn't it vice verse? @ritvikmath
@christosck
@christosck Жыл бұрын
Hi there, I am trying to use your example to create a 12 Hour forward forecast. Novice with python, so having a hard time converting these lines of code: future_dates = [returns.index[-1] + timedelta(days=i) for i in range(1,8)] pred = pd.Series(np.sqrt(pred.variance.values[-1,:]), index=future_dates) fyi, i have 499 prior hourly periods of real data. thanks for great content !
@christosck
@christosck Жыл бұрын
pred = model_fit.forecast(horizon=12) future_hours = [returns.index[-1] + timedelta(hours=i) for i in range(1,13)] pred = pd.Series(np.sqrt(pred.variance.values[-1,:]), index=future_hours) this is what i have, but get unsupported operand type error
@minhtan7491
@minhtan7491 2 жыл бұрын
How can use the multivariate GARCH with Python, sir?
@ironjax3369
@ironjax3369 Жыл бұрын
3:52 "horizon = 1" and the volatility follows the returns... It does not predict anything, it juste reacts to what just happened
@gordong9596
@gordong9596 3 жыл бұрын
Hmm so you are using past data to predict past trend, seems a bit off
I Bought $500 of Stocks Using Graph Theory and the Sharpe Ratio
20:07
Time Series Talk : ARCH Model
10:29
ritvikmath
Рет қаралды 140 М.
Schoolboy - Часть 2
00:12
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 4,9 МЛН
Mama vs Son vs Daddy 😭🤣
00:13
DADDYSON SHOW
Рет қаралды 50 МЛН
Викторина от МАМЫ 🆘 | WICSUR #shorts
00:58
Бискас
Рет қаралды 5 МЛН
Predict The Stock Market With Machine Learning And Python
35:55
Dataquest
Рет қаралды 659 М.
1. Modeling & Analysis of Apple Stock Prices in R | GARCH Models
8:59
Dr. Bharatendra Rai
Рет қаралды 24 М.
Time Series Forecasting with Facebook Prophet and Python in 20 Minutes
19:19
Predicting Stock Prices and Making $$$ Using the ARMA Model
9:57
I Used Data Science to Buy the Dip
19:32
ritvikmath
Рет қаралды 8 М.
What are ARCH & GARCH Models
5:10
Aric LaBarr
Рет қаралды 36 М.
Time Series Forecasting with XGBoost - Advanced Methods
22:02
Rob Mulla
Рет қаралды 117 М.
181 - Multivariate time series forecasting using LSTM
22:40
DigitalSreeni
Рет қаралды 273 М.
GARCH Model : Time Series Talk
10:25
ritvikmath
Рет қаралды 155 М.
Schoolboy - Часть 2
00:12
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 4,9 МЛН