Robinhood trading bot - How to Build a Robinhood auto-stock trader in Python (part 3)

  Рет қаралды 3,790

ComputerGuyChris

ComputerGuyChris

Күн бұрын

This video is part 3 of a 7 part series on how to design a Robinhood trading bot to interact with and trade your stocks for you. If you would like to see the previous episode, Robinhood trading bot - How to Build a Robinhood auto-stock trader in Python (part 2), before watching this one, click this link:
• Robinhood trading bot ...
In this video, we are going to be building the most important part of the trading bot system, the trading strategy. This part will tell your trading bot whether to send a "BUY", "SELL", or "HOLD" command to Robinhood for each stock listed in your bot. This part can be customized to fit your exact trading strategy with just a little bit of python. ENJOY!
Thank you to my brother for editing the video!!

Пікірлер: 52
@codingforslowpeople6721
@codingforslowpeople6721 3 жыл бұрын
You are the man, you make things very simple.
@ComputerGuyChris
@ComputerGuyChris 3 жыл бұрын
Thank you, I believe that is the mark of a good teacher.
@nighthawksptfreak1
@nighthawksptfreak1 3 жыл бұрын
Wow this very cool. I will have to carve some time out to watch this whole series.
@Indeterminite
@Indeterminite 3 жыл бұрын
Great Video Chris! thank you for putting this up!
@downwithosama1
@downwithosama1 3 жыл бұрын
Really liked the video! I watched the whole thing but I don't know how to do python or any coding yet but I want to learn. I've subscribed and looking forward to you testing out this trading strategy.
@ComputerGuyChris
@ComputerGuyChris 3 жыл бұрын
I am glad you like the series. Thank you for subscribing!
@ronniesamaroo1775
@ronniesamaroo1775 3 жыл бұрын
Thank you for this man…
@sdKomorebi
@sdKomorebi 3 жыл бұрын
awesome so far I've been able to finish up to part 6. Thank you Chris!
@ComputerGuyChris
@ComputerGuyChris 3 жыл бұрын
Glad you are enjoying it! Feel free to share it, trying to pump up those views haha
@karthik33271
@karthik33271 3 жыл бұрын
I am very interested in these videos. Are you going to do any python code video describing to set up entry and exit price for a particular stock? In other words, buy low and sell high in few minutes intra-day trading.
@ComputerGuyChris
@ComputerGuyChris 3 жыл бұрын
I am glad you are liking the videos, The videos are more about designing a trader to implement a trading strategy. If all you want is some code that will buy and sell at certain prices, you can just take the code from "part 2" and "part 4" and change the if statement to whatever price you want to buy or sell at.
@lilgotti3317
@lilgotti3317 3 жыл бұрын
Hey Chris, I love your content and can't wait to see more. I have a question about changing the strategy, as I've only begun learning Python. At 16:45, I understand you can change the interval and span values, but what should you change them to to accomplish a different period? Also, how exactly is the hourly periodicity selected out of that list in span_interval = {list}? Is it what you mentioned about the window at 18:05? Thank you much.
@ComputerGuyChris
@ComputerGuyChris 3 жыл бұрын
So span and interval are directly related per the robinhood api. If you try to get hourly data from the past year, the request will be denied. I use a dictionary as a lookup so that the user only need specify a span and that will automatically correspond to a interval. That way the robinhood platform always accepts the request. Does that make sense?
@seoalistersseoalisters9746
@seoalistersseoalisters9746 3 жыл бұрын
Hi Chris, awesome videos . Thanks for sharing that information. Can you help me with How I would I be able to check how many shares I own via the api? I own 4K Doge coins but I’m not sure if I am using the api correctly because I am not getting the amount of shares I have purchased via the api.
@ComputerGuyChris
@ComputerGuyChris 3 жыл бұрын
There are a few ways to get current shares but you need to use the particular function for crypto trading. Here is the API website: robin-stocks.readthedocs.io/en/latest/robinhood.html
@jothkell9173
@jothkell9173 3 жыл бұрын
intro music is fire
@ComputerGuyChris
@ComputerGuyChris 3 жыл бұрын
That is thanks to my brother for editing my videos! Hope you enjoy the content as well haha
@danielchoo4746
@danielchoo4746 3 жыл бұрын
Hey Chris, I'm trying to follow your instructions but, got an error like 401 Client Error: Unauthorized for URL any suggestions??
@ComputerGuyChris
@ComputerGuyChris 3 жыл бұрын
Which line of code exactly is giving you that issue? Do you already have an account with Robinhood?
@LK-bd9hv
@LK-bd9hv 3 жыл бұрын
@@ComputerGuyChris Hey, Chris. First off, big thank you, these videos are wonderful. Second, I too am getting this error. I do have an account with robinhood. I was able to log into it as well. The error comes at about minute 12 in your video here, when trying to grab historical data. The error is: "401 Client Error: Unauthorized for url: api.robinhood.com/quotes/historicals/?symbols=OGI&interval=5minute&span=day&bounds=regular data: [None]" Thanks for any help in advance!
@ComputerGuyChris
@ComputerGuyChris 3 жыл бұрын
@@LK-bd9hv I am glad you are liking the videos. I have 3 questions on your error. 1. did you change the config.py file to have your login information? 2. if you remove the trade_strat part of the main loop, are you able to get things like current stock prices and your current holdings? 3. does this error come in the first time you run the program or does it happen after a few minutes of the program running?
@LK-bd9hv
@LK-bd9hv 3 жыл бұрын
@@ComputerGuyChris Hey Chris! Thanks for the reply. Let's see, I'm not sure I will be able to answer all of your questions, because I found a workaround (which I'll mention) but to try and provide helpful feedback: 1) Yep 2) unsure, and too afraid to try at this point lol, but I would guess so since the issue was grabbing the historical data 3) right away, it crashed without letting me pull any info Workaround: So, as far as I can tell, there seems to be an issue with the url. I tried entering printing and entering the url manually, but it seems it does not exist. (This reminded me of when yahoo finances decided to change everything up on us without warning, wondering if that is similar to what is going on here?) Nonetheless, I found my way around it by around it by simply using the "get_stock_historicals" on the robin-stocks readthedocs website. Hope this helps! Thanks for getting me off the ground, everything is up and running now. If I miraculously make it rich from this, I'll make sure to paypal you :)
@ComputerGuyChris
@ComputerGuyChris 3 жыл бұрын
@@LK-bd9hv Huh, it is odd that the URL doesnt exist for you but I have no problem running it on my system. Yes, replacing the historical data function with the "get_stock_historical" is perfect, that is actually one of the changes I made to mine as I have been doing updates for it. Appreciate the shout out! Would love if you could share the video. Trying to get enough views to monetize haha
@mlpzaqwer
@mlpzaqwer 3 жыл бұрын
How should run_time be updated?
@ComputerGuyChris
@ComputerGuyChris 3 жыл бұрын
I updated run_time from the main file "trader.py" and passed it as one of the attributes to the "trade_strat.py" file, incrementing run_time for each time the while loop is run. This allowed me to update the historical data in "trade_strat.py" every 5min which is the increment time from Robinhood.
@reginaldholland4906
@reginaldholland4906 3 жыл бұрын
since i am a swing trader,what would be the optimal settings for me?
@ComputerGuyChris
@ComputerGuyChris 3 жыл бұрын
Optimal settings would depend on so many things. It would depend on what specific stocks you trade, the time frame you are swinging in, and so much more. The system that I built and talk about in these videos is designed to allow you to modify the "trade_strat.py" file to best fit your needs. Also, if I knew how to optimally tune parameters, I would be making a lot more money haha. I have found the best method to find a strategy that works for you is testing. I suggest just adding a small amount of money to an account (I used $1,100) and use that account to trade with different trade_strats.
@reginaldholland4906
@reginaldholland4906 3 жыл бұрын
@@ComputerGuyChris last question..I've watched every video and downloaded the needed files but I'm lost as to how to use the command prompt with the whole thing to make it run
@ComputerGuyChris
@ComputerGuyChris 3 жыл бұрын
@@reginaldholland4906 so just go to the location you saved all the files in file explorer, type "cmd" into the search bar, and then type "py trader.py" or "python trader.py" depending on how you have set up your env. Also, remember to modify the files as instructed in the README. Here is a video I made that might help: kzbin.info/www/bejne/qHmXh3lrn8SNaqs
@AlwaniAkber
@AlwaniAkber Жыл бұрын
it would be best if you can share the code also really appreciate to avoid any coding mistakes, even though follow step by step unable to run the code as whole
@alex-zw1el
@alex-zw1el 3 жыл бұрын
What would the def be if I wanted to use an EMA instead of a SMA?
@ComputerGuyChris
@ComputerGuyChris 3 жыл бұрын
If you wanted to, you could create a new function, similar to the SMA function, with given weights to give to the EMA. However, onelibrary I have found since making these videos is called "technical analysis". From this library, you can just import the EMA, that would be much easier. I plan to make a follow up video on the improvements I have made to my trader and how it has been doing as I have been running it since the beginning of the year. So make sure to keep an eye out for that and happy trading.
@alex-zw1el
@alex-zw1el 3 жыл бұрын
@@ComputerGuyChris Will do, thank you for your help!! I appreciate it!
@anirudhsharma2697
@anirudhsharma2697 3 жыл бұрын
I'm getting an SMA of zero not sure why in one of the stocks and because of that getting a zero division error. Any thoughts on this ?
@anirudhsharma2697
@anirudhsharma2697 3 жыл бұрын
Also only when i incoprporate the trade_option function before that I can see the values makes sense and there are no zeros
@ComputerGuyChris
@ComputerGuyChris 3 жыл бұрын
I would double check your code, it sounds like you made a mistake somewhere when creating your formula.
@AlwaniAkber
@AlwaniAkber Жыл бұрын
I send many messages but did not receive reply ever
@rverm1000
@rverm1000 3 жыл бұрын
got a question about the active graph. i have 20 stocks on the list but 2 of the stocks have a color bar. but the rest dont. is there a way to fix that in the grapher program?
@ComputerGuyChris
@ComputerGuyChris 3 жыл бұрын
I am not entirely sure by what you mean by “color bar”. The graphed program sets stocks that you do not currently own to very opaque lines, try buying 1 share of a few of those stocks and see if the lines are more visible. If I am not understanding your question, please correct me.
@rverm1000
@rverm1000 3 жыл бұрын
@@ComputerGuyChris each stock has a color asigned to it. there are 20 sqiggly lines on the graph. however i dont know what color goes to each stock becuase the legend only shows sndl= orange, trx = gray, sos= gray, nakd= gray, sesn= gray, f=gray,gm=gray
@ComputerGuyChris
@ComputerGuyChris 3 жыл бұрын
@@rverm1000 hm, the only thing I can think of is that maybe 20 is too many for matplotlib to auto assign. I believe there is a way to assign colors to each item in a list. Maybe that is something that could be useful.
@rverm1000
@rverm1000 3 жыл бұрын
@@ComputerGuyChris well it is drawing all the lines in different colors. the legend there all gray except for 1. ill try to find some plotly code and post it.
@rverm1000
@rverm1000 3 жыл бұрын
What about vwap?
@ComputerGuyChris
@ComputerGuyChris 3 жыл бұрын
You can implement any trading strategy. VWAP is a great one.
@Adam_Lam
@Adam_Lam Жыл бұрын
I'm getting "AttributeError: 'trader' object has no attribute 'get_historical_prices'." Anyone know how to fix this? Is robin_stocks outdated?
@Retfosho
@Retfosho Жыл бұрын
nvm, had a comment i put before the method "get_historical_prices" and the indentation was off
I Built a Trading Bot with ChatGPT
18:33
Siraj Raval
Рет қаралды 1,9 МЛН
GTA 5 vs GTA San Andreas Doctors🥼🚑
00:57
Xzit Thamer
Рет қаралды 28 МЛН
Шок. Никокадо Авокадо похудел на 110 кг
00:44
小丑妹妹插队被妈妈教训!#小丑#路飞#家庭#搞笑
00:12
家庭搞笑日记
Рет қаралды 33 МЛН
Фейковый воришка 😂
00:51
КАРЕНА МАКАРЕНА
Рет қаралды 6 МЛН
I run untested, viewer-submitted code on my 500-LED christmas tree.
45:17
Think Fast, Talk Smart: Communication Techniques
58:20
Stanford Graduate School of Business
Рет қаралды 40 МЛН
I Tried Day Trading w/ a Trading Bot Algorithm
14:01
Daniel Inskeep
Рет қаралды 907 М.
Coolify Crash Course | Self Host 101 | Secure Set up
1:29:06
GT OMSCS | 10 tips to get an A in CS6515 - Intro to Graduate Algorithms
15:35
GTA 5 vs GTA San Andreas Doctors🥼🚑
00:57
Xzit Thamer
Рет қаралды 28 МЛН