Some stratergies require a candle OHLC to calculate indicators. For example RSI is based on Candle close by default. So when strategies depending on indicators are executed in real time, candle data is required. I checked in older threads and the solution was to "calculate OHLC in the client side based on websocket data". This is entirely possible but I'm afraid it's not going to be accurate.
From my understanding, the websocket data received by the client is only a small part of the total orders executed in the exchange. So there is a very high possibility that the OHLC calculated is not going to be accurate. I guess other Algo traders would have come across this ? Any solutions ?
I guess the best option is to get the historical data from the Kite API. So how much of a delay can we expect from the Kite API to calculate the OHLC candle and be available so we can query it ? (possible option is to query every second until data is available for previous minute)
Our system listen to every incoming tick and build a candle at the end of the minute. This happens for all the instruments present in the instruments master. As you know, DB writes are not guaranteed, if one of the write request slows down then it has a cascading effect on the following writes. Hence we don't guarantee the availability of candle data at then end of the minute or even after 20 seconds of the minute.
There is no accurate data when ticks are received on internet. The basic idea is to capture the trend. You can check out this thread to know more. For accurate data, you will need to get a colo setup at the exchange premises where ticks are streamed via LAN and not internet. The basic setup itself costs upwards 18 lakhs/annum. You can write to kiteconnect(at)zerodha.com if you are interested for the colo setup. We can help you with it.
Because of the above mentioned reasons, a feasible solution is to use Websockets API and generate candles at your end.
@sujith Thank you for the explanation. One more question.
I have a stratergy , which just requires the close price of the previous minute. I guess that querting the LTP endpoint at the first second of the next minute is the most accurate way, Or is there a better approach to this ? Like constructing the candle on my own(I have a dedicated average server to run the stratergy to avoid network issues)
There is no accurate data when ticks are received on internet. The basic idea is to capture the trend.
You can check out this thread to know more. For accurate data, you will need to get a colo setup at the exchange premises where ticks are streamed via LAN and not internet. The basic setup itself costs upwards 18 lakhs/annum. You can write to kiteconnect(at)zerodha.com if you are interested for the colo setup. We can help you with it.
Because of the above mentioned reasons, a feasible solution is to use Websockets API and generate candles at your end.
I have a stratergy , which just requires the close price of the previous minute. I guess that querting the LTP endpoint at the first second of the next minute is the most accurate way, Or is there a better approach to this ? Like constructing the candle on my own(I have a dedicated average server to run the stratergy to avoid network issues)
HH:MM:59
i.e last tick for that minute period.