JestonBlu / RobinHood

An R interface for the RobinHood.com no commision investing site
https://jestonblu.github.io/RobinHood/
GNU Lesser General Public License v3.0
45 stars 12 forks source link

Can't place orders #170

Closed ostokes1 closed 1 year ago

ostokes1 commented 1 year ago

Hello,

I used to be able to submit orders through the API but in the last few weeks I have had no success. I can successfully log in and use many other functions in the API, the place_order function is the only one I have trouble with. Here is the code I am running:

currentPositions <- get_positions(RH) # gets current positions to_sell <- 52 # I want to sell the stock in row 52 of currentPositions

place_order(RH, symbol=currentPositions$symbol[to_sell], type = 'market', trigger = 'immediate', stop_price = round(currentPositions$last_trade_price[to_sell]*.975,2), time_in_force = "gtc", # Good till close quantity = currentPositions$quantity[to_sell], side = 'sell')

When I run this I get a bad request (HTTP 400) error: Error in RobinHood::api_orders(RH = RH, action = "order", instrument_id = instrument_id, : Bad Request (HTTP 400).

I went through the current issues and didn't see this mentioned but I apologize if I missed something. Any help would be appreciated.

Thanks!

ericvaughn11 commented 1 year ago

I had to convert everything to limit orders. 'market' stopped working for some reason.

JestonBlu commented 1 year ago

updated api, i was able to create market and limit orders