GetHistory

GetHistory : Returns historical data (Tick / Minute / EOD)

Supported parameters
accessKeyAccess key according to your subscriptionRequired parameter.
exchangeString value like MCXName of supported exchange. How to get list of supported exchanges you can find here
instrumentIdentifierValue of instrument identifierHow to get list of available instruments and identifiers you can find here
You will need to use URL Econding for instrument identifiers with special characters (like BAJAJ-AUTO, M&M, L&T, NIFTY 50, etc.) as explained here
periodicity[TICK]/[MINUTE]/[HOUR]/[DAY]/[WEEK]/[MONTH], default = [TICK]String value of required periodicity.
periodNumerical value 1, 2, 3…l default = 1Optional parameter of required period for historical data. Can be applied for [MINUTE]/[HOUR]/[DAY] periodicity types
fromNumerical value of UNIX Timestamp like ‘1388534400’ (01-01-2014 0:0:0)Optional parameter. It means starting timestamp for called historical data. This value is expressed as no. of seconds since Epoch time (i.e. 1st January 1970). Also known as Unix Time. Please Visit https://www.epochconverter.com/ to get formulae to convert human readable time to Epoch and vice versa (scroll to end of their home page)
toNumerical value of UNIX Timestamp like ‘1412121600’ (10-01-2014 0:0:0)Optional parameter. It means ending timestamp for called historical data. This value is expressed as no. of seconds since Epoch time (i.e. 1st January 1970). Also known as Unix Time. Please Visit https://www.epochconverter.com/ to get formulae to convert human readable time to Epoch and vice versa (scroll to end of their home page)
maxNumerical value. Default = 0 (means all available data)Optional parameter. It limits returned data.
userTagAny string valueOptional parameter. It will be returned with historical data.
xml[true]/[false], default = [false]Optional parameter. By default function will return JSON data. Functions will return XML data if set as [true]
isShortIdentifier[true]/[false], default = [false]Optional parameter. By default function will use long instrument identifier format. Functions will use short instrument identifier format if set as [true]. Example of ShortIdentifiers are NIFTY25MAR21FUT, RELIANCE25MAR21FUT, NIFTY25MAR2115000CE, etc.
Example http://endpoint:port/GetHistory/?accessKey=0a0b0c&exchange=MCX&instrumentIdentifier=FUTIDX_BANKNIFTY_25MAR2021_XX_0&periodicity=DAY&from=1388534400&to=1412121600&max=100&userID=aabbcc&xml=true&isShortIdentifier=true
What is returned ?
LastTradeTime, QuotationLot (LotSize), TradedQty, OpenInterest, Open, High, Low, Close
LastTradeTime : In JSON Response, this value is expressed as no. of seconds since Epoch time (i.e. 1st January 1970). Also known as Unix Time. Please Visit https://www.epochconverter.com/ to get formulae to convert human readable time to Epoch and vice versa (scroll to end of their home page)
Example of returned data (Tick)
JSONXML
{“TICK”: [{ “BUYPRICE”: 1115.1, “BUYQTY”: 1, “LASTTRADEPRICE”: 1115.8, “LASTTRADETIME”: 1391864127, “OPENINTEREST”: 1885, “QUOTATIONLOT”: 15, “SELLPRICE”: 1116, “SELLQTY”: 1, “TRADEDQTY”: -87},{ “BUYPRICE”: 1115, “BUYQTY”: 1, “LASTTRADEPRICE”: 1115.1, “LASTTRADETIME”: 1391864128, “OPENINTEREST”: 1886, “QUOTATIONLOT”: 15, “SELLPRICE”: 1116, “SELLQTY”: 1, “TRADEDQTY”: -86}]}
<?xml version=”1.0″ encoding=”utf-16″ ?>

<TickHistory

xmlns:xsd=”http://www.w3.org/2001/XMLSchema”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
<Value LastTradeTime=”2-8-2014 12:55:27 PM” LastTradePrice=”1115.8″ QuotationLot=”15″ TradedQty=”-87″ OpenInterest=”1885″ BuyPrice=”1115.1″ BuyQty=”1″ SellPrice=”1116″ SellQty=”1″/>
<Value LastTradeTime=”2-8-2014 12:55:28 PM” LastTradePrice=”1115.1″ QuotationLot=”15″ TradedQty=”-86″ OpenInterest=”1886″ BuyPrice=”1115″ BuyQty=”1″ SellPrice=”1116″ SellQty=”1″/>

</TickHistory>

Example of returned data (Minute/EOD)
JSONXML
{“OHLC”: [{ “CLOSE”: 1116.5, “HIGH”: 1119.6, “LASTTRADETIME”: 1391817600, “LOW”: 1102.1, “OPEN”: 1102.1, “OPENINTEREST”: 1887, “QUOTATIONLOT”: 15, “TRADEDQTY”: 310},{ “CLOSE”: 1116.5, “HIGH”: 1119.6, “LASTTRADETIME”: 139817600, “LOW”: 1102.1, “OPEN”: 1102.1, “OPENINTEREST”: 1887, “QUOTATIONLOT”: 15, “TRADEDQTY”: 310}]}
<?xml version=”1.0″ encoding=”utf-16″ ?>

<OHLCHistory

xmlns:xsd=”http://www.w3.org/2001/XMLSchema”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
<Value LastTradeTime=”2-8-2014 12:00:00 AM” QuotationLot=”15″ TradedQty=”310″ OpenInterest=”1887″ Open=”1102.1″ High=”1119.6″ Low=”1102.1″ Close=”1116.5″/>
<Value LastTradeTime=”2-9-2014 12:00:00 AM” QuotationLot=”15″ TradedQty=”300″ OpenInterest=”1787″ Open=”1116.9″ High=”1120.2″ Low=”1109.4″ Close=”1115.5″/>

</OHLCHistory>

Was this helpful?