No tick data in this frame

I have developed a Python script to fetch the LTP (Last Traded Price) and other details from the live market feed. However, the script is not returning any data as expected. Below, I have shared the code along with the output. Could you please help me resolve this issue?

code:—

import asyncio
import json
import websockets
import MarketDataFeedV3_pb2 as pb # Your compiled Protobuf module
import ssl

ACCESS_TOKEN = ‘my ACCESS_TOKEN’
ws_url = “wss://api.upstox.com/v3/feed/market-data-feed” # Make sure this is ws:// not wss://
INSTRUMENT_KEYS = [“101000000”]
ssl_context = ssl.create_default_context()
ssl_context.check_hostname = False
ssl_context.verify_mode = ssl.CERT_NONE

def decode_protobuf(buffer):
resp = pb.FeedResponse()
resp.ParseFromString(buffer)
return resp

async def subscribe_to_feed():
print(“:electric_plug: Connecting to WebSocket…”)

async with websockets.connect(
    ws_url,
    ssl=ssl_context,
    additional_headers={"Authorization": f"Bearer {ACCESS_TOKEN}"}
) as websocket:
    print("✅ WebSocket connection established")

    sub_request = {
        "guid": "my-guid-001",
        "method": "sub",
        "mode": "ltpc",
        "instrumentKeys": INSTRUMENT_KEYS
    }

    print("📦 Sending subscription request:", sub_request)
    await websocket.send(json.dumps(sub_request))
    print("📡 Subscription sent:", INSTRUMENT_KEYS)

    print("🔄 Starting tick reception loop...")
    while True:
        raw_data = await websocket.recv()
        buffer = raw_data if isinstance(raw_data, bytes) else raw_data.encode()

        response = decode_protobuf(buffer)
        print("🧭 Decoded message type:", response.type)
        print("📊 Market Info:", response.marketInfo.segmentStatus)
        print("📈 Feed count:", len(response.feeds))

        if response and response.feeds:
            for symbol, feed in response.feeds.items():
                print(f"🔑 {symbol}")
                if feed.HasField("ltpc"):
                    print("  📊 LTP:", feed.ltpc.ltp)
                elif feed.HasField("fullFeed"):
                    ff = feed.fullFeed
                    if ff.HasField("marketFF"):
                        print("  📊 Market LTP:", ff.marketFF.ltpc.ltp)
                    elif ff.HasField("indexFF"):
                        print("  📊 Index LTP:", ff.indexFF.ltpc.ltp)
        else:
            print("⏳ No tick data in this frame.")

if name == “main”:
asyncio.run(subscribe_to_feed())

Below are the multiple run OUTPUT after changing instrumentKeys:—

:electric_plug: Connecting to WebSocket…
:white_check_mark: WebSocket connection established
:package: Sending subscription request: {‘guid’: ‘my-guid-001’, ‘method’: ‘sub’, ‘mode’: ‘ltpc’, ‘instrumentKeys’: [‘NSE_EQ|INE002A01018’]}
:satellite_antenna: Subscription sent: [‘NSE_EQ|INE002A01018’]
:counterclockwise_arrows_button: Starting tick reception loop…
:compass: Decoded message type: 2
:bar_chart: Market Info: {‘NCD_FO’: 2, ‘BCD_FO’: 2, ‘NSE_INDEX’: 2, ‘NSE_EQ’: 2, ‘BSE_INDEX’: 2, ‘BSE_FO’: 2, ‘MCX_FO’: 2, ‘NSE_FO’: 2, ‘NSE_COM’: 2, ‘BSE_EQ’: 2, ‘MCX_INDEX’: 2}
:chart_increasing: Feed count: 0
:hourglass_not_done: No tick data in this frame.

:electric_plug: Connecting to WebSocket…
:white_check_mark: WebSocket connection established
:package: Sending subscription request: {‘guid’: ‘my-guid-001’, ‘method’: ‘sub’, ‘mode’: ‘ltpc’, ‘instrumentKeys’: [‘NSE_EQ|INE002A01018’]}
:satellite_antenna: Subscription sent: [‘NSE_EQ|INE002A01018’]
:counterclockwise_arrows_button: Starting tick reception loop…
:hourglass_not_done: No tick data in this frame.

:electric_plug: Connecting to WebSocket…
:white_check_mark: WebSocket connection established
:package: Sending subscription request: {‘guid’: ‘my-guid-001’, ‘method’: ‘sub’, ‘mode’: ‘ltpc’, ‘instrumentKeys’: [‘101000000’]}
:satellite_antenna: Subscription sent: [‘101000000’]
:counterclockwise_arrows_button: Starting tick reception loop…
:compass: Decoded message type: 2
:bar_chart: Market Info: {‘NCD_FO’: 2, ‘BCD_FO’: 2, ‘NSE_INDEX’: 2, ‘NSE_EQ’: 2, ‘BSE_INDEX’: 2, ‘BSE_FO’: 2, ‘MCX_FO’: 2, ‘NSE_FO’: 2, ‘NSE_COM’: 2, ‘BSE_EQ’: 2, ‘MCX_INDEX’: 2}
:chart_increasing: Feed count: 0
:hourglass_not_done: No tick data in this frame.

This is not a valid instrument key, please use correct instrument keys as present in our instrument json file Instruments | Upstox Developer API

Also for easier implementation of websockets do refer to streamer functionalities provided in various languages.

Thanks!