I have following code for KiteTicker to fetch live tick data: It runs successfully but I am not able to come from this loop. Refer attached image for output.i.e. how to close this loop. Can you please suggest correction in below code? I want to use this data for placing order at particular time.
@Ashok121 Check this. Yup ws.stop() has to happen inside on_close callback. But to trigger on_close callback based on some logic, you need to call ws.close() somewhere right?
@Ashok121 What purpose does the while loop serve here? Error clearly states that the reactor is not restartable and still you close the ticker on on_ticks and attempts to restart. This clearly defeats the purpose of websocket. If your idea is for processing ticks only if a specific condition is met, why dont you specify that condition inside on_ticks callback and remove the infinite while loop.
You can check out the example here.
You need to call ws.stop() inside on_close.
Yup ws.stop() has to happen inside on_close callback. But to trigger on_close callback based on some logic, you need to call ws.close() somewhere right?
Could you please provide exact location?
I got the location for ws.close(). Please find attached script.
Now one more issue, while using while loop, at every one second tick data is not being produced. refer output of script also.
Pls help.