Skip to content

Order Margin

You can view the margin requirement for the selected order before placing the order.

POST: /api/orderMargin

https://connect.thefirstock.com/api/orderMargin

Request Details

Parameter Description
userId Logged in User Id
actid Login users account ID
exchange NSE / NFO / BSE
tradingSymbol Trading Symbol (use url encoding to avoid special char error for symbols like M&M)
quantity Order Quantity
price Order Price
jKey Key Obtained on login success.
product C/M/I C -> Cash and Carry, M -> F&O Normal, I -> Intraday
transactionType B/S B -> BUY, S -> SELL
priceType LMT / MKT / SL-LMT / SL-MKT

Code

from thefirstock import thefirstock

oM = thefirstock.firstock_orderMargin(
    exchange='NSE',
    tradingSymbol='ITC-EQ',
    quantity='10',
    price='260',
    product='C',
    transactionType='B',
    priceType='LMT',
) 
curl -X POST 'https://connect.thefirstock.com/api/orderMargin' \
     -H 'Content-Type: application/json' \
     -d '{
          "userId": "",
          "actid": "",
          "exchange": "NSE",
          "tradingSymbol": "ITC-EQ",
          "quantity": "10",
          "price": "260",
          "product": "C",
          "transactionType": "B",
          "priceType": "LMT",
          "jKey": ""
        }'
const Firstock = require('thefirstock');

const firstock = new Firstock();

firstock.orderMargin({
    exchange:"",
    tradingSymbol:"",
    quantity:"",
    price:"",
    product:"",
    transactionType:"",
    priceType:"",
},(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.orderMargin(
        exchange: "NSE",
        tradingSymbol: "ITC-EQ",
        quantity: "10",
        price: "260",
        product: "C",
        transactionType: "B",
        priceType: "LMT"
      );
}
}

Response Details

Parameter Description
stat Ok or Not_Ok Place order success or failure indication
requestTime Response received time.
remarks This field will be available only on success.
cash Total credits available for order
marginused Total margin used.
emsg This will be present only if Order placement fails

Sample Response

{
"request_time":"23:48:13 29-05-2022",
"stat":"Ok","cash":"1717185.09",
"marginused":"2601.56",
"cash": "1717185.09",
"remarks":"Order Success"
}
{
"stat":"Not_Ok",
"request_time":"20:40:01 19-05-2020",
"emsg":"Error Occurred : 2 \"invalid input\""
}