Skip to content

Basket Margin


POST: /apiV2/basketMargin

https://connect.thefirstock.com/apiV2/basketMargin

Request Details

Parameter Description
userId Logged in User Id
data Noren order number
jKey Key Obtained on login success.

Request Details for Data

Parameter Description
exchange NSE / NFO / BSE/ MCX
tradingSymbol Unique id of contract on which order to be placed. (use urlencoding to avoid special char error for symbols like M&M)
quantity Order Quantity
transactionType B -> BUY, S -> SELL

Code

curl -X POST 'https://connect.thefirstock.com/apiV2/basketMargin' \
     -H 'Content-Type: application/json' \
     -d '{
        "userId": "",
        "jKey": "",
        "exchange": "",
        "tradingSymbol": "",
        "quantity": "",
        "transactionType": "",
        "price": "",
        "product": "",
        "priceType": "",
        "data": [
                {
                    "exchange": "",
                    "tradingSymbol": "",
                    "quantity": "",
                    "transactionType": "",
                    "price": "",
                    "product": "",
                    "priceType": ""
                },
                {
                    "exchange": "",
                    "tradingSymbol": "",
                    "quantity": "",
                    "transactionType": "",
                    "price": "",
                    "product": "",
                    "priceType": ""
                }
            ]
        }'
from thefirstock import thefirstock

basketMargin = thefirstock.firstock_BasketMargin(
exchange="NFO",
tradingSymbol="",
quantity="50",
transactionType="S",
price="17000",
product="M",
priceType="LMT",
data=[
        {
            "exchange": "NFO",
            "tradingSymbol": "",
            "quantity": "50",
            "transactionType": "S",
            "price": "0",
            "product": "M",
            "priceType": "LMT"
        },
        {
            "exchange": "NFO",
            "tradingSymbol": "",
            "quantity": "50",
            "transactionType": "S",
            "price": "0",
            "product": "M",
            "priceType": "LMT"
        }
    ]
)
const Firstock = require('thefirstock');

const firstock = new Firstock();

firstock.basketMargin(
{
 exchange: "",
 tradingSymbol: "",
 quantity: "",
 transactionType: "",
 price: "",
 product: "",
 priceType: "",
 data: [
   {
     exchange: "",
     tradingSymbol: "",
     quantity: "",
     transactionType: "",
     price: "",
     product: "",
     priceType: "",
   },
   {
     exchange: "",
     tradingSymbol: "",
     quantity: "",
     transactionType: "",
     price: "",
     product: "",
     priceType: "",
   },
 ],
},
(err, result) => {
    console.log("Error, ", err);
    console.log("Result: ", result);
}
);
using thefirstock;

       var result = firstock.basketMargin(exchange: "BSE",
                                      tradingSymbol: "SAIL01DEC22P99",
                                      quantity: "1",
                                      transactionType: "S",
                                      price: "350",
                                      product: "C",
                                      priceType: "lmt",
                                      data: new List<basketMarginObject>()
                                      {
                                         new basketMarginObject(
                                             exchange: "BSE",
                                             tradingSymbol:"SAIL01DEC22P99",
                                             quantity:"1",
                                             transactionType:"S",
                                             price:"350",
                                             priceType:"lmt",
                                             product:"C"
                                              )
                                      }
                                      );

Response Details

Parameter Description
Status Success or Failed
data.request_time Response received time.
data.remarks This field will contain rejection reason.
data.marginused Total margin used.
data.marginusedtrade Margin used after trade
data.emsg This will be present only if Order placement fails

Response data will be in json format with below fields in case of failure:

Parameter Description
detail.Status Failed
data.requestTime Response received time.
detail.data Type of error

Sample Response

{
"Status": "Success",
"data": {
        "request_time": "",
        "stat": "",
        "marginused": "",
        "marginusedtrade": "",
        "remarks": ""
        }
    }
{
 "Status": "Failed",
 "data": "",
 "requestTime": ""
}