Place CO Order
POST /order/placeOrderCO
This API allows you to place an equity/derivative order to the exchange i.e the place order request typically registers the order with OMS and when it happens successfully, a success response is returned. Successful placement of an order via the API does not imply its successful execution. To be precise, under normal scenarios, the whole flow of order execution starting with order placement, routing to OMS and transfer to the exchange, order execution, and confirmation from exchange happen real time. But due to various reasons like market hours, exchange related checks etc. This may not happen instantly. So when an order is successfully placed the placeOrder API returns an orderNumber in response, and in scenarios as above the actual order status can be checked separately using the orderStatus API call. This is for Placing CO Orders.
In the BFO exchange, only SENSEX and BANKEX trades are allowed.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
body | object | false | none |
symbolName | string | true | Pass "name" in the symbolName parameter for Equity Cash symbols and "Trading Symbol" for all the F&O contracts ('name' and 'tradingSymbol' are available in ScripMaster.csv). |
exchange | string | true | Name of the exchange. Valid exchange values are BSE, NSE, NFO, MCX, and CDS. If the user does not provide an exchange name, the default is NSE. For trading with BSE, NFO, CDS, and MCX, the exchange is mandatory. |
transactionType | string | true | Transaction type should be either BUY or SELL. |
orderType | string | true | Type of order. It can be one of the following: L (Limit Order). |
quantity | string | true | Quantity with which the order is being placed. |
disclosedQuantity | string | true | If provided, it should be a minimum of 10% of the actual quantity. |
price | string | true | Price at which the order will be placed. |
orderValidity | string | true | Order validity should be DAY. DAY is an order type which is valid for the whole trading day and stays pending until it is executed within the respective trading day. |
productType | string | true | Product type of the order. It can be CO (Cover Order). |
triggerPrice | string | false | The price at which an order should be triggered. |
Sample Request Body
requestBody={
"symbolName": "RELIANCE",
"exchange": "BSE",
"transactionType": "BUY",
"orderType": "L",
"quantity": "1",
"disclosedQuantity": "1",
"price": "1240.0",
"orderValidity": "DAY",
"productType": "CO",
"triggerPrice": "1070.00"
}Live trading endpoint
This sample sends a real request against your trading account. Replace <SESSION_TOKEN> and review every field before running — Samco does not provide a sandbox, and any successful call affects live positions and balances.
Sample Code
curl -X POST 'https://tradeapi.samco.in/order/placeOrderCO' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-session-token: <SESSION_TOKEN>' \
-d '{"symbolName":"RELIANCE","exchange":"BSE","transactionType":"BUY","orderType":"L","quantity":"1","disclosedQuantity":"1","price":"1240.0","orderValidity":"DAY","productType":"CO","triggerPrice":"1070.00"}'import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Sample {
public static void main(String[] args) throws Exception {
String requestBody = """
{
"symbolName": "RELIANCE",
"exchange": "BSE",
"transactionType": "BUY",
"orderType": "L",
"quantity": "1",
"disclosedQuantity": "1",
"price": "1240.0",
"orderValidity": "DAY",
"productType": "CO",
"triggerPrice": "1070.00"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://tradeapi.samco.in/order/placeOrderCO"))
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.header("x-session-token", "<SESSION_TOKEN>")
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.build();
HttpResponse<String> response =
client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}(async () => {
const headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-session-token': '<SESSION_TOKEN>',
};
const requestBody = {
symbolName: "RELIANCE",
exchange: "BSE",
transactionType: "BUY",
orderType: "L",
quantity: "1",
disclosedQuantity: "1",
price: "1240.0",
orderValidity: "DAY",
productType: "CO",
triggerPrice: "1070.00"
};
const response = await fetch('https://tradeapi.samco.in/order/placeOrderCO', {
method: 'POST',
headers,
body: JSON.stringify(requestBody),
});
const data = await response.json();
console.log(data);
})();import requests
import json
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-session-token': '<SESSION_TOKEN>',
}
requestBody = {
"symbolName": "RELIANCE",
"exchange": "BSE",
"transactionType": "BUY",
"orderType": "L",
"quantity": "1",
"disclosedQuantity": "1",
"price": "1240.0",
"orderValidity": "DAY",
"productType": "CO",
"triggerPrice": "1070.00"
}
r = requests.post('https://tradeapi.samco.in/order/placeOrderCO',
data=json.dumps(requestBody),
headers=headers)
print(r.json())Sample Responses
{
"serverTime": "12/12/19 16:20:11",
"msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
"orderNumber": "190726000001077",
"status": "Success",
"exchangeOrderStatus": "Executed",
"rejectionReason": "--",
"statusMessage": "CO Order request placed successfully",
"orderDetails": {
"pendingQuantity": "0",
"avgExecutionPrice": "1193.00",
"orderPlacedBy": "DV9999",
"tradingSymbol": "RELIANCE",
"triggerPrice": "0.00",
"exchange": "BSE",
"totalQuantity": "1",
"expiry": "--",
"transactionType": "BUY",
"productType": "CO",
"orderType": "L",
"quantity": "1",
"filledQuantity": "1",
"orderPrice": "1240.00",
"filledPrice": "1240.0",
"exchangeOrderNo": "1565067682526005486",
"orderValidity": "DAY",
"orderTime": "12/12/2019 16:20:09"
}
}Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
serverTime | string | Time at Server. |
msgId | string | This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request. |
orderNumber | string | Unique Order identifier generated after placing an order which could be used for tracking order status. |
status | string | Status of the order. It would be success or failure. |
exchangeOrderStatus | string | Status of the order execution at the Exchange side. Most common values are PENDING, COMPLETE, REJECTED, CANCELLED, and OPEN. |
rejectionReason | string | If an order is rejected, the cause of order rejection, which comes as a user-friendly textual description. |
statusMessage | string | Order placement status message. |
orderDetails | object | none. |
pendingQuantity | string | Quantity which is in a waiting state to be filled in a specific trade. |
avgExecutionPrice | string | Average price at which the quantities were bought/sold during the day. |
orderPlacedBy | string | Client code of the user who placed the order. |
tradingSymbol | string | Trading Symbol of the scrip. |
triggerPrice | string | The price at which an order should be triggered in the case of SL. |
exchange | string | Name of the exchange. Valid exchange values are BSE, NSE, NFO, MCX, and CDS. If not provided, the default is NSE. For trading with BSE, NFO, CDS, and MCX, the exchange is mandatory. |
totalQuantity | string | Total quantity. |
expiry | string | Expiry date of the trading symbol. |
transactionType | string | Type of the transaction, BUY / SELL. |
productType | string | Product type of the order as placed by the user is CO (Cover Order). |
orderType | string | Type of order the user has placed. It can be one of the following: L (Limit Order), SL (Stop Loss Limit). |
quantity | string | Order quantity as placed by the user. |
filledQuantity | string | Quantity filled in a specific trade. Can be less than or equal to the total quantity. |
orderPrice | string | Limit price entered at the time of placing the order. |
filledPrice | string | Price at which the exchange has filled the order. |
exchangeOrderNo | string | Order identifier at the exchange. |
orderValidity | string | Validity of the order. |
orderTime | string | Order placement time. |