Stock Trading AI 101: How to Build Your Own Reinforcement Learning Model
ฝัง
- เผยแพร่เมื่อ 29 ม.ค. 2023
- Hey, thanks for clicking on the video.
CONSIDER JOINING THE NEWSLETTER
witty-motivator-1414.ck.page/...
I talk about coding, python, technology, education, data science, deep learning, etc. If you enjoyed the video please like or subscribe. It is one of the best ways to let TH-cam share similar content with you and others interested in this topic. Many thanks
GET THE CODE
colab.research.google.com/dri...
CHAPTERS
Install Dependencies - 0:28
Source Stock Data - 1:30
Reinforcement Learning Explanation - 2:50
Create Gym - 3:50
Random Results - 5:23
Creating Agent - 6:40
First Results - 9:44
Second Results - 12:03
Future Improvements - 13:07
My goal is to create a community of like-minded people for a mastermind group where we can help each other succeed, so browse around and let me know what you think. Cheers!
Keyword for the algorithm: Creating an AI with reinforcement learning with OpenAI and stablebaselines3 along with Tensorflow I successfully trained an agent to trade apple stocks with deep learning and machine learning code with python. I took financial time-series data from Alpha Vantage API. Data science and python coding
Thank you for making this video! I feel like there is a lack of machine learning for trading videos out there on TH-cam. This is just enough to get me started which I find is the hardest part. Please make the second part to this video
Thank you for the support! Stay tuned for part two coming out in a few weeks
Excellent work! Can't wait for the next video...👏
Thank you so much for the support. I'm planning on having part 2 out in a couple of weeks
Can't wait for the next video too!
Loved the Video love that you get to the point with your explanations I find it so much easier to just learn a concept by doing then researching further on my own and your video was great for that
Thank you so much for the kind words. I'm glad you found it useful. If you have suggestions for other topics you'd like me to cover please share!
Thanks for the video. So detailed.
Appreciate the comment Sergio! Thank you
Thanks for sharing! Waiting to see how to implement custom indicators inside the gym!
Thanks for watching! Should have a video ready in a couple of weeks
It is hard to tell, because I am used to Keras and not stable-baseline, but it seems to somehow feed OHLC data into the network/agent. If you add the indicator output into the data file as a new column, it should use that in the training.
thank you 🙌
My pleasure, thanks for watching
How would I go about saving/loading models? Let's say I want to implement a callback that saves the model with the highest explained variance and then load it and serve it new data as it comes in through the terminal?
Is there a way to do this without using stable-baselines, and use keras instead?
Also, @2:25 the time data is backwards. You can fix that with data.sort_index()
Yeah good catch, I implement the sorting in a different video. The stable baseline callback was a bit confusing for me. I looked into it at the time but eventually gave up after finding FinRL which seemed more intuitive.
I have been following you video and learning g greatly from you sir. But I want to know how can we connect this learning agent to trading platform like binance in order to execute a trade
That’s a great question, it’s in the pipeline we’ll likely connect the model to Alpaca. First gotta figure out how lol. Hoping to release a video about it late August.
Keep going
Thank you my man
Is this a lstm model? Or Arima?
To be honest, my knowledge on reinforcement learning is basic at best-- I think the model is A2C which is Advantage Actor Critic which uses an MLPpolicy, which I don't think is recurrent. You can kind of think of it as two algorithms. One takes in inputs > calculates an action. The other calculates performance and reward vs what was predicted and helps the first model out. If anyone more knowledgeable about the subject comes across this, please add clarification. Hope this helps.
Very nice!...what's the closing song?
I don't really remember, I got it off TH-cam's Creator Music catalogue
got damn, superman use AI to trade now =)))
haha journalism and fighting crime weren't keeping up with inflation
I am wondering the data should be in reverse order. It seems the alphavantage reversed the order. It gives you 100 rows of the stock price changes. However, the newest data row is at the beginning of the dataframe. I'm wondering if you miss data.iloc[::-1]. Thx for the work BTW!
This is something I catch in a later video, but you're 100% correct. It's important to sort the data to move from earliest period to most-recent period!
@@eminsh how many months or days of data is suitable to train the model for shorterm (intraday) trading?
I am getting a runtime error when I try and run the line of code which says "model = A2C('MlpPolicy', env, verbose=1)". Could you please help me resolve this? , Here is the error summary: RuntimeError: Calling torch.geqrf on a CPU tensor requires compiling PyTorch with LAPACK. Please use PyTorch built with LAPACK support.
There isn't much information out there about this... Are you using Jupyter Labs with Anaconda as your development environment?
I got the same error and am also using Jupyter Labs with Anaconda..... Cannot find the reason / solution for this, pls help