Place Cover Order
Place a cover order, a market or limit order paired with a compulsory stop-loss trigger price.
https://apix.stocksdeveloper.in/trading/placeCoverOrder The Place Cover Order call places a cover order across leading Indian stock brokers. The same function is available in AmiBroker, MetaTrader, Excel, Java, C#, Python and the HTTP REST API. On success it returns an order id; on failure it returns an error message. Confirm your broker supports cover orders before using it.
A cover order is a market or limit order paired with a compulsory stop-loss trigger price. Use this call to place one from any supported client. Cover orders work only on brokers that offer them on their own platform, so availability changes from broker to broker. The simplest way to check is to place a small sample cover order and see if it goes through; if you get an error, your broker may not support it — contact support or suggest it as a feature request and we will look into it. For related order types, see Place Regular Order and Place Bracket Order.
Code samples
HTTP
Example
curl https://apix.stocksdeveloper.in/trading/placeCoverOrder \
-H "api-key: <your-api-key>" \
-d "pseudoAccount=ACC_NAME" \
-d "exchange=<exchange>" \
-d "symbol=SBIN" \
-d "tradeType=BUY" \
-d "orderType=LIMIT" \
-d "quantity=10" \
-d "price=180.5" \
-d "triggerPrice=180"Response
{
"result":"200622000333410",
"error":null,
"message":null,
"status":true,
"commandId":"6d4b5738-c1aa-4623-b0c5-8df779e0f44d"
}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_cover_order(self, pseudo_account, \
exchange, symbol, tradeType, orderType, \
quantity, price, triggerPrice):Example
response = autotrader.place_cover_order( \
'XX1234', '<exchange>', 'SBIN', 'SELL', 'LIMIT', \
1, 188.15, 190.0)
if response.success():
print("Result: {0}".format(response.result))
else:
print("Message: {0}".format(response.message))Java
Signature
/**
* Places a cover order.
*
* @param pseudoAccount pseudo account
* @param exchange exchange
* @param symbol symbol
* @param tradeType trade type
* @param orderType order type
* @param quantity quantity
* @param price price
* @param triggerPrice trigger price
* @return the order id given by your stock broker
*/
IOperationResponse<String> placeCoverOrder(
String pseudoAccount, String exchange,
String symbol, TradeType tradeType,
OrderType orderType, int quantity,
float price, float triggerPrice);Example
// Place a cover order
final IOperationResponse<String> response =
autotrader.placeCoverOrder("ACC_NAME",
"<exchange>", "SBIN", TradeType.BUY, OrderType.LIMIT,
10, 180.5f, 180f);
// Read order id
String orderId = null;
if (response.success()) {
orderId = response.getResult();
} else {
final String errorMessage = response.getMessage();
}This places a cover order into the trading account mapped to the passed pseudo account. The response object has a success() method, which returns true on successful execution. Use getResult() to read the order id given by your trading platform.
C#
Signature
/// <summary>
/// Places a cover order. For more information, please see <a href=
/// "https://stocksdeveloper.in/documentation/api/place-cover-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="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> PlaceCoverOrder(
string pseudoAccount, string exchange,
string symbol, TradeType tradeType,
OrderType orderType, int quantity,
float price, float triggerPrice);Example
IOperationResponse<string> response =
autoTrader.PlaceCoverOrder("XX1234",
"<exchange>", "SBIN", TradeType.SELL,
OrderType.MARKET, 3, 0, 218.4f);
if(response.Success()) {
Console.WriteLine("Result: {0}", response.Result);
}
else {
Console.WriteLine("Message: {0}", response.Message);
}This places an order into the trading account mapped to the passed pseudo account. The response object has a Success() method, which returns true on successful execution. Use the Result property to read the order id given by your trading platform.
Excel
Signature
Public Function PlaceCoverOrder( _
PseudoAccount As String, _
Exchange As String, _
Symbol As String, _
TradeType As String, _
OrderType As String, _
Quantity As Integer, _
Price As Double, _
TriggerPrice As Double) As StringExample
Dim OrderId As String
OrderId = PlaceCoverOrder("ACC_NAME", _
"<exchange>", "SBIN", "BUY", "LIMIT", 100, 200.55, 0)AmiBroker
Signature
function placeCoverOrder(account, exchange,
symbol, tradeType, orderType,
quantity, price, triggerPrice, validate)Example 1
// Apply your logic to calculate stoploss trigger price
stoplossTriggerPrice = buyPrice - 5;
// Place cover order
orderId = placeCoverOrder(AT_ACCOUNT, AT_EXCHANGE,
AT_SYMBOL, "BUY", "LIMIT", AT_QUANTITY,
buyPrice, stoplossTriggerPrice, True);This places a cover order for the account, exchange and symbol chosen in the chart parameters. Some variables used above are parameters defined by the AutoTrader library.
Example 2
// Apply your logic to calculate stoploss trigger price
stoplossTriggerPrice = buyPrice - 5;
// Place cover order (Market)
orderId = placeCoverOrder("ACC_NAME", "<exchange>",
"SBIN", "BUY", "MARKET", 10,
0, stoplossTriggerPrice, True);This places a MARKET cover order with quantity 10, so the order price is zero. Here the values are passed directly instead of using chart parameters.
MetaTrader
Signature
string placeCoverOrder(string account,
Exchange exchange, string symbol,
TradeType tradeType, OrderType orderType,
int quantity, double price,
double triggerPrice, bool validate)Example 1
// Apply your logic to calculate stoploss trigger price
double stoplossTriggerPrice = buyPrice - 5;
// Place cover order
string id = placeCoverOrder(AT_ACCOUNT,
AT_EXCHANGE, AT_SYMBOL, BUY, LIMIT, 1,
192, stoplossTriggerPrice, true);This places a cover order for the account, exchange and symbol chosen in the chart parameters. Some variables used above are parameters defined by the MetaTrader library.
Example 2
// Apply your logic to calculate stoploss trigger price
double stoplossTriggerPrice = buyPrice - 5;
// Place cover order (Market)
string id = placeCoverOrder("XX2030",
AT_EXCHANGE, "SBIN", BUY, MARKET, 10,
0, stoplossTriggerPrice, true);This places a MARKET cover order with quantity 10, so the order price is zero.
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 |
|---|---|
| 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 |
| quantity | quantity |
| price | order price |
| triggerPrice | trigger price |
| validate | validate order (check for duplicate signals). Only applicable for AmiBroker and 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
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
Your broker must support cover orders on our platform. Try placing a cover order from our platform’s trading terminal first to confirm whether it is supported.
For related order types, see Place Regular Order and Place Bracket Order.
Thanks for the feedback. Still stuck? Contact support.
Last updated 22 June 2026