on_ticks - Read this to correctly implement on_ticks

tahseen
tahseen edited December 2019 in Python client
After seeing lot of people make same mistake of overloading the on_ticks function, I decided to write this

Please note

1. Read about python Queue()
2. Create a global Queue at the start of your python code, so that Queue instance accessible anywhere
3. Inside on_ticks function, just write one line of code of pushing ticks into Queue instance and nothing else
4. Once kite ticks start coming, they would go into the Queue and you can read from Queue in any your algo function

So keep your on_ticks function clean

def on_ticks(ws, ticks):

# Just write one line to push ticks into the Queue Instances that
# you created in the beginning of your program
Please don't write if-then-else conditions or computations or functions inside on_ticks function. It is not meant for that
Tagged:
Sign In or Register to comment.