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.
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!