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.72k stars 464 forks source link

[Bug?] 'Stop limit order requested, but no stop price provided.' #489

Open worthapenny opened 2 months ago

worthapenny commented 2 months ago
from robin_stocks import robinhood as rh

order = rh.order_sell_stop_loss(
   symbol='SYMBOL', 
   quantity=1,
   stopPrice=999,
)

Error, order =

{'non_field_errors': ['Stop limit order requested, but no stop price provided.']}

Is there something I am missing that I need to provide, or could there possibly be an issue?

Kr1msonReaper commented 1 month ago

I have this same issue. I went through the robin-stocks function and changed stop_price to a hardcoded number to test it out and sure enough it still returns the error saying there is no assigned value. I used a network listener to check to see if the payload variable name had changed on Robinhood but it hasn't. I'm not sure what's going on, I'm new to this.

Edit: I fixed it! the order_sell_stop_loss function is categorized as a market order. However, in the module it checks if the function that calls it is asking for a market order and if it is it removes the stop_price value from the payload. Took a few minutes to figure it out, but you should be able to bypass the removal with a simple if statement.

@worthapenny

mw66 commented 1 month ago

Could be related to this fix:

https://github.com/jmfernandes/robin_stocks/pull/488

@jmfernandes can you take a look of this PR? Thanks.

jmfernandes commented 1 month ago

New version 3.2 is released. See if this fixes the issue.