Contract Analyser
POST /contractsAnalyser
The Contact Analyzer API serves as an indispensable tool for traders and financial analysts seeking to evaluate and optimize intricate trading strategies involving multiple contracts, particularly in the realm of options trading. By delivering a comprehensive and detailed report that covers both performance metrics and risk assessments, the API enables users to gain profound insights into the nuances of their strategies. It provides critical data such as breakeven points, maximum profit, maximum loss, strategy Greeks, risk-reward ratio, estimated margins, and payoff points, accompanied by graphs. This empowers users to make well-informed, data-driven decisions with confidence. By offering an in-depth breakdown of every critical aspect of the strategy, including potential profits, losses, risk parameters, and various payoff scenarios, the Contact Analyzer API becomes an essential resource for those striving to enhance their decision-making processes in the complex and dynamic landscape of financial markets.
Parameter
| Name | Type | Required | Description |
|---|---|---|---|
exchange | string | true | Specifies the exchange where the contracts are traded. Valid values: NFO, BFO. |
contracts | object | true | A list of contract details being analyzed. |
tradingSymbol | string | true | The symbol representing the contract. |
transactionType | string | true | The type of transaction, either "Buy" or "Sell." |
price | string | true | The price at which the contract is being traded. |
lot | string | true | The number of lots associated with the contract. |
targetDate | string | true | The date for which the analysis is being performed. |
Sample Request Body
requestBody={
"exchange": "NFO",
"contracts": [
{
"tradingSymbol": "HDFCBANK24OCT1510CE",
"transactionType": "Buy",
"price": "152.75",
"lot": "2"
},
{
"tradingSymbol": "HDFCBANK24SEP1510CE",
"transactionType": "SELL",
"price": "1342.75",
"lot": "2"
}
],
"targetDate": "2024-10-11"
}Sample Code
curl -X POST 'https://tradeapi.samco.in/contractsAnalyser' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-session-token: <SESSION_TOKEN>' \
-d '{"exchange":"NFO","contracts":[{"tradingSymbol":"HDFCBANK24OCT1510CE","transactionType":"Buy","price":"152.75","lot":"2"},{"tradingSymbol":"HDFCBANK24SEP1510CE","transactionType":"SELL","price":"1342.75","lot":"2"}],"targetDate":"2024-10-11"}'import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Sample {
public static void main(String[] args) throws Exception {
String requestBody = """
{
"exchange": "NFO",
"contracts": [
{
"tradingSymbol": "HDFCBANK24OCT1510CE",
"transactionType": "Buy",
"price": "152.75",
"lot": "2"
},
{
"tradingSymbol": "HDFCBANK24SEP1510CE",
"transactionType": "SELL",
"price": "1342.75",
"lot": "2"
}
],
"targetDate": "2024-10-11"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://tradeapi.samco.in/contractsAnalyser"))
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.header("x-session-token", "<SESSION_TOKEN>")
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.build();
HttpResponse<String> response =
client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}(async () => {
const headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-session-token': '<SESSION_TOKEN>',
};
const requestBody = {
exchange: "NFO",
contracts: [
{
tradingSymbol: "HDFCBANK24OCT1510CE",
transactionType: "Buy",
price: "152.75",
lot: "2"
},
{
tradingSymbol: "HDFCBANK24SEP1510CE",
transactionType: "SELL",
price: "1342.75",
lot: "2"
}
],
targetDate: "2024-10-11"
};
const response = await fetch('https://tradeapi.samco.in/contractsAnalyser', {
method: 'POST',
headers,
body: JSON.stringify(requestBody),
});
const data = await response.json();
console.log(data);
})();import requests
import json
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-session-token': '<SESSION_TOKEN>',
}
requestBody = {
"exchange": "NFO",
"contracts": [
{
"tradingSymbol": "HDFCBANK24OCT1510CE",
"transactionType": "Buy",
"price": "152.75",
"lot": "2"
},
{
"tradingSymbol": "HDFCBANK24SEP1510CE",
"transactionType": "SELL",
"price": "1342.75",
"lot": "2"
}
],
"targetDate": "2024-10-11"
}
r = requests.post('https://tradeapi.samco.in/contractsAnalyser',
data=json.dumps(requestBody),
headers=headers)
print(r.json())Sample Response
{
"serverTime": "09/09/24 12:16:08",
"msgId": "cc1569f6-e666-4759-8590-4fefa538ce4e",
"status": "Success",
"statusMessage": "Contracts analysis report is successfully generated.",
"analyseReport": {
"strategyInfo": {
"symbol": "1333_NSE",
"symbolName": "HDFCBANK",
"change": "2.45",
"changePer": "0.15",
"exchange": "NSE",
"noOfStrategyLegs": 2,
"strategyLegs": [
{
"tradingSymbol": "HDFCBANK24OCT1510CE",
"symName": "HDFCBANK",
"symbol": "107396_NFO",
"optionType": "CE",
"instrument": "OPTSTK",
"expiry": "31 Oct 24",
"lotSize": "550",
"quantity": "1100",
"lTP": "165.55",
"avgPrc": "152.75",
"askPrice": "0.00",
"bidPrice": "0.00",
"openInterest": "0",
"strategyLegType": "LONG CALL",
"strategyExpiryType": "Next expiry",
"upperCktLimit": "16555.00",
"lowerCktLimit": "0.05",
"tickSize": "0.05"
},
{
"tradingSymbol": "HDFCBANK24SEP1510CE",
"symName": "HDFCBANK",
"symbol": "78225_NFO",
"optionType": "CE",
"instrument": "OPTSTK",
"expiry": "26 Sep 24",
"lotSize": "550",
"quantity": "1100",
"lTP": "148.8",
"avgPrc": "1342.75",
"askPrice": "0.00",
"bidPrice": "0.00",
"openInterest": "0",
"strategyLegType": "SHORT CALL",
"strategyExpiryType": "Current expiry",
"upperCktLimit": "14880.00",
"lowerCktLimit": "0.05",
"tickSize": "0.05"
}
],
"breakeven1": "NA",
"breakeven2": "0.00",
"maxProfit": "13,49,308",
"sMaxProfit": "13,49,308(1265%)",
"maxLoss": "13,10,536",
"sMaxLoss": "13,10,536(1229%)",
"sNetTheta": "0.000000",
"sNetDelta": "0.000000",
"sNetGamma": "0.000000",
"sNetVega": "0.000000",
"sRRRatio": "1: 1.03",
"estimatedMargin": "1,06,632.57",
"targetExpiryDate": "26 Sep 24",
"lotSize": "550",
"plDataByPricePointPayoffChart": [
{
"pricePoint": 1380,
"pricePointProfitLoss": 1310536,
"pricePointProfitLossOnUserExpiry": 1309155
},
{
"pricePoint": 1381,
"pricePointProfitLoss": 1310582,
"pricePointProfitLossOnUserExpiry": 1309161
},
{
"pricePoint": 1382,
"pricePointProfitLoss": 1310630,
"pricePointProfitLossOnUserExpiry": 1309169
},
{
"pricePoint": 1382,
"pricePointProfitLoss": 1310678,
"pricePointProfitLossOnUserExpiry": 1309176
}
]
}
}
}{
"serverTime": "14/05/24 13:49:07",
"status": "Failure",
"statusMessage": "No Symbol found for the provided symbol name and exchange."
}Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
serverTime | string | The timestamp of when the response was generated, indicating the server's current time. |
msgId | string | A unique identifier for the request, useful for tracking and debugging. |
status | string | The status of the API response. It can be either 'Success', 'Error', or 'Failure'. |
statusMessage | string | A message providing additional details about the status of the request. |
analyseReport | Object | The core of the response containing the detailed analysis of the strategy. |
strategyInfo | Object | A summary of the strategy being analyzed. |
symbol | string | An internal symbol code used by the system to represent the strategy. |
symbolName | string | The name of the underlying asset in the strategy. |
change | string | The change in price for the underlying asset. |
changePer | string | The percentage change in price for the underlying asset. |
exchange | string | The exchange where the asset is listed. |
noOfStrategyLegs | string | The number of legs or positions in the strategy. A strategy can involve multiple contracts (legs). |
strategyLegs | array | Details of each leg in the strategy. |
tradingSymbol | string | The symbol of the contract. |
symName | string | The underlying asset's name. |
symbol | string | The internal symbol code used by the system. |
optionType | string | The type of option (e.g., Call (CE) or Put (PE)). |
instrument | string | The type of financial instrument. |
expiry | string | The expiry date of the contract. |
lotSize | string | The number of units in a lot. |
quantity | string | Total quantity involved in the leg (lot size * lots). |
lTP | string | The last traded price of the contract. |
avgPrc | string | The average price at which the contract was executed. |
askPrice | string | The current ask price. |
bidPrice | string | The current bid price. |
openInterest | string | The current open interest of the contract. |
strategyLegType | string | The type of leg (e.g., "LONG CALL" or "SHORT CALL"). |
strategyExpiryType | string | Indicates whether the expiry is current or next. |
upperCktLimit | string | The upper circuit limit of the contract. |
lowerCktLimit | string | The lower circuit limit of the contract. |
tickSize | string | The minimum price movement of the contract. |
breakeven1 | string | The first breakeven point for the strategy, representing the price level where neither profit nor loss is made. |
breakeven2 | string | The second breakeven point, set at "0.00" here. |
maxProfit | string | The maximum profit that can be achieved with the strategy. |
sMaxProfit | string | The maximum profit shown with the percentage of profit relative to the investment. |
maxLoss | string | The maximum potential loss with the strategy. |
sMaxLoss | string | The maximum loss shown with the percentage of loss relative to the investment. |
sNetTheta | string | The net Theta of the strategy, representing the time decay of options. |
sNetDelta | string | The net Delta of the strategy, representing the price sensitivity to the underlying asset. |
sNetGamma | string | The net Gamma of the strategy, representing the rate of change of Delta. |
sNetVega | string | The net Vega of the strategy, representing the sensitivity to volatility. |
sRRRatio | string | The risk-reward ratio of the strategy. |
estimatedMargin | string | The estimated margin required to execute the strategy. |
targetExpiryDate | string | The target expiry date for the strategy. |
lotSize | string | The lot size used in the strategy. |
plDataByPricePointPayoffChart | array | An array of objects representing the profit/loss at different price points. |
pricePoint | string | The price point of the underlying asset. |
pricePointProfitLoss | string | The profit or loss at that price point. |
pricePointProfitLossOnUserExpiry | string | The profit or loss at that price point on the user-defined expiry date. |