issue: unable to cancel order using cancelOrder end point
API end point orderList returns:
[{'id': 517123456, # generalized for security
'accountId': 0, # generalized for security
'contractId': 0, # generalized for security
'timestamp': '2021-09-10T15:52:24.826Z',
'action': 'Buy',
'ordStatus':
'Working',
'executionProviderId': 1,
'archived': False,
'external': False,
'admin': False}]
API endpoint cancelOrder requires “orderId” for payload. How do I obtain “orderId”, when orderList does not provide this (at least by name). I have attempted using “id”, “accountId”, and 'contractId" with each returning a 404 error.
Schema for cancelOrder:
def cancel_order(orderid):
endpoint = r'https://live.tradovateapi.com/v1/order/cancelorder'
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer ' + cfg.access_token
}
payload = {
'orderId': orderid,
"isAutomated": False
}
content = requests.post(url=endpoint, headers=headers, params=payload)
reply = content.json()
I have attempted with “isAutomated” removed, set too True, and as presented False.