Modify Order

Change an open order's type, quantity, price or trigger price, from any client language.

POST https://apix.stocksdeveloper.in/trading/modifyOrderByPlatformId
WriteReturns true on success7 languagesBroker independent
In short

The Modify Order call changes an open order's type, quantity, price or trigger price. Pass a blank string or zero for any parameter you do not want to change. The same call works across every client language and every supported broker. It returns true on success and false on failure.

This call modifies an open order’s attributes such as order type, quantity, price and trigger price. It is available in HTTP REST, Python, Java, C#, Excel, AmiBroker, and MetaTrader. To change only the price or only the quantity, see Modify Order Price and Modify Order Quantity.

Code samples

Samples

HTTP

Example

curl https://apix.stocksdeveloper.in/trading/modifyOrderByPlatformId \
   -H "api-key: <your-api-key>" \
   -d "pseudoAccount=ACC_NAME" \
   -d "platformId=120022012211" \
   -d "orderType=MARKET" \
   -d "quantity=20" \
   -d "price=0" \
   -d "triggerPrice=0"

To skip a parameter, pass a blank string for text parameters or zero for numeric parameters.

Response

{
    "result":true,
    "error":null,
    "message":null,
    "status":true,
    "commandId":"6d4b5738-c1aa-4623-b0c5-8df779e0f44d"
}

status is true on success. On error it is false, and message holds the error text.

Python

Signature

def modify_order_by_platform_id(self, \
	pseudo_account, platform_id, \
	order_type=None, quantity=None, \
	price=None, trigger_price=None):

Example

response = autotrader.modify_order_by_platform_id( \
	'XX1234', '201007000443194', price=325.9)
# response = autotrader.modify_order_by_platform_id('XX1234', '201007000443194', quantity=2)
# response = autotrader.modify_order_by_platform_id('XX1234', '201007000443194', trigger_price=322)
# response = autotrader.modify_order_by_platform_id('XX1234', '201007000443194', order_type='MARKET')

if response.success():
    print("Result: {0}".format(response.result))
else:
    print("Message: {0}".format(response.message))

Java

Signature

/**
 * Modifies the order as per the parameters passed.
 *
 * @param pseudoAccount pseudo account
 * @param platformId    platform id (id given to order by trading platform)
 * @param orderType     order type (pass null if you do not want to modify order
 *                      type)
 * @param quantity      quantity (pass zero if you do not want to modify
 *                      quantity)
 * @param price         price (pass zero if you do not want to modify price)
 * @param triggerPrice  trigger price (pass zero if you do not want to modify
 *                      trigger price)
 * @return <code>true</code> on success, <code>false</code> otherwise
 */
IOperationResponse<Boolean> modifyOrderByPlatformId
	(final String pseudoAccount, final String platformId,
	final OrderType orderType, final Integer quantity, 
	final Float price, final Float triggerPrice)

Example

// Places an order
final IOperationResponse<String> response = 
    autotrader.placeRegularOrder("ACC_NAME", "<exchange>", "SBIN",
    TradeType.BUY, OrderType.LIMIT, ProductType.INTRADAY, 
    10, 100.5f, 0f);
 
// Read order id
String orderId = null;
if (response.success()) {
    orderId = response.getResult();
} else {
    final String errorMessage = response.getMessage();
}
 
// Somewhere later in your code
 
// Modify the order
autotrader.modifyOrderByPlatformId("ACC_NAME", orderId, OrderType.MARKET, 20, 0, 0);

C#

Signature

/// <summary>
/// Modifies the order as per the parameters passed.
/// </summary>
/// <param name="pseudoAccount"> pseudo account </param>
/// <param name="platformId">    platform id (id given to order by trading platform) </param>
/// <param name="orderType">     order type (pass null if you do not want to modify order
///                      type) </param>
/// <param name="quantity">      quantity (pass null or zero if you do not want to modify
///                      quantity) </param>
/// <param name="price">         price (pass null or zero if you do not want to modify price) </param>
/// <param name="triggerPrice">  trigger price (pass null or zero if you do not want to modify
///                      trigger price) </param>
/// <returns> <code>true</code> on success, <code>false</code> otherwise </returns>
IOperationResponse<bool?> ModifyOrderByPlatformId(
	string pseudoAccount, string platformId, 
	OrderType? orderType, int? quantity, 
	float? price, float? triggerPrice);

Example

// Places an order
IOperationResponse<string> response = 
	autotrader.PlaceRegularOrder("ACC_NAME", 
	"<exchange>", "SBIN", TradeType.BUY, OrderType.LIMIT, 
	ProductType.INTRADAY, 10, 100.5f, 0f);

// Read order id
string orderId = null;
if (response.Success())
{
	orderId = response.Result;
}
else
{
	string errorMessage = response.Message;
}

// Somewhere later in your code

// Modify the order
autotrader.modifyOrderByPlatformId(
	"ACC_NAME", orderId, OrderType.MARKET, 20, 0, 0);

Excel

Signature

Public Function ModifyOrder( _
    PseudoAccount As String, _
    OrderId As String, _
    OrderType As String, _
    Quantity As Integer, _
    Price As Double, _
    TriggerPrice As Double) As Boolean

Example

orderId = PlaceOrder("ACC_NAME", 
    "<exchange>", "SBIN", "BUY", 
    "LIMIT", "INTRADAY", 10, 
    100.5, 0, True)
  
' Somewhere later in your code, 
' when you want to modify this order
  
' Modify the order
Call ModifyOrder("ACC_NAME", orderId, "MARKET", 
	20, 0, 0)

AmiBroker

Signature

function modifyOrder(account, orderId, orderType, 
	quantity, price, triggerPrice)

Example

orderId = placeOrder(AT_ACCOUNT, 
    AT_EXCHANGE, AT_SYMBOL, "BUY", 
    "LIMIT", AT_PRODUCT_TYPE, 10, 
    100.5, defaultTriggerPrice(), True);
  
// You can save this orderId in a static variable
saveStaticVariableText(AT_ACCOUNT, "ORDER_ID", orderId);
  
// Somewhere later in your code, 
// when you want to modify this order
  
// Read orderId from static variable
orderId = readStaticVariableText(AT_ACCOUNT, "ORDER_ID");
  
// Modify the order
modifyOrder(AT_ACCOUNT, orderId, "MARKET", 
	20, 0, 0);

MetaTrader

Signature

bool modifyOrder(string account, string orderId, 
	OrderType orderType, int quantity, 
	double price, double triggerPrice)

Example

string orderId = placeOrder(AT_ACCOUNT, 
    AT_EXCHANGE, "SBIN", SELL, LIMIT, INTRADAY, 10, 
    100.5, 0.0, true);
  
// You can even store the orderId 
// in a static variable
  
// Somewhere later in your code, 
// when you want to modify this order
  
modifyOrder(AT_ACCOUNT, "1595251087-30714", MARKET, 20, 0, 0);

Pass NULL or zero for any parameter you do not want to change.

Postman

Postman is a widely used tool for API testing. We provide a collection of all our APIs in Postman collection format. See the Postman collection guide to learn how to use it.

In this example, we change the order type from LIMIT to MARKET, the quantity from 10 to 20 and the price from 100.5 to 0.

Parameters

ParameterDescriptionSkip a change by passing
accountnickname of the broker account (also known as pseudo account)
orderTypeorder typeblank or NULL
quantityquantityzero
priceorder pricezero
triggerPricetrigger pricezero

Note on quantity: For derivatives on Indian stock exchanges, quantity should be a multiple of the lot size. For example, if a contract’s lot size is 15, then to buy or sell 1 lot you enter 15 quantity.

orderId by language

LanguagesorderId value
AmiBroker, Excel, MetaTraderpublisherId (orderId given by the placeOrder*() function)
Java, HTTP, C#, PythonplatformId (orderId given by the placeOrder*() function)

Return value

DirectJava · C# · Python · HTTP

The call returns the order id given by your trading platform.

BridgeExcel · AmiBroker · MetaTrader

The call returns the library order id. The Desktop Client passes the request on to your broker.

Notes

For AmiBroker, Excel and MetaTrader, this call sends a modify order request to the AutoTrader Desktop Client. It returns true on successful submission, otherwise false. For Java, HTTP, C# and Python, it returns a response object whose result is true on success and false otherwise.

Every broker limits how many times a single order can be modified. This limit changes from one broker to another, so please ask your specific broker for details. Make sure your code does not send a modify request for the same order beyond that limit. In such cases, cancel the order and place a fresh one.

Once modified, you can track the order with Read Orders or stop it with Cancel Order.

Was this page helpful?

Last updated 21 June 2026