Trade on Robinhood with Python - Tutorial For Beginners

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

This is both great and scary - just make sure your password is not floating around somewhere and use tremendous level of security.

Here are few good recommendations on how to store your password and username on your OS securely: https://stackoverflow.com/questions/7014953/i-need-to-securely-store-a-username-and-password-in-python-what-are-my-options

πŸ‘οΈŽ︎ 90 πŸ‘€οΈŽ︎ u/forbiscuit πŸ“…οΈŽ︎ Nov 12 2020 πŸ—«︎ replies

This is some r/Wallstreetbets type of shit

πŸ‘οΈŽ︎ 72 πŸ‘€οΈŽ︎ u/Prome_Owl πŸ“…οΈŽ︎ Nov 12 2020 πŸ—«︎ replies

Now I can lose money on FDs even faster! Sweet!

πŸ‘οΈŽ︎ 114 πŸ‘€οΈŽ︎ u/Big_Booty_Pics πŸ“…οΈŽ︎ Nov 12 2020 πŸ—«︎ replies

You have to be careful about the number of requests made per minute and per month. They will shut down your account if you trip their monitoring systems.

πŸ‘οΈŽ︎ 34 πŸ‘€οΈŽ︎ u/methodsman πŸ“…οΈŽ︎ Nov 12 2020 πŸ—«︎ replies

Now I can finally combine my incompetence at the stock exchange with my spaghetti code. What could go wrong?

πŸ‘οΈŽ︎ 27 πŸ‘€οΈŽ︎ u/oddish_enthusiast πŸ“…οΈŽ︎ Nov 12 2020 πŸ—«︎ replies

This is great, but Alpaca is a site I would recommend over Robinhood if you want to run algorithms on the market. Their api is great, and they even have a test mode you can run all the algorithms you want for free where you don’t have to trade any real money. The only downside is that if you want to put in money and trade for real through them, they have more fees than Robinhood.

πŸ‘οΈŽ︎ 27 πŸ‘€οΈŽ︎ u/KalrexOW πŸ“…οΈŽ︎ Nov 12 2020 πŸ—«︎ replies

Do not do this lmao

πŸ‘οΈŽ︎ 20 πŸ‘€οΈŽ︎ u/super-porp-cola πŸ“…οΈŽ︎ Nov 12 2020 πŸ—«︎ replies

nice. i've been looking for something like this.

πŸ‘οΈŽ︎ 3 πŸ‘€οΈŽ︎ u/BackyardAnarchist πŸ“…οΈŽ︎ Nov 12 2020 πŸ—«︎ replies

I thought their APIs were taken down? Or just the ones RobinTrack was using?

πŸ‘οΈŽ︎ 3 πŸ‘€οΈŽ︎ u/Smok3dSalmon πŸ“…οΈŽ︎ Nov 12 2020 πŸ—«︎ replies
Captions
how's it going everybody my name is avery and today we're gonna be covering over this api that i just found it's a python api that allows you to do trades and allows you to access your robinhood account and i just set up my robinhood account a few days ago this is what i've got going so far and the api is called robin slash dash socks so the first thing you want to do is go ahead and just install it this way with pip install robin dash stocks and you can use paper pip3 whatever version of python you're using and today we're going to be covering some basic things we're going to be getting a quote for the stock so i'm going to check the price on it and we're also gonna be able to oh along with that we'll be able to log into our account with a two uh step authentication and we're gonna be able to buy and sell whatever sort of stock sticker that you want and we're just being covering over that and before we get started i just want to thank everybody i haven't released a video since we reached the 1000 subscribers so thank you guys so much i really appreciate that thanks for everyone that's been sticking along for a while thanks for anyone that's just joined us recently if you're new to the channel go ahead and give a think about subscribing and let's jump right into it so like i said it's just gonna be pip three install and then robin stocks and it'll be really quick and i already have installed so that's why it's like that and now the first thing we want to do is we're going to want to set up a tooth two-factor authentication so we can actually have access to our account so what i've got going right here is this right here you'll want to import the library and i'll just call it as robin make it a little bit shorter most of the documentations and the examples are just are but uh i decided to do this robin and you want to type in your email and your password into this login uh function and when you do that and then you need to do python 3.8 or whatever version of python you're running like i said and then just the name of the file and then if you run that it's going to it's going to it's going to actually give a little bit of an output differently than mine because mine's already set up for the two factor authentication but it's going to ask you for a certain code so for us to figure out that code you want to go on to the robinhood website and you'll want to click on account and click on settings in the settings we'll click on security then right here the two-factor authentication click on that and then what you're going to do is click on and when you click on you'll have this authentication app so we're making our own application and you'll click next and when you click next it'll have a qr code but we can't read a qr code like that so there's going to be something that says can't scan it right here below you click can't scan it and when you do that do that it'll give you a number you can go ahead uh it's gonna be a mix of numbers and letters you can go ahead and copy that so now that you've got that copied here's the next step we want to put it into the system so we can actually go ahead and import a different library byotp um if you want this library installed if it says it's missing you can install it the exact same way that you installed here right here let's do pyotp and now we're going to send in the code that we just got as such so right here is where you'll be copying the code so now when you run the program it's going to come out a little bit differently it's going to send in this thing and then it's going to give you a different number and that number i believe is going to be a five digit number then a space and another five digit number and you just want to make sure you don't want to share any of these things with anybody so now when you run the code one more time it will print that out and you just want to be able to save that as well so you want to save this number and that number and of course you should know your email and your password and from there i got a little a simple way of putting it all up uh this right here is just reading in my own key and my own code and my own email and password just so it's not displayed for anyone so you guys can go ahead and do it yourself it's basically just a text file and in the text file the first line is the key and the key is the one that you got from the website then second line is your email it's the third lines of password and the fourth line is the code the code is what should have just been outputted if you had ran the last thing and then right here we'll do pyo2p you send in the key and then for login it's a little bit different right here is the mfa code and then right here you pass in the code so now you should be able to actually access your robinhood account so the first step of accessing it let's go ahead and let's set up a function where you can send in a ticker and it'll tell you the price and we'll just call the variable ticker and then in here the r equals robin dot get latest price and we'll pass in the ticker now we'll just want to print it out to format it to make it look a little bit nice we'll do ticker um upper make it uppercase now that's so and let's pass it as a string to make sure it's going to work close that right there and this right here should just be able to pull the ticker and then i'll print it out as such so now let's actually go ahead and run the function to see if everything's working uh we'll make it a little bit of an argument way so we'll pass in an argument so ticker will equal to system arg v and it'll be the first argument which would be zero and i'm passing this upper as well just to make sure everything's like that and quote ticker and we're going to want to import system as well and import this so now let's go ahead and try that right there apple so here's the apple stock and then go ahead and pull it there we can see it's right there it's 119 bucks so let's go ahead and robinhood ourself and let's check out apple there it is right there and it says we can side has changed so there it is 119. so it's going to change every single second basically it depends on the stock how volatile it is how much volume there is in trading but uh yeah it's real time it follows the information as you go you can do the same thing for google like i said you don't need to uppercase to lower case it because the script already changes that for us and right there google 1758 and let's check that out right here it's class c stock and 1756. so it pulled it real time it's just changing as you see there was a dip right there it was around there that we got it and now we've got that let's show you the last two functions that are actually very simple for selling and buying the stock so right here's the first function it's for buying and we're just going to do a robin dot order by market and then the ticker itself and then the amount so that's all this function is going to be doing you send in the ticker he's sending them out and robin hood on its own is going to figure out if you're capable of buying it it's going to figure out if you can and if it goes through and buys it and i'll send a notification on the website i'll send you a notification in your email and on your phone if you have the app installed it'll just pop up on your phone and say that you bought it um and selling works the exact same way so instead of order buy market you just do order sell market of course there's tons of other ways for trading there's more specific you can uh do option trading as well you can also put in an order to make it so you can say you're invited at a certain price but uh for this video we're just covering over the very basic stuff so as you can see right here the cell it works the exact same way you ticker them out it's just order sell and market and now we're going to set up a few more argument things so instead of just sending in the argument for the ticker we'll send an argument saying if you want to buy it or sell it and the amount and what we want to do that first all we want to check if there are arguments for this we just want to check if there's an argument for the buy or the sell and if there's an argument for the amount so we don't get any sort of errors and then we can save these variables right here under account under action and amount the action will be buy or sell and the amount would be how much you're buying you're selling it by and i'll just copy this right in here just remove that remove that so now just going to check for the action and if it's buy it'll buy it print out that's buying it if it's selling it'll sell it and with these prints out right here it's just a little bit more data if there's any sort of error i'll tell you as well but uh to know for sure that for bother sell it'll just it'll ding your phone and you'll really know for sure so let's go ahead and check this right again it's apple and let's go ahead and find a stock that we can quickly buy that's something cheap so i got this one right here rwt redwood trust it's down a little bit and we're just going to go ahead and buy it just to show that we can so it's at 866 rwt rwt i1 buying and i just got a notification on my phone showing that i bought it i'll take a screenshot so i can share that here on the screen and here on the website let's just click back to the home page and it shows we have one share so now i don't want to day trade day trading means you you buy and sell the same stock in the same day and if you do that there's only a certain amount of times you can do that in a week so i'm going to go ahead and sell a different stock i'll sell this wpx i have five of them let's go ahead and sell two of them and right there so might cause pdt designation um here let's see what that's about give an error i think i actually got a notification about this the wpx the wpx is one of the ones i got for free and i think he didn't want me to trade it it was saying something like that so let's just go ahead and sell this new so actually i didn't change that your wpx two that's why okay that's my bad i was trying to sell two i only had one i didn't change it to wpx so now the wpx is right there and i just got a notification on my phone showing this hold i'll screenshot that share it to you guys and just reload the page there's five shares and it's reloading and there it is three shares so that's everything for this video as you can see it actually prints out a lot of data just right here so you guys can actually go ahead and comb through the data to see what's actually in there um along with this gate get lattice latest price there's tons of other functions i'll have the link for the documentation and the github and everything just in the description all the links for the code in the description as well and if you guys enjoy the video i really hope you guys enjoyed it go ahead and give it a like feel free to subscribe if you're not already share the video with your friends i had another video that's similar to this it's using a different api called alpha advantage alpha vantage and it's not for actually doing the trades itself it's for pulling old data so you guys can go ahead and check that video i'll have it linked right here and that video its audio is not that great hopefully this video the audio is much better and i hope you guys are having a great day and see you guys next time bye
Info
Channel: Avery Makes Games
Views: 10,309
Rating: 4.8461537 out of 5
Keywords: robinhood, stocks, python, programming, trading
Id: C5buU4zjjx0
Channel Id: undefined
Length: 12min 50sec (770 seconds)
Published: Wed Nov 11 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.