• Home
  • Products
    • Login
    • Product Info
    • User Guide
    • Pricing
  • Services
    • Stock Brokers
    • Freelancers
  • Help
    • Documentation
    • Knowledge Base
    • FAQ
  • Company
    • About Us
    • Contact Us
    • Terms & Conditions
  • Home
  • Products
    • Login
    • Product Info
    • User Guide
    • Pricing
  • Services
    • Stock Brokers
    • Freelancers
  • Help
    • Documentation
    • Knowledge Base
    • FAQ
  • Company
    • About Us
    • Contact Us
    • Terms & Conditions

AutoTrader Web

home/Documentation/AutoTrader Web
Expand All Collapse All
  • Index
  • Getting Started
  • Portfolio Management System (PMS)
  •  Copy Trading (Master-Child Auto-Copy)
    • Master-Child Copy - Performance
  • PMS vs Master-Child
  • Trading View
  •  Supported Brokers
    • Symphony XTS
    • Zerodha
    • Angel Broking
    • Dhan
    • Aliceblue
    • Fyers
    • Nuvama
    • IIFL
    • Zebu
    • Finvasia
    • Motilal Oswal
    • Kotak
    • Mastertrust
    • Five Paisa
    • Choice Broking
    • FlatTrade
    • Tradejini
    • Upstox
    • SAS Online
    • Profitmart
  •  Client Setup
    • Desktop Client
    • AmiBroker Library
    • Excel Library or Tools
    • Java Library
    • MetaTrader Library
    • C# Library
    • Python Library
    • HTTP REST
  •  User Interface
    • User Registration
    •   Settings
      • General
      • Trading Accounts
      • Pseudo Accounts
      • Group Accounts
      • API Key
    •   AutoTrader
      • Activity
      • Instruments
    •   Trading
      • Summary
      • Positions
      • Orders
      • Margins
      • Holdings
      • Trade
    •   User
      • Account
      • Profile
  •  API (Application Programming Interface)
    • Place Regular Order
    • Place Cover Order
    • Place Bracket Order
    • Place Advanced Order
    • Cancel Order
    • Cancel Child Orders
    • Cancel All Orders
    • Modify Order
    • Modify Order Price
    • Modify Order Quantity
    • Square-off Position
    • Square-off Portfolio
    • Read Orders
    • Read Positions
    • Read Margins
    • Read Holdings
    • Read Portfolio Summary
    • Fetch All Trading Accounts
    • Create or Update Trading Account
    • Validate Trading Account Credentials
    • API Parameters
    • API Rate Limits
    • Email Limits
    • Postman
  • Pricing
  • Precautions
  •  Broker Independence
    • API Functions
    • Pseudo Account
    • Instruments (Trading Symbols)
  • Quantity Multiplier
  • Architecture

Modify Order

3811 views July 29, 2024 Pritesh 3

API function to modify an open order’s attributes like order type, quantity, price & trigger price. APIs are available in AmiBroker, MetaTrader, Excel, Java, C#, Python, HTTP REST.

Api function will modify an order on Supports leading Indian Stock Brokers.

  • AmiBroker
  • MetaTrader
  • Java
  • C#
  • Python
  • HTTP
  • Excel
  • Postman

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);

Signature

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

Example 1

string orderId = placeOrder(AT_ACCOUNT, 
    NSE, "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 mpdify this order
  
modifyOrder(AT_ACCOUNT, "1595251087-30714", MARKET, 20, 0, 0);

User must pass NULL or zero for those parameters which they do not want to change.

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", "NSE", "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);

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", 
	"NSE", "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);

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))

Example

curl https://api.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"

If you do not want to modify a certain parameter then pass blank string for text parameters or zero for numeric parameter.

Response

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

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", 
    "NSE", "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)

Postman is widely used tool for API testing. We have provided below a collection of all of our APIs in postman collection format. Click postman collection to know more about how to use it.

In this example, we are changing order type from “LIMIT” to “MARKET”, quantity from 10 to 20 & price form 100.5 to 0.


Parameters

  • account – pseudo account
  • orderType – order type (pass blank or NULL if you don’t want to change)
  • quantity – quantity (pass zero if you don’t want to change)
    • Note: For NSE/BSE derivatives, quantity should be multiple of lot size. Example, BANKNIFTY lot size is 15. So to buy/sell 1 lot, you need to enter 15 quantity.
  • price – order price (pass zero if you don’t want to change)
  • triggerPrice – trigger price (pass zero if you don’t want to change)

AmiBroker, Excel, MetaTrader

  • orderId – publisherId (orderId given by placeOrder*() function)

Java, HTTP, C#, Python

  • orderId – platformId (orderId given by placeOrder*() function)

Return value

AmiBroker, Excel, MetaTrader

This function sends a modify order request to AutoTrader Desktop Client. On successful submission, it will return True, otherwise False

Java, HTTP, C#, Python

Returns a response object, with result being True on success, False otherwise.

The type of the return value is Boolean.

Important

Every broker has a limit on how many times a single order can be modified. For example, Zerodha does not allow you to modify an order more than 20 times. This limit changes from one broker to another. So please ask your specific broker for details.

Make sure your code does not send modify request for the same order beyond the limit set by your stock broker. You must cancel that order and place a fresh order in such cases.

Cancel All Orders
Modify Order Price

Was this helpful?

3 Yes  No
Related Articles
  • Master-Child Copy – Performance
  • Tradejini
  • Dhan
  • FlatTrade
  • Supported Brokers
  • Symphony XTS

© 2025 Stocks Developer. All Rights Reserved.