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
Parameter | Description | Data type | Example |
---|---|---|---|
userId | User Id of the login user | String | "AA1999" |
exchange | NSE / NFO / BSE / BFO | String | "NSE" |
tradingSymbol | Trading Symbol (use url encoding to avoid special char error for symbols like M&M) | String | "ITC-EQ" |
quantity | Order Quantity | String | "10" |
price | Order Price | String | "260" |
jKey | Key Obtained on login success. | String | "d9b4e1b1c79042476fd96 11eed81003b2dc34c3f13b 0b60a4842fd5a24c9f3f2" |
product | C/M/I C -> Cash and Carry, M -> F&O Normal, I -> Intraday | String | "C" |
transactionType | B/S B -> BUY, S -> SELL | String | "B" |
priceType | LMT / MKT / SL-LMT / SL-MKT | String | "LMT" |
- cURL
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"
}'
from thefirstock import thefirstock
orderMargin = thefirstock.firstock_orderMargin(
exchange="NSE",
tradingSymbol="ITC-EQ",
quantity="1",
priceType="LMT",
product="C",
price="350",
transactionType="B"
)
const Firstock = require("thefirstock");
const firstock = new Firstock();
firstock.orderMargin(
{
exchange: "NSE",
tradingSymbol: "ITC-EQ",
quantity: "1",
price: "350",
product: "I",
transactionType: "B",
priceType: "LMT",
},
(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"
);
}
}
Success response details
Parameter | Description | Data types | Examples |
---|---|---|---|
Status | Success | String | "Success" |
data.requestTime | Response received time. | String | "14:31:41 15-02-2023" |
data.cash | This data to be sent in subsequent requests in jKey field and web socket connection while connecting. | String | "-141.37" |
data.marginused | Email Id | String | "523.05" |
data.remarks | This field will be available only on success. | String | "Insufficient Balance" |
Failure response details
Parameter | Description | Data Type | Example |
---|---|---|---|
status | Failed | String | "Failed" |
code | HTTP Code | String | "401" |
name | Type of error | String | "INVALID_USERID" |
error.field | Error field | String | "userid" |
error.message | Error message | String | "userid parameter is invalid" |
Sample response
- Success response
- Failure response
{
"status": "Success",
"data": {
"requestTime": "14:31:41 15-02-2023",
"cash": "-141.37",
"marginused": "523.05",
"remarks": "Insufficient Balance"
}
}
{
"status": "Failed",
"code": "401",
"name": "INVALID_USERID",
"error": {
"field": "userid",
"message": "userid parameter is invalid"
}
}