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.73k stars 467 forks source link

robin_stocks.account.get_day_trades(info=None) url gone #73

Open TheTradeBakery opened 4 years ago

TheTradeBakery commented 4 years ago

Looks like Robinhood might have removed https://api.robinhood.com/accounts/{account_number}/recent_day_trades/

I am getting a: 410 Client Error: Gone for url: https://api.robinhood.com/accounts/XXXXXXXX/recent_day_trades/

inverseyourself commented 4 years ago

This is how I did it. Hope it helps.

# check we have at least one day trade available
account = rh.profiles.load_account_profile('account_number')
url = rh.urls.daytrades(account)

headers = rh.globals.SESSION.headers
rh.globals.SESSION.headers['X-Robinhood-API-Version'] =  '1.315.0'

results = rh.helper.request_get(url)
stock_day_trades = results['equity_day_trades']
options_day_trades = results['option_day_trades']
day_trades = len(stock_day_trades) + len(options_day_trades)

rh.globals.SESSION.headers = headers

if day_trades < 0 or day_trades > 2:
    print("WARNING: Must have less then 3 day trades available to trade.")
    return
lalliexperience commented 3 years ago

I'm not sure if this is related to the same issue, but I get 'results' is not a key in the dictionary after running _rbaccountdaytrades = rs.account.get_daytrades(info=None)

txavier commented 3 years ago

Bump. This is still an issue for me.