Jake0303 / RobinHood-RSI-Trading-Bot

A Robinhood stock trading bot in Python using the RSI indicator https://youtu.be/kSLkRXY3NPQ
206 stars 115 forks source link

Two factor authentication #1

Open cpipero opened 4 years ago

cpipero commented 4 years ago

I was looking into getting around the 2FA prompt (which prevents me to automate the startup). But I think this pyrh issue has a good answer https://github.com/robinhood-unofficial/pyrh/issues/221 .

Probably worth mentioning.

This is great work, thanks!

Cos

cpipero commented 4 years ago

I updated my VisualStudio solution to fetch the master instead of the pip default (by asking for git+https://github.com/robinhood-unofficial/pyrh.git#egg=pyrh in the Python Packages Manager).

Unfortunately, they changed the API. So the login parameters are now in the constructor, I had to change the code as follows:

...
#A Simple Robinhood Python Trading Bot using RSI (buy <=30 and sell >=70 RSI) and with support and resistance.
#Youtube : Jacob Amaral
# Log in to Robinhood app (will prompt for two-factor)
rh = Robinhood("username", "password")
# rh.login(username="user@mail.com", password="H@rd2Crack")
#Setup our variables, we haven't entered a trade yet and our RSI period
enteredTrade = False
...

And that works, but then other functions have changed so I get the following output:

Getting historical quotes
Input challenge code from Email (3/3):
537813
Invalid code entered
Input challenge code from Email (3/3):
567813
Current Support is :
6.165
Current Resistance is :
6.165
Current Resistance is :
6.175
Current Support is :
6.16
Traceback (most recent call last):
  File "RobinhoodBot.py", line 64, in <module>
    s.run()
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\sched.py", line 151, in run
    action(*argument, **kwargs)
  File "RobinhoodBot.py", line 48, in run
    instrument = rh.instruments("F")[0]
TypeError: 'generator' object is not subscriptable

It's going to take me a while to troubleshoot.

Any help and advice welcome.

Jake0303 commented 3 years ago

Just a heads up your username and password are in your quote, I would remove it ASAP.

danoc505 commented 3 years ago

has there been any solutions to this? The code is being sent to me via txt and when I put it back into the command line it brings up an error. Is there a way to store it in the bots code like the user name?