When trying to create 1m candles from tick data received via websocket, I am struggling to get the volume right. I am assuming that LastTradeQuantity is the volume associated with the tick but I am not sure.
I am using volume = current volume + LastTradeQuantity
I have observed that many a times, the 4 to 5 ticks received in a minute interval have the same LastTradeQuantity. I am a bit confused as to what should be the correct method to determine the volume associated with that particular tick. Kindly help.
Volume you get in Websocket is cumulative volume which means it gives you total volume traded till that tick.
If you have subscribed to full mode then you might get tick when there is change in market depth wherein volume traded might not be changed which means no trade happened in that interval.
Simplest way to calculate volume would be, volume traded in that minute = volume traded of last tick - volume traded of first tick.