Place Regular Order

Place a single regular order into any supported broker account, from any client language.

POST https://apix.stocksdeveloper.in/trading/placeRegularOrder
WriteReturns an order id7 languagesBroker independent
In short

The Place Regular Order call places a single regular order into the trading account mapped to a pseudo account. The same call works across every client language and every supported broker. On success it returns an order id; on failure it returns an error message.

This call places a regular order. It is available in HTTP REST, Python, Java, C#, Excel, AmiBroker, and MetaTrader. For other order styles, see Place Cover Order, Place Bracket Order, and Place Advanced Order.

Code samples

Samples

HTTP

Example

curl https://apix.stocksdeveloper.in/trading/placeRegularOrder \
   -H "api-key: <your-api-key>" \
   -d "pseudoAccount=ACC_NAME" \
   -d "exchange=<exchange>" \
   -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 fields work as follows:

FieldMeaning
resultThe order id given by your trading platform.
statustrue on success. On error, it is false and message holds the error text.
commandIdUsed to trace the activity on AutoTrader Web.

Python

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

Java

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", "<exchange>", 
	"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();
}

The response object has a success() method, which returns true on successful execution. You can then use getResult() to read the order id given by your trading platform.

C#

Signature

/// <summary>
/// Places a regular order.
/// </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", "<exchange>", "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);
}

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 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", _
	"<exchange>", "SBIN", "BUY", "LIMIT", "INTRADAY", 100, 200.55, 0)

AmiBroker

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 places a regular market order for the account, exchange, and symbol chosen in the chart parameters. Some variables above are parameters defined by the AutoTrader library.

Example 2

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

This example passes the values directly instead of using chart parameters.

MetaTrader

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 places an order for the account, exchange, and symbol chosen in the chart parameters. Some variables above are parameters defined by the MetaTrader library.

Example 2

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

This example passes the values directly instead of using chart parameters.

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

ParameterDescription
accountnickname of the broker account (also known as pseudo account)
exchangeinstrument (stock/derivative) exchange
symbolinstrument (stock/derivative) symbol
tradeTypetrade type
orderTypeorder type
productTypeproduct type
quantityquantity
priceorder price
triggerPricetrigger price
validatevalidate order (check for duplicate signals). Only applicable for AmiBroker & MetaTrader.

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

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

Once the order is placed, you can track it with Read Orders, change it with Modify Order, or stop it with Cancel Order.

Was this page helpful?

Last updated 21 June 2026