robinhood-unofficial / pyrh

Python Framework to make trades with the unofficial Robinhood API
https://pyrh.readthedocs.io/en/latest/
MIT License
1.78k stars 603 forks source link

rh.place_market_buy_order 400 Client Error: Bad Request for url: https://api.robinhood.com/orders/ #238

Closed Emnolope closed 4 years ago

Emnolope commented 4 years ago
rh=Robinhood(username="yabbadabbadoo@stone.flint",password="dinodung")
rh.place_market_buy_order(instrument_URL='https://robinhood.com/stocks/F', symbol='F', quantity=1,time_in_force="GFD")

returns 400 Client Error: Bad Request for url: https://api.robinhood.com/orders/

adithyabsk commented 4 years ago

~@Emnolope If that is your password, I would change it ASAP.~

[EDIT] Nevermind

adithyabsk commented 4 years ago

I'll take a look, it's likely many parts of the app aren't fully functional, yet. PRs are welcome.

Emnolope commented 4 years ago

Ahh I got it working with this tidbit:

import pyrh
rh=pyrh.Robinhood(username="yabbadabbadoo@stone.flint",password="dinodung")
STOCK1=pyrh.urls.instruments('F')
import requests
requests.get(STOCK1)
STOCK2=requests.get(STOCK1).json()['results'][0]['url']
rh.place_market_buy_order(instrument_URL=STOCK2, symbol='F', quantity=1,time_in_force="GFD")
adithyabsk commented 4 years ago

Yeah, feel free to leave the issue open since this is a verified bug. Again, happy to take contributors here. I'm not too free for the next few weeks but will likely be working in force again later this month.