GetHistory : Returns delayed historical data (Tick / Minute / EOD)
Delay parameter is configured at our backend. Hence this function works exactly in same manner like GetHistory. So the request syntax and fields in response remain exactly same like GetHistory. Only difference is that the data is delayed which will be visible only from the trade timestamp received in the response (field : LastTradeTime) and comparing it with the current time.
Supported parameters
Exchange | String value like MCX | Name of supported exchange. How to get list of supported exchanges you can find here |
InstrumentIdentifier | String value of instrument identifier | How 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. |
Period | Numerical value 1, 2, 3…, default = 1 | Optional parameter of required period for historical data. Can be applied for [MINUTE]/[HOUR]/[DAY] periodicity types |
From | Numerical 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) |
To | Numerical 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) |
Max | Numerical value. Default = 0 (means all available data) | Optional parameter. It limits returned data. |
userTag | Any string value | Optional 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 https://www.epochconverter.com/ 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", Periodicity: "MINUTE", Period: 5, Max: 10, isShortIdentifier: "False", UserTag : "demouser" }; var message = JSON.stringify(request); websocket.send(message);
Example of returned data (OHLC) in JSON format
Time : Wed Sep 11 2024 12:21:31 GMT+0530 (India Standard Time) RESPONSE: {"Request":{"Exchange":"NFO","InstrumentIdentifier":"NIFTY-I","IsShortIdentifier":false,"From":0,"To":0,"Max":10,"Periodicity":"MINUTE","Period":5,"UserTag":null,"AdjustSplits":true,"MessageType":"GetHistory"}, "Result":[{"LastTradeTime":1726036500,"QuotationLot":25,"TradedQty":64500,"OpenInterest":13405900,"Open":25120.65,"High":25138.8,"Low":25113.65,"Close":25115.45}, {"LastTradeTime":1726036200,"QuotationLot":25,"TradedQty":85850,"OpenInterest":13400800,"Open":25108.0,"High":25127.95,"Low":25108.0,"Close":25120.65}, {"LastTradeTime":1726035900,"QuotationLot":25,"TradedQty":54300,"OpenInterest":13401975,"Open":25088.6,"High":25115.0,"Low":25088.6,"Close":25108.0}, {"LastTradeTime":1726035600,"QuotationLot":25,"TradedQty":40250,"OpenInterest":13397325,"Open":25093.05,"High":25104.0,"Low":25086.55,"Close":25088.45}, {"LastTradeTime":1726035300,"QuotationLot":25,"TradedQty":31950,"OpenInterest":13389625,"Open":25090.55,"High":25098.0,"Low":25080.05,"Close":25094.85}, {"LastTradeTime":1726035000,"QuotationLot":25,"TradedQty":29925,"OpenInterest":13379725,"Open":25081.1,"High":25095.0,"Low":25075.05,"Close":25090.55}, {"LastTradeTime":1726034700,"QuotationLot":25,"TradedQty":41025,"OpenInterest":13376250,"Open":25090.45,"High":25094.0,"Low":25062.15,"Close":25082.95}, {"LastTradeTime":1726034400,"QuotationLot":25,"TradedQty":26825,"OpenInterest":13372525,"Open":25086.9,"High":25096.0,"Low":25080.5,"Close":25090.75}, {"LastTradeTime":1726034100,"QuotationLot":25,"TradedQty":17350,"OpenInterest":13368300,"Open":25078.15,"High":25091.0,"Low":25075.8,"Close":25086.25}, {"LastTradeTime":1726033800,"QuotationLot":25,"TradedQty":60450,"OpenInterest":13382200,"Open":25079.55,"High":25082.85,"Low":25068.35,"Close":25078.25}], "MessageType":"HistoryOHLCResult"}
Sample request by taking FROM & TO parameter(JavaScript)
{ MessageType: "GetHistory", Exchange: "NFO", InstrumentIdentifier: "NIFTY-I", Periodicity: "MINUTE", From: 1725942600, To: 1725943800, Period: 10, isShortIdentifier: "False", UserTag : "demouser" }; var message = JSON.stringify(request); websocket.send(message);
Example of returned data (OHLC) in JSON format
Time : Tue Sep 10 2024 21:24:39 GMT+0530 (India Standard Time) RESPONSE: {"Request":{"Exchange":"NFO","InstrumentIdentifier":"NIFTY-I","IsShortIdentifier":false,"From":1725942600,"To":1725943800,"Max":0,"Periodicity":"MINUTE","Period":10,"UserTag":null,"AdjustSplits":true,"MessageType":"GetHistory"}, "Result":[{"LastTradeTime":1725943800,"QuotationLot":25,"TradedQty":71275,"OpenInterest":13879850,"Open":24944.5,"High":24966.9,"Low":24940.6,"Close":24959.9}, {"LastTradeTime":1725943200,"QuotationLot":25,"TradedQty":100250,"OpenInterest":13889050,"Open":24942.15,"High":24949.95,"Low":24919.5,"Close":24938.8}, {"LastTradeTime":1725942600,"QuotationLot":25,"TradedQty":126200,"OpenInterest":13871875,"Open":24943.45,"High":24959.05,"Low":24930.0,"Close":24941.7}], "MessageType":"HistoryOHLCResult"}
Sample request for hour timeframe using FROM & TO parameter(JavaScript)
{ MessageType: "GetHistory", Exchange: "NFO", InstrumentIdentifier: "NIFTY-I", Periodicity: "Hour", From: 1725942600, To: 1725949800, UserTag : "demo_user" }; var message = JSON.stringify(request); websocket.send(message);
Example of returned data (OHLC) in JSON format
Time : Wed Sep 11 2024 11:43:31 GMT+0530 (India Standard Time) RESPONSE: {"Request":{"Exchange":"NFO","InstrumentIdentifier":"NIFTY-I","IsShortIdentifier":false,"From":1725942600,"To":1725949800,"Max":0,"Periodicity":"HOUR","Period":1,"UserTag":null,"AdjustSplits":true,"MessageType":"GetHistory"}, "Result":[{"LastTradeTime":1725949800,"QuotationLot":25,"TradedQty":1029450,"OpenInterest":13730625,"Open":25062.95,"High":25124.0,"Low":25047.0,"Close":25102.75}, {"LastTradeTime":1725946200,"QuotationLot":25,"TradedQty":675800,"OpenInterest":13886750,"Open":24991.6,"High":25067.9,"Low":24978.75,"Close":25062.95}, {"LastTradeTime":1725942600,"QuotationLot":25,"TradedQty":555175,"OpenInterest":13930900,"Open":24943.45,"High":24996.0,"Low":24919.5,"Close":24995.3}], "MessageType":"HistoryOHLCResult"}
Sample request in TICK format(JavaScript)
{ MessageType: "GetHistory", Exchange: "NFO", InstrumentIdentifier: "NIFTY-I", Periodicity: "TICK", Period: 1, // Period is mandatory Max: 5, isShortIdentifier: "False", UserTag : "demouser" }; var message = JSON.stringify(request); websocket.send(message);
Example of returned data (Tick) in JSON format
Time : Wed Sep 11 2024 11:55:04 GMT+0530 (India Standard Time) RESPONSE: {"Request":{"Exchange":"NFO","InstrumentIdentifier":"NIFTY-I","IsShortIdentifier":false,"From":0,"To":0,"Max":5,"Periodicity":"TICK","Period":1,"UserTag":null,"AdjustSplits":true,"MessageType":"GetHistory"}, "Result":[{"LastTradeTime":1726035004,"LastTradePrice":25083.9,"QuotationLot":25,"TradedQty":50,"OpenInterest":13377500,"BuyPrice":25081.15,"BuyQty":50,"SellPrice":25083.9,"SellQty":25}, {"LastTradeTime":1726035002,"LastTradePrice":25084.0,"QuotationLot":25,"TradedQty":450,"OpenInterest":13376250,"BuyPrice":25080.6,"BuyQty":50,"SellPrice":25084.3,"SellQty":100}, {"LastTradeTime":1726035001,"LastTradePrice":25081.1,"QuotationLot":25,"TradedQty":150,"OpenInterest":13376250,"BuyPrice":25080.45,"BuyQty":50,"SellPrice":25082.15,"SellQty":50}, {"LastTradeTime":1726034999,"LastTradePrice":25082.95,"QuotationLot":25,"TradedQty":50,"OpenInterest":13376250,"BuyPrice":25081.6,"BuyQty":125,"SellPrice":25083.0,"SellQty":50}, {"LastTradeTime":1726034997,"LastTradePrice":25080.0,"QuotationLot":25,"TradedQty":0,"OpenInterest":13376250,"BuyPrice":25080.75,"BuyQty":500,"SellPrice":25082.95,"SellQty":75}], "MessageType":"HistoryTickResult"}
Sample request in DAY format(JavaScript)
{ MessageType: "GetHistory", Exchange: "NFO", InstrumentIdentifier: "NIFTY-I", Periodicity: "DAY", Max: 5, UserTag : "demouser" }; var message = JSON.stringify(request); websocket.send(message);
Example of returned data (OHLC) in JSON format
Time : Wed Sep 11 2024 12:14:08 GMT+0530 (India Standard Time) RESPONSE: {"Request":{"Exchange":"NFO","InstrumentIdentifier":"NIFTY-I","IsShortIdentifier":false,"From":0,"To":0,"Max":5,"Periodicity":"DAY","Period":1,"UserTag":null,"AdjustSplits":true,"MessageType":"GetHistory"}, "Result":[{"LastTradeTime":1725971400,"QuotationLot":25,"TradedQty":6026375,"OpenInterest":13288750,"Open":25034.0,"High":25174.0,"Low":24919.5,"Close":25083.0}, {"LastTradeTime":1725885000,"QuotationLot":25,"TradedQty":5348700,"OpenInterest":13714275,"Open":24865.35,"High":25000.8,"Low":24816.0,"Close":24985.0}, {"LastTradeTime":1725625800,"QuotationLot":25,"TradedQty":10407125,"OpenInterest":14273075,"Open":25189.8,"High":25219.0,"Low":24855.0,"Close":24906.0}, {"LastTradeTime":1725539400,"QuotationLot":25,"TradedQty":3922150,"OpenInterest":14884750,"Open":25350.0,"High":25351.0,"Low":25225.0,"Close":25236.75}, {"LastTradeTime":1725453000,"QuotationLot":25,"TradedQty":5544900,"OpenInterest":15240000,"Open":25210.15,"High":25275.0,"Low":25142.35,"Close":25247.8}], "MessageType":"HistoryOHLCResult"}
Important Note
As per user requirement of data for the delayed datafeed, changes are done at GFDL’s backend. So users will not need to make any changes in their code. The request syntax and response fields will remain the same for realtime as well as delayed history.
Was this helpful?