No video

I Bought $500 of Stocks using Data Science. This is What Happened.

  Рет қаралды 9,937

ritvikmath

ritvikmath

Күн бұрын

Пікірлер: 73
@mightywurlitzer
@mightywurlitzer Жыл бұрын
4:44 "So a couple things, in some sense, have gone wrong..." Welcome to quantitative finance.
@ritvikmath
@ritvikmath Жыл бұрын
😂
@arontapai5586
@arontapai5586 Жыл бұрын
A stochastic volatility model would be very useful to predict the range of the stock returns hence the potential losses and wins for possible exits. Also, a good thing would be to check the option implied volatilites of the stocks as it represents the market consensus way better than realized historical volatilites. Usually the market works like this; the derivatives are moving the underlying prices and not the other way around. I mean you may kinda predict the log returns based on historical data but I cannot see this working fully as the random walk process of the stock return is a markov process. The best you can do is go with what people, hedge funds are thinking and either trade with them or try to beat them. Seems an unfair game to be honest.
@arontapai5586
@arontapai5586 Жыл бұрын
What also came to my mind, it might be worth to model the stylized facts that so many people had written about in these markets. Asymmetry, skew, liquidity, earnings, divident yield etc. But then again this doesn't mean it is going to work nor that the stylized facts hold up anymore. (See Farmer's, Cont's work on this for example). I am cheering for you guys to find something that actually works, but then again if u may find something I don't see why you should publish it here :D
@Septumsempra8818
@Septumsempra8818 Жыл бұрын
I think we should add a correlation filter. Use something like Dynamic Conditional Correlation to estimate the t+1 correlation. Also might wanna see for correlation at extreme highs and lows. P.S. can't wait for the Bayes stuff
@ritvikmath
@ritvikmath Жыл бұрын
Great suggestions and I can’t wait to try the Bayes stuff !
@mightywurlitzer
@mightywurlitzer Жыл бұрын
I would suggest spending some time on coming up with an improved performance metric. As you saw very clearly, the portfolio rises and falls along with the broader market, and what you really care about is if your strategy outperforms the best baseline strategy, which is buy-and-hold the S&P. Keep in mind that each stock will perform by some multiple of the S&P (beta), so you have to take this into account as well. Scattering the returns of the stock versus the S&P should give you a rough idea of beta (slope) and alpha (excess returns, y-intercept). Also, your tendency towards Bayesian is a good instinct, since pretty much you'll eventually just be manipulating various distributions. No guarantee that an approach will generate alpha, but it's just much easier to think of a stock as a distribution.
@ritvikmath
@ritvikmath Жыл бұрын
Thanks so much for the input!
@94sl
@94sl Жыл бұрын
I always suspected that this kind of technial analysis and tracking some graphs could never work in any reliable way beyond a very short time period. Just did a course on these topics at the uni and I cannot say other than I felt it was just learning for the sake of learning with no tangible value in most of this stuff. Nonetheless, thanks to this channel I passed, so studying for studying's sake is how we roll!
@ritvikmath
@ritvikmath Жыл бұрын
Congrats on passing!
@alg0rithm1
@alg0rithm1 Жыл бұрын
This isn't technical analysis
@junal27
@junal27 2 ай бұрын
Excellent video and content, thank you. I am not a trader nor a financial person but the training window size vs. the holding window size may be part of the problem unless the choosen entry time would be an outlier by chance. The holding size may play a huge role in certain market dinamics with periods of revovery much greater than the chose holding window time. When market goes down correlations tend to one and in many cases do revert to positive from negative in calm situation. Best
@hawksportsent3630
@hawksportsent3630 Жыл бұрын
I've tried using partial autocorrelations for moving average and volatility. It's worked pretty well for predicting log returns. That also might be a cool idea. Applying a transformation on the TS. Just some ideas lmk what you think.
@ritvikmath
@ritvikmath Жыл бұрын
Awesome ideas! Will keep in mind for next iterations
@robharwood3538
@robharwood3538 Жыл бұрын
Just looking at the initial results, my mind immediately yelled, "Regression toward the mean!" Is it possible that by picking the 'best' (most extreme) performers in the 'training period', you were *actually* just selecting those with the most extreme random/noise deviation *above* their own means? Thus, as soon as you go outside the 'selection window', most of them were virtually *bound* to revert towards their (lower) true means. It seems to say to me: "He had a training period, but where's his test/validation period???" I think if you ran *exactly* the same experiment many times, you would end up losing money for *most* of those experiments, perhaps even regardless of what the market overall did.
@ritvikmath
@ritvikmath Жыл бұрын
Love this take on it. Indeed one big missing piece was to actually run backtesting with this strategy to see a distribution of what we would expect. Something to include for next time!
@jasdeepsinghgrover2470
@jasdeepsinghgrover2470 Жыл бұрын
Overall markets don't have mean reversion otherwise they wouldn't show growth over very long periods.
@robharwood3538
@robharwood3538 Жыл бұрын
@@jasdeepsinghgrover2470 Well, this wasn't a very long period, though. Just a short period of 'training' then just one week investment. A lot of volatility in there, IMO.
@jasdeepsinghgrover2470
@jasdeepsinghgrover2470 Жыл бұрын
@@robharwood3538 I don't think the argument still holds. Mean reversion is an expectation in a process which has some underlying phenomenon explained by the mean and then followed by noise component. But the price of anything is not having a clear underlying phenomenon even in the short term even though many people use mean-reverting Brownian motions to explain it. Will the price of any crypto asset revert to the mean? If so then what is the mean? I am much more agnostic about the predictability of future prices compared to others.
@MrEo89
@MrEo89 Жыл бұрын
IMHO if only using a few weeks of data, the resolution should be min by min for the training set. Then the testing set should also be minute resolution for maybe a day ahead in time. There are far too many variables to consider from close-to-close over weeks at a time to be of any real use to anyone.
@softerseltzer
@softerseltzer Жыл бұрын
Plot twist: the viewers shorted the stocks using information from the last video!
@ritvikmath
@ritvikmath Жыл бұрын
😂
@Sheblah1
@Sheblah1 Жыл бұрын
It's possible. Maybe a second pair of before-and-after investments is worth investigating but this time maybe keep us all in the dark about which stocks were picked until the next weekly reveal?
@durchnet
@durchnet Жыл бұрын
You should try metalabelling on this model(maybe also make a video on it for your viewers) so you have a baseline model running on the back telling you if you should buy or sell or take that trade depending on your model. Additionally you change the grain of your timeseries so you better data output. Or else it’s always garbage in garbage out. Thankyou for the content you put out there
@ritvikmath
@ritvikmath Жыл бұрын
Great suggestion thank you !
@patrickhollick4095
@patrickhollick4095 Жыл бұрын
I would be interested in seeing if the sharpe ratio is correlated from period to period. I dont know finance that well yet (but I am trying to learn) so that might be a dumb question. From my understanding it is a description of performance but not necessarily a predictive one. In baseball if someone had a good batting avg we would think they are a good hitter but batting avg is not a good metric for assessing future performance so by looking at that wrong conclusions could easily be drawn. It would be better to look at more granular measurements of performance to predict future results like plate discipline and exit velocity. What would the parallel be for the stock market, if there is one? Additionally it would be nice to see strategies tested on more periods with cross validation so results are less likely to be thrown off by one strange period of time. Great vid and looking forward to more in the series!
@peterk6215
@peterk6215 Жыл бұрын
So looking forward to the rest of this series!
@ritvikmath
@ritvikmath Жыл бұрын
Looking forward to making more !
@MyMy-tv7fd
@MyMy-tv7fd Жыл бұрын
looks like everything correlated due to a large market event - Fed meeting, interest rates hike, etc.
@ritvikmath
@ritvikmath Жыл бұрын
Very likely. And something to be aware of for next time
@vanshr.sachan264
@vanshr.sachan264 Жыл бұрын
How would the model do if we somehow incorporate ARMA processes into this? We could also add stop losses at some threshold so that we don't lose a lot of money (Also I've been learning about time series analysis from your channel and it has helped me a lot so thanks a bunch!)
@ritvikmath
@ritvikmath Жыл бұрын
Awesome suggestions! There’s a good chance we do a future experiment using ARMA family models!
@axscs1178
@axscs1178 Жыл бұрын
Better use an LSTM neural network, it's proven to beat traditional time series models
@pretendcampus5410
@pretendcampus5410 Жыл бұрын
@@axscs1178"it's proven to beat..." Could you suggest some reading in on this? Just learning but your statement is very interesting and would love to read more :)
@MrThePixelCraft
@MrThePixelCraft Жыл бұрын
Very interesting series ! I’m not good at all in stocks but maybe by estimating a VAR model could be useful for this topic
@ritvikmath
@ritvikmath Жыл бұрын
Great suggestion!
@cornagojar
@cornagojar Жыл бұрын
Hi, I am not big expert, but in general you want to rank your portfolio (buying/selling the stocks that overperformed/underperformed, or the other way around). In general you want to avoid to go long on so many correlated stocks, and keeping a portfolio with a very high variance. Stocks on the same exchange are always correlated, especially during market crashes Also, as some expert said in the past, your edge is not in the model, the model is used express the edge.
@ritvikmath
@ritvikmath Жыл бұрын
That’s a lot of good points. Some of the considered stocks were also those representing other countries or certain industries and in the future an even more diverse set of tickers should be considered
@cornagojar
@cornagojar Жыл бұрын
​@@ritvikmath I have a few suggestions, if you are interested: - if you point if to create a portfolio of uncorrelated instruments, you might want to include non-stock instruments like bonds, commodities and currencies. Stocks only long portfolios will also collapse altogher during market crashes - In general, portfolio aims to reach highest sharpe ratio including at least 20 uncorrelated assets (I think that alone increases the SR by 3 or 4, check online). So, you might want to put more stocks I guess. - your strategy looks like a trend-following long-only (or do you also short the stocks?). You should probably compare it with a default naive method, like a simple moving average crossover. What is the point of doing tough modelling when a brainless strategy outperforms you? - Also, you might want to backtest over a long period and prove that your strategy beats a long-only investment on the SPY Good work! I have been beating my head on similar problems for years, it is always nice to see somebody working on similar problems
@gravious
@gravious Жыл бұрын
looking forward to more in this series :)
@ritvikmath
@ritvikmath Жыл бұрын
More to come!
@e555t66
@e555t66 Жыл бұрын
I don't have money to pay him so leaving a comment instead for the algo. He is the best.
@johnsorensen4696
@johnsorensen4696 11 ай бұрын
There is nothing inherently wrong with the model (yes it could be more sophisticated in countless ways), but you just need to evaluate it for more than a week. The signal to noise ratio in finance is so low that a week of testing is all but meaningless. Equities just went down overall and there's nothing you or your model could have done.
@josepeeterson6681
@josepeeterson6681 Жыл бұрын
Hey Ritvik, your videos are absolutely fantastic. Succinct, yet packed with content. I totally love it. Please keep it up!! 1) Firstly, why not use virtual money (some platforms call it paper trading) where you can do this exact analysis without the risk. 2) Should not the holding period be the same as the training period to be fair to the model (stock picking analysis)? 3) should you consider any (mini) seasonal market cycles so that the training and holding period cycles are synchronized? This is just my belief. I don't know if these cycles even exist.
@alg0rithm1
@alg0rithm1 Жыл бұрын
Unless you're hedged, 1 week's return is meaningless. The best you can do is benchmark against the S&P. And it's a known phenomena that when the market tanks, that stocks sell off indiscriminately (i.e. correlations convert to 1) and volatility expands.
@ismamalhoque6850
@ismamalhoque6850 Жыл бұрын
Is there a playlist on market related series like stock picks for this channel?
@alvinjamur1
@alvinjamur1 11 ай бұрын
look at calmar ratio as edges of graph….
@muuubiee
@muuubiee Жыл бұрын
You should compare to market trend as well. Going negative is not so bad if the market overall is going negative too, but going negative when the market is going positive overall then it's pretty bad.
@ritvikmath
@ritvikmath Жыл бұрын
Very true 👍
@bin4ry_d3struct0r
@bin4ry_d3struct0r Жыл бұрын
In a nutshell, data science and machine learning are all about math-based pattern recognition, are they not? So, big picture question: if past performance of a stock is not indicative of future performance, is it at all useful to attempt to build AI/ML models using past data to predict future performance?
@ritvikmath
@ritvikmath Жыл бұрын
That’s a great big picture question. I think with the simplicity of this first method we’re not quite ready to say no machine learning model can do a better job but in general we know even the top ml models do have a tough time with this problem
@Justin-General
@Justin-General Жыл бұрын
So if data science doesn't help you, then back to TA? (I.e. throwing darts at a chart?)
@ritvikmath
@ritvikmath Жыл бұрын
I think in this instance we found lots of gaps in the method. And the time frame was too short to say anything conclusive about this method in general. So next time we’ll try and use a method that addresses these issues and see if we can do better!
@yuhaoding1778
@yuhaoding1778 Жыл бұрын
Could you share the codes, thank you very much!
@alvinjamur1
@alvinjamur1 11 ай бұрын
also….no pearson corr. spearman….
@MarkGlissmann
@MarkGlissmann Жыл бұрын
What was the code you used to make the charts interactive?
@ritvikmath
@ritvikmath Жыл бұрын
It’s a python library called plotly
@bharathgopalakrishnan3739
@bharathgopalakrishnan3739 Жыл бұрын
Just to clarify, training period indicates the training data while the holding period indicates the predicted one or is it the testing data ?
@ritvikmath
@ritvikmath Жыл бұрын
So training period is training data which we used to identify historical patterns and decide which stocks to buy. And holding period was the actual time between buying and selling stocks during this experiment. Sorry if the terminology is confusing!
@bharathgopalakrishnan3739
@bharathgopalakrishnan3739 Жыл бұрын
@@ritvikmath hey, no need to be sorry.. I was just trying to understand. Also, just to clarify those spikes are predicted accurately in the model as compared to the real life data ?
@josepeeterson6681
@josepeeterson6681 Жыл бұрын
@@bharathgopalakrishnan3739 there is no model here. He just did a stock picking analysis (which you can call a "model") based on some good behavior of those stocks and expected a similar behavior to replay in the holding period. But that did not happen.
@bharathgopalakrishnan3739
@bharathgopalakrishnan3739 Жыл бұрын
@@josepeeterson6681 thanks
@wjrasmussen666
@wjrasmussen666 Жыл бұрын
The stock market AI is watching what you are doing and adjusting.
@ritvikmath
@ritvikmath Жыл бұрын
You know … maybe
@realcirno1750
@realcirno1750 Жыл бұрын
do you think it would have worked better than this if you held e.g. for a month or two
@ritvikmath
@ritvikmath Жыл бұрын
Very well could have! And the holding period is something we will vary in future videos
@axscs1178
@axscs1178 Жыл бұрын
Holding period was so short, considering the length of your training period
@ritvikmath
@ritvikmath Жыл бұрын
True!
I Day Traded $500 of Stocks using the ARMA Model
18:29
ritvikmath
Рет қаралды 10 М.
I Bought $500 of Stocks Using Graph Theory and the Sharpe Ratio
20:07
娜美这是在浪费食物 #路飞#海贼王
00:20
路飞与唐舞桐
Рет қаралды 3,9 МЛН
7 Days Stranded In A Cave
17:59
MrBeast
Рет қаралды 95 МЛН
I Day Traded $500 of Stocks using ARMA .. This is What Happened
23:14
I Used Data Science to Buy the Dip
19:32
ritvikmath
Рет қаралды 8 М.
This is why Deep Learning is really weird.
2:06:38
Machine Learning Street Talk
Рет қаралды 383 М.
Candlestick Patterns : Stock Trading Basics
10:28
ritvikmath
Рет қаралды 6 М.
娜美这是在浪费食物 #路飞#海贼王
00:20
路飞与唐舞桐
Рет қаралды 3,9 МЛН