Using instrument token to store historic data has issues

ashwin_tay
I was under the impression that all scrips has their unique instrument token.

Last week I update my instruments from Zerodha and comparing it with this week there is a mismatch

Last week
instrument_token exchange_token tradingsymbol
9595650 37483 BANKNIFTY1930726000CE

This week
instrument_token exchange_token tradingsymbol
11283714 44077 BANKNIFTY1940430100CE

Now if you see the kite application
BANKNIFTY1940430100CE (APR Weekly expiry) has the exchange token of march month first week expiry instrument_token.

https://kite.zerodha.com/chart/web/ciq/NFO-OPT/BANKNIFTY1940430700CE/9595650

Even in the network tab of the console, the same number shows.

These are the 15min candles fetched for 29-03-2019
"candles":[["2019-03-29T09:15:00+0530",705.35,723,511.05,588.9,8540],
["2019-03-29T09:30:00+0530", 588.9, 588.9, 462.6, 514.9, 8640],
["2019-03-29T09:45:00+0530", 514.9, 530, 490, 521.8, 1440],
["2019-03-29T10:00:00+0530", 521.8, 521.8, 480.05, 508.95, 1180],
["2019-03-29T10:15:00+0530", 508.95, 508.95, 476.55, 493.8, 1140],
["2019-03-29T10:30:00+0530", 493.8, 493.8, 445.95, 466.85, 4100],
["2019-03-29T10:45:00+0530", 466.85, 482.5, 445.95, 463.4, 3200],
["2019-03-29T11:00:00+0530", 463.4, 509, 460.5, 503, 2840],
["2019-03-29T11:15:00+0530", 503, 533.4, 497.45, 505, 2140],
["2019-03-29T11:30:00+0530", 505, 517, 500, 507.75, 520],
["2019-03-29T11:45:00+0530", 507.75, 530.25, 505, 530.25, 940],
["2019-03-29T12:00:00+0530", 530.25, 530.25, 505.35, 521.75, 180],
["2019-03-29T12:15:00+0530", 521.75, 521.75, 466.25, 487.05, 800],
["2019-03-29T12:30:00+0530", 487.15, 524, 485.75, 513.3, 1720],
["2019-03-29T12:45:00+0530", 513.3, 531, 509.1, 519.4, 640],
["2019-03-29T13:00:00+0530", 519.4, 526.1, 490.05, 515, 940],
["2019-03-29T13:15:00+0530", 515, 570, 515, 530, 1620],
["2019-03-29T13:30:00+0530", 530, 563.5, 525.6, 555.85, 260]]

These are the 15min candles thats supposed to be fetched for 29-03-2019
"candles": [["2019-03-29T09:30:00+0530", 264.95, 264.95, 201, 226, 302600],
["2019-03-29T09:45:00+0530", 225, 239, 215.85, 230, 136860],
["2019-03-29T10:00:00+0530", 229.8, 234.5, 210, 225.1, 115900],
["2019-03-29T10:15:00+0530", 225.1, 225.5, 212, 217.2, 73540],
["2019-03-29T10:30:00+0530", 216.5, 218.4, 195.3, 206.45, 93840],
["2019-03-29T10:45:00+0530", 206.4, 215.4, 195.55, 209.45, 68640],
["2019-03-29T11:00:00+0530", 207.85, 229.8, 207.35, 227.5, 82220],
["2019-03-29T11:15:00+0530", 227.5, 241, 222.05, 225.75, 95920],
["2019-03-29T11:30:00+0530", 225.75, 233.5, 220.15, 228.1, 45080],
["2019-03-29T11:45:00+0530", 228.1, 239.7, 224, 234.5, 48940],
["2019-03-29T12:00:00+0530", 233, 234.55, 224, 228.8, 44460],
["2019-03-29T12:15:00+0530", 228.8, 228.8, 205, 216.55, 112800],
["2019-03-29T12:30:00+0530", 216.55, 234.3, 214.25, 228.5, 60100],
["2019-03-29T12:45:00+0530", 228.5, 238, 222.2, 231.45, 73800],
["2019-03-29T13:00:00+0530", 231.45, 234, 215.05, 229.15, 78580],
["2019-03-29T13:15:00+0530", 229.15, 252.9, 225.75, 235.3, 179760],
["2019-03-29T13:30:00+0530", 233.9, 251.65, 233.05, 243.55, 80820]
]
  • rakeshr
    @ashwin_tay
    The exchange re-uses the tokens once expired so you can't store tokens for expired instruments.
    We will recommend you to fetch instrument list daily or post expiry date, check instrument file here.
  • RA9243
    RA9243 edited March 30
    @rakeshr in that case, could you propose a good method to store data in db for long historical datastore. Is a combination of excange and tradingsymbol unique?
  • rakeshr
    @RA9243
    Yes,exchange and tradingsymbol (eq: NSE:SBIN) remains unique until there is symbol change corporate action.
  • RA9243
    RA9243 edited April 24
    @rakeshr Thanks :)
This discussion has been closed.