Use case of instrument_token when tradingsymbol and exchange can be used for uniq selection?

pavanvora
I understand that it is definitely something that will be useful but I was just wondering what could be the use case for these values. When fetching historical data I need to provide instrument_token but while doing a trade it needs only tradingsymbol and exchange, So my question is if I'm storing the historical data to some DB, is instrument_token is something that I should store for future use (*Anyway I'm storing the tradingsymbol and exchange to the DB)?

Your thoughts on this will be really appreciated and helpful.
  • sujith
    The instrument token is unique for the day and it can be used to subscribe for live ticks and historical data.
    But if you are dumping data on your DB then I would suggest using a combination of tradingsymbol and exchange as the key.
    An instrument token is assigned by Zerodha based on the exchange token provided by the exchange. Exchange reuses token for a new scrip once old scrip expires.
  • pavanvora
    okay, so suppose if fetching of historical data takes longer than a day that means I'll have to refetch the instrument list the next day because you said the instrument token will be unique for the day?
  • rakeshr
    I'll have to refetch the instrument list the next day because you said the instrument token will be unique for the day?
    Yes, you need to re-fetch the instrument tokens on each trading day.
  • pavanvora
    @rakeshr But I've been using old instrument_token (fetched a couple of days back) for fetching Historical data and all works fine. Is it like the instrument_token value changes on a random day or how does that works?
  • rakeshr
    @pavanvora
    Is it like the instrument_token value changes on a random day or how does that works?
    Generally for equity contracts, instrument token won't change until there is corporate action. But instrument token for expired F&O contracts can be reused for new F&O contracts. These changes are done on the next day to expiry, once old F&O contract expires and new contracts are added.
    in general, it becomes difficult to track each segment expiry data, so we recommend daily import/update for full instrument list on each trading day.
  • pavanvora
    Gotcha, thank you for your detailed reply @rakeshr.

    You can close the discussion.
This discussion has been closed.