sbalaji987

About

Username
sbalaji987
Joined
Visits
111
Last Active
Roles
Member

Activity

  • Kamalv
    Sorry for bothering you, sample code is not working as expected, realized issues with Windows OS, degraded version and running in solo mode, working as expected now.

    I'm happy to work together if required :)
    October 2021
  • Kamalv
    Here is my code:
    import sys
    import json
    from kiteconnect import KiteTicker
    import time
    from db import insert_ticks

    api_key = ''
    access_token = ''
    kite = KiteConnect(api_key=api_key, access_token=access_token)

    tokens = [6191105]

    def on_tick(ticks, ws):
    logging.info("on tick - {}".format(json.dumps(ticks)))
    insert_ticks.delay(ticks, mapInsdf)

    def on_connect(kws, response):
    print("connected")

    def on_close():
    logging.info("con closed")

    kws.on_tick = on_tick
    kws.on_connect = on_connect
    kws.on_close = on_close

    kws.connect(threaded=True)

    count = 0
    while True:
    logging.info("2s delay")

    if count < len(tokens):
    if kws.is_connected():
    logging.info("Subscribing to: {}".format(tokens[count]))
    kws.subscribe([tokens[count]])
    kws.set_mode(kws.MODE_FULL, [tokens[count]])
    count += 1
    print('Subscribed successfully')
    else:
    logging.info("Connecting to WebSocket...")

    time.sleep(2)
    October 2021
  • Kamalv
    Hi Balaji,

    I am also trying to "Stream websocket data and store in Postgres" used celery but it is not hitting "on_connect". is it possible to share your code on [email protected].

    I tried couple of options resulting some or other issues.

    Thanks in advance,
    Kamal.
    October 2021
  • Welcome Aboard!
    June 2021