Symbols for index like NIFTY, BANKNIFTY or any other index

Satish G. shared this question 3 years ago
Answered

Hello,

I am using WebSocket API and I can pull data for NIFTY or BANKNIFTY futures by lines below:


hist_data = td_app.get_historic_data('NIFTY-I', duration = '6 D', bar_size = 'EOD')


hist_data = td_app.get_historic_data('BANKNIFTY-I', duration = '6 D', bar_size = 'EOD')


However, I am not able to find symbol to pull data for index itself like NIFTY or BANKNIFTY.

Where I can find list of symbols for indices?

Thanks/

Replies (6)

photo
1

I am looking for something similar to this: https://feedback.truedata.in/knowledge-base/article/list-of-all-indices?_route_=feedback/knowledge-base/article/list-of-all-indices

However, as these symbols are from Velocity, they are not working in WebSocket API.

photo
1

Please find the symbols list of Market Data (WebSocket) API >> Symbol Formats for Market Data (WebSocket) API

photo
1

Thanks Sourabh. It worked for NIFTY indices.

However, I tried to pull data for BANKNIFTY options by looking at your examples, I got error.

I tried this line:


hist_data = td_app.get_historic_data('BANKNIFTY21032518000CE', duration = '5 D', bar_size = 'EOD')

df = pd.DataFrame(hist_data)

print(df)


I was trying to get data for BANKNIFTY 18000 call option expiring on 25th March 2021. However, I got error:

Your request failed with error "No Data exists for BANKNIFTY21032518000CE".

Am I missing something/doing something wrong here?

Thanks.

photo
1

You're Welcome!

I see that you are trying to pull Data for BANKNIFTY 18000 call option which is not trading at this time and hence please try to pull the Data for BANKNIFTY 35000 call option and it would give you the data (snapshot below).

97bdd20b43061ee789d555d23c07ee53

Always try to pull options closer to ATM and it will work for you.

photo
1

Yes, it worked. Thanks Sourabh.

photo
1

You're Welcome Sir! :o)

Leave a Comment
 
Attach a file