Can any one please guide me how to get bank nifty from api-script-master.csv
Manually… if you want to look for all the options.
- Open the file. 2. Apply filter on the column ‘SEM_EXM_EXCH_ID’ to select ‘NSE’ only. 3. Apply filter on the column ‘SEM_INSTRUMENT_NAME’ to select only ‘OPTIDX’.
Now you are left with all indexes options data on NSE.
Target column ‘SEM_CUSTOM_SYMBOL’ for an easy search. Lets say you are looking for security id for bank nifty 24th July 52400 PUT. The format for custom symbol is 'BANKNIFTY . So you will serach for ‘BANKNIFTY 24 JUL 52400 PUT’.
Programatically… use the same logic as above to lookup.
search_column1 = ‘SEM_EXM_EXCH_ID’
search_value1 = ‘NSE’
search_column2 (str) = ‘SEM_CUSTOM_SYMBOL’
search_value2 = ‘BANKNIFTY 24 JUL 52400 PUT’
def lookup_entry(search_column1, search_value1, search_column2, search_value2, result_column):
"""
Lookup function to find the value in 'result_column' based on 'search_column' and 'search_value'.
Parameters:
search_column1 (str): The name of the column1 to search in.
search_value1: The value1 to search for in the search column.
search_column2 (str): The name of the column1 to search in.
search_value2: The value1 to search for in the search column.
result_column (str): The name of the column from which to retrieve the result.
Returns:
result: The entry found in 'result_column' corresponding to the 'search_value'.
"""
what is the security if for banknifty ??
Hello @Dhruv_Sharma1
In order to find out the Security ID, you can visit here : Instrument List - DhanHQ Ver 1.0 / API Document . In order to get the Security ID for Bank Nifty filter the SEM_SEGMENT as I, by doing so you will be able to get the same.
security for banknifty is, 25
how did you get this number ,in that master cv its something else .can you clarify ?
#for NIFTY
data = dhan.option_chain(13, under_exchange_segment=“NSE_IDX”, expiry=“2024-11-28”)
print(data)
it was working before but now start giving error:-
{‘813’: ‘Invalid SecurityId’}
your expiry list function also stop working
expiry = dhan.expiry_list(13, under_exchange_segment=“IDX_I”)
or
expiry = dhan.expiry_list(13, under_exchange_segment=“NSE_IDX”)
what are you doing, you are irritating too much
@Tradehull_Imran @Hardik
Hello @Happy_Life
Just tried this and this is working fine. Is there any specific time where you faced this issue, can take a look.