• 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 Regular Order

19374 views July 29, 2024 Pritesh 7

API function to place regular order. APIs are available in AmiBroker, MetaTrader, Excel, Java, C#, Python, HTTP REST.

Api function will place a regular order on Supports leading Indian Stock Brokers.

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

Signature

function placeOrder(account, exchange, symbol, 
	tradeType, orderType, productType, 
	quantity, price, triggerPrice, validate)

Example 1

orderId = placeOrder(AT_ACCOUNT, AT_EXCHANGE, AT_SYMBOL, 
		"BUY", "MARKET", AT_PRODUCT_TYPE, AT_QUANTITY, 
		buyPrice, defaultTriggerPrice(), True);

This example will place a Regular Market order for Account, Exchange & Symbol chosen in chart parameters.

Some variables used in above code are parameters defined by AutoTrader library.

Example 2

orderId = placeOrder("ACC_NAME", "NSE", 
	"BANKNIFTY_25-JUN-2020_FUT", 
	"BUY", "MARKET", "INTRADAY", 15, 
	buyPrice, defaultTriggerPrice(), True);

This example will place Regular Market order for Account (ACC_NAME), Exchange (NSE) & Symbol (BankNifty June 2020 Future).

Here we did not use chart parameters, instead we passed the values directly.

Signature

string placeOrder(string account, Exchange exchange, 
	string symbol, TradeType tradeType, 
	OrderType orderType, ProductType productType, 
	int quantity, double price, double triggerPrice, 
	bool validate)

Example 1

string id = placeOrder(AT_ACCOUNT, 
	AT_EXCHANGE, AT_SYMBOL, SELL, 
	LIMIT, INTRADAY, 
	1, 192.45, 0.0, true);

This example will place a Regular Market order for Account, Exchange & Symbol chosen in chart parameters.

Some variables used in above code are parameters defined by MetaTrader library.

Example 2

string id = placeOrder("XX2030", 
	NSE, "BANKNIFTY_24-SEP-2020_FUT", 
	BUY, LIMIT, INTRADAY, 
	25, 22400.45, 0.0, true);

In this example, we are not using any chart parameters. Instead, we are directly passing the values.

Signature

/**
 * Places a regular order.
 *
 * @param pseudoAccount pseudo account
 * @param exchange      exchange
 * @param symbol        symbol
 * @param tradeType     trade type
 * @param orderType     order type
 * @param productType   product type
 * @param quantity      quantity
 * @param price         price
 * @param triggerPrice  trigger price
 * @return the order id given by your stock broker
 */
IOperationResponse<String> placeRegularOrder(
	String pseudoAccount, String exchange, 
	String symbol, TradeType tradeType, 
	OrderType orderType, ProductType productType, 
	int quantity, float price, float triggerPrice);

Example

// Place a regular order
final IOperationResponse<String> response = autotrader
	.placeRegularOrder("ACC_NAME", "NSE", 
	"BANKNIFTY_25-JUN-2020_FUT", TradeType.BUY, 
	OrderType.MARKET, ProductType.INTRADAY, 20, 0f, 0f);

// Read order id
String orderId = null;
if (response.success()) {
	orderId = response.getResult();
} else {
	final 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.

Signature

/// <summary>
/// Places a regular order. For more information, please see <a href=
/// "https://stocksdeveloper.in/documentation/api/place-regular-order/">api
/// docs</a>.
/// </summary>
/// <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>
/// <returns> the order id given by your stock broker </returns>
IOperationResponse<String> PlaceRegularOrder(
	string pseudoAccount, string exchange, 
	string symbol, TradeType tradeType, 
	OrderType orderType, ProductType productType, 
	int quantity, float price, float triggerPrice);

Example

IOperationResponse<string> response = 
	autoTrader.PlaceRegularOrder( "XX1234", "NSE", "SBIN", 
	TradeType.BUY, OrderType.LIMIT, ProductType.INTRADAY, 
	2, 214.55f, 0);

if(response.Success()) {
	Console.WriteLine("Result: {0}", response.Result);
}
else {
	Console.WriteLine("Message: {0}", response.Message);
}

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 Result property to access order_id given by your trading platform.

Signature

def place_regular_order(self, pseudo_account, \
	exchange, symbol, tradeType, orderType, \
	productType, quantity, price, triggerPrice=0.0):

Example

response = autotrader.place_regular_order( \
	'XX1234', 'NSE', 'BANKNIFTY_25-JUN-2020_FUT', 'BUY', 'LIMIT', \
	'INTRADAY', 25, 23700.35, 0.0)

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

Example

curl https://api.stocksdeveloper.in/trading/placeRegularOrder \
   -H "api-key: <your_api_key>" \
   -d "pseudoAccount=ACC_NAME" \
   -d "exchange=NSE" \
   -d "symbol=BANKNIFTY_25-JUN-2020_FUT" \
   -d "tradeType=BUY" \
   -d "orderType=MARKET" \
   -d "productType=INTRADAY" \
   -d "quantity=20" \
   -d "price=0" \
   -d "triggerPrice=0"

Response

{
	"result":"200622000325378",
	"error":null,
	"message":null,
	"status":true,
	"commandId":"dea02c25-4c10-4a78-81dc-8da1e42ff0eb"
}

The response contains result (which is order_id given by your trading platform).

If there is any error, then you will get status as false & message will have error text.

The commandId cab be used to trace the activity on AutoTrader Web.

Signature

Public Function PlaceOrder( _
    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) As String

Example

Dim OrderId As String

OrderId = PlaceOrder("ACC_NAME", _
	"NSE", "SBIN", "BUY", "LIMIT", "INTRADAY", 100, 200.55, 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.


Parameters

  • 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
  • validate – validate order (check for duplicate signals). Only applicable for AmiBroker & MetaTrader.

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, C#, Python

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

The type of the return value is String or Text.

API
Place Cover Order

Was this helpful?

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

© 2025 Stocks Developer. All Rights Reserved.