I know that the ticks are continuous data. I am using Node Js Kite API. I found issue in the case when I call asynchronous APIs like getPositions(), placeOrder().
The main issue is below :
As the tick data is coming in continuous flow. When I try to call getPositions() or placeOrder() after my condition satisfy, the new tick data arrives before the completion of getPositions() or placeOrder() APIs or sometimes getPositions() or placeOrder() got called 2-3 times continuously.
The main thing is that the flow of calls should be proper i.e. ticks -> getPositions() ->placeOrder() , then, ticks -> getPositions() ->placeOrder(), then, ticks -> getPositions() ->placeOrder() and so on..
I need help on this. 1. Is there any way to control tick data like using setInterval() ? I tried , but not succeeded. 2. I also tried to implement Javascript Promise and Async/Await, but not worked.
Anyways, you will have tick data coming frequently.
Another thing is, use some kind of lock mechanism like useTicks, a boolean to process or block processing.