Skip to content

Not getting market feed #97

@adhilabu

Description

@adhilabu

I'm using the below method to get the market feed data from upstox_client and it was working few days ago but for the past few days after running the websockets, the on_open and on_message method is not getting executed. I'm using sdk version 2.12.0. Is there any issues with the code below or any other reasons


async def fetch_market_data_V3(producer: PulsarProducer):
    # Create default SSL context
    ssl_context = ssl.create_default_context()
    ssl_context.check_hostname = False
    ssl_context.verify_mode = ssl.CERT_NONE

    make_auth()
    access_token = None
    filename = get_accesstoken_filename()
    with open(filename, "r") as file:
        access_token = file.read()

    configuration = upstox_client.Configuration()
    configuration.access_token = access_token

    streamer = upstox_client.MarketDataStreamerV3(
        upstox_client.ApiClient(configuration))

    def on_open():
        instruments = get_instruments(WS_FEED_TYPE)
        streamer.subscribe(instruments, "full")

    def on_message(message):
        # filtered_data = filter_data_by_interval(message)
        producer.send_message(json.dumps(message))

    streamer.on("open", on_open)
    streamer.on("message", on_message)

    streamer.connect()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions