Place Advanced Order
Place any kind of order with full control over attributes other order calls keep at their defaults.
https://apix.stocksdeveloper.in/trading/placeAdvancedOrder The Place Advanced Order call places any kind of order on a mapped trading account. Use it when you need to set attributes that other order functions keep at their defaults, such as validity and disclosed quantity. It works across AmiBroker, MetaTrader, Java, C#, Python, Excel and HTTP, on leading Indian stock brokers. On success it returns an order id; on failure it returns an error message.
This call places an advanced order. It is most useful when you want to pass attributes that are normally kept at their default values, for example validity and disclosed quantity. For simpler cases, see Place Regular Order and Place Bracket Order.
Code samples
HTTP
Example
curl https://apix.stocksdeveloper.in/trading/placeAdvancedOrder \
-H "api-key: <your-api-key>" \
-d "variety=REGULAR" \
-d "pseudoAccount=ACC_NAME" \
-d "exchange=<exchange>" \
-d "symbol=SBIN" \
-d "tradeType=SELL" \
-d "orderType=MARKET" \
-d "productType=INTRADAY" \
-d "quantity=1" \
-d "price=0" \
-d "triggerPrice=0" \
-d "amo=false" \
-d "validity=DAY"Response
{
"result":"200622000325378",
"error":null,
"message":null,
"status":true,
"commandId":"dea02c25-4c10-4a78-81dc-8da1e42ff0eb"
}The response fields work as follows:
| Field | Meaning |
|---|---|
result | The order id given by your trading platform. |
status | true on success. On error, it is false and message holds the error text. |
commandId | Used to trace the activity on AutoTrader Web. |
Python
Signature
def place_advanced_order(self, variety, pseudo_account,
exchange, symbol, tradeType, orderType,
productType, quantity, price, triggerPrice,
target, stoploss, trailingStoploss,
disclosedQuantity, validity, amo,
strategyId, comments, publisherId):Example
response = autotrader.place_advanced_order( \
'REGULAR', '159401', '<exchange>', 'SBIN', 'SELL', 'LIMIT', 'INTRADAY', \
1, 410.35, 0.0, 0.0, 0.0, 0.0, 0, 'DAY', False, '', '', '')
if response.success():
print("Result: {0}".format(response.result))
else:
print("Message: {0}".format(response.message))Java
Signature
/**
* Places an order.
*
* @param order order object
* @return the order id given by your stock broker
*/
IOperationResponse<String> placeOrder(Order order);Example
// Create a pseudo account
final PseudoAccount account = new PseudoAccount();
account.setKey("ACC_NAME");
// Create an order
final Order order = Order.builder().account(account).
tradeType(TradeType.BUY).orderType(OrderType.LIMIT)
.exchange("<exchange>").symbol("SBIN").quantity(1)
.price(187.6f).productType(ProductType.INTRADAY).build();
// Place an order
final IOperationResponse<String> response = autotrader.placeOrder(order);
// Extract order id from response
String orderId = null;
if (response.success()) {
// Order id given by your trading platform
orderId = response.getResult();
} else {
String errorMessage = response.getMessage();
}This places an order into the trading account that is mapped to the passed pseudo account. The response object has a success() method, which returns true on successful execution. You can then call getResult() to read the order id given by your trading platform.
C#
Signature
/// <summary>
/// Places an advanced order. For more information, please see <a href=
/// "https://stocksdeveloper.in/documentation/api/place-advanced-order/">api
/// docs</a>.
/// </summary>
/// <param name="variety"> variety </param>
/// <param name="pseudoAccount"> pseudo account </param>
/// <param name="exchange"> exchange </param>
/// <param name="symbol"> symbol </param>
/// <param name="tradeType"> trade type </param>
/// <param name="orderType"> order type </param>
/// <param name="productType"> product type </param>
/// <param name="quantity"> quantity </param>
/// <param name="price"> price </param>
/// <param name="triggerPrice"> trigger price </param>
/// <param name="target"> target (Bracket order) </param>
/// <param name="stoploss"> stoploss (Bracket order) </param>
/// <param name="trailingStoploss"> trailingStoploss (Bracket order) </param>
/// <param name="disclosedQuantity"> disclosedQuantity </param>
/// <param name="validity"> validity </param>
/// <param name="amo"> amo (indicates an After Market Order) </param>
/// <param name="strategyId"> strategyId (kept for future use) </param>
/// <param name="comments"> comments (optional) </param>
/// <param name="publisherId"> publisherId (optional) </param>
/// <returns> the order id given by your stock broker </returns>
IOperationResponse<String> PlaceAdvancedOrder(Variety variety,
string pseudoAccount, string exchange, string symbol,
TradeType tradeType, OrderType orderType, ProductType productType,
int quantity, float price, float triggerPrice, float target, float stoploss,
float trailingStoploss, int disclosedQuantity, Validity validity, bool amo,
string strategyId, string comments, string publisherId);Example
IOperationResponse<string> response = autoTrader.PlaceAdvancedOrder(
Variety.REGULAR, "MM01515", "<exchange>", "SBIN", TradeType.BUY,
OrderType.LIMIT, ProductType.INTRADAY, 1, 400.3f, 0f, 0f, 0f, 0f, 0,
Validity.DAY, false, "", "", "");This places an order into the trading account that is mapped to the passed pseudo account. The response object has a Success() method, which returns true on successful execution. You can then use the Result property to read the order id given by your trading platform.
Excel
Signature
Public Function PlaceOrderAdvanced(Variety As String, _
PseudoAccount As String, _
Exchange As String, _
Symbol As String, _
TradeType As String, _
OrderType As String, _
ProductType As String, _
Quantity As Integer, _
Price As Double, _
TriggerPrice As Double, _
Target As Double, _
Stoploss As Double, _
TrailingStoploss As Double, _
DisclosedQuantity As Integer, _
Validity As String, _
Amo As Boolean, _
StrategyId As Integer, _
Comments As String) As StringExample
Dim OrderId As String
OrderId = PlaceOrderAdvanced("REGULAR", "ACC_NAME", _
"<exchange>", "SBIN", "BUY", "LIMIT", "INTRADAY", 100, 200.55, _
0, 0, 0, 0, 50, "DAY", False, -1, "Going long...")AmiBroker
Signature
function placeOrderAdvanced(variety, account,
exchange, symbol,
tradeType, orderType, productType,
quantity, price, triggerPrice,
target, stoploss, trailingStoploss,
disclosedQuantity, validity, amo,
strategyId, comments, validate)Example
orderId = placeOrderAdvanced("REGULAR", "ACC_NAME",
"<exchange>", "SBIN", "BUY", "LIMIT", "INTRADAY",
100, 180.55, 0, 0, 0, 0,
50, "DAY", False,
-1, "Entering long", True);MetaTrader
Signature
string placeOrderAdvanced(Variety variety, string account,
Exchange exchange, string symbol,
TradeType tradeType, OrderType orderType,
ProductType productType, int quantity,
double price, double triggerPrice, double target,
double stoploss, double trailingStoploss,
int disclosedQuantity, Validity validity, bool amo,
int strategyId, string comments, bool validate)Example
string id = placeOrderAdvanced(REGULAR,
AT_ACCOUNT, AT_EXCHANGE, "SBIN", BUY,
MARKET, INTRADAY, 1,
0.0, 0.0, 0, 0, 0, 0, DAY, false,
defaultStrategyId(), "", true);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.
Parameters
| Parameter | Description |
|---|---|
| variety | variety |
| account | nickname of the broker account (also known as pseudo account) |
| exchange | instrument (stock/derivative) exchange |
| symbol | instrument (stock/derivative) symbol |
| tradeType | trade type |
| orderType | order type |
| productType | product type |
| quantity | quantity |
| price | order price |
| triggerPrice | trigger price |
| target | target for bracket order |
| stoploss | stoploss for bracket order |
| trailingStoploss | trailing stoploss for bracket order |
| disclosedQuantity | disclosed quantity |
| validity | validity |
| amo | After Market Order |
| strategyId | strategy id (kept for future use). Keep it -1 for now |
| comments | any comments you might want to add to the order |
| validate | validate order (check for duplicate signals). Only applicable for AmiBroker. |
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.
Return value
The call returns the order id given by your trading platform.
The call returns the library order id. The Desktop Client passes the request on to your broker.
Notes
Once the order is placed, you can track it with Read Orders, change it with Modify Order, or stop it with Cancel Order. For related order types, see Place Bracket Order.
Thanks for the feedback. Still stuck? Contact support.
Last updated 21 June 2026