Do I need to call on_connect or on_tick in a loop to get streaming of data

sunilguglani


Do I need to call on on_connect/on_tick/connect functions explicitly in a loop to get live streaming of stock data? Do they have any implicit loop?
  • trade_then
    trade_then edited March 2018
    on_ticks is a callback. Kite server is throwing tick data to this function. you have to do nothing just listen to it from inside of it. just don't do anything while listening that would take time and block this function. pass the ticks received here, to something ( non-blocking buffer/thread whatever is the equivalent in python to that ). From that non-blocking buffer/thread pick the ticks for storage or charting or algo calculations.

    Thanks
    Regards
  • sunilguglani
    Thanks for the reply. But when I ran this script, it just returned the ticker data once. Is it that, I am running it after market hours and it will not return until there is any change in the tick?
  • trade_then
    yes that is exactly the cause. it is after market hours.
    during market hours you will receive ticks as the change happens in the data of the
    prescribed scrips. i.e change in LTP, etc...

    Thanks
    Regards

  • sunilguglani
    I appreciate your prompt reply. I will try it tomorrow morning. :)
  • sunilguglani
    The data is streaming. Thanks for your help. I am facing another problem. it shows the error if I store the data in the data frame.
  • sunilguglani
    If I change the last statement in the loop to below statement then it works fine
    tick_df_all2=tick_df_all.append(tick_df_latest,ignore_index=True)

    Therefore it is considered as resolved
Sign In or Register to comment.