We want to set up two kiteticker instances one in threaded mode to listen to the order updates so that while we wait for feting details like LTP, orders, etc. we will not lose the order callbacks
We also need a second kiteticker to process the incoming ticks to determine the current state of positions
What is currently happening is that after we call connect() on the second kiteconnect instance. Main thread simply terminates
program simply terminates with exit status 0 after call to positionManager.monitorPositions()
Don't see kiteTickerOnTicks method detail above. Are you performing any computataion inside on_tick? Make sure, you are not blocking the ticker thread. This thread should help.
Indeed we do some computations onside on_tick callback but those are for just pnl calculation which is basic arithmatic and some sleep in certain scenarios like checking the status of a recent order. What we want is to run tickers in both threaded and non threaded mode so that while processing tics we do not miss the order update while we wait. We dropped few updates as the ticks were being processed hence want to change the working model to thread-based order event listening
In the example shared can you please explain why do we need to write two on_tick functions. Also, how will the last line get executed while the main thread is in an infinite loop? Sorry to ask silly question but wanted to know this
What we have experienced is that calling kiteTicker.connect(threaded=True) first time starts the ticker in separate thread as expected.
However when we call kiteTicker.connect() second time to run ticker in main thread, it is starting it in separate thread again which is daemon.
Post calling kiteTicker.connect(), main thread ends and so does the application
Is there any functionality to add callback on exception similar to
concurrent.futures.add_done_callback where we can check the error and handle it
kiteTickerOnTicks
method detail above.Are you performing any computataion inside on_tick?
Make sure, you are not blocking the ticker thread. This thread should help.
What we want is to run tickers in both threaded and non threaded mode so that while processing tics we do not miss the order update while we wait.
We dropped few updates as the ticks were being processed hence want to change the working model to thread-based order event listening
Also, how will the last line get executed while the main thread is in an infinite loop?
Sorry to ask silly question but wanted to know this
it will help you as it will not block main thread
However when we call kiteTicker.connect() second time to run ticker in main thread, it is starting it in separate thread again which is daemon.
Post calling kiteTicker.connect(), main thread ends and so does the application