so i have built an simple .NET console to receive Tick Data by subscribing to one instrument and have been trying to form 1 min Candles with the recieved tick data.Mnay a times i can see a lot of tick data is missing .See below image(did a simple Console.Write to print for a min ).This leads to inconsistent 1 min candle formation i havealso attached the ping speed test to make sure there are no latency with my ISP..May i know why this is happening ??
the code used is shown below FYI
static void Main(string[] args) { // Read API key and access token from configuration string apiKey = AppConfig.GetApiKey(); string requestToken = AppConfig.GetRequestToken(); string accessToken = AppConfig.GetAccessToken(); string apiSecret = AppConfig.GetApiSecret(); KiteConnectApi kiteConnect = new KiteConnectApi(apiKey, apiSecret,accessToken);
try {
// Create a new Ticker instance ticker = new Ticker(apiKey, accessToken);
// Keep the application running to receive live updates Console.WriteLine("Press any key to exit..."); //onsole.ReadKey(); Thread.Sleep(TimeSpan.FromMinutes(2)); // Disconnect ticker before closing the application ticker.Close();
Thanks @sujith for the response. I just wanted to know whether there is a latency issue on my end or this is normal behaviour in websocket to miss out on few ticks in between ? . From what i read , the missing data in Kite charts are readjusted later when all the information is received.
You can go through this thread to know more about how to convert ticks to candle. There is no adjustment, you just need first, last tick of the minute, high and low of the minute to form the candle.
Yes @sujith i am doing that already. i am getting consistent results but for few candles , the tick that needs to come in at the 1st sec for example- 10:00:00 i get it at 10:00:02 so the open price is not correct for that candle and similarly the tick which is supposed to come in at 10:00:59 gets missed and the close price also becomes incorrect. So this is affecting my calculations leading to losses.
I don't think you should compare other charts. The idea is to capture the trend. The live market data on Websocket API is only a snapshot data. It is not a tick by tick data. There can be hundreds of ticks every second at the exchange but exchange streams only one or two ticks a second on the internet. You can know more here.
There is no adjustment, you just need first, last tick of the minute, high and low of the minute to form the candle.