jmfernandes / robin_stocks

This is a library to use with Robinhood Financial App. It currently supports trading crypto-currencies, options, and stocks. In addition, it can be used to get real time ticker information, assess the performance of your portfolio, and can also get tax documents, total dividends paid, and more. More info at
http://www.robin-stocks.com
MIT License
1.69k stars 459 forks source link

Exception: Request was throttled #304

Open mschwartz0659 opened 3 years ago

mschwartz0659 commented 3 years ago

Hello, I've been using robin_stocks for a few months now (thank you! its great). Today i received an error: File "/Users/mps/rh/robinhood.py", line 127, in rh_acct.auth() File "/Users/mps/rh/rh_acct.py", line 24, in auth rs.robinhood.authentication.login( File "/Users/mps/opt/anaconda3/lib/python3.8/site-packages/robin_stocks/robinhood/authentication.py", line 189, in login raise Exception(data['detail']) Exception: Request was throttled.

This started happening a few hours ago and I cant sent any requests at all, including authentication.

I authenticate with: totp = otp(mfa).now() rs.robinhood.authentication.login( username=user, password=pw, mfa_code=totp )

Is there a known throttle limitation on the robinhood side that will eventually be released? I tried reconnecting on a few different networks but the error is always raised, though I'm able to connect the same account with both my mobile device and webpage, on the same network.

Is there a way to change the User Agent that robin_stocks sends? I see in my device history log a bunch of 'Other(Other)'.

Thanks!

txavier commented 3 years ago

Interesting. How many requests were you making per minute?

mschwartz0659 commented 3 years ago

Maybe 20-30 requests in a 15 second span, run a few dozen times with a few minutes in between each run.

mschwartz0659 commented 3 years ago

it did release at some point overnight. was working on this again this afternoon, only sending a few requests a minute for a few hours and back into a blocked throttled state

dgabriele commented 3 years ago

Any halfway decent engineering team will have put measures in place to prevent people from spamming their API. I highly recommend not sending so many requests in such a short span of time. There's got to be a better way of doing what you're trying to do. If people don't exercise self-control in how they treat the API, I'm afraid Robinhood will make it more difficult for all of us by restricting access.

mschwartz0659 commented 3 years ago

sure, point well taken. this wasnt fully intentional or intended long term and of course I expect them to have some sort of throttling. My question was more geared toward whether anyone knew what the throttle was and what the release was. everything is back to normal now after it blocked me for nearly 48 hours.

flo-Ty commented 3 years ago

Hey, I've been getting this issue for a couple months now without any luck (i.e. no API access). I've only been requesting the API a couple times every five minutes, so I didn't think I would be over the throttle limit. It gives me super long "Expected available" time of more than 16 days, and seems to still not give me access after that period is over.

This is the tail end of my output on my most recent attempt:

File "/home/mass/AutoStock/robinstocks4/lib/python3.8/site-packages/robin_stocks/authentication.py", line 189, in login raise Exception(data['detail']) Exception: Request was throttled. Expected available in 1434082 seconds.