Skip to main content

Order margin

Margin trading refers to the activity of buying or selling where an individual increases his/her possible returns on investment by investing more than they can afford to

Before placing your order, you have the option to review the margin requirement for your selected order.

Method: POST

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

Request details

ParameterDescriptionData typeExample
userIdUser Id of the login userString"AA1999"
exchangeNSE / NFO / BSE / BFOString"NSE"
tradingSymbolTrading Symbol (use url encoding to avoid special char error for symbols like M&M)String"ITC-EQ"
quantityOrder QuantityString"10"
priceOrder PriceString"260"
jKeyKey Obtained on login success.String"d9b4e1b1c79042476fd96
11eed81003b2dc34c3f13b
0b60a4842fd5a24c9f3f2"
productC/M/I C -> Cash and Carry, M -> F&O Normal, I -> IntradayString"C"
transactionTypeB/S B -> BUY, S -> SELLString"B"
priceTypeLMT / MKT / SL-LMT / SL-MKTString"LMT"
curl --location 'https://connect.thefirstock.com/api/V3/orderMargin' \
--header 'Content-Type: application/json' \
--data '{
"userId": "AA123",
"exchange": "NSE",
"tradingSymbol": "ITC-EQ",
"quantity": "1",
"price": "350",
"product": "C",
"transactionType": "B",
"priceType": "LMT",
"jKey": "e6a211bea63adff386578988e1cf4a9521c4744e6a39ad63174c8797e2af8c38"
}'

Success response details

ParameterDescriptionData typesExamples
StatusSuccessString"Success"
data.requestTimeResponse received time.String"14:31:41 15-02-2023"
data.cashThis data to be sent in subsequent requests in jKey field and web socket connection while connecting.String"-141.37"
data.marginusedEmail IdString"523.05"
data.remarksThis field will be available only on success.String"Insufficient Balance"

Failure response details

ParameterDescriptionData TypeExample
statusFailedString"Failed"
codeHTTP CodeString"401"
nameType of errorString"INVALID_USERID"
error.fieldError fieldString"userid"
error.messageError messageString"userid parameter is invalid"

Sample response

{
"status": "Success",
"data": {
"requestTime": "14:31:41 15-02-2023",
"cash": "-141.37",
"marginused": "523.05",
"remarks": "Insufficient Balance"
}
}