I am making a request for an order but getting back the Bad Request 400
Anyone know why this request would generate that? I have already verified that the accountSpec and accountId are both correct. I’m not showing my actual ones here.
The price at the time of execution was at 1.08565. I’m trying to enter a sell stop below the current price. I was able to enter a sell limit above the current price. I was entering a total of 11 trades the first trade was at market, then 5 sell limit trades above the current price then 5 sell stop below the current price. All of the ones below the price failed with the Bad Request.
{“accountSpec”:“mySpec”,“accountId”:myId,“clOrdId”:11,“action”:“Sell”,“symbol”:“6EM4”,“orderQty”:1,“orderType”:“Stop”,“isAutomated”:true,“price”:1.08515}
For anyone else coming accross this post, the solution is that a “Stop” order requires you to fill in the stopPrice, not the price, so once I filled in the stopPrice, everything worked fine.
this is my OSO order on python, im also getting #400 requests. Do you think you might know the solution to fixing this?
In this function im trying to place a buy limit order at 5515 with a TP of 5517
def place_oso_buy(buyprice):
url = “https://demo.tradovateapi.com/v1/order/placeoso”
headers = {
‘Accept’: ‘application/json’,
‘Authorization’: F’Bearer {get_access_token()}',
}
oso = {
# TP
“action”: “Sell”,
“orderType”: “Limit”,
“price”: 5517,
}
}
intial = {
“accountSpec”: ‘username’,
“accountId”: ‘id’,
“action”: “Buy”,
“symbol”: “ESU4”,
“orderQty”: 1,
‘orderType’: “Limit”,
‘price’: buyprice,
‘isAutomated’: ‘true’,
“bracket1”: oso,
}
response = requests.post(url, data=intial, headers=headers)
print(response)
place_oso_buy(buyprice=5515