robinhood-unofficial / pyrh

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

place_limit_sell_order error #181

Closed aceidon closed 4 years ago

aceidon commented 5 years ago

Hey all,

place_limit_sell_order is kicking back a HTTP 400 bad request error for me. When I switch the same submission over to place_market_sell_order it goes through just fine.

The only difference between these two seems to be the price in the code and the order type. The market_sell_order gets the market price from the endpoints quote data as a float. Order type is set to market.

For the limit I'm sending a float, I've even sent it the market price as a float. Setting the order type to limit. And it breaks down.

Anyone else having this problem?

Thanks!

quada commented 5 years ago

same issue here. did you ever figure this out?

aceidon commented 5 years ago

nope :(

jkcaldwe commented 5 years ago

I am getting a similar issue which may or may not be related. When I attempt to limit sell the symbol 'SPY' I get the 400 bad request error however when I try to limit sell any "normal" stock it works as expected. The only difference I can see is that 'SPY' is an ETF type stock. I havent tried the market_sell_order but will give that a shot and see if it goes through for SPY.

Update: Late update but turns out I had a stop loss attached to the stock which prevented me from submitting a limit sell order. Once I removed the stop loss everything worked as expected.

kuhner commented 5 years ago

I'm having the same issue. 400 Errors on limit sell and buy orders.

RuosenD commented 5 years ago

I'm having the same issue. 400 Errors on limit sell and buy orders.

Same here. Got errors on every limit buy and sell orders. Wondering if this problem solved for you?

viaConBodhi commented 5 years ago

I just tested and got 201 (for buy only) ` md = StockMarketdata.quote_by_symbol(client, 'UMC') inst = md['instrument']

testBuy = my_trader.place_limit_buy_order(instrument_URL=inst,symbol='UMC',time_in_force='GFD',price=2.13,quantity=1) ` I'm using the FastArrow package that I slightly modified (but uses the same 2FA as this package) and then passing the keys to the login for this package so I can use the method.

Jamonke login ' def login(self,*args): for i in args: testing = i.access_token username = i.username password = i.password device_token = i.device_token auth_token = i.access_token refresh_token = i.refresh_token

    self.auth_token = auth_token
    self.refresh_token = refresh_token
    self.headers['Authorization'] = 'Bearer ' + auth_token

'

Seems like you are not passing the keys correctly.