Cancel order
A cancelled order is a previously submitted order to buy or sell a security that gets cancelled before it executes on an exchange.
As long as an order remains active or in a state of pending in the system, it can be canceled.
Method: POST
https://connect.thefirstock.com/api/V3/cancelOrder
Request details
Parameter | Description | Data Types | Example |
---|---|---|---|
userId | User Id of the login user | String | "AA1999" |
jKey | Key Obtained on login success. | String | " d9b4e1b1c79042476fd96 11eed81003b2dc34c3f13b0 b60a4842fd5a24c9f3f2v" |
orderNumber | orderNumber, which needs to be cancelled | String | "89089875" |
- cURL
curl --location 'https://connect.thefirstock.com/api/V3/cancelOrder' \
--header 'Content-Type: application/json' \
--data '{
"userId": "AA123",
"jKey": "e6a211bea63adff386578988e1cf4a9521c4744e6a39ad63174c8797e2af8c38",
"orderNumber": "11030800009600"
}'
from thefirstock import thefirstock
cancelOrder = thefirstock.firstock_cancelOrder(
orderNumber="11030800009600"
)
const Firstock = require("thefirstock");
const firstock = new Firstock();
firstock.cancelOrder({ orderNumber: "11030800009600" }, (err, result) => {
console.log("Error, ", err);
console.log("Result: ", result);
});
using thefirstock;
class Program
{
public static void Main()
{
Firstock firstock = new Firstock();
var result = firstock.cancelOrder(orderNumber: "11030800009600");
}
}
Success response details
Parameter | Description | Data types | Examples |
---|---|---|---|
data.requestTime | Reaponse received time. | String | "14:45:38 15-02-2023" |
status | Success | String | "Success" |
data.orderNumber | orderNumber of the canceled order. | String | "1234567890111" |
Failure response details
Parameter | Description | Data Type | Example |
---|---|---|---|
status | Failed | String | "Failed" |
code | HTTP Code | String | "404" |
name | Type of error | String | "ORDER_NOT_FOUND" |
error.field | Error field | String | "orderNumber" |
error.message | Error message | String | "Order not found to cancel" |
Sample response
- Success response
- Failure response
{
"status": "Success",
"data": {
"requestTime": "14:45:38 15-02-2023",
"orderNumber": "1234567890111"
}
}
{
"status": "Failed",
"code": "404",
"name": "ORDER_NOT_FOUND",
"error": {
"field": "orderNumber",
"message": "Order not found to cancel"
}
}