Feed issues

ansubur
The live market feed is updating very slowly. Updating just once in every 10 seconds.
This is happening in particularly in NSE Index segment data only.
  • rakeshr
    The live market feed is updating very slowly. Updating just once in every 10 seconds.
    Are you blocking the main ticker thread by some operations? Go through the websocket FAQs here.
  • ansubur
    I'm not blocking the thread.
    Everything else are updating just fine.
    Only NSE Spot data is getting updated once every 10-20 seconds.

    HARDWARE:
    Internet: 500 Mbps
    Processor: Intel i7 9th Gen
    RAM: 16GB
    Disk : NVMe

    The CPU utilization is just under 2%.
    The price are update more frequently in LTP mode, I'm facing this issue only in FULL mode.
  • sujith
    We haven't observed any issue at our end.
  • ANL
    ANL edited July 29
    @ansubur
    he live market feed is updating very slowly. Updating just once in every 10 seconds.
    This is happening in particularly in NSE Index segment data only.
    1. Did you check with another instrument ? And what time period did you get delayed?
    2. You stated the tick is updating every 10 seconds. This means you put some delay in your code or you have added heavy computation inside on_ticks. If it was delayed, then you would have received ticks out of order, not like every 10 seconds.
    3. Did you check that loop or list that you put inside WS on_connect to fetch live tick data?

    No way the spot became delayed; Nifty is an index; if it delayed, then the issue would have become macro level.

    You requested help and have not posted your code here. How would you expect a proper response from a developer? I will make it clear. The Zerodha Kite API has no tick delay issue. If there was any delay, someone would have posted here or the team would have confirmed the issue earlier.

    When you post an issue, include your code or clearly explain what the problem is.
  • ansubur
    @ANL here is my code

    // initiating the ticker class from kiteconnect .Net library
    private Ticker initTicker()
    {
    delCallUpdateReports("Connecting to RT Data feed Service...");

    Ticker newTicker = new Ticker(MyAPIKey, MyAccessToken);

    newTicker.OnTick += OnTick;
    newTicker.OnReconnect += OnReconnect;
    newTicker.OnNoReconnect += OnNoReconnect;
    newTicker.OnError += OnError;
    newTicker.OnClose += OnClose;
    newTicker.OnConnect += OnConnect;

    newTicker.EnableReconnect(Interval: 50000, Retries: 50);
    newTicker.Connect();

    delCallUpdateReports("is Ticker connected ? " + newTicker.IsConnected);

    return newTicker;
    // Subscribing to NIFTY50 and setting mode to LTP
    //ticker.Subscribe(Tokens: new UInt32[] { 256265 });
    //ticker.SetMode(Tokens: new UInt32[] { 256265 }, Mode: Constants.MODE_FULL);
    }

    // subscribing the tokens.
    async private Task SubscribeSymbols(List brokerToken)
    {
    int totalSubedSymbol = 0;
    updateReport($"Symbol subscription started. Total tickers open {TickerInstanceCount}.");

    if (TickerInstanceCount < int_MaxTickerInstances.Value)
    {
    var chunks = Split(brokerToken, Convert.ToInt32(int_MaxSymbolsPerConnection.Value));

    foreach (List chunk in chunks)
    {
    await Task.Run(() =>
    {
    Ticker tickerRef = initTicker();

    if (tickerRef != null)
    {
    TickerInstanceCount++;
    tickerRef.Subscribe(chunk.ToArray());
    tickerRef.SetMode(chunk.ToArray(), Mode: Constants.MODE_FULL);
    updateReport($"FULL MODE: {chunk.Count} chunk subscribed in {TickerInstanceCount} ticker.");
    totalSubedSymbol += chunk.Count;
    }
    });
    }
    }
    else
    {
    delCallUpdateReports($"Exceeded Max ticker count {int_MaxTickerInstances.Value}");
    }

    updateReport($"Total of {totalSubedSymbol} Symbols subscribed in {TickerInstanceCount} tickers.");

    }


    // processing the received data.
    private static void onTick(Tick TickData)
    {
    Console.WriteLine("Token:" + TickData.InstrumentToken + ", LTP: " + TickData.LastTradeTime);
    }

    ################
    OUTPUT
    ################
    256265, 31-07-2024 12:52:44
    256265, 31-07-2024 12:52:47
    256265, 31-07-2024 12:53:02
    256265, 31-07-2024 12:53:05
    256265, 31-07-2024 12:53:18
    256265, 31-07-2024 12:53:21
    256265, 31-07-2024 12:53:38
    256265, 31-07-2024 12:53:44
    256265, 31-07-2024 12:53:48
    256265, 31-07-2024 12:53:53
    256265, 31-07-2024 12:53:55
    256265, 31-07-2024 12:53:59
    256265, 31-07-2024 12:54:00
    256265, 31-07-2024 12:54:13
    256265, 31-07-2024 12:54:17

  • ansubur
    If subscribe only for NIFTY alone then the streaming data at good speed.
    But if I subscribe for more 2 symbols then it slowing down.
    Suggest me a solution!
  • ansubur
    @ANL
    The code shared with output, how else should I need to explain problem?
    1) Works perfectly when the subscribed symbol is just 1.
    2) Random delay if the subscribed symbols are more than 1.
    3) ltp mode is working perfectly without delay, for any number of symbols.
    4) I'm using your library from github.

    What should I consider from your quiet response?
  • ANL
    ANL edited August 5
    @ansubur
    What should I consider from your quiet response?
    I am not a part of Zerodha. I am an independent Python Algo developer. I am helping people who are stuck to start or helping people to solve their logic issues as much as I possibly can. I won't correct somebody's code.

    I can't help you in this matter because you are working with.net and you forgot to mention your coding language when posting a thread. It seems that you are not good at the.net language, and not many people are using this library. If you are not good at.net, it's better to move to a simple language like Python. If you had posted Python code here, someone would have already responded.

    Note: Nobody has agreed to solve or rewrite your code; those who are online are not committed to doing so. Zerodha Kite Connect API Forum only offers API related issue support and does not teach how to code or rectify bad codes. You are paying just 2000 rupees, like everyone in this forum. You will get help only if someone knows the issue already or is free to look at it. No one is obligated to rewrite your code if you paid 2000 rupees for API.
    The code shared with output, how else should I need to explain problem?
    This is your coding issue not Zerodha API's issue. Their service is fine.
  • ansubur
    ansubur edited August 21
    @ANL
    What should I consider from your quiet response?
    This is addressed at zerodha team only. Don't take it personal. I sincerely apologies for mentioning you in the comment. I accept your point that for 2000 forum members are not obligated, but the service provider is definitely. There are many brokers offer the same service free of cost. I'm paying zerodha only on the expectation that they will provide support since they are getting paid. NOW IT SEEMS I'M WRONG.
    This is your coding issue not Zerodha API's issue.
    How come you so sure about it? If don't know .Net. Just shut ur stinky mouth and let the professional & well mannered members do the discussion. If you can't help then learn to be quiet & don't poke ur nose in other's business.
    I can't help you in this matter
    I don't even understand, who in this fuking world cried for your help dude? Your involvement in this thread is completely uninvited. You voluntarily came in & started showing off your ego. Such a disgrace!!!
  • ANL
    Most beginners, or those who are unfamiliar with coding or APIs, will accuse Zerodha of hiding their egos and refuse to acknowledge that they are taking the wrong approach. That is the most common behaviour of humans.
    How come you so sure about it? If don't know .Net. Just shut ur loud mouth and do the technical team do their work. If you can't help then learn to be quiet & don't poke ur nose in other's business. Your contribution is uninvited.
    This is exactly what I stated above. Before accusing Zerodha, did you check your code well? Do you think that the Zerodha team is the worst to manage the API or.Net library? They are the best developer team, and they have better skills in coding; that's why they got hired at Zerodha. If they implement any library, they will do their best to optimize it. Before going to blame or accuse, make sure that you have enough skills to see and do every nuances.

    First, you need to understand which language you can work with and how the API works.
    As I stated, I don't know .net but I found some code that doesn't require.

    You used Task.Run it may introduce a slight overhead especially if initTicker is performing synchronous I/O operations. Better to use sync/await instead of wrapping them in Task.Run
    Also you did not pasted full code, that could be causing delays, such as unnecessary Thread.Sleep or long-running tasks.

    In fact, the inner logic of all languages is the same, but the syntax is different.
    If a person who doesn't know.net but finds this many issues, then what would happen if an experienced guy looked at your code?

    Before you sharpen your ego, sharpen your code.
  • kakush30
    I havent find any kind of delays in websocket(on average two ticks per sec), albeit I am handling ticks in go, but a programming language doesnt going to make websocket slow. As mentioned by @ANL, the problem is at your end.

    And you are not entitled to get answers in these circumstances. Furthur, knowing or not knowing about .NET has nothing to do with this, websocket is common for all language and libraries, it is not like Kite is opening a special websocket for you or .NET.
Sign In or Register to comment.