Entry in scrip master

There is incorrect entry of SEM_EXCH_INSTRUMENT_TYPE in KIMS as Other while it should be A. It is breaking my code since last many days

Please fix such instances @Hardik

Hello @sv28

Thanks for highlighting this. Yes, will check the code here and fix.

@Hardik any ETA? It happened today as well

Hello @sv28

Just to know more here, is there a check that you have kept on SEM_EXCH_INSTRUMENT_TYPE? If yes, then what?

def filter_csv_file(file_path, stocks):
    """Filters SCRIP_MASTER file for specific instruments based on a list of symbols.

    Args:
        file_path: The path to the CSV file.
        stocks: A list of instrument symbols.

    Returns:
        A dictionary mapping symbols to their corresponding security IDs.
    """

    filtered_rows = {}
    missing_symbols = set()

    with open(file_path, 'r') as file:
        csv_reader = csv.DictReader(file)
        for row in csv_reader:
            # Extract and normalize instrument information
            instrument_name = row['SEM_INSTRUMENT_NAME'].strip()
            exchange_id = row['SEM_EXM_EXCH_ID'].strip()
            instrument_type = row['SEM_EXCH_INSTRUMENT_TYPE'].strip()
            series = row['SEM_SERIES'].strip()

            # Check if the instrument is an equity and matches the exchange and series criteria
            if instrument_name == 'EQUITY':
                if exchange_id in ['NSE'] and series in ['EQ', 'BE']:
                    is_valid = True
                elif exchange_id in ['BSE'] and instrument_type in ['EQ', 'ES']:
                    is_valid = True
                else:
                    is_valid = False

                # If valid, process the symbol and security ID
                if is_valid:
                    symbol = f"{exchange_id}:{row['SEM_TRADING_SYMBOL'].strip()}-{series}"
                    if symbol in stocks:
                        filtered_rows[symbol] = row["SEM_SMST_SECURITY_ID"]
    #  Check if stock is in stocks list but missing in filtered_rows
    for stock in stocks:
        if stock not in filtered_rows and stock != SCRIP_NIFTY50_IDX:
            missing_symbols.add(stock)

    if missing_symbols:
        logging.error(f"The following symbols were not found in the CSV file: {missing_symbols}")

    return filtered_rows

@Hardik any update? Critical stuff like these should not be taken lightly. There are 3 other issues which are going on in parallel but no one from Dhan is paying heed to it.

@PravinJ I have been with Dhan since the very beginning but lately I’ve started to feel that the customer focus now has gone for a toss. Please take a look into all of the ongoing matters - this is not the kind of customer support I expect

Hello @sv28

Will connect with you today and take a look into this. For this issue, the file is fetched directly from exchange and such scenarios are hard to avoid.
We are trying at our end to resolve this.

Update: There has been an update to this file. This will be fixed from Monday.

@Hardik IK you guys fixed it but this issue happened today again

Hello @sv28

Just checked this, taking a look into it.