Modify Order
When working at the market, one often needs to modify or delete the placed pending order.
While an order remains open or pending in the system, certain elements of it can be adjusted.
Method: POST
https://connect.thefirstock.com/api/V4/modifyOrder
Request details
Parameter | Description | Example |
---|---|---|
userId String |
Identifier for the user upon login, unique to each user in the system. |
AA0013 |
orderNumber String |
Unique identifier for the order that needs to be modified. |
1234567890111 |
price String |
Price at which the order is to be executed. | 240 |
quantity String |
New or modified quantity for the order. | 1 |
triggerPrice String |
New trigger price for orders which has SL-MKT or SL-LMT in priceType. |
235 |
exchange String |
Exchange on which the order is placed (e.g., NSE, BSE, NFO, BFO) |
NSE |
tradingSymbol String |
Encoded trading symbol of the security | ITC-EQ |
priceType String |
Type of pricing for the order (e.g., LMT, MKT, SL-LMT, SL-MKT) |
LMT |
jKey String |
Authentication token obtained from the login API | d9b4e1b1c7902 |
Libraries and SDKs
from thefirstock import thefirstock
modifyOrder = thefirstock.firstock_ModifyOrder(
userId="{{userId}}",
orderNumber="23111100000112",
quantity="1",
price="301",
triggerPrice="301",
exchange="NSE",
tradingSymbol="ITC-EQ",
priceType="LMT"
)
curl --location --request POST 'https://connect.thefirstock.com/api/V4/modifyOrder' \
--header 'Content-Type: application/json' \
--data-raw '{
"userId": "{{userID}}",
"exchange": "NSE",
"quantity": "250",
"price": "413",
"triggerPrice": "0",
"orderNumber": "",
"tradingSymbol": "",
"priceType": "LMT",
"jKey": "{{jKey}}"
}'
const Firstock = require("thefirstock");
const firstock = new Firstock();
firstock.modifyOrder(
{
userId: {{userId}},
orderNumber: "11030800009600",
price: "301",
quantity: "1",
triggerPrice: "301",
tradingSymbol: "ITC-EQ",
exchange: "NSE",
priceType: "LMT",
},
(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.modifyOrder(
userId: {{userId}},
orderNumber: "11030800009600",
price: "240",
quantity: "1",
triggerPrice: "265",
tradingSymbol: "ITC-EQ",
exchange: "NSE",
priceType: "LMT"
);
}
}
Success response details
Parameter | Description | Example |
---|---|---|
status string |
Indicates the success of the API request | success |
data.orderNumber string |
Unique identifier for the modified order | 1234567890111 |
data.requestTime string |
Timestamp indicating when the response was received |
14:51:30 15-02-2023 |
{
"status": "success",
"data": {
"requestTime": "14:51:30 15-02-2023",
"orderNumber": "1234567890111"
}
}
Failure response details
Parameter | Description | Example |
---|---|---|
status String |
Indicates the result status of the API operation |
failed |
code String |
HTTP status code associated with the error |
400 |
name String |
Specifies the type or category of the error encountered |
BAD REQUEST |
error.field String |
Type of order pricing | priceType |
error.message String |
Detailed message describing the error |
priceType cannot be undefined or NULL |
{
"status": "failed",
"code": "400",
"name": "BAD_REQUEST",
"error": {
"field": "priceType",
"message": "priceType cannot be undefined or NULL"
}
}