Arcit sir please help me i do not under stand

mera problem hai
Dhan pratice folder ke andar

  1. dhan api crip master.csv
  2. ipmort pandas as pd create ho nahi raha hai
  3. apka tempcoderunnerfile.py kaise create kiye hai

pl arcit sir help me

This is my code. It is working. It is fetching the symbol ID.

import pandas as pd

def get_instrument_token():
    df = pd.read_csv('api-scrip-master.csv')
    data_dict = {}
    for index, row in df.iterrows():
        trading_symbol = row['SEM_TRADING_SYMBOL']
        exm_exch_id = row['SEM_EXM_EXCH_ID']
        if trading_symbol not in data_dict:
            data_dict[trading_symbol] = {}
        data_dict[trading_symbol][exm_exch_id] = row.to_dict()
    return data_dict

token_dict = get_instrument_token()

def get_symbol_name(symbol, expiry, strike, strike_type):
    instrument = f'{symbol}-{expiry}-{str(strike)}-{strike_type}'
    return instrument

symbol = 'MIDCPNIFTY'
expiry = 'Mar2024'
strike = 10050
strike_type = 'CE'
instrument = get_symbol_name(symbol, expiry, strike, strike_type)


if instrument in token_dict:

    print(token_dict[instrument]['NSE']['SEM_SMST_SECURITY_ID'])
else:
    print("Instrument not found")

Regards

Maddy

2 Likes

Thank you sir so much sir