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.74k stars 468 forks source link

create market order buy & create market order sell POST 400 ERROR #414

Open Mariani-code opened 1 year ago

Mariani-code commented 1 year ago

Running into "Error in request_post: Received 400" on sell market orders on 3.0.5, Is anyone else running into this?

kshoop250 commented 1 year ago

I have the same issue when using the function order_sell_market in version 3.0.5. "Error in request_post: Received 400"

paraluke23 commented 1 year ago

Same issue for me, why is it not getting fixed? Thanks.

eilin75 commented 1 year ago

I am getting the same error with limit orders as well:

result = api.orders.order_buy_limit(currency, BuyAMT, BuyPrice)

superfrank27 commented 1 year ago

same issue on my end. can anyone help us?

shinwss commented 1 year ago

same issue market order not working

NelsonDane commented 1 year ago

I have the same issue as well

eilin75 commented 1 year ago

I finally got this to work. You have to use the long order per the instructions.

i.e.

robin_stocks.robinhood.orders.order(symbol, quantity, side, limitPrice=None, stopPrice=None, account_number=None, timeInForce='gtc', extendedHours=False, jsonify=True, market_hours='regular_hours')

bvandorf commented 1 year ago

There is a pull request that will fix this. https://github.com/jmfernandes/robin_stocks/pull/421

NelsonDane commented 1 year ago

Thank you @eilin75 , your suggestion worked. Using the broader order function worked great!

FranklinDCodes commented 1 year ago

I had this same error when trying to place a sell order. I was trying to sell fractional shares and I realized I was using the wrong sell order. It didn't work until I used robin_stocks.robinhood.orders.order_sell_fractional_by_quantity("stock", shares)

eilin75 commented 1 year ago

this is the order structure that I got working:

currency ='SQQQ'

BuyAMT = 1 BuyPrice =1.00 result = api.orders.order(currency,BuyAMT,'buy',float(BuyPrice),stopPrice=None, timeInForce='gtc') print (result)

NelsonDane commented 1 year ago

I'm using that and it's been working well for me.