Code on GitHub not working

@Hardik

I noticed, I have given you the complete logic. refer below -

try:
    # Initialize the Dhan Feed with subscription details
    data = marketfeed.DhanFeed(client_id, access_token, instruments, version)
    # # Start the feed
    # print("Starting to receive market feed data...")
    while True:
        data.run_forever()  # Maintain a persistent connection
        message = data.get_data()  # Fetch the data from feed
        timestamp = datetime.datetime.now().strftime("%d-%m-%Y %H:%M:%S")
        print(message)

        # Process the message
        if message:
            # Extract security_id and LTP
            
            security_id = message.get('security_id')
            ltp = message.get('LTP')
            # print(f"Security ID: {security_id}, LTP: {ltp}")

            # Print the information if available
            if security_id and ltp:
            
            //// code to print in excel and place orders/////

            else:
                 print(f"Incomplete message received:", {"timestamp": timestamp, "message": message})

except Exception as e:
    # Handle exceptions gracefully
    print(f"An error occurred at timestamp {timestamp}:", str(e))
type or paste code here

Whenever the message comes without LTP it will execute and print the “else:” condition. I hope, I am able to make you understand the issue with it.

Please let me know about the resolution, so I can decide if it worth continuing with Data API paid subscription.