GetHistory

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

Supported parameters
ExchangeString value like MCXName of supported exchange. How to get list of supported exchanges you can find here
InstrumentIdentifierString value of instrument identifierHow to get list of available instruments and identifiers you can find here
Periodicity[“TICK”]/[“MINUTE”]/[“HOUR”]/[“DAY”]/[“WEEK”]/[“MONTH”], default = [“TICK”]String value of required periodicity.
PeriodNumerical value 1, 2, 3…, 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 Epoch Converter 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 Epoch Converter 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.
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.
What is returned ?
LastTradeTime, QuotationLot (LotSize), TradedQty, OpenInterest, Open, High, Low, Close
LastTradeTime : This value is expressed as no. of seconds since Epoch time (i.e. 1st January 1970). Also known as Unix Time. Please Visit Epoch Converter to get formulae to convert human readable time to Epoch and vice versa (scroll to end of their home page)
Sample request(JavaScript)
{
                MessageType: "GetHistory",
                Exchange: "NFO",
                InstrumentIdentifier: "NIFTY-I",
		//isShortIdentifier: "TRUE",
                Periodicity: "MINUTE",
                Max: 5
};
var message = JSON.stringify(request);
websocket.send(message);
Example of returned data (OHLC) in JSON format
{"Request":{"Exchange":"NFO","InstrumentIdentifier":"NIFTY-I","IsShortIdentifier":false,"From":0,"To":0,"Max":5,"Periodicity":"MINUTE","Period":0,"MessageType":"GetHistory"},
"Result":[{"LastTradeTime":1594186020,"QuotationLot":75,"TradedQty":44175,"OpenInterest":12130575,"Open":10772.85,"High":10779.95,"Low":10771.55,"Close":10779.2},
{"LastTradeTime":1594185960,"QuotationLot":75,"TradedQty":48000,"OpenInterest":12130575,"Open":10770.05,"High":10774.75,"Low":10769.35,"Close":10772.8},
{"LastTradeTime":1594185900,"QuotationLot":75,"TradedQty":54150,"OpenInterest":12055275,"Open":10773.45,"High":10774.0,"Low":10769.9,"Close":10771.65},
{"LastTradeTime":1594185840,"QuotationLot":75,"TradedQty":71325,"OpenInterest":12055275,"Open":10774.4,"High":10776.0,"Low":10771.65,"Close":10773.4},
{"LastTradeTime":1594185780,"QuotationLot":75,"TradedQty":38925,"OpenInterest":12055275,"Open":10780.0,"High":10780.3,"Low":10774.55,"Close":10775.1}],
"MessageType":"HistoryOHLCResult"}
Example of returned data (Tick) in JSON format
{"Request":{"Exchange":"NFO","InstrumentIdentifier":"NIFTY-I","IsShortIdentifier":false,"From":0,"To":0,"Max":5,"Periodicity":"TICK","Period":0,"MessageType":"GetHistory"},"Result":
[{"LastTradeTime":1594186301,"LastTradePrice":10775.0,"QuotationLot":75,"TradedQty":225,"OpenInterest":12176625,"BuyPrice":10774.3,"BuyQty":75,"SellPrice":10775.0,"SellQty":3150},
{"LastTradeTime":1594186300,"LastTradePrice":10774.0,"QuotationLot":75,"TradedQty":0,"OpenInterest":12176625,"BuyPrice":10774.3,"BuyQty":75,"SellPrice":10775.0,"SellQty":3375},
{"LastTradeTime":1594186299,"LastTradePrice":10774.0,"QuotationLot":75,"TradedQty":0,"OpenInterest":12176625,"BuyPrice":10774.1,"BuyQty":75,"SellPrice":10775.0,"SellQty":3375},
{"LastTradeTime":1594186298,"LastTradePrice":10774.0,"QuotationLot":75,"TradedQty":75,"OpenInterest":12176625,"BuyPrice":10773.9,"BuyQty":75,"SellPrice":10775.0,"SellQty":3375},
{"LastTradeTime":1594186297,"LastTradePrice":10773.8,"QuotationLot":75,"TradedQty":0,"OpenInterest":12176625,"BuyPrice":10774.0,"BuyQty":75,"SellPrice":10775.0,"SellQty":3300}],
"MessageType":"HistoryTickResult"}
×

Was this helpful?