Delay in ticks

PrashantM
HI, Since last couple of days i have noticed that there is some delay in ticks that i am receiving. The market data is different from the ticks that i am getting. Also not getting ticks every second, (not even for Banknifty and nifty tokens), and in some cases the delay is up to 10 seconds between consecutive banknifty/nifty tokens.
Has there been any change recently? Please advice some solution
  • SRIJAN
    You might be blocking the main ticker thread receiving ticks resulting in delay.
    You have to offload all the computation to another thread asynchronously without blocking the main thread.

    Also, it's not necessary that you will get a tick every second.A tick is sent whenever there is a change in any of the fields present in the mode subscribed by you. If there is no change,you don't get any tick.
  • PrashantM
    Thanks for the prompt response. I have not made any changes to my code recently, so was surprised, However let me recheck the code flow for thread blockage. Thanks again.
  • PrashantM
    Just to provide additional info..the following KiteConnect code (websocket.cs file) is calling continuously as it is expected (no delay)...however the data that is coming back has only 5-6 tokens, although the request is made for 489 tokens...
    // send data to process
    OnData?.Invoke(buffer, offset, t.Result.MessageType.ToString());
    // Again try to receive data
    if (_ws != null)
    {
    _ws.ReceiveAsync(new ArraySegment(buffer), CancellationToken.None).ContinueWith(callback);
    }

    Even the Banknifty token is coming after 10 seconds or so, that makes me wonder something is wrong ...i have rechecking the flow, however wanted to update this additional information to you.
  • PrashantM
    On further analysis i found that the lenght is not coming correctly for different ticks data. I am expecting lenght to be 184 for FULL mode..but for many ticks it is not comming correctly


    ushort length = ReadShort(Data, ref offset); // length of the packet
    // if (_debug) Console.WriteLine("Packet Length " + length);

    Tick tick = new Tick();
    switch (length)
    {
    case 8: //ltp
    tick = ReadLTP(Data, ref offset);
    break;
    case 28: //index quote
    tick = ReadIndexQuote(Data, ref offset);
    break;
    case 32: //index quote
    tick = ReadIndexFull(Data, ref offset);
    break;
    case 44: //quote
    tick = ReadQuote(Data, ref offset);
    break;
    case 184: // full with marketdepth and timestamp
    tick = ReadFull(Data, ref offset);
    break;

    }
  • PrashantM
    I got the root cause. I updated the .net version recently to .net6, and changed this resulted in configuration mess up.. . Corrected the configuration,,..and not getting full ticks back with full speed.Thanks for your help.
  • saurabh2309
    Hi Prashant, did you downgrade your project to use .net framework version or are you still using .net6 ?
Sign In or Register to comment.