Is there any API available in Java client which tells whether market is open or not? The problem is as soon as we subscribe for tokens I get the ticks for the subscribed tokens even though the market is not open. Currently I am ignoring the first tick but sometimes I get multiple ticks before market opens. if these ticks generates the order then it will be rejected as market is not open. Is there any way to solve this problem?
Hi @Girish, Don't ignore first tick, if you are trading on illiquid scrip then you may get only one tick. Next tick will be sent only if tick data changes. Currently, we don't have API to check if market is open or not. We have plans of providing it in future. For now, you may hard-code market timings and check before you place order.
Hi Sujith, The pattern What I see is, Lets say If I subscribe 10 scrips at 9:14 AM I will get a onTick notification with tick size 10 immediately(in next second) . After this on every second I get onTick notification with ticks size 0. So what I am doing is the first notification I am ignoring then I will start processing the ticks only if size>0. This works most of the time but some days I get onTick notification with tick size >0 before 9:15 Am after the first notification so my logic fails. Hard coding market timing may not be a good idea as system times may not be in exact sync. Even few seconds mismatch will skip those many ticks. How others are handling this?
Hi @Girish, In premarket ticks, before 9:07 LTP won't change since only order collection happens. During this period market depth will keep changing and once equilibrium price is decided LTP is updated at 9:08. After that, till market opens LTP won't update. This is what happens in premarket, may be this will help you to come up with a feasible solution.
PS: You don't have to ignore ticks, you can just add a check before placing the order.
Don't ignore first tick, if you are trading on illiquid scrip then you may get only one tick. Next tick will be sent only if tick data changes.
Currently, we don't have API to check if market is open or not. We have plans of providing it in future.
For now, you may hard-code market timings and check before you place order.
The pattern What I see is, Lets say If I subscribe 10 scrips at 9:14 AM I will get a onTick notification with tick size 10 immediately(in next second) . After this on every second I get onTick notification with ticks size 0. So what I am doing is the first notification I am ignoring then I will start processing the ticks only if size>0. This works most of the time but some days I get onTick notification with tick size >0 before 9:15 Am after the first notification so my logic fails.
Hard coding market timing may not be a good idea as system times may not be in exact sync. Even few seconds mismatch will skip those many ticks. How others are handling this?
In premarket ticks, before 9:07 LTP won't change since only order collection happens. During this period market depth will keep changing and once equilibrium price is decided LTP is updated at 9:08.
After that, till market opens LTP won't update.
This is what happens in premarket, may be this will help you to come up with a feasible solution.
PS: You don't have to ignore ticks, you can just add a check before placing the order.