NAV Navigation
JavaScript Python

StockNote API Documentation v1.0

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

StockNote API is a set of Rest APIs using which users can build customized applications based on their trading requirements. It facilitates the users of the APIs to login, search symbols, place orders and execute them, view their order status, positions and holdings etc. This documentation provides you with all the necessary details to understand the SAMCO StockNote API collection. APIs are compatible with both Javascript and Python.

For any issues or support, please raise ticket to us using the support link and we will be happy to assist you.

For Reference you can download postman collection Click here

For downloading a list of all tradeable scrips across exchanges please Click here This is a CSV file which you can import into your database.

If you are using Python,Java or JavaScript as client platform to code your strategies and integrate with our APIs, you can use our StockNoteBridge which provides pre-written wrappers over StockNote APIs that ensure seamless and reliable connectivity to the APIs and help you fast-track your development process.

LanguagesDocumentation
PythonPython SDK Documentation
JavaJava SDK Documentation
JavaScriptNodeJS SDK Documentation

Add 'session token' of login api response as 'x-session-token' in header param of all Apis.

NOTE: To ensure stability and there by provide seamless services to our customers, Samco may set limits on your use of the StockNote APIs (for example, limit on the number of requests sent to a specific API) . If you have additional questions regarding the rate limits on APIs, please reach out to us using the support link and we will be happy to assist you.

APIs will work intermittently over the weekends/holidays and outside market hours due to maintenance activity.

Base URLs:

User Login

User Login

Code samples

var headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'

};

$.ajax({
  url: 'https://api.stocknote.com/login',
  method: 'post',
  data: JSON.stringify(requestBody),
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('https://api.stocknote.com/login'
, data=json.dumps(requestBody)
, headers = headers)

print r.json()

POST /login

The StockNote APIs allow the user authentication using the Login API. A valid StockNote Trading Account and subscription to StockNote API Services is a pre-requisite for successful authentication. For Example, if you are going to use 3 users for Trading using APIs, all the 3 users will have to open a StockNote Trading Account and will have to subscribe to StockNote API Services.

Body parameter

requestBody={
  "userId": "DV99999",
  "password": "abc1234",
  "yob": "1975"
}

Parameters

Name Type Required Description
body object false none
userId string true The client Code provided to you by SAMCO after opening an account.
password string true If user has set password using any of the SAMCO Trading platform i.e. Stocknote Mobile App, Stocknote Web or Stockbasket, then use the password as set. Or else, use the password provided in the welcome email sent to you at the time of account opening.
yob string true Your year of birth.

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMessage": "Request successful",
  "sessionToken": "078131a2d0d5877ecbf2a130e16acd78",
  "accountID": "DV99999",
  "accountName": "FirstName LastName",
  "exchangeList": "NFO,NSE,CDS",
  "orderTypeList": "L, MKT, SL",
  "productList": "CNC, CO, MIS,NRML"
}

Responses

Status Meaning Description
200 OK Login Successful. Session token, which is used as authenticator for all requests after login is generated after successful login.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error.Login failure.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
status string Login Success or Failure.
statusMessage string status Message
sessionToken string Session token that should be used with API request is given in the response. It is used as an authenticator. A session token is valid for 24 hours or until a new login request is given, where you a new session token will be generated and the previous one will get expired.
accountID string Same as Client Code for SAMCO Trading Account, is unique and used for identification of user.
accountName string Users full name as registered with Samco Trading Account.
exchangeList [string] List of exchanges enabled for trading for the user.
orderTypeList [string] List of order types enabled for trading for the user.The list can be from of the following, MKT - Market Order,L- Limit Order,SL - Stop Loss Limit,SL-M - Stop loss market.
productList [string] List of product types enabled for the user . It can be CNC (Cash and Carry),BO (Bracket Order),CO (Cover Order),NRML (Normal),MIS (Intraday).

Search Equity & Derivative

Search Equity scrips

Code samples

var headers = {
  'Accept':'application/json',
  'x-session-token':'115aead43798e35cef8308c15cc79c7a'

};

$.ajax({
  url: 'https://api.stocknote.com/eqDervSearch/search?searchSymbolName=INFY',
  method: 'get',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Accept': 'application/json',
  'x-session-token': '115aead43798e35cef8308c15cc79c7a'
}

r = requests.get('https://api.stocknote.com/eqDervSearch/search', params={
  'searchSymbolName': 'INFY'
}, headers = headers)

print r.json()

GET /eqDervSearch/search

This API is used to search equity, derivatives and commodity scrips based on user provided search symbol and exchange name.

Parameters

Name Type Required Description
exchange string false Name of the exchange.Valid exchanges values (BSE/ NSE/ NFO/ MCX/ CDS).If the user does not provide an exchange name, by default considered as NSE.For trading with BSE, NFO, CDS and MCX, exchange is mandatory.
searchSymbolName string true Trading Symbol of the scrip to be searched

Example responses

200 Response

{
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMessage": "Request successful",
  "searchResults": [
    {
      "exchange": "NSE",
      "scripDescription": "INFOSYS LIMITED",
      "tradingSymbol": "INFY-EQ",
      "isin": "INE009A01021",
      "bodLotQuantity": "string",
      "tickSize": "0.05",
      "instrument": "FUTIDX",
      "quantityInLots": "10"
    }
  ]
}

Responses

Status Meaning Description
200 OK Scrip details successfully retrived.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. Failed to retrieve scrip details.

Response Schema

Status Code 200

Name Type Description
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
status string Response status. Can be Success or Failure
statusMessage string status Message
searchResults [object] Scrips Details available for the provided search text.
exchange string Name of the exchange.Valid exchanges values (BSE/ NSE/ NFO/ MCX/ CDS).If the user does not provide an exchange name, by default considered as NSE.For trading with BSE, NFO, CDS and MCX, exchange is mandatory.
scripDescription string scrip description
tradingSymbol string Trading Symbol of the scrip.
isin string The standard ISIN representing stocks uniquely at international level. It is same for every exchange.
bodLotQuantity string none
tickSize string The value of a single price tick. Default value is 0.05
instrument string Instrument Name.
quantityInLots string Lot size of the symbol to be traded. At the time of placing order, the quantity should be in multiples of Broadlot Qty only.

Quote

Index Quote

Code samples

var headers = {
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/quote/indexQuote?indexName=Sensex',
  method: 'get',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.get('https://api.stocknote.com/quote/indexQuote', params={
  'indexName': 'Sensex'
}, headers = headers)

print r.json()

GET /quote/indexQuote

Getting Index Quote details for a specific Indicies. This helps user with market picture of an specific Index Details.

Parameters

Name Type Required Description
indexName string true Index name of the scrip.

Example responses

200 Response

{
  "serverTime": "23/07/20 11:05:43",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMessage": "Index Quote details retrieved successfully.",
  "indexName": "Sensex",
  "listingId": "-101",
  "lastTradedTime": "23/07/2020 11:05:39",
  "lastTradedPrice": "37871.52",
  "spotPrice": "38015.28",
  "changePercentage": "9.82",
  "lastTradedQuantity": "1",
  "averagePrice": "1586.50",
  "openValue": "37871.52",
  "highValue": "37871.52",
  "lowValue": "37871.52",
  "closeValue": "37871.52",
  "totalBuyQuantity": "50092",
  "totalSellQuantity": "49421",
  "totalTradedValue": "9.6437187 (Lacs)",
  "totalTradedVolume": "603",
  "openInterest": "5",
  "getoIChangePer": "13.57"
}

Responses

Status Meaning Description
200 OK Index Quote details retrieved successfully.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. Failed to get Index details.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
status string Response status. Can be Success or Failure
statusMessage string Status message of the Quote request
indexName string Index Name of the indices.
listingId string Identifier assigned to the scrip by exchange in the format <>_<>
lastTradedTime string Time of the last transaction
lastTradedPrice string Price at which last transaction / trade is done
spotPrice string Spot price. Applicable in case of Futures and Options
changePercentage string Percentage of change between the current value and the previous day's market close
lastTradedQuantity string Quantity of last transaction
averagePrice string average price of a market snapshot
openValue string Opening price of a market snapshot
highValue string High value of market snapshot
lowValue string Low value of market snapshot
closeValue string Close value of market snapshot
totalBuyQuantity string Total quantity of BUY transaction
totalSellQuantity string Total quantity of SELL transaction
totalTradedValue string Value of total trade made for the scrip
totalTradedVolume string Total volume of trading done
openInterest string Open interest is the Number of existing contracts held by buyers or sellers for any market for any given day.
getoIChangePer string It will shows the change % based on Open Interest

Get Quote

Code samples

var headers = {
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/quote/getQuote?symbolName=RELIANCE',
  method: 'get',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.get('https://api.stocknote.com/quote/getQuote', params={
  'symbolName': 'RELIANCE'
}, headers = headers)

print r.json()

GET /quote/getQuote

Get market depth details for a specific equity scrip including but not limited to values like last trade price, previous close price, change value, change percentage, bids/asks, upper and lower circuit limits etc. This helps user with market picture of an equity scrip using which he will be able to place an order.

Parameters

Name Type Required Description
exchange string false Name of the exchange.Valid exchanges values (BSE/ NSE/ NFO/ MCX/ CDS).If the user does not provide an exchange name, by default considered as NSE.For trading with BSE, NFO, CDS and MCX, exchange is mandatory.
symbolName string true Symbol name of the scrip.For Equity enter SymbolName of the scrip & For Derivatives enter TradingSymbol of the scrip

Example responses

200 Response

{
  "serverTime": "15/10/19 17:27:43",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMessage": "Quote details retrieved successfully.",
  "symbolName": "RELIANCE",
  "tradingSymbol": "RELIANCE",
  "exchange": "NSE",
  "companyName": "RELIANCE INDUSTRIES LTD",
  "lastTradedTime": "03/12/2019 12:05:39",
  "lastTradedPrice": "1600.00",
  "previousClose": "1456.90",
  "changeValue": "143.10",
  "changePercentage": "9.82",
  "lastTradedQuantity": "1",
  "lowerCircuitLimit": "1427.85",
  "upperCircuitLimit": "1745.15",
  "averagePrice": "1599.29",
  "openValue": "1586.50",
  "highValue": "1600.00",
  "lowValue": "1575.50",
  "closeValue": "1456.90",
  "totalBuyQuantity": "50092",
  "totalSellQuantity": "49421",
  "totalTradedValue": "9.6437187 (Lacs)",
  "totalTradedVolume": "603",
  "yearlyHighPrice": "1614.45",
  "yearlyLowPrice": "1055.00",
  "tickSize": "0.05",
  "openInterest": "5",
  "bestBids": [
    {
      "number": "2",
      "quantity": "88",
      "price": "1575.55"
    }
  ],
  "bestAsks": [
    {
      "number": "2",
      "quantity": "88",
      "price": "1575.55"
    }
  ],
  "expiryDate": "26 Dec, 2019 - 14:30:0",
  "spotPrice": "1578.35",
  "instrument": "EQ",
  "lotQuantity": "500",
  "listingId": "2885_NSE",
  "openInterestChange": "285500",
  "getoIChangePer": "13.57"
}

Responses

Status Meaning Description
200 OK Successfully retrived market depth details for the input scrip.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. Failed to get market depth of scrip.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
status string It would be success or failure
statusMessage string Status message of the Quote request
symbolName string Symbol name of the scrip.
tradingSymbol string Trading Symbol of the scrip.
exchange string Name of the exchange.Valid exchanges values (BSE/ NSE/ NFO/ MCX/ CDS).If the user does not provide an exchange name, by default considered as NSE.For trading with BSE, NFO, CDS and MCX, exchange is mandatory.
companyName string Full name of the company
lastTradedTime string Time of the last transaction
lastTradedPrice string Price at which last transaction / trade is done
previousClose string Previous close refers to the prior day's final price of a security when the market officially closes for the day
changeValue string Change value is the difference between the current value and the previous day's market close
changePercentage string Percentage of change between the current value and the previous day's market close
lastTradedQuantity string Quantity of last transaction
lowerCircuitLimit string Limit below which a stock price cannot trade on a particular trading day
upperCircuitLimit string Limit above which a stock price cannot trade on a particular trading day
averagePrice string Average price of the trading
openValue string Opening price of a market snapshot
highValue string High value of market snapshot
lowValue string Low value of market snapshot
closeValue string Close value of market snapshot
totalBuyQuantity string Total quantity of BUY transaction
totalSellQuantity string Total quantity of SELL transaction
totalTradedValue string Value of total trade made for the scrip
totalTradedVolume string Total volume of trading done
yearlyHighPrice string 52 week high
yearlyLowPrice string 52 week low
tickSize string The value of a single price tick. Default value is 0.05
openInterest string Open interest is the Number of existing contracts held by buyers or sellers for any market for any given day.
bestBids [object] Most frequent trading bids for BUY
number string Sequence number for Bid/Ask
quantity string Quantity asked for trading.
price string Price asked for trading.
bestAsks [object] Most frequent trading asked for SELL
number string Sequence number for Bid/Ask
quantity string Quantity asked for trading.
price string Price asked for trading.
expiryDate string Expiry date of the scrip
spotPrice string Spot price. Applicable in case of Futures and Options
instrument string Instrument Name.
lotQuantity string Lot quantity. Applicable for F & O
listingId string Identifier assigned to the scrip by exchange in the format <>_<>
openInterestChange string It shows Open interest change in Number of contracts held for market
getoIChangePer string It will shows the change % based on Open Interest

Option

Option Chain

Code samples

var headers = {
  'Accept':'application/json',
  'x-session-token':'115aead43798e35cef8308c15cc79c7a'

};

$.ajax({
  url: 'https://api.stocknote.com/option/optionChain?searchSymbolName=TCS',
  method: 'get',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Accept': 'application/json',
  'x-session-token': '115aead43798e35cef8308c15cc79c7a'
}

r = requests.get('https://api.stocknote.com/option/optionChain', params={
  'searchSymbolName': 'TCS'
}, headers = headers)

print r.json()

GET /option/optionChain

This API is used to search OptionChain for equity, derivatives and commodity scrips based on user provided search symbol and exchange name.

Parameters

Name Type Required Description
exchange string false Name of the exchange.Valid exchanges values (BSE/ NSE/ NFO/ MCX/ CDS).If the user does not provide an exchange name, by default considered as NSE.For trading with BSE, NFO, CDS and MCX, exchange is mandatory.
searchSymbolName string true Trading Symbol of the scrip to be searched
expiryDate string false From date in yyyy-MM-dd
strikePrice string false The strike price is the predetermined price at which a put buyer can sell the underlying asset
optionType string false Option Type (PE/CE).

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMessage": "Request successful",
  "optionChainDetails": [
    {
      "tradingSymbol": "TCS20JUN2800CE",
      "exchange": "NFO",
      "symbol": "64790_NFO",
      "strikePrice": "2800.00",
      "expiryDate": "25 Jun 2020",
      "instrument": "OPTSTK",
      "optionType": "CE",
      "underLyingSymbol": "TCS",
      "spotPrice": "2045.80",
      "lastTradedPrice": "0.00",
      "openInterest": "0",
      "openInterestChange": "0",
      "oichangePer": "0",
      "volume": "0",
      "bestBids": [
        {
          "number": "2",
          "quantity": "88",
          "price": "1575.55"
        }
      ],
      "bestAsks": [
        {
          "number": "2",
          "quantity": "88",
          "price": "1575.55"
        }
      ]
    }
  ]
}

Responses

Status Meaning Description
200 OK OptionChain details retrived successfully.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. Failed to retrieve scrip details.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
status string Response status. Can be Success or Failure
statusMessage string status Message
optionChainDetails [object] Scrips Details available for the provided search text.
tradingSymbol string Trading Symbol of the scrip.
exchange string Name of the exchange.Valid exchanges values (BSE/ NSE/ NFO/ MCX/ CDS).If the user does not provide an exchange name, by default considered as NSE.For trading with BSE, NFO, CDS and MCX, exchange is mandatory.
symbol string Symbol Code of the trading Symbol
strikePrice string The strike price is the predetermined price at which a put buyer can sell the underlying asset.
expiryDate string Shows expiry date of a trading symbol.
instrument string Instrument Name.
optionType string Option Type (PE/CE).
underLyingSymbol string Root symbol of TradingSymbol
spotPrice string Spot price. Applicable in case of Futures and Options
lastTradedPrice string Price at which last transaction / trade is done
openInterest string Open interest is the Number of existing contracts held by buyers or sellers for any market for any given day.
openInterestChange string It shows Open interest change in Number of contracts held for market
oichangePer string It will shows the change % based on Open Interest
volume string Limit amount of a security traded on the specific day
bestBids [object] Most frequent trading bids for BUY
number string Sequence number for Bid/Ask
quantity string Quantity asked for trading.
price string Price asked for trading.
bestAsks [object] Most frequent trading asked for SELL
number string Sequence number for Bid/Ask
quantity string Quantity asked for trading.
price string Price asked for trading.

User Limits

User Limits

Code samples

var headers = {
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/limit/getLimits',
  method: 'get',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.get('https://api.stocknote.com/limit/getLimits'
,headers = headers)
print r.json()

GET /limit/getLimits

Gets the user cash balances, available margin for trading in equity and commodity segments.

Parameters

Name Type Required Description

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMessage": "Request successful",
  "equityLimit": {
    "grossAvailableMargin": "50000000000",
    "payInToday": "0",
    "notionalCash": "0",
    "collateralMarginAgainstShares": "0",
    "marginUsed": "27380.9",
    "netAvailableMargin": "49999972619.1"
  },
  "commodityLimit": {
    "grossAvailableMargin": "50000000000",
    "payInToday": "0",
    "notionalCash": "0",
    "collateralMarginAgainstShares": "0",
    "marginUsed": "27380.9",
    "netAvailableMargin": "49999972619.1"
  }
}

Responses

Status Meaning Description
200 OK Limits successfully retrieved.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. Limits cannot be retrieve.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
status string Response status. Can be Success or Failure
statusMessage string status Message
equityLimit object none
grossAvailableMargin string Total amount of margins or balances available for trading. Opening balance for current day
payInToday string Current day deposited amount
notionalCash string Additional Limit that may or may not be given by RMS for Trading.
collateralMarginAgainstShares string Margin against shares offered by SAMCO to their clients for trading in stock and shares.
marginUsed string The amount deducted from opening balance for trading on the current day, and the amount blocked for creating a position when user places an order.
netAvailableMargin string Actual margin available with user for Trading after making all necessary adjustments.
commodityLimit object none
grossAvailableMargin string Total amount of margins or balances available for trading. Opening balance for current day
payInToday string Current day deposited amount
notionalCash string Additional Limit that may or may not be given by RMS for Trading.
collateralMarginAgainstShares string Margin against shares offered by SAMCO to their clients for trading in stock and shares.
marginUsed string The amount deducted from opening balance for trading on the current day, and the amount blocked for creating a position when user places an order.
netAvailableMargin string Actual margin available with user for Trading after making all necessary adjustments.

Orders

Place Order

Code samples

var headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/order/placeOrder',
  method: 'post',
  data: JSON.stringify(requestBody),
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.post('https://api.stocknote.com/order/placeOrder'
, data=json.dumps(requestBody)
, headers = headers)

print r.json()

POST /order/placeOrder

This API allows you to place an equity/derivative order to the exchange i.e the place order request typically registers the order with OMS and when it happens successfully, a success response is returned. Successful placement of an order via the API does not imply its successful execution. To be precise, under normal scenarios, the whole flow of order execution starting with order placement, routing to OMS and transfer to the exchange, order execution, and confirmation from exchange happen real time. But due to various reasons like market hours, exchange related checks etc. This may not happen instantly. So when an order is successfully placed the placeOrder API returns an orderNumber in response, and in scenarios as above the actual order status can be checked separately using the orderStatus API call.This is for Placing CNC, MIS and NRML Orders

Body parameter

requestBody={
  "symbolName": "RELIANCE",
  "exchange": "BSE",
  "transactionType": "BUY",
  "orderType": "L",
  "quantity": "1",
  "disclosedQuantity": "1",
  "price": "1240.0",
  "priceType": "LTP",
  "marketProtection": " ",
  "orderValidity": "DAY",
  "afterMarketOrderFlag": "NO",
  "productType": "MIS",
  "triggerPrice": "0.00"
}

Parameters

Name Type Required Description
body object false none
symbolName string true Trading Symbol Name of the scrip
exchange string true Name of the exchange.Valid exchanges values (BSE/ NSE/ NFO/ MCX/ CDS).If the user does not provide an exchange name, by default considered as NSE.For trading with BSE, NFO, CDS and MCX, exchange is mandatory.
transactionType string true Transaction type should be BUY or SELL
orderType string true Type of order. It can be one of the following, MKT - Market Order,L- Limit Order,SL - Stop Loss Limit,SL-M - Stop loss market
quantity string true Quantity with which order is being placed
disclosedQuantity string true If provided should be minimum of 10% of actual quantity
price string true Price at which the order will be placed
priceType string true Price type required to place an order. Valid price type - LTP/ATP , default is LTP. Applicable for BO orders only.
marketProtection string true Percentage of MarketProtection required for ordertype MKT/SL-M to limit loss due to market price changes against the price with which order is placed. Default value is 3%.
orderValidity string true Order validity can be DAY / IOC .Day is an order type which is valid for the whole trading day and stays pending till it is executed in respective trading day. IOC(Immediate Or Cancel) order type is where once the user punches the order, the order hits the exchange and if not executed immediately, the order stands cancelled
afterMarketOrderFlag string true After Market Order Flag YES/NO
productType string true Product Type of the order. It can be CNC (Cash and Carry)NRML (Normal),MIS (Intraday)
triggerPrice string false The price at which an order should be triggered in case of SL, SL-M

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "orderNumber": "191206000000079",
  "status": "Success",
  "statusMessage": "MIS Order request placed successfully",
  "exchangeOrderStatus": "complete",
  "rejectionReason": "--",
  "orderDetails": {
    "pendingQuantity": "0",
    "avgExecutionPrice": "1193.00",
    "orderPlacedBy": "DV9999",
    "tradingSymbol": "RELIANCE",
    "triggerPrice": "0.00",
    "exchange": "BSE",
    "totalQuantity": "1",
    "expiry": "--",
    "transactionType": "BUY",
    "productType": "MIS",
    "orderType": "L",
    "quantity": "1",
    "filledQuantity": "1",
    "orderPrice": "1240.00",
    "filledPrice": "1240.0",
    "exchangeOrderNo": "1565067682526005486",
    "orderValidity": "DAY",
    "orderTime": "12/12/2019 16:20:09"
  }
}

Responses

Status Meaning Description
200 OK Order placed successfully.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. Failed to place an Order.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
orderNumber string Unique Order identifier generated after placing an order which could be used for tracking order status
status string Status of the order. It would be success or failure
statusMessage string Order placement status Message
exchangeOrderStatus string Status of the order execution at Exchange side, Most common values are PENDING, COMPLETE, REJECTED, CANCELLED, and OPEN
rejectionReason string If an order is rejected, cause of order rejection which comes as user friendly textual description
orderDetails object none
pendingQuantity string Quantity which is in waiting state to be filled in a specific trade
avgExecutionPrice string Average price at which the quantities were bought/sold during the day
orderPlacedBy string Client code of the user who placed the order
tradingSymbol string Trading Symbol of the scrip.
triggerPrice string The price at which an order should be triggered in case of SL, SL-M.
exchange string Name of the exchange.Valid exchanges values (BSE/ NSE/ NFO/ MCX/ CDS).If the user does not provide an exchange name, by default considered as NSE.For trading with BSE, NFO, CDS and MCX, exchange is mandatory.
totalQuantity string Total Quantity
expiry string expiry date of trading symbol
transactionType string Type of the transaction, BUY / SELL.
productType string Product Type of order as placed by the user. It can be CNC (Cash and Carry),BO (Bracket Order),CO (Cover Order),NRML (Normal),MIS (Intraday).
orderType string Type of order user has placed . It can be one of the following, MKT - Market Order,L- Limit Order,SL - Stop Loss Limit,SL-M - Stop loss market.
quantity string Order Quantity as placed by the user
filledQuantity string Quantity which is filled in a specific trade. Can be less than or equal to the total quantity
orderPrice string Limit price entered at the time of placing the order.
filledPrice string Price at which exchange has filled the order
exchangeOrderNo string Order identifier at the exchange.
orderValidity string validity of the order
orderTime string Order placement time

Place BO Order

Code samples

var headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/order/placeOrderBO',
  method: 'post',
  data: JSON.stringify(requestBody),
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.post('https://api.stocknote.com/order/placeOrderBO'
, data=json.dumps(requestBody)
, headers = headers)

print r.json()

POST /order/placeOrderBO

This API allows you to place an equity/derivative order to the exchange i.e the place order request typically registers the order with OMS and when it happens successfully, a success response is returned. Successful placement of an order via the API does not imply its successful execution. To be precise, under normal scenarios, the whole flow of order execution starting with order placement, routing to OMS and transfer to the exchange, order execution, and confirmation from exchange happen real time. But due to various reasons like market hours, exchange related checks etc. This may not happen instantly. So when an order is successfully placed the placeOrder API returns an orderNumber in response, and in scenarios as above the actual order status can be checked separately using the orderStatus API call. This is for Placing BO Orders.

Body parameter

requestBody={
  "symbolName": "RELIANCE",
  "exchange": "NSE",
  "transactionType": "BUY",
  "orderType": "L",
  "quantity": "1",
  "disclosedQuantity": "1",
  "price": "1240.0",
  "priceType": "LTP",
  "orderValidity": "DAY",
  "productType": "BO",
  "squareOffValue": "5",
  "stopLossValue": "5",
  "valueType": "Ticks",
  "trailingStopLoss": "5"
}

Parameters

Name Type Required Description
body object false none
symbolName string true Trading Symbol Name of the scrip
exchange string true Name of the exchange.Valid exchanges values (NSE/ NFO/ MCX/ CDS).If the user does not provide an exchange name, by default considered as NSE.For trading with NFO, CDS and MCX, exchange is mandatory. BO orders not applicable to place in BSE exchange.
transactionType string true Transaction type should be BUY or SELL
orderType string true Type of order. It should be L- Limit Order
quantity string true Quantity with which order is being placed
disclosedQuantity string true If provided should be minimum of 10% of actual quantity
price string true Price at which the order will be placed
priceType string true Price type required to place an order. Valid price type - LTP/ATP , default is LTP. Applicable for BO orders only.
orderValidity string true Order validity should be DAY .Day is an order type which is valid for the whole trading day and stays pending till it is executed in respective trading day.
productType string true Product Type of the order. It can be BO (Bracket Order))
squareOffValue string true Price difference from entry price at which the order should be squared off to limit losses (eg: if Order price is 300. Profit target is 305. So target = 5). Applicable for BO orders only
stopLossValue string true Stoploss price difference from the entry price at which the order should be squared off (eg: if Order price is 300. Stoploss target is 295. So stop loss = 5). Applicable for both BO & CO
valueType string true ValueType required to place an Order. Applicable for both Stop Loss Value and Square off value. Valid value types - Absolute/Ticks. Default is Absolute.Applicable for BO orders only.
trailingStopLoss string true Incremental value set as % of change from the market price. Trailing stop moves as the price moves up. but, if the price starts to fall, the stop loss does not move (For example, if you buy a stock at Rs 100 and set a trailing stop loss value of Rs 2. If the stock price moves up to say Rs 105, the trailing stop loss value also would move up to be Rs 103 and stays Rs 2 less than the current market price. But if the stock price starts to fall and becomes Rs 103, trailing stop loss order will become a market order. Applicable for BO orders only

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "orderNumber": "190726000001077",
  "status": "Success",
  "exchangeOrderStatus": "Executed",
  "rejectionReason": "--",
  "statusMessage": "BO Order request placed successfully",
  "orderDetails": {
    "pendingQuantity": "0",
    "avgExecutionPrice": "1193.00",
    "orderPlacedBy": "DV9999",
    "tradingSymbol": "RELIANCE",
    "triggerPrice": "0.00",
    "exchange": "NSE",
    "totalQuantity": "1",
    "expiry": "--",
    "transactionType": "BUY",
    "productType": "BO",
    "orderType": "L",
    "quantity": "1",
    "filledQuantity": "1",
    "orderPrice": "1240.00",
    "filledPrice": "1240.0",
    "exchangeOrderNo": "1565067682526005486",
    "orderValidity": "DAY",
    "orderTime": "12/12/2019 16:20:09"
  }
}

Responses

Status Meaning Description
200 OK BO Order placed successfully.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. Failed to place an BO Order.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
orderNumber string Unique Order identifier generated after placing an order which could be used for tracking order status
status string Status of the order. It would be success or failure
exchangeOrderStatus string Status of the order execution at Exchange side, Most common values are PENDING, COMPLETE, REJECTED, CANCELLED, and OPEN
rejectionReason string If an order is rejected, cause of order rejection which comes as user friendly textual description
statusMessage string Order placement status Message
orderDetails object none
pendingQuantity string Quantity which is in waiting state to be filled in a specific trade
avgExecutionPrice string Average price at which the quantities were bought/sold during the day
orderPlacedBy string Client code of the user who placed the order
tradingSymbol string Trading Symbol of the scrip.
triggerPrice string The price at which an order should be triggered in case of SL, SL-M.
exchange string Name of the exchange.Valid exchanges values (NSE/ NFO/ MCX/ CDS).If the user does not provide an exchange name, by default considered as NSE.For trading with NFO, CDS and MCX, exchange is mandatory. BO orders not applicable for BSE exchange.
totalQuantity string Total Quantity
expiry string expiry date of trading symbol
transactionType string Type of the transaction, BUY / SELL.
productType string Product Type of order as placed by the user is BO (Bracket Order)
orderType string Type of order user has placed . It can be one of the following, MKT - Market Order,L- Limit Order,SL - Stop Loss Limit,SL-M - Stop loss market.
quantity string Order Quantity as placed by the user
filledQuantity string Quantity which is filled in a specific trade. Can be less than or equal to the total quantity
orderPrice string Limit price entered at the time of placing the order.
filledPrice string Price at which exchange has filled the order
exchangeOrderNo string Order identifier at the exchange.
orderValidity string validity of the order
orderTime string Order placement time

Place CO Order

Code samples

var headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/order/placeOrderCO',
  method: 'post',
  data: JSON.stringify(requestBody),
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.post('https://api.stocknote.com/order/placeOrderCO'
, data=json.dumps(requestBody)
, headers = headers)

print r.json()

POST /order/placeOrderCO

This API allows you to place an equity/derivative order to the exchange i.e the place order request typically registers the order with OMS and when it happens successfully, a success response is returned. Successful placement of an order via the API does not imply its successful execution. To be precise, under normal scenarios, the whole flow of order execution starting with order placement, routing to OMS and transfer to the exchange, order execution, and confirmation from exchange happen real time. But due to various reasons like market hours, exchange related checks etc. This may not happen instantly. So when an order is successfully placed the placeOrder API returns an orderNumber in response, and in scenarios as above the actual order status can be checked separately using the orderStatus API call. This is for Placing CO Orders.

Body parameter

requestBody={
  "symbolName": "RELIANCE",
  "exchange": "BSE",
  "transactionType": "BUY",
  "orderType": "L",
  "quantity": "1",
  "disclosedQuantity": "1",
  "price": "1240.0",
  "orderValidity": "DAY",
  "productType": "CO",
  "triggerPrice": "1070.00"
}

Parameters

Name Type Required Description
body object false none
symbolName string true Trading Symbol Name of the scrip
exchange string true Name of the exchange.Valid exchanges values (BSE/ NSE/ NFO/ MCX/ CDS).If the user does not provide an exchange name, by default considered as NSE.For trading with BSE, NFO, CDS and MCX, exchange is mandatory.
transactionType string true Transaction type should be BUY or SELL
orderType string true Type of order. It can be one of the following, MKT - Market Order,L- Limit Order
quantity string true Quantity with which order is being placed
disclosedQuantity string true If provided should be minimum of 10% of actual quantity
price string true Price at which the order will be placed
orderValidity string true Order validity should be DAY .Day is an order type which is valid for the whole trading day and stays pending till it is executed in respective trading day.
productType string true Product Type of the order. It can be CO (Cover Order))
triggerPrice string false The price at which an order should be triggered

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "orderNumber": "190726000001077",
  "status": "Success",
  "exchangeOrderStatus": "Executed",
  "rejectionReason": "--",
  "statusMessage": "CO Order request placed successfully",
  "orderDetails": {
    "pendingQuantity": "0",
    "avgExecutionPrice": "1193.00",
    "orderPlacedBy": "DV9999",
    "tradingSymbol": "RELIANCE",
    "triggerPrice": "0.00",
    "exchange": "BSE",
    "totalQuantity": "1",
    "expiry": "--",
    "transactionType": "BUY",
    "productType": "CO",
    "orderType": "L",
    "quantity": "1",
    "filledQuantity": "1",
    "orderPrice": "1240.00",
    "filledPrice": "1240.0",
    "exchangeOrderNo": "1565067682526005486",
    "orderValidity": "DAY",
    "orderTime": "12/12/2019 16:20:09"
  }
}

Responses

Status Meaning Description
200 OK CO Order placed successfully.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. Failed to place an CO Order.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
orderNumber string Unique Order identifier generated after placing an order which could be used for tracking order status
status string Status of the order. It would be success or failure
exchangeOrderStatus string Status of the order execution at Exchange side, Most common values are PENDING, COMPLETE, REJECTED, CANCELLED, and OPEN
rejectionReason string If an order is rejected, cause of order rejection which comes as user friendly textual description
statusMessage string Order placement status Message
orderDetails object none
pendingQuantity string Quantity which is in waiting state to be filled in a specific trade
avgExecutionPrice string Average price at which the quantities were bought/sold during the day
orderPlacedBy string Client code of the user who placed the order
tradingSymbol string Trading Symbol of the scrip.
triggerPrice string The price at which an order should be triggered in case of SL, SL-M.
exchange string Name of the exchange.Valid exchanges values (BSE/ NSE/ NFO/ MCX/ CDS).If the user does not provide an exchange name, by default considered as NSE.For trading with BSE, NFO, CDS and MCX, exchange is mandatory.
totalQuantity string Total Quantity
expiry string expiry date of trading symbol
transactionType string Type of the transaction, BUY / SELL.
productType string Product Type of order as placed by the user is CO (Cover Order)
orderType string Type of order user has placed . It can be one of the following, MKT - Market Order,L- Limit Order,SL - Stop Loss Limit,SL-M - Stop loss market.
quantity string Order Quantity as placed by the user
filledQuantity string Quantity which is filled in a specific trade. Can be less than or equal to the total quantity
orderPrice string Limit price entered at the time of placing the order.
filledPrice string Price at which exchange has filled the order
exchangeOrderNo string Order identifier at the exchange.
orderValidity string validity of the order
orderTime string Order placement time

Get Order Status

Code samples

var headers = {
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/order/getOrderStatus?orderNumber=190707000000004',
  method: 'get',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.get('https://api.stocknote.com/order/getOrderStatus', params={
  'orderNumber': '190707000000004'
}, headers = headers)

print r.json()

GET /order/getOrderStatus

Get status of an order placed previously. This API returns all states of the orders,but not limited to open, pending, and partially filled ones.

Parameters

Name Type Required Description
orderNumber string true Order Number for which the user wants to check the order status

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "orderNumber": "190722000000243",
  "orderStatus": "Success",
  "statusMessage": "Requested MIS Order placed successfully",
  "orderDetails": {
    "pendingQuantity": "0",
    "avgExecutionPrice": "1193.00",
    "orderPlacedBy": "DV9999",
    "tradingSymbol": "RELIANCE",
    "triggerPrice": "0.00",
    "exchange": "BSE",
    "totalQuantity": "1",
    "expiry": "--",
    "transactionType": "BUY",
    "productType": "MIS",
    "orderType": "L",
    "quantity": "1",
    "filledQuantity": "1",
    "orderPrice": "1240.00",
    "filledPrice": "1240.0",
    "exchangeOrderNo": "1565067682526005486",
    "orderValidity": "DAY",
    "orderTime": "12/12/2019 16:20:09"
  }
}

Responses

Status Meaning Description
200 OK Order status successfully retrived.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Servsr Error. Failed to retrive OrderStatus.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
orderNumber string Unique number generated at the exchange while placing an order
orderStatus string Status of the order at Exchange side, Most common values are PENDING, COMPLETE, REJECTED, CANCELLED, and OPEN
statusMessage string Status Message of the order
orderDetails object none
pendingQuantity string Quantity which is in waiting state to be filled in a specific trade
avgExecutionPrice string Average price at which the quantities were bought/sold during the day
orderPlacedBy string Client code of the user who placed the order
tradingSymbol string Trading Symbol of the scrip.
triggerPrice string The price at which an order should be triggered in case of SL, SL-M.
exchange string Name of the exchange.Valid exchanges values (BSE/ NSE/ NFO/ MCX/ CDS).If the user does not provide an exchange name, by default considered as NSE.For trading with BSE, NFO, CDS and MCX, exchange is mandatory.
totalQuantity string Total Quantity
expiry string expiry date of trading symbol
transactionType string Type of the transaction, BUY / SELL.
productType string Product Type of order as placed by the user. It can be CNC (Cash and Carry),BO (Bracket Order),CO (Cover Order),NRML (Normal),MIS (Intraday).
orderType string Type of order user has placed . It can be one of the following, MKT - Market Order,L- Limit Order,SL - Stop Loss Limit,SL-M - Stop loss market.
quantity string Order Quantity as placed by the user
filledQuantity string Quantity which is filled in a specific trade. Can be less than or equal to the total quantity
orderPrice string Limit price entered at the time of placing the order.
filledPrice string Price at which exchange has filled the order
exchangeOrderNo string Order identifier at the exchange.
orderValidity string validity of the order
orderTime string Order placement time

Order Book

Code samples

var headers = {
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/order/orderBook',
  method: 'get',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.get('https://api.stocknote.com/order/orderBook'
, headers = headers)
print r.json()

GET /order/orderBook

Orderbook retrieves and displays details of all orders placed by the user on a specific day. This API returns all states of the orders, namely, open, pending, rejected and executed ones.

Parameters

Name Type Required Description

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMessage": "Request successful",
  "orderBookDetails": [
    {
      "orderNumber": "191206000000079",
      "exchange": "BSE",
      "tradingSymbol": "RELIANCE",
      "symbolDescription": "RELIANCE INDUSTRIES LTD.",
      "transactionType": "BUY",
      "productCode": "MIS",
      "orderType": "L",
      "orderPrice": "1560.15",
      "quantity": "13",
      "disclosedQuantity": "1",
      "triggerPrice": "1090.00",
      "marketProtection": "3",
      "orderValidity": "DAY",
      "orderStatus": "Complete",
      "orderValue": "20281.95",
      "instrumentName": "NA",
      "orderTime": "06-Dec-2019 13:47:04",
      "userId": "DV99999",
      "filledQuantity": "13",
      "fillPrice": "1560.15",
      "averagePrice": "1560.15",
      "unfilledQuantity": "0",
      "exchangeOrderId": "1575608622401000995",
      "rejectionReason": "NA",
      "exchangeConfirmationTime": "06-Dec-2019 14:14:47",
      "cancelledQuantity": "0",
      "referenceLimitPrice": "0.00",
      "coverOrderPercentage": "0.00",
      "orderRemarks": "--",
      "exchangeOrderNumber": "1575608622401000995",
      "symbol": "52310_NFO",
      "displayStrikePrice": "0.00",
      "displayNetQuantity": "10",
      "status": "complete",
      "exchangeStatus": "complete",
      "expiry": "--",
      "pendingQuantity": "0",
      "instrument": "--",
      "scripName": "--",
      "totalQuanity": "13",
      "optionType": "--",
      "orderPlaceBy": "DV99999",
      "lotQuantity": "1",
      "parentOrderId": "200824000050316"
    }
  ]
}

Responses

Status Meaning Description
200 OK Order book details successfully retrieved
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. Order book details cannot be retrieved.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
status string Response status. Can be Success or Failure
statusMessage string status Message
orderBookDetails [object] List of all orders with details during the day
orderNumber string Unique Order identifier generated after placing an order
exchange string Name of the exchange.Valid exchanges values (BSE/ NSE/ NFO/ MCX/ CDS).If the user does not provide an exchange name, by default considered as NSE.For trading with BSE, NFO, CDS and MCX, exchange is mandatory.
tradingSymbol string Trading Symbol of the scrip.
symbolDescription string Scrip description
transactionType string Type of the transaction, BUY / SELL.
productCode string Product Type of order as placed by the user. It can be CNC (Cash and Carry),BO (Bracket Order),CO (Cover Order),NRML (Normal),MIS (Intraday).
orderType string Type of order user has placed . It can be one of the following, MKT - Market Order,L- Limit Order,SL - Stop Loss Limit,SL-M - Stop loss market.
orderPrice string Total price of a particular order
quantity string Total Quantity as placed by the user
disclosedQuantity string If provided should be minimun of 10% of actual quantity.
triggerPrice string The price at which an order should be triggered in case of SL, SL-M.
marketProtection string Percentage of MarketProtection required for ordertype MKT/SL-M to limit loss due to market price changes against the price with which order is placed. Default value is 3%.
orderValidity string Order validity can be DAY / IOC
orderStatus string Status of the order at Exchange side, either executed successfully or pending or rejected
orderValue string Value of the order
instrumentName string Name of the instrument
orderTime string Order placement time
userId string The client Code provided to you by SAMCO after opening an account.
filledQuantity string Quantity which is filled in a specific trade. Can be less than or equal to the total quantity
fillPrice string Price at which exchange has filled the order
averagePrice string Average trading price of the equity
unfilledQuantity string Quantity which is not filled in a partially filled order. Can be less than or equal to the total quantity
exchangeOrderId string Unique Order identifier generated from exchange
rejectionReason string If order is rejected, Cause of order Rejection
exchangeConfirmationTime string Order confirmation time at exchange
cancelledQuantity string cancelled quantity for partial cancelled orders
referenceLimitPrice string Limit Price reference
coverOrderPercentage string Percentage of cover order
orderRemarks string Remarks about order
exchangeOrderNumber string Unique Order identifier generated after placing an order
symbol string symbol about stock
displayStrikePrice string Shows the strick price
displayNetQuantity string Display the limit quantity of order
status string Status will display Executed/Pending/Rejected
exchangeStatus string ExchangeStatus will display Executed/Pending/Rejected
expiry string shows ExpiryDate of the stock
pendingQuantity string PendingQuantity will show pending quantity stock
instrument string Instrument is about the type of stock. FUT/OPT
scripName string Name of the scrip
totalQuanity string Total Quantity
optionType string Option Type (PE/CE).
orderPlaceBy string Client code of the user who placed the order
lotQuantity string lotQuantity represents the number of contracts contained in one derivative security.Applicable for F & O
parentOrderId string order Id of the parent order(it is applicable for only BO/CO orders)

TriggerOrders

Code samples

var headers = {
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/order/getTriggerOrders?orderNumber=190707000000004',
  method: 'get',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.get('https://api.stocknote.com/order/getTriggerOrders', params={
  'orderNumber': '190707000000004'
}, headers = headers)

print r.json()

GET /order/getTriggerOrders

This API allows you to get the trigger order numbers in case of BO and CO orders so that their attribute values can be modified for BO orders, it will give the order identifiers. For Stop loss leg and target leg. Similarly for CO orders, it will return order identifier of stop loss leg only. Using the order identifier, the user would be able to modify the order attributes using the modifyOrder API. Refer modifyOrder API documentation for the parameters details.

Parameters

Name Type Required Description
orderNumber string true Order Number for which the user wants to check the order status

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMessage": "SubOrder details retrieved successfully.",
  "triggerOrders": [
    {
      "stopLossOrderNo": "191219000000063",
      "orderStatus": "Complete",
      "orderPrice": "351.20",
      "triggerPrice": "331.20"
    }
  ]
}

Responses

Status Meaning Description
200 OK SubOrder details successfully retrieved
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. BO/CO SubOrder details cannot be retrieved.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
status string Response status. Can be Success or Failure
statusMessage string status Message
triggerOrders [object] Trigger order Details available for the provided OrderNumber.
stopLossOrderNo string Unique Order identifier generated from exchange
orderStatus string Status of the order at Exchange side, either executed successfully complete or trigger pending or cancelled
orderPrice string price of a particular order
triggerPrice string The price at which an order should be triggered

Modify Order

Code samples

var headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/order/modifyOrder/{orderNumber}',
  method: 'put',
  data: JSON.stringify(requestBody),
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.put('https://api.stocknote.com/order/modifyOrder/{orderNumber}'
, data=json.dumps(requestBody)
, headers = headers)

print r.json()

PUT /order/modifyOrder/{orderNumber}

User would be able to modify some attributes of an order as long as it is with open/pending status in system. For modification order identifier is mandatory. With order identifier you need to send the optional parameter(s) which needs to be modified. In case the optional parameters aren't sent, the default will be considered from the original order. Modifiable attributes include quantity, Order Type (L,MKT, SL,SL-M). This API cannot be used for modifying attributes of an executed/rejected/cancelled order. Only the attribute that needs to be modified should be sent in the request alongwith the Order Identifier.

Body parameter

requestBody={
  "orderType": "L",
  "quantity": "3",
  "disclosedQuantity": "1",
  "orderValidity": "DAY",
  "price": "1240.00",
  "triggerPrice": "1070.00",
  "parentOrderId": "190707000000004",
  "marketProtection": "5"
}

Parameters

Name Type Required Description
orderNumber string true Unique Order identifier of the order which needs to be modified
body object false Type of order. MKT - Market Order,L - Limit Order, SL - Stop Loss Limit, SL-M - Stop Loss Market
orderType string false Type of order user has placed . It can be one of the following, MKT - Market Order,L- Limit Order,SL - Stop Loss Limit,SL-M - Stop loss market.
quantity string false Quantity of the order user wants to modify
disclosedQuantity string false Quantity to disclose publicly
orderValidity string true Order validity can be DAY or IOC
price string false Price at which the order was placed
triggerPrice string false The price at which an order should be triggered in case of SL, SL-M.
parentOrderId string true ParentOrderId required to modify an order (applicable for BO orders only)
marketProtection string false Percentage of MarketProtection required for ordertype MKT/SL-M to limit loss due to market price changes against the price with which order is placed. Default value is 3%.

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "orderNumber": "191206000000079",
  "status": "Success",
  "statusMessage": "MIS Order request placed successfully",
  "exchangeOrderStatus": "complete",
  "rejectionReason": "--",
  "orderDetails": {
    "pendingQuantity": "0",
    "avgExecutionPrice": "1193.00",
    "orderPlacedBy": "DV9999",
    "tradingSymbol": "RELIANCE",
    "triggerPrice": "0.00",
    "exchange": "BSE",
    "totalQuantity": "1",
    "expiry": "--",
    "transactionType": "BUY",
    "productType": "MIS",
    "orderType": "L",
    "quantity": "1",
    "filledQuantity": "1",
    "orderPrice": "1240.00",
    "filledPrice": "1240.0",
    "exchangeOrderNo": "1565067682526005486",
    "orderValidity": "DAY",
    "orderTime": "12/12/2019 16:20:09"
  }
}

Responses

Status Meaning Description
200 OK Orders modified successfully.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. Orders failed to modify.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
orderNumber string Unique Order identifier generated after placing an order which could be used for tracking order status
status string Status of the order. It would be success or failure
statusMessage string Order placement status Message
exchangeOrderStatus string Status of the order execution at Exchange side, Most common values are PENDING, COMPLETE, REJECTED, CANCELLED, and OPEN
rejectionReason string If an order is rejected, cause of order rejection which comes as user friendly textual description
orderDetails object none
pendingQuantity string Quantity which is in waiting state to be filled in a specific trade
avgExecutionPrice string Average price at which the quantities were bought/sold during the day
orderPlacedBy string Client code of the user who placed the order
tradingSymbol string Trading Symbol of the scrip.
triggerPrice string The price at which an order should be triggered in case of SL, SL-M.
exchange string Name of the exchange.Valid exchanges values (BSE/ NSE/ NFO/ MCX/ CDS).If the user does not provide an exchange name, by default considered as NSE.For trading with BSE, NFO, CDS and MCX, exchange is mandatory.
totalQuantity string Total Quantity
expiry string expiry date of trading symbol
transactionType string Type of the transaction, BUY / SELL.
productType string Product Type of order as placed by the user. It can be CNC (Cash and Carry),BO (Bracket Order),CO (Cover Order),NRML (Normal),MIS (Intraday).
orderType string Type of order user has placed . It can be one of the following, MKT - Market Order,L- Limit Order,SL - Stop Loss Limit,SL-M - Stop loss market.
quantity string Order Quantity as placed by the user
filledQuantity string Quantity which is filled in a specific trade. Can be less than or equal to the total quantity
orderPrice string Limit price entered at the time of placing the order.
filledPrice string Price at which exchange has filled the order
exchangeOrderNo string Order identifier at the exchange.
orderValidity string validity of the order
orderTime string Order placement time

Cancel BO Order

Code samples

var headers = {
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/order/exitBO?orderNumber=190707000000004',
  method: 'delete',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.delete('https://api.stocknote.com/order/exitBO', params={
  'orderNumber': '190707000000004'
}, headers = headers)

print r.json()

DELETE /order/exitBO

For Cancellation/exit of BO orders pass main leg Order number. If main leg is in Open/Pending state that order will be cancelled. If the main leg is executed and the sublegs are created and in open/Trigger pending state, the order will be exited. If the main leg is executed and if either of Stop loss or target is hit, API will return error message "SubOrder is in Executed status. Cannot exit/cancel such orders."

Parameters

Name Type Required Description
orderNumber string true The main order identifier provided as an input which needs to be exited.

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "orderNumber": "190722000000243",
  "statusMessage": "Order cancellation request placed successfully"
}

Responses

Status Meaning Description
200 OK BO Order cancelation completed successfully.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. The order cannot be cancelled.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
status string Status of the order cancellation request. Can be success or failure
orderNumber string Unique Order identifier generated after placing an order
statusMessage string Status Message for the order cancellation request

Cancel CO Order

Code samples

var headers = {
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/order/exitCO?orderNumber=190707000000004',
  method: 'delete',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.delete('https://api.stocknote.com/order/exitCO', params={
  'orderNumber': '190707000000004'
}, headers = headers)

print r.json()

DELETE /order/exitCO

For Cancellation/exit of CO orders pass main leg Order number. If main leg is in Open/Pending state that order will be cancelled. If the main leg is executed and the sublegs are created and in open/Trigger pending state, the order will be exited. If the main leg is executed and if Stop loss is hit, API will return error message "SubOrder is in Executed status. Cannot exit/cancel such orders."

Parameters

Name Type Required Description
orderNumber string true The main order identifier provided as an input which needs to be exited.

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "orderNumber": "190722000000243",
  "statusMessage": "Order cancellation request placed successfully"
}

Responses

Status Meaning Description
200 OK CO Order cancelation completed successfully.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. The order cannot be cancelled.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
status string Status of the order cancellation request. Can be success or failure
orderNumber string Unique Order identifier generated after placing an order
statusMessage string Status Message for the order cancellation request

Cancel Order

Code samples

var headers = {
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/order/cancelOrder?orderNumber=190707000000004',
  method: 'delete',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.delete('https://api.stocknote.com/order/cancelOrder', params={
  'orderNumber': '190707000000004'
}, headers = headers)

print r.json()

DELETE /order/cancelOrder

An order which is open or pending in system can be cancelled. In other words, cancellation cannot be initiated for already Executed, Rejected orders.This is for CNC, MIS and NRML Orders.

Parameters

Name Type Required Description
orderNumber string true The order identifier provided as an input which needs to be cancelled

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "orderNumber": "190722000000243",
  "statusMessage": "Order cancellation request placed successfully"
}

Responses

Status Meaning Description
200 OK Order cancelation completed successfully.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. The order cannot be cancelled.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
status string Status of the order cancellation request. Can be success or failure
orderNumber string Unique Order identifier generated after placing an order
statusMessage string Status Message for the order cancellation request

TradeBook

Trade Book

Code samples

var headers = {
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/trade/tradeBook',
  method: 'get',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.get('https://api.stocknote.com/trade/tradeBook'
, headers = headers)

print r.json()

GET /trade/tradeBook

Details of all successfully executed orders placed by the user.

Parameters

Name Type Required Description

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMessage": "Request successful",
  "tradeBookDetails": [
    {
      "orderNumber": "191206000000079",
      "exchange": "BSE",
      "tradingSymbol": "RELIANCE",
      "symbolDescription": "RELIANCE INDUSTRIES LTD.",
      "transactionType": "BUY",
      "productCode": "MIS",
      "orderType": "L",
      "orderPrice": "1560.15",
      "quantity": "13",
      "disclosedQuantity": "1",
      "triggerPrice": "0.00",
      "marketProtection": "3",
      "orderValidity": "DAY",
      "orderStatus": "Complete",
      "orderValue": "20281.95",
      "instrumentName": "NA",
      "orderTime": "06-Dec-2019 13:47:04",
      "userId": "DV99999",
      "filledQuantity": "13",
      "unfilledQuantity": "0",
      "exchangeConfirmationTime": "05:06:12",
      "coverOrderPercentage": "%",
      "exchangeOrderNumber": "1571202357797000054",
      "tradeNumber": "195300",
      "tradePrice": "1560.15",
      "tradeDate": "06DEC2019",
      "tradeTime": "02:14:47 PM",
      "strikePrice": "800.00",
      "optionType": "XX",
      "lastTradePrice": "2,077.00",
      "expiry": "NA"
    }
  ]
}

Responses

Status Meaning Description
200 OK Trade book details successfully retrieved.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. Trade book details cannot be retrieved.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
status string Response status. Can be Success or Failure
statusMessage string status Message
tradeBookDetails [object] Get list of TradeBookEntries.
orderNumber string Unique Order identifier generated after placing an order
exchange string Name of the exchange.Valid exchanges values (BSE/ NSE/ NFO/ MCX/ CDS).If the user does not provide an exchange name, by default considered as NSE.For trading with BSE, NFO, CDS and MCX, exchange is mandatory.
tradingSymbol string Trading Symbol of the scrip.
symbolDescription string Scrip description
transactionType string Type of the transaction, BUY / SELL.
productCode string Product Type of order as placed by the user. It can be CNC (Cash and Carry),BO (Bracket Order),CO (Cover Order),NRML (Normal),MIS (Intraday).
orderType string Type of order user has placed . It can be one of the following, MKT - Market Order,L- Limit Order,SL - Stop Loss Limit,SL-M - Stop loss market.
orderPrice string Limit price of a particular order
quantity string It is the order quantity
disclosedQuantity string Quantity to disclose to public in the market
triggerPrice string The price at which an order should be triggered in case of SL, SL-M.
marketProtection string Percentage of MarketProtection required for ordertype MKT/SL-M to limit loss due to market price changes against the price with which order is placed. Default value is 3%.
orderValidity string Order validity can be DAY / IOC
orderStatus string Status of the order at Exchange side, either executed successfully or pending or rejected
orderValue string Value of the order
instrumentName string Name of the instrument
orderTime string Order placement time
userId string The client Code provided to you by SAMCO after opening an account.
filledQuantity string Quantity which is filled in a specific trade. Can be less than or equal to the total quantity
unfilledQuantity string Quantity which is not filled in a partially filled order. Can be less than or equal to the total quantity
exchangeConfirmationTime string Order confirmation time at exchange
coverOrderPercentage string Percentage of cover order
exchangeOrderNumber string Unique Order identifier generated after placing an order.
tradeNumber string Unique trade identifier generated for every trade.
tradePrice string Price of a trade.
tradeDate string Date of a trade.
tradeTime string Time of a trade.
strikePrice string The strike price is the predetermined price at which a put buyer can sell the underlying asset.
optionType string Option Type (PE/CE).
lastTradePrice string Price at which last transaction/trade is done
expiry string Shows expiry date of a trading symbol.

Positions

User Positions

Code samples

var headers = {
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/position/getPositions?positionType=DAY',
  method: 'get',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.get('https://api.stocknote.com/position/getPositions', params={
  'positionType': 'DAY'
}, headers = headers)

print r.json()

GET /position/getPositions

Get position details of the user (The details of equity, derivative, commodity, currency borrowed or owned by the user).

Parameters

Name Type Required Description
positionType string true Position type can be DAY/NET. If Position type is “DAY”, fetch current day position details, If Position Type is “NET”, fetch carry forward position details

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMessage": "Request successful",
  "positionSummary": {
    "gainingTodayCount": "2",
    "losingTodayCount": "2",
    "totalGainAndLossAmount": "0.00",
    "dayGainAndLossAmount": "-4910.00"
  },
  "positionDetails": [
    {
      "averagePrice": "1560.15",
      "exchange": "BSE",
      "markToMarketPrice": "-182.70",
      "lastTradedPrice": "1,550.00",
      "previousClose": "1552.55",
      "productCode": "CNC",
      "symbolDescription": "RELIANCE INDUSTRIES LTD.",
      "tradingSymbol": "RELIANCE",
      "calculatedNetQuantity": "18.0",
      "averageBuyPrice": "1560.15",
      "averageSellPrice": "0.00",
      "boardLotQuantity": "1",
      "boughtPrice": "28082.70",
      "buyQuantity": "18",
      "carryForwardQuantity": "0",
      "carryForwardValue": "0.00",
      "multiplier": "1",
      "netPositionValue": "-182.70",
      "netQuantity": "18",
      "netValue": "-182.70",
      "positionType": "DAY",
      "positionConversions": "CNC, NRML",
      "soldValue": "0.00",
      "transactionType": "BUY",
      "realizedGainAndLoss": "0.00",
      "unrealizedGainAndLoss": "-182.70",
      "companyName": "RELIANCE INDUSTRIES LTD.",
      "expiryDate": "--",
      "optionType": "--"
    }
  ]
}

Responses

Status Meaning Description
200 OK Successfully retrieved Position details of the user.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. Unable to get Position details.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
status string Response status. Can be Success or Failure
statusMessage string status Message
positionSummary object none
gainingTodayCount string Count of scrips which are gaining in value in a trading day
losingTodayCount string Count of scrips which are losing in value in a trading day
totalGainAndLossAmount string Total amount of Gain / Loss for all existing positions since their creation
dayGainAndLossAmount string Amount of Gain / Loss for all positions on a specific trading day
positionDetails [object] Details of Day/Net positions as queried
averagePrice string Average trading price of the equity
exchange string Name of the exchange.Valid exchanges values (BSE/ NSE) If the user does not provide an exchange name, by default considered as NSE.
markToMarketPrice string Price change between previous close price and current price
lastTradedPrice string Price at which last transaction/trade is done
previousClose string Previous close refers to the prior day's final price of security when the market officially closes for the day.
productCode string Type of the product, allowable type is CNC
symbolDescription string Scrip Description
tradingSymbol string Symbol name of the scrip.
calculatedNetQuantity string Quantity left after the day
averageBuyPrice string Average price at which the quantities were bought
averageSellPrice string Average price at which the quantities were sold
boardLotQuantity string The standardized number of shares decided by the exchange as a trading unit
boughtPrice string Price at which quantities were bought during the day
buyQuantity string Total quantity brought and added to the position during the day
carryForwardQuantity string Quantity bought or sold in previous session
carryForwardValue string Net value of the position in previous session
multiplier string The lot size multiplier used to calculate Profit and Loss
netPositionValue string Net value of the position during the day
netQuantity string Limit quantity of the position
netValue string Net value of the bought quantities
positionType string Type of the position, Ex -Day/Net
positionConversions [string] Different Product types the user can Convert an existing position to
soldValue string Total value of sold quantities
transactionType string Type of the transaction, BUY / SELL.
realizedGainAndLoss string The Profit and Loss returns from a closed position
unrealizedGainAndLoss string The Profit and Loss returns from a open position
companyName string Full name of the trading company
expiryDate string Expiry date of the scrip
optionType string Option Type (PE/CE).

Position Conversion

Code samples

var headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/position/convertPosition',
  method: 'post',
  data: JSON.stringify(requestBody),
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.post('https://api.stocknote.com/position/convertPosition'
, data=json.dumps(requestBody)
, headers = headers)

print r.json()

POST /position/convertPosition

Convert an existing position of a margin product to a different margin product type. All or a subset of an existing position quantity can be converted to a different product type.The available margin product types are MARGIN_INTRADAY_SQUAREOFF(MIS), CASHNCARRY(CNC), NORMAL(NRML).

Body parameter

requestBody={
  "symbolName": "RELIANCE",
  "exchange": "BSE",
  "transactionType": "BUY",
  "positionType": "DAY",
  "netQuantity": "18",
  "quantityToConvert": "2",
  "fromProductType": "MIS",
  "toProductType": "CNC"
}

Parameters

Name Type Required Description
body object false none
symbolName string true Symbol name of the scrip
exchange string true Name of the exchange. If the user does not provide an exchange name, by default considered as NSE
transactionType string true Transaction type can be either BUY or SELL
positionType string true DAY or NET
netQuantity string true Total quantity of the position
quantityToConvert string true Quantity to be converted. Can be less than or equal to netQuantity
fromProductType string true The existing product type of the position . It can be CNC (Cash and Carry),NRML (Normal),MIS (Intraday)
toProductType string true The target product type user wants to convert to . It can be CNC (Cash and Carry),NRML (Normal),MIS (Intraday)

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMsg": "Position Conversion from MIS to CNC successful"
}

Responses

Status Meaning Description
200 OK Position conversion successful.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. Position conversion failed.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
status string Status of the position conversion request.Success / Failure
statusMsg string Status message of position conversion request

Position Square Off

Code samples

var headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/position/squareOff',
  method: 'post',
  data: JSON.stringify(requestBody),
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.post('https://api.stocknote.com/position/squareOff'
, data=json.dumps(requestBody)
, headers = headers)

print r.json()

POST /position/squareOff

SqareOff existing position. Mostly used in day trading, in which user buy or sell a particular quantity of a stock and later in the day reverse the transaction to earn a profit.

Body parameter

requestBody={
  "userId": "DJ9999",
  "positionSquareOffRequestList": [
    {
      "userId": "DJ9999",
      "exchange": "NFO",
      "symbolName": "TCS",
      "productType": "MIS",
      "netQuantity": "250",
      "transactionType": "BUY"
    }
  ],
  "positionSquareOffList": [
    {
      "userId": "DJ9999",
      "exchange": "NFO",
      "symbolName": "TCS",
      "productType": "MIS",
      "netQuantity": "250",
      "transactionType": "BUY"
    }
  ]
}

Parameters

Name Type Required Description
body object false none
userId string true The client Code provided to you by SAMCO after opening an account.
positionSquareOffRequestList [object] false List of the position squareOff user wants to do
userId string true The client Code provided to you by SAMCO after opening an account.
exchange string false Name of the exchange.Valid exchanges values (BSE/ NSE/ NFO/ MCX/ CDS).If the user does not provide an exchange name, by default considered as NSE.For trading with BSE, NFO, CDS and MCX, exchange is mandatory.
symbolName string false Symbol name of the scrip.
productType string false Product type of the existing position.It can be CNC (Cash And Carry),NRML (Normal),MIS (Intraday)
netQuantity string false Total quantity held in existing position
transactionType string false Type of the transaction, BUY / SELL.
positionSquareOffList [object] false none
userId string true The client Code provided to you by SAMCO after opening an account.
exchange string false Name of the exchange.Valid exchanges values (BSE/ NSE/ NFO/ MCX/ CDS).If the user does not provide an exchange name, by default considered as NSE.For trading with BSE, NFO, CDS and MCX, exchange is mandatory.
symbolName string false Symbol name of the scrip.
productType string false Product type of the existing position.It can be CNC (Cash And Carry),NRML (Normal),MIS (Intraday)
netQuantity string false Total quantity held in existing position
transactionType string false Type of the transaction, BUY / SELL.

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "positionSquareOffResponseList": [
    {
      "serverTime": "12/12/19 16:20:11",
      "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
      "status": "Success",
      "statusMessage": "Request successful"
    }
  ]
}

Responses

Status Meaning Description
200 OK Square off successfully completed.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. Position Square off failed.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
positionSquareOffResponseList [object] List of the PositionSquareOff end of the day
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
status string Response status. Can be Success or Failure
statusMessage string status Message

Holdings

User Holdings

Code samples

var headers = {
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/holding/getHoldings',
  method: 'get',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.get('https://api.stocknote.com/holding/getHoldings'
, headers = headers)
print r.json()

GET /holding/getHoldings

Get the details of the Stocks which client is holding. Here, you will be able to get the Client holdings which are bought under ‘CNC’ product type and are not sold yet.

Parameters

Name Type Required Description

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMessage": "Request successful",
  "holdingSummary": {
    "gainingTodayCount": "2",
    "losingTodayCount": "2",
    "totalGainAndLossAmount": "0.00",
    "dayGainAndLossAmount": "-4910.00",
    "portfolioValue": "343.80"
  },
  "holdingDetails": [
    {
      "averagePrice": "1560.15",
      "exchange": "BSE",
      "markToMarketPrice": "-182.70",
      "lastTradedPrice": "1,550.00",
      "previousClose": "1552.55",
      "productCode": "CNC",
      "symbolDescription": "RELIANCE INDUSTRIES LTD.",
      "tradingSymbol": "RELIANCE",
      "totalGainAndLoss": "0.00",
      "calculatedNetQuantity": "18.0",
      "holdingsQuantity": "3",
      "collateralQuantity": "2",
      "holdingsValue": "436.46",
      "isin": "INE917I01010",
      "sellableQuantity": "1",
      "totalMarketToMarketPrice": "0"
    }
  ]
}

Responses

Status Meaning Description
200 OK Successfully retrieved Holding details of the user.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. Unable to get Holding details.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
status string Response status. Can be Success or Failure
statusMessage string status Message
holdingSummary object none
gainingTodayCount string Count of scrips which are gaining in value in a trading day
losingTodayCount string Count of scrips which are losing in value in a trading day
totalGainAndLossAmount string Total amount of Gain / Loss for all existing positions since their creation
dayGainAndLossAmount string Amount of Gain / Loss for all positions on a specific trading day
portfolioValue string Value of the portfolio.
holdingDetails [object] Details of the user holdings.
averagePrice string Average trading price of the equity
exchange string Name of the exchange.Valid exchanges values (BSE/ NSE) If the user does not provide an exchange name, by default considered as NSE.
markToMarketPrice string Price change between previous close price and current price
lastTradedPrice string Price at which last transaction/trade is done
previousClose string Previous close refers to the prior day's final price of security when the market officially closes for the day.
productCode string Type of the product, allowable type is CNC
symbolDescription string Scrip Description
tradingSymbol string Trading Symbol of the scrip.
totalGainAndLoss string Total Gain/Loss for all existing positions since their creation
calculatedNetQuantity string Quantity left after the day
holdingsQuantity string Currently holding(CNC) quantity
collateralQuantity string Quantity of loan against shares offered by SAMCO to their clients for trading in stock and shares.
holdingsValue string Limit value of the available holdings.
isin string The standard ISIN representing stocks uniquely at international level. It is same for every exchange.
sellableQuantity string Quantity which is open for sale.
totalMarketToMarketPrice string Total price change between previous close price and current price

IntraDay candle data

Intraday candle data

Code samples

var headers = {
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/intraday/candleData?symbolName=INFY&fromDate=2019-11-11%2010%3A00%3A00',
  method: 'get',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.get('https://api.stocknote.com/intraday/candleData', params={
  'symbolName': 'INFY',  'fromDate': '2019-11-11 10:00:00'
}, headers = headers)

print r.json()

GET /intraday/candleData

Gets the Intraday candle data such as Open, high, low, close and volume within specific time period per min for a specific symbol.

Parameters

Name Type Required Description
exchange string false Name of the exchange.Valid exchanges values (BSE/ NSE/ NFO/ MCX/ CDS).If the user does not provide an exchange name, by default considered as NSE.For trading with BSE, NFO, CDS and MCX, exchange is mandatory.
symbolName string true Symbol name of the scrip.
fromDate string true From date in yyyy-MM-dd hh:mm:ss
toDate string false To date in yyyy-MM-dd hh:mm:ss
interval string false Interval of data, By default interval is considered as 1 min

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMessage": "Request successful",
  "intradayCandleData": [
    {
      "dateTime": "2019-11-11 10:01:00",
      "open": "689.9",
      "high": "694.0",
      "low": "682.75",
      "close": "688.0",
      "volume": "600344"
    }
  ]
}

Responses

Status Meaning Description
200 OK Intraday candle data successfully retrieved.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. Intraday candle data.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
status string Response status. Can be Success or Failure
statusMessage string status Message
intradayCandleData [object] Get List of IntraDayCandleData .
dateTime string Date for which CandleData shown
open string Opening price of a market snapshot
high string High value of market snapshot
low string Low value of market snapshot
close string Close value of market snapshot
volume string Limit amount of a security traded on the specific day

Index IntraDay candle data

Code samples

var headers = {
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/intraday/indexCandleData?indexName=SENSEX&fromDate=2020-03-11%2010%3A00%3A00',
  method: 'get',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.get('https://api.stocknote.com/intraday/indexCandleData', params={
  'indexName': 'SENSEX',  'fromDate': '2020-03-11 10:00:00'
}, headers = headers)

print r.json()

GET /intraday/indexCandleData

Gets the Index intraday candle data such as Open, high, low, close and volume within specific time period per min for a specific index.

Supports Following List of Index names:

BSE CGSENSEXBSE CDNIFTY50 PR 1x INV
BSE ITMETALOILGASNIFTY50 PR 2x LEV
BSEIPOGREENXPOWERNIFTY50 TR 1x INV
CARBONBASMTRCDGSNIFTY50 TR 2x LEV
BSEFMCBSE HCALLCAPNIFTY50 TR 2x LEV
REALTYSMEIPODOL30NIFTY Mid LIQ 15
LRGCAPMIDSELSMLSELNIFTY100 LIQ 15
SNXT50SNSX50NIFTY 50NIFTY Quality 30
NIFTY BANKNIFTY NEXT 50DOL100NIFTY MIDCAP 50
NIFTY 100NIFTY 200NIFTY 500NIFTY FIN SERVICE
NIFTY AUTONIFTY FMCGNIFTY ITNIFTY COMMODITIES
NIFTY MEDIANIFTY METALNIFTY PHARMANIFTY CONSUMPTION
NIFTY PSU BANKNIFTY PVT BANKNIFTY REALTYNIFTY GROWSECT 15
NIFTY CPSENIFTY ENERGYNIFTY INFRANIFTY DIV OPPS 50
NIFTY MNCNIFTY PSENIFTY SERV SECTORNIFTY MID100 FREE
DOL200TECKBSEPSUNIFTY SML100 FREE
AUTOBANKEXINDIA VIXNIFTY50 VALUE 20

Parameters

Name Type Required Description
indexName string true Index name of the scrip
fromDate string true From date in yyyy-MM-dd hh:mm:ss
toDate string false To date in yyyy-MM-dd hh:mm:ss
interval string false Interval of data, By default interval is considered as 1 min

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMessage": "Index details retrieved successfully.",
  "indexIntraDayCandleData": [
    {
      "dateTime": "2019-11-11 10:01:00",
      "open": "689.9",
      "high": "694.0",
      "low": "682.75",
      "close": "688.0",
      "volume": "600344"
    }
  ]
}

Responses

Status Meaning Description
200 OK Index IntraDay Candle data retrieved successfully.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. Index intraday candle data.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
status string It would be success or failure
statusMessage string Status message of the Index request
indexIntraDayCandleData [object] Get List of IndexIntraDayCandleData .
dateTime string Date for which CandleData shown
open string Opening price of a market snapshot
high string High value of market snapshot
low string Low value of market snapshot
close string Close value of market snapshot
volume string Limit amount of a security traded on the specific day

Historical candle data

Historical candle data

Code samples

var headers = {
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/history/candleData?symbolName=INFY&fromDate=2019-10-11',
  method: 'get',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.get('https://api.stocknote.com/history/candleData', params={
  'symbolName': 'INFY',  'fromDate': '2019-10-11'
}, headers = headers)

print r.json()

GET /history/candleData

Gets the historical candle data such as Open, high, low, close, last traded price and volume within specific dates for a specific symbol. From date is mandatory. End date is optional and defaults to yesterday.

Parameters

Name Type Required Description
exchange string false Name of the exchange.Valid exchanges values (BSE/ NSE/ NFO/ MCX/ CDS).If the user does not provide an exchange name, by default considered as NSE.For trading with BSE, NFO, CDS and MCX, exchange is mandatory.
symbolName string true Symbol name of the scrip.
fromDate string true From date in yyyy-MM-dd
toDate string false To date in yyyy-MM-dd

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMessage": "Request successful",
  "historicalCandleData": [
    {
      "date": "2019-11-01",
      "open": "689.9",
      "high": "694.0",
      "low": "682.75",
      "close": "688.0",
      "ltp": "688.0",
      "volume": "600344"
    }
  ]
}

Responses

Status Meaning Description
200 OK Historical candle data successfully retrieved.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. Historical candle data.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
status string Response status. Can be Success or Failure
statusMessage string status Message
historicalCandleData [object] Get List of CandleData .
date string Date for which CandleData shown
open string Opening price of a market snapshot
high string High value of market snapshot
low string Low value of market snapshot
close string Close value of market snapshot
ltp string Price at which last transaction / trade is done
volume string Limit amount of a security traded on the specific day

Index Historical CandleData

Code samples

var headers = {
  'Accept':'application/json',
  'x-session-token':'c5c81c20f0fe81ceb45f93d3621d0938'

};

$.ajax({
  url: 'https://api.stocknote.com/history/indexCandleData?indexName=SENSEX&fromDate=2020-03-09',
  method: 'get',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Accept': 'application/json',
  'x-session-token': 'c5c81c20f0fe81ceb45f93d3621d0938'
}

r = requests.get('https://api.stocknote.com/history/indexCandleData', params={
  'indexName': 'SENSEX',  'fromDate': '2020-03-09'
}, headers = headers)

print r.json()

GET /history/indexCandleData

Gets the Index historical candle data such as Open, high, low, close, last traded price and volume within specific dates for a specific index. From date is mandatory. End date is optional and defaults to Today.

Supports Following List of Index names:

BSE CGSENSEXBSE CDNIFTY50 PR 1x INV
BSE ITMETALOILGASNIFTY50 PR 2x LEV
BSEIPOGREENXPOWERNIFTY50 TR 1x INV
CARBONBASMTRCDGSNIFTY50 TR 2x LEV
BSEFMCBSE HCALLCAPNIFTY50 TR 2x LEV
REALTYSMEIPODOL30NIFTY Mid LIQ 15
LRGCAPMIDSELSMLSELNIFTY100 LIQ 15
SNXT50SNSX50NIFTY 50NIFTY Quality 30
NIFTY BANKNIFTY NEXT 50DOL100NIFTY MIDCAP 50
NIFTY 100NIFTY 200NIFTY 500NIFTY FIN SERVICE
NIFTY AUTONIFTY FMCGNIFTY ITNIFTY COMMODITIES
NIFTY MEDIANIFTY METALNIFTY PHARMANIFTY CONSUMPTION
NIFTY PSU BANKNIFTY PVT BANKNIFTY REALTYNIFTY GROWSECT 15
NIFTY CPSENIFTY ENERGYNIFTY INFRANIFTY DIV OPPS 50
NIFTY MNCNIFTY PSENIFTY SERV SECTORNIFTY MID100 FREE
DOL200TECKBSEPSUNIFTY SML100 FREE
AUTOBANKEXINDIA VIXNIFTY50 VALUE 20

Parameters

Name Type Required Description
indexName string true Index name of the scrip
fromDate string true From date in yyyy-MM-dd
toDate string false To date in yyyy-MM-dd

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMessage": "Index details retrieved successfully.",
  "indexCandleData": [
    {
      "date": "2019-11-01",
      "open": "689.9",
      "high": "694.0",
      "low": "682.75",
      "close": "688.0",
      "ltp": "688.0",
      "volume": "600344"
    }
  ]
}

Responses

Status Meaning Description
200 OK Index data retrieved successfully.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. Index candle data.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
status string It would be success or failure
statusMessage string Status message of the Index request
indexCandleData [object] Get List of IndexData .
date string Date for which CandleData shown
open string Opening price of a market snapshot
high string High value of market snapshot
low string Low value of market snapshot
close string Close value of market snapshot
ltp string Price at which last transaction / trade is done
volume string Limit amount of a security traded on the specific day

Streaming Data

Streaming Market Data

Code samples










wss:/stream.stocknote.com/.

StockNote API platform provides the Broadcast API, as the most effective way to receive market data for instruments across all exchanges during live market hours. The API provides continuous streaming data of market data based on user request, and primarily consists of fields such as 5 levels of bid/offer market depth data etc.

The API uses WebSocket protocol to establish a dedicated TCP connection after an HTTP handshake to receive streaming quotes and thereby provides seamless streaming of market data. You need to use a WebSocket client to connect to our broadcast API. If you have already subscribed to our StockNote API services, you will be able to access broadcast API too.

Body parameter




Parameters

Name Type Required Description
body object false none
streaming_type string true Streaming type.Added for future use.Pass this value as “marketdata” always
symbols [string] true List of symbols contains listing nos used to get marketdata.
request_type string true Request type.This can be Subscribe/Unsubscribe. Subscribe - Receive continuous quote data. UnSubscribe - Stop receiving the continuous quote data. *It's important to unsubscribe when the streaming is no longer needed.
response_format string true Response data format. Currently supports json only

Example responses

200 Response




Responses

Status Meaning Description
200 OK Successfully retrieved streaming data.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. Unable to get streaming data.

Response Schema

Status Code 200

Name Type Description
askValues [object] Get List of AskValues .
number string Sequence number for Bid/Ask
quantity string Quantity asked for trading.
price string Price asked for trading.
bidValues [object] Get List of BidValues .
number string Sequence number for Bid/Ask
quantity string Quantity asked for trading.
price string Price asked for trading.
ltt string Last transaction time in milliseconds
lttUTC string Last transaction time in UTC time zone format
sym string Actual symbol name of the scrip
tBQ string Total quantity of BUY transaction
tSQ string Total quantity of SELL transaction

Streaming Quote Data

Code samples



import websocket

def on_message(ws, msg):
print ("Message Arrived:" + msg)

def on_error(ws, error):
print (error)

def on_close(ws):
print ("Connection Closed")

def on_open(ws):
print ("Sending json")
data='{"request":{"streaming_type":"quote", "data":{"symbols":[{"symbol":"532826_BSE"}]}, "request_type":"subscribe", "response_format":"json"}}'
ws.send(data)
ws.send("\n")

headers = {'x-session-token':'12a8a2b304142425a1e52f109ff02cb2'}

websocket.enableTrace(True)

ws = websocket.WebSocketApp("wss://stream.stocknote.com", on_open = on_open, on_message = on_message, on_error = on_error, on_close = on_close, header = headers)

ws.run_forever()

wss:/stream.stocknote.com

StockNote API platform provides the Broadcast API, as the most effective way to receive quote data for instruments across all exchanges during live market hours. The API provides continuous streaming data of quote based on user request, and primarily consists of fields such as last traded price, open, high, low, close, last traded quantity, last traded volume, last traded time etc.

The API uses WebSocket protocol to establish a dedicated TCP connection after an HTTP handshake to receive streaming quotes and thereby provides seamless streaming of quote data. You need to use a WebSocket client to connect to our broadcast API. If you have already subscribed to our StockNote API services, you will be able to access broadcast API too.

Body parameter

requestBody={
  "streaming_type": "quote",
  "symbols": "[{'symbol':'-53'},{'symbol':'89017_NFO'}]",
  "request_type": "subscribe",
  "response_format": "JSON"
}

Parameters

Name Type Required Description
body object false none
streaming_type string true Streaming type.Added for future use.Pass this value as “quote” always
symbols [string] true List of symbols contains listing nos used to get quote.
request_type string true Request type.This can be Subscribe/Unsubscribe. Subscribe - Receive continuous quote data. UnSubscribe - Stop receiving the continuous quote data. *It's important to unsubscribe when the streaming is no longer needed.
response_format string true Response data format. Currently supports json only

Example responses

200 Response

{
  "aPr": "44561.00",
  "bPr": "44554.00",
  "aSz": "1",
  "bSz": "1",
  "sym": "2885_NSE",
  "avgPr": "44371.85",
  "c": "44119.00",
  "h": "44786.00",
  "l": "43969.00",
  "o": "44105.00",
  "oI": "361290",
  "oIChg": "22350.00",
  "ch": "435.00",
  "chPer": "0.99",
  "lTrdT": "01 Oct 2019, 06:47:03 PM",
  "ltp": "44554.00",
  "ltq": "1",
  "ltt": "01 Oct 2019, 06:47:03 PM",
  "lttUTC": "01 Oct 2019, 01:17:03 PM",
  "tBQ": "973",
  "tSQ": "610",
  "ttv": "782763833.41",
  "vol": "782763833.41",
  "yH": "44786.00",
  "yL": "0.00",
  "streaming_type": "quote"
}

Responses

Status Meaning Description
200 OK Successfully retrieved streaming data.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error. Unable to get streaming data.

Response Schema

Status Code 200

Name Type Description
aPr string Ask Price that seller willing to take for the scrip
bPr string Bid Price that buyer willing to pay for the scrip
aSz string Ask size/quantity for trading
bSz string Bid size/quantity for trading
sym string Actual symbol name of the scrip
avgPr string Average trading price of the equity or derivative
c string Close value of market snapshot
h string High value of market snapshot
l string Low value of market snapshot
o string Opening price of a market snapshot
oI string Open interest is the total number of outstanding derivative contracts that have not been settled
oIChg string open interest changed value
ch string Change value is the difference between the current value and the previous day's market close
chPer string Percentage of change between the current value and the previous day's market close
lTrdT string Time of the last transaction
ltp string Price at which last transaction / trade is done
ltq string Quantity of last transaction
ltt string Last transaction time in milliseconds
lttUTC string Last transaction time in UTC time zone format
tBQ string Total quantity of BUY transaction
tSQ string Total quantity of SELL transaction
ttv string Total volume of trading done
vol string Total amount of a security traded Today
yH string 52 week high
yL string 52 week low
streaming_type string Streaming type. Added for future use.Pass this value as “quote” always

User Logout

User Logout

Code samples

var headers = {
  'Accept':'application/json',
  'x-session-token':'3f38c6dd6b950e48a23ebd16b04eb74e'

};

$.ajax({
  url: 'https://api.stocknote.com/logout',
  method: 'delete',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  },
  error : function(error){
    console.log(error);
  }
})

import requests
headers = {
  'Accept': 'application/json',
  'x-session-token': '3f38c6dd6b950e48a23ebd16b04eb74e'
}

r = requests.delete('https://api.stocknote.com/logout'
, headers = headers)

print r.json()

DELETE /logout

Logging out user from the application

Parameters

Name Type Required Description

Example responses

200 Response

{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMessage": "Request successful"
}

Responses

Status Meaning Description
200 OK Logout successful.
400 Bad Request Input validation Failed. Check the validation errors in response object.
500 Internal Server Error Server Error.Logout failured.

Response Schema

Status Code 200

Name Type Description
serverTime string Time at Server.
msgId string This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
status string Response status. Can be Success or Failure
statusMessage string status Message