Cancel an order
client.cancel_order(order_id = "")This method checks the order status first and then cancels the order if it is open.
client.cancel_order(order_id = "", isVerify=True)from neo_api_client import NeoAPI
#First initialize session and generate session token
client = NeoAPI(consumer_key=" ",consumer_secret=" ",environment=" ")
client.login(mobilenumber=" ", password=" ")
client.session_2fa("")
try:
# Cancel an order
client.cancel_order(order_id = "")
except Exception as e:
print("Exception when calling OrderApi->cancel_order: %s\n" % e)| Name | Description | Type |
|---|---|---|
| order_id | Order ID to cancel | str |
| isVerify | Flag to check the status of order (Delayed method) | boolean |
| amo | After market order - YES, NO (optional, Default Value - NO) | str |
object
{
"stat": "Ok",
"nOrdNo": "230120000017243",
"stCode": 200
}- Accept: application/json
| Status Code | Description |
|---|---|
| 200 | Order cancelled successfully |
| 400 | Invalid or missing input parameters |
| 403 | Invalid session, please re-login to continue |
| 429 | Too many requests to the API |
| 500 | Unexpected error |
| 502 | Not able to communicate with OMS |
| 503 | Trade API service is unavailable |
| 504 | Gateway timeout, trade API is unreachable |