No video

I Day Traded $1000 Using Reinforcement Learning and Bayesian Statistics

  Рет қаралды 8,557

ritvikmath

ritvikmath

Күн бұрын

Пікірлер: 25
@steveetches6013
@steveetches6013 10 ай бұрын
I don't think what you are doing here is a reinforcement learning process, it is just a Bayesian approach that you are updating with each days data. Reinforcement Learning would involve the algorithm learning the optimal policy for traders given a specific state of the tickers. To train such a model you would probably use historic ticker data and let the model learning by simulating a week/month/quarter and repeating so the algorithm learnings.
@ritvikmath
@ritvikmath 10 ай бұрын
Thanks for your comment; I thought about it a bit from first-principles and wanted to share my thoughts. An RL problem consists of: an agent taking actions in an environment, various states of the agent/environment as a result of those actions, rewards associated to each state. I think for a reinforcement learning stock trading algorithm: - the actions would be choices of which stocks to buy and how much to buy - the rewards would be the returns of those stocks the next day, week, month, etc. - the states, as you mention, would be the specific state of the tickers which I'm taking to mean any and all information about the market So if the goal of an RL problem is to learn an optimal policy which is P(action | state) that means P(choice of stocks to buy | specific state of the tickers) in our problem. I think the method I've presented here does work in that way; given the specific state of tickers A and B, we use their history of returns (and the prior) to decide which action to next take (which stocks to next buy). However, I think there are definitely key components missing in the approach I've presented which you'd see in a usual RL problem. For example, there's no notion of exploration in this method. I simply use the means of the posteriors (exploitation only) and that is likely a big problem with this method. How do we know if the mean of a posterior is trustworthy without including its variance? Overall, I think you're right that this doesn't fit as cleanly into the mold of a usual RL problem and we could probably benefit from a future video where I present an RL method starting from actions, states, and rewards as I've tried to do in this comment.
@nelsonjesus8906
@nelsonjesus8906 10 ай бұрын
Well, its a RL problem with a more frequent update of the historical content, instead of learning from previous (long) experiences (which is a legitimate process), it's learning from a more narrow time frame, updating the environment with more regularity (i'm not sure if the learning process is as fast or as accurate as with the historical data) but, we must agree that has all the components and expected behaviour of an RL problem. My only question for @ritvikmath is the assumption of normality, real data rarely behaves normally.
@bin4ry_d3struct0r
@bin4ry_d3struct0r 10 ай бұрын
Your summary at the end perfectly explains why I personally don't use trading bots. I don't see these trend chasing methods working out in the long run. The way you make money off the stock market is to buy low and sell high, and the cons listed mean these methods fail in that regard. 9/10 traders cannot beat the S&P, so the easier and more reliable thing to do is to set it and forget it. Appreciate the math, though!
@sharks1349
@sharks1349 10 ай бұрын
I always get so excited about the next stock trading strategy you're gonna show us
@sigma_z
@sigma_z 10 ай бұрын
Just started watching, can already see it's going to be a brilliant video. Thank you. 🙏🏼
@ritvikmath
@ritvikmath 10 ай бұрын
Hope you enjoy it!
@cornagojar
@cornagojar 10 ай бұрын
Try this for the next video, it's super simple: - Download a bunch of backadjusted futures data (or backadjust it yourself). The more futures the better (with 100 you are done). - Calculate the running recent annualized volatility, something like Vol = sqrt(EMA(Returns^2, 30)) * sqrt(252) - Choose a target volatility, let's say 20% - Apply a trend following strategy, something slow like Forecast = (EMA(Price, 20) - EMA(Price, 80)) / (Price * Vol * sqrt(252)) - Calculate excess returns: ER = lag(Forecast * 0.20/Vol) * Returns - Merge all the future contracts results together by averaging the excess returns, calculate sharpe ratio etc... And...surprise! 🤗
@deadalnix
@deadalnix 4 ай бұрын
It's be good if you could compare sharpe ratio or any other risk adjusted return metric and whatnot. Because if the method has significantly less volatility, it might still be worth doing with leverage. I doubt so, but nevertheless, this is how one shoudl evaluate the trading strategy.
@AB-zv6dz
@AB-zv6dz 7 ай бұрын
Fair enough but there is so much in your results which is unexplained. I am sure you know that just measuring absolute returns over a period is a nonsense. I cant be bothered to go into all the unknowns. But if you have a strat that can make 0.6% a week, and goes long and short to trade momentum in a bayesian manner, you have a system that makes 30% a year, which is very respectable. So does your system beat risk adjusted return of the market? Big fat UNKNOWN. It was sad after all that effort to publish only a week of your results and not think about them for more than 2 seconds. You even compared your strat to a week in which the S&P returned 1.6% which is miles from average. The average return is about .2% a week. So even at .6 youre beating the average S&P week. As I say, it was a shame to do all that work then do your work dirty by not competently analysing the results.
@find2hard
@find2hard 10 ай бұрын
Aren't daily returns a brownian motion/wiener process? Also the mean would have to be consistently higher than 0 otherwise you would still lose money because of negative % bias (or whatever it's called: if you make 5%, then lose 5% you are in the negative overall, even without counting trading costs).
@6Ligma
@6Ligma 10 ай бұрын
Can you put a link to the notebook you coded?
@mistermiyagi4570
@mistermiyagi4570 10 ай бұрын
I would love to see you put out some videos on chaos mathematics applied to stock trading
@ritvikmath
@ritvikmath 10 ай бұрын
Great suggestion!
@djpremier333
@djpremier333 10 ай бұрын
Very nice video again, which software do you use for bayesian inference, pymc or tensorflow prob?
@nanthawatanancharoenpakorn6649
@nanthawatanancharoenpakorn6649 10 ай бұрын
I learned so many things from your vdo and it is very helpful since you explain the story (context) of the concept. I am working on buidling on quantitative trading strategies. I some guildence. Please let me know if you are happy to be my mentor or someone who I can get advice. :)
@Hellotherewhtsup
@Hellotherewhtsup 9 ай бұрын
PLEASE CAN WE GET A SIMPLE GUIDE ON HOW TO DO IT?? I MEAN ALL THE STEPS AND APPS , THANKS
@juanfa98
@juanfa98 10 ай бұрын
Great video, new subscriber here Could you link the notebook you coded or show it in another video?
@appliedstatistics2043
@appliedstatistics2043 8 ай бұрын
Hi I also have another idea about Bayesian trading, and I have applied in the back testing, the strategy is like using beta binomial conjugation, we set the theta the probability of the stock raising up as the prior which follows beta distribution, and then we use binomial likelihood to compute the posterior. The prior theta is set by observing the data in hours bar, and the likelihood is computed by 5 min bar, the idea is that small change and affect the whole trend , if you would like to know more I would love to discuss with u . I like ur videos !
@ntesla66
@ntesla66 9 ай бұрын
You have a sample space 7 wide and yet you said in the video that the returns were calculated over 5 days... I'm confused.
@christusrex334
@christusrex334 5 ай бұрын
Could this method be feasible using weekly price changes instead of daily, where you use historic data for each weekly price change and update weekly?
@ritvikmath
@ritvikmath 5 ай бұрын
It certainly could, we’d have to run it and see if this gives usually better performance than daily
@cornagojar
@cornagojar 10 ай бұрын
Assuming that trading is mostly a zero-sum game, so that every time you make money somebody else loses it: Why do you think that a strategy like this systematically makes money? In order words, why is somebody else constantly losing money to you?
@ApiolJoe
@ApiolJoe 10 ай бұрын
> Why do you think that a strategy like this systematically makes money? I don't think he thinks that. I hope he doesn't.
@anondsml
@anondsml 10 ай бұрын
are you available for tutoring in Bayes Statistics? can i find you on LI?
I Used Data Science to Buy the Dip
19:32
ritvikmath
Рет қаралды 8 М.
What the Heck is Bayesian Stats ?? : Data Science Basics
20:30
ritvikmath
Рет қаралды 64 М.
Joker can't swim!#joker #shorts
00:46
Untitled Joker
Рет қаралды 40 МЛН
Bony Just Wants To Take A Shower #animation
00:10
GREEN MAX
Рет қаралды 7 МЛН
t-SNE Simply Explained
25:49
ritvikmath
Рет қаралды 12 М.
How Financial Firms Actually Make Money
22:40
QuantPy
Рет қаралды 347 М.
Reinforcement Learning Series: Overview of Methods
21:37
Steve Brunton
Рет қаралды 93 М.
I Traded $1000 with Every Tree-Based Machine Learning Model
15:44
Ep: 119 - Betting with Modeling, Statistics and Bayes Theorem
50:51
Business of Betting with Jason Trost
Рет қаралды 3,3 М.
This is why Deep Learning is really weird.
2:06:38
Machine Learning Street Talk
Рет қаралды 383 М.
Two Reasons Why Making AI for Day Trading is Hard
14:50
eminshall
Рет қаралды 2,1 М.