Skip to main content

Strategies

Multi place Order

This API allows us to place multiple orders up to 10, the order number of each order will be printed out as a list.

Method : POST

https://connect.thefirstock.com/api/V4/strategies/multiPlaceOrders

Request details

API Parameters
Parameter Description Data Types Example
userId
String
User Id of the login user String AA1999
data
List
List of place orders List list of place orders
jKey
String
Key Obtained on login success String 28fa3983bd7ae

Request details for data

Order Placement API Parameters
Parameter Description Example
data.exchange
String
NSE / NFO / BSE NSE
data.tradingSymbol
String
Trading Symbol (use URL encoding
for special characters)
ITC-EQ
data.quantity
String
Number of shares or contracts to be traded 10
data.price
String
Price at which the order is to be executed 260
data.triggerPrice
String
Trigger price for stop-loss orders 0
data.product
String
Product code indicating the type of trade
C -> Cash and Carry,
M -> F&O Normal,
I -> Intraday
C
transactionType
String
Transaction type, either Buy (B) or Sell (S) B
data.priceType
String
Type of order pricing
(e.g., LMT / MKT / SL-LMT / SL-MKT)
LMT
data.retention
String
Order validity terms
(e.g., DAY / EOS / IOC)
DAY
data.transactionType
String
B / S (B -> BUY, S -> SELL) S
data.remarks
String
Remarks or notes associated with the order place order

Libraries and SDKs

Tabbed Interface
from thefirstock import thefirstock

multiPlaceOrder = thefirstock.firstock_MultiPlaceOrder(
    userId="{{userId}}",
    dataList=[
        {
            "exchange": "NSE",
            "tradingSymbol": "ITC-EQ",
            "quantity": "1",
            "price": "0",
            "product": "I",
            "transactionType": "S",
            "priceType": "MKT",
            "retention": "DAY",
            "triggerPrice": "800",
            "remarks": "Test1"
        },
        {
            "exchange": "NSE",
            "tradingSymbol": "ITC-EQ",
            "quantity": "1",
            "price": "0",
            "product": "I",
            "transactionType": "S",
            "priceType": "MKT",
            "retention": "DAY",
            "triggerPrice": "800",
            "remarks": "Test2"
        },
        {
            "exchange": "NSE",
            "tradingSymbol": "ITC-EQ",
            "quantity": "1",
            "price": "0",
            "product": "I",
            "transactionType": "S",
            "priceType": "MKT",
            "retention": "DAY",
            "triggerPrice": "800",
            "remarks": "Test3"
        },
        {
            "exchange": "NSE",
            "tradingSymbol": "ITC-EQ",
            "quantity": "1",
            "price": "0",
            "product": "I",
            "transactionType": "S",
            "priceType": "MKT",
            "retention": "DAY",
            "triggerPrice": "800",
            "remarks": "Test1"
        }
    ]
)
curl --location --request POST 'https://connect.thefirstock.com/api/V4/strategies/multiPlaceOrders' \
--header 'Content-Type: application/json' \
--data-raw '{
    "userId": "{{userID}}",
    "jKey": "{{jKey}}",
    "data": [
        {
            "exchange": "NSE",
            "tradingSymbol": "ITC-EQ",
            "quantity": "250",
            "price": "413",
            "product": "C",
            "transactionType": "B",
            "priceType": "LMT",
            "retention": "DAY",
            "triggerPrice": "0",
            "remarks": "test1"
        },
        {
            "exchange": "NSE",
            "tradingSymbol": "ITC-EQ",
            "quantity": "250",
            "price": "413",
            "product": "C",
            "transactionType": "B",
            "priceType": "LMT",
            "retention": "DAY",
            "triggerPrice": "0",
            "remarks": "test1"
        },
        {
            "exchange": "NSE",
            "tradingSymbol": "ITC-EQ",
            "quantity": "250",
            "price": "413",
            "product": "C",
            "transactionType": "B",
            "priceType": "LMT",
            "retention": "DAY",
            "triggerPrice": "0",
            "remarks": "test1"
        }
    ]
}'
constFirstock = require("thefirstock");

constfirstock = newFirstock();
firstock.multiPlaceOrder(
  {
    data: [
      {
        userId: {{userId}},
        exchange: "NSE",
        tradingSymbol: "ITC-EQ",
        quantity: "1",
        price: "0",
        product: "I",
        transactionType: "S",
        priceType: "MKT",
        retention: "DAY",
        triggerPrice: "800",
        remarks: "Test1",
      },
    ],
  },
  (err, result) => {
    console.log("Error, ", err);
    console.log("Result: ", result);
  }
);
using thefirstock;

class Program
{
    public static void Main()
    {
      Firstock firstock = new Firstock();
      var result = firstock.multiPlaceOrder(userId: {{userId}},data: new List(){
                          new multiPlaceOrderObject{
                          exchange="NSE",
                          tradingSymbol="ITC-EQ",
                          quantity="1",
                          price="1200",
                          product="I",
                          transactionType="S",
                          priceType="MKT",
                          retention="DAY",
                          triggerPrice="800",
                          remarks="test"
                          }
                      }
                   );
      }
  }

Success response details

API Parameters
Parameter Description Example
status
String
Indicates the success status of the
API operation
success
data.requestTime
String
Time when the response was received 18:53:14 15-02-2023
data.orderNumber
String
Unique identifier of the order,
present only on successful placement
to OMS
1234567890111
[ 
  {  
    status: "success", 
    data: {   
      requestTime: "18:53:14 15-02-2023",
      orderNumber: "1234567890111",  
    },
  }, 
  {   
    status: "success",  
    data: {    
      requestTime: "18:53:14 15-02-2023",
      orderNumber: "1234567890111",   
    },  
  },
];

Failure response details

API Parameters
Parameter Description Example
status
String
Indicates the result status of the
API operation
failed
code
String
HTTP status code associated with the error 200
data
String
Data pertaining to the API response
or error
Invalid Session Key
[  
  {  
    status: "failed", 
    data: "Session Expired :  Invalid Session Key",
  },  
  {  
    status: "failed",
    data: "Session Expired :  Invalid Session Key",  
  },
];