• 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

Place Advanced Order

5151 views July 29, 2024 Pritesh 8

API function to place any kind of order. It is mostly useful when you want pass attributes which are normally kept to their default values. Some of those attributes are:

  • Validity
  • Disclosed Quantity

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

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

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", 
	"NSE", "SBIN", "BUY", "LIMIT", "INTRADAY", 
	100, 180.55, 0,	0, 0, 0,
	50, "DAY", False,
	-1, "Entering long", True);

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, NSE, "SBIN", BUY, 
	MARKET, INTRADAY, 1, 
	0.0, 0.0, 0, 0, 0, 0, DAY, false,
	defaultStrategyId(), "", true);

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("NSE").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 will place an order into your trading account that is mapped to the passed pseudo account. The function will return a response object.

Response object has a function called success(), which returns true on successful execution.

We can then use the method getResult() to access order_id given by your trading platform.

Parameters

  • order – the order object

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", "NSE", "SBIN", TradeType.BUY, 
	OrderType.LIMIT, ProductType.INTRADAY, 1, 400.3f, 0f, 0f, 0f, 0f, 0, 
	Validity.DAY, false, "", "", "");

This will place an order into your trading account that is mapped to the passed pseudo account. The function will return a response object.

Response object has a function called success(), which returns true on successful execution.

We can then use the method getResult() to access order_id given by your trading platform.

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

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 String

Example

Dim OrderId As String

OrderId = PlaceOrderAdvanced("REGULAR", "ACC_NAME", _
	"NSE", "SBIN", "BUY", "LIMIT", "INTRADAY", 100, 200.55, _
	0, 0, 0, 0, 50, "DAY", False, -1, "Going long...")

Example

curl https://api.stocksdeveloper.in/trading/placeAdvancedOrder \
   -H "api-key: <your_api_key>" \
   -d "variety=REGULAR" \
   -d "pseudoAccount=ACC_NAME" \
   -d "exchange=NSE" \
   -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"
}

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.


Parameters

  • variety – variety
  • account – pseudo account
  • exchange – instrument (stock/derivative) exchange
  • symbol – instrument (stock/derivative) symbol
  • tradeType – trade type
  • orderType – order type
  • productType – product type
  • quantity – quantity
    • 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
  • 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 order
  • validate – validate order (check for duplicate signals) . Only applicable for AmiBroker.

Return value

AmiBroker, MetaTrader, Excel

This function sends place order request to AutoTrader Desktop Client. On successful submission, it will return a unique publisherId (orderId given by AutoTrader library).

Java, HTTP

The function returns a platformId (orderId given by your trading platform).

The type of the return value is String or Text.

Place Bracket Order
Cancel Order

Was this helpful?

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

© 2025 Stocks Developer. All Rights Reserved.