Skip to content

BasketOrder ​

Place multiple orders simultaneously in a single API call. Ideal for portfolio rebalancing, multi-stock strategies, or executing correlated trades.

Endpoint URL ​

http
Local Host   :  POST http://127.0.0.1:5000/api/v1/basketorder
Ngrok Domain :  POST https://<your-ngrok-domain>.ngrok-free.app/api/v1/basketorder
Custom Domain:  POST https://<your-custom-domain>/api/v1/basketorder

Sample API Request ​

json
{
  "apikey": "<your_app_apikey>",
  "strategy": "Python",
  "orders": [
    {
      "symbol": "BHEL",
      "exchange": "NSE",
      "action": "BUY",
      "quantity": "1",
      "pricetype": "MARKET",
      "product": "MIS"
    },
    {
      "symbol": "ZOMATO",
      "exchange": "NSE",
      "action": "SELL",
      "quantity": "1",
      "pricetype": "MARKET",
      "product": "MIS"
    },
    {
      "symbol": "RELIANCE",
      "exchange": "NSE",
      "action": "BUY",
      "quantity": "1",
      "pricetype": "LIMIT",
      "product": "MIS",
      "price": "1180"
    }
  ]
}

Sample cURL Request ​

bash
curl -X POST http://127.0.0.1:5000/api/v1/basketorder \
  -H 'Content-Type: application/json' \
  -d '{
  "apikey": "<your_app_apikey>",
  "strategy": "Python",
  "orders": [
    {
      "symbol": "BHEL",
      "exchange": "NSE",
      "action": "BUY",
      "quantity": "1",
      "pricetype": "MARKET",
      "product": "MIS"
    },
    {
      "symbol": "ZOMATO",
      "exchange": "NSE",
      "action": "SELL",
      "quantity": "1",
      "pricetype": "MARKET",
      "product": "MIS"
    },
    {
      "symbol": "RELIANCE",
      "exchange": "NSE",
      "action": "BUY",
      "quantity": "1",
      "pricetype": "LIMIT",
      "product": "MIS",
      "price": "1180"
    }
  ]
}'

Sample API Response ​

json
{
  "status": "success",
  "results": [
    {
      "symbol": "BHEL",
      "exchange": "NSE",
      "product": "MIS",
      "status": "success",
      "orderid": "250408000999544"
    },
    {
      "symbol": "ZOMATO",
      "exchange": "NSE",
      "product": "MIS",
      "status": "success",
      "orderid": "250408000997545"
    },
    {
      "symbol": "RELIANCE",
      "exchange": "NSE",
      "product": "MIS",
      "status": "success",
      "orderid": "250408000997546"
    }
  ]
}

Failed legs carry only symbol, status, and message; exchange, product, and orderid are omitted. In analyzer mode the top level also carries "mode": "analyze".

Request Body ​

ParameterDescriptionMandatory/OptionalDefault Value
apikeyYour Tradeboard API keyMandatory-
strategyStrategy identifierMandatory-
ordersArray of order objectsMandatory-

Order Object Fields ​

ParameterDescriptionMandatory/OptionalDefault Value
symbolTrading symbolMandatory-
exchangeExchange code accepted by the shared validation constantsMandatory-
actionOrder action: BUY or SELLMandatory-
quantityPositive numeric order quantityMandatory-
pricetypePrice type: MARKET, LIMIT, SL, SL-MOptionalMARKET
productProduct type: MIS, CNC, NRMLOptionalMIS
priceOrder price (for LIMIT orders)Optional0
trigger_priceTrigger price (for SL orders)Optional0
disclosed_quantityDisclosed quantity for iceberg ordersOptional0

The top-level body accepts only apikey, strategy, and orders; each item in orders accepts only the eight fields above. Any other key, at either level, returns HTTP 400. In particular there is no per-order strategy field.

Response Fields ​

FieldTypeDescription
statusstring"success" if at least one order succeeded
resultsarrayArray of individual order results

Results Array Fields ​

FieldTypeDescription
symbolstringTrading symbol. Always present
statusstring"success" or "error". Always present
exchangestringExchange for the leg. Success entries only
productstringProduct for the leg. Success entries only
orderidstringOrder ID from broker. Success entries only
messagestringError message. Failure entries only

Notes ​

  • BUY orders are processed before SELL orders. Live execution uses concurrent batches of 10 with a one-second delay between batches.
  • Analyzer execution prefetches quotes and sends the ordered basket through the sandbox path.
  • If some orders fail, others still execute (partial success possible)
  • Each order in the basket is independent
  • Fractional quantities are accepted only for CRYPTO; non-crypto quantities must be whole numbers.
  • Rate limit: API_RATE_LIMIT, not ORDER_RATE_LIMIT
  • Use for:
    • Portfolio rebalancing: Buy/sell multiple stocks together
    • Pair trading: Simultaneous long/short positions
    • Index tracking: Replicating index constituents

Example Use Cases ​

Portfolio Rebalancing ​

json
{
  "apikey": "<your_app_apikey>",
  "strategy": "Rebalance",
  "orders": [
    {"symbol": "TCS", "exchange": "NSE", "action": "BUY", "quantity": "5", "pricetype": "MARKET", "product": "CNC"},
    {"symbol": "INFY", "exchange": "NSE", "action": "BUY", "quantity": "10", "pricetype": "MARKET", "product": "CNC"},
    {"symbol": "WIPRO", "exchange": "NSE", "action": "SELL", "quantity": "8", "pricetype": "MARKET", "product": "CNC"}
  ]
}

Pair Trading ​

json
{
  "apikey": "<your_app_apikey>",
  "strategy": "PairTrade",
  "orders": [
    {"symbol": "SBIN", "exchange": "NSE", "action": "BUY", "quantity": "100", "pricetype": "MARKET", "product": "MIS"},
    {"symbol": "BANKBARODA", "exchange": "NSE", "action": "SELL", "quantity": "200", "pricetype": "MARKET", "product": "MIS"}
  ]
}

Back to: API Documentation