delay in price

dhavalp
Hi

I have raised this issue even before and even now I observe that the price displayed on the dashboard of zerodha is displayed much faster than the websocket API. The delay is not in ms but in seconds and up to 5 seconds which is creating issues in my development strategy. Can you please look into it? Note that the delay is not always it comes some times for some scripts this is my observation since last 15 days atleast.
  • Vivek
    @dhavalp Can you specify the scrips token for which you encountered this?
  • dhavalp
    I am comparing Cipla Cash / FUT. This happens especially in cash.
  • garpitg
    garpitg edited July 2016
    Even I am facing same w.r.t YesBank in cash. It seems that in my case delay if for about 60sec :o
    IMO few seconds delay could be possible (a few means 1-2sec) since it possible that you might not have subscribed the feed exactly at the minute over and you are sampling based on available feed. But in that you must be noticing same High/Low (most of the time). If so then probably you need to fine tune the timings to subscribe but delay should not be more like in my case.
  • Vivek
    @dhavalp @garpitg We are investigating the issue and its difficult to reproduce the bug in our end.
  • dhavalp
    @vivek Thanks for the reply. I feel that keep an eye on FUT / CASH (NSE / BSE) data simultaneously for cipla or Yes Bank that will help us to identify the issue.
  • garpitg
    @vivek I have captured the logs, see if it is useful for you to investigate.
    As per Kite 1m candle in Yesbank (3050241) at time
    07/07/2016 12:33:00,1114.25,1114.80,1114.05,1114.45

    **Please note that your timing starts from 9:15 and in my case 9:16, so there will be 1m gap always which is well understood. You are taking starting time and I am taking end time of candle.

    I have received following ticks (time stamp 07/07/2016 12:34:00 - 07/07/2016 12:34:59).

    07/07/2016 12:34:00,on_tick [{'last_price': 1114.25, 'volume': 754510, 'sell_quantity': 159046, 'last_quantity': 5, 'change': -1.0786576704545534, 'average_price': 1118.31, 'ohlc': {'high': 1130.0, 'close': 1126.4, 'open': 1130.0, 'low': 1110.0}, 'depth': {'sell': [], 'buy': []}, 'mode': 'quote', 'tradeable': True, 'buy_quantity': 106012, 'instrument_token': 3050241}]
    07/07/2016 12:34:01,on_tick [{'last_price': 1114.05, 'volume': 754543, 'sell_quantity': 158245, 'last_quantity': 8, 'change': -1.0964133522727393, 'average_price': 1118.31, 'ohlc': {'high': 1130.0, 'close': 1126.4, 'open': 1130.0, 'low': 1110.0}, 'depth': {'sell': [], 'buy': []}, 'mode': 'quote', 'tradeable': True, 'buy_quantity': 106821, 'instrument_token': 3050241}]
    07/07/2016 12:34:02,on_tick [{'last_price': 1114.05, 'volume': 754543, 'sell_quantity': 158323, 'last_quantity': 8, 'change': -1.0964133522727393, 'average_price': 1118.31, 'ohlc': {'high': 1130.0, 'close': 1126.4, 'open': 1130.0, 'low': 1110.0}, 'depth': {'sell': [], 'buy': []}, 'mode': 'quote', 'tradeable': True, 'buy_quantity': 106871, 'instrument_token': 3050241}]
    ===============================================
    07/07/2016 12:34:58,on_tick [{'last_price': 1114.65, 'volume': 757796, 'sell_quantity': 158493, 'last_quantity': 25, 'change': -1.0431463068181817, 'average_price': 1118.3, 'ohlc': {'high': 1130.0, 'close': 1126.4, 'open': 1130.0, 'low': 1110.0}, 'depth': {'sell': [], 'buy': []}, 'mode': 'quote', 'tradeable': True, 'buy_quantity': 108051, 'instrument_token': 3050241}]
    07/07/2016 12:34:59,on_tick [{'last_price': 1114.45, 'volume': 757801, 'sell_quantity': 158489, 'last_quantity': 5, 'change': -1.0609019886363675, 'average_price': 1118.3, 'ohlc': {'high': 1130.0, 'close': 1126.4, 'open': 1130.0, 'low': 1110.0}, 'depth': {'sell': [], 'buy': []}, 'mode': 'quote', 'tradeable': True, 'buy_quantity': 108180, 'instrument_token': 3050241}]

    Based on above ticks 1m candle will be "07/07/2016 12:35:00,1114.25,1114.80,1114.05,1114.45,757801"
    Which is correct. Interesting to note here is timestamp of ticks It is starting from "07/07/2016 12:34:00" which should be "07/07/2016 12:33:00".


    As per Kite Candle @ 07/07/2016 12:33:00 has the data from "07/07/2016 12:33:00" to "07/07/2016 12:33:59".
    I have checked system time. It is in sync. Here we are seeing a delay of 1m.

    @dhavalp Can you please share your logs as well so that it might be helpful for Vivek to investigate.
  • garpitg
    @vivek I am not sure some times delay is not even there. Candles are matching point to point. :/
  • dhavalp
    Today in Reliance infra I got a price of 552.0 at 2016-07-18 09:30:03 +0530
    where as the price was 563.80 after few seconds it got in sync.
  • Kailash
    @dhavalp Did you have Kite open at the same instant?

    The stream you receive via the library and the stream you see on Kite are the same thing (websocket.kite.trade). So if you have Kite open and it's fine, but the library is showing delayed values on the same machine, it could be some sort of a clog in the Python websocket library we use. We'll investigate once you confirm.
  • garpitg
    @Kailash, any thoughts on why YesBank is showing 1m delay ?
  • Kailash
    @grapitg We are investigating the underlying WebSocket client we use in our Kite client.
  • dhavalp
    What is the LTP Of HindZinc Aug fut in websocket API? Can you please check? Its showing me 20310 = 203.10 where as actually it is 207.40. Is there something I am missing?
  • Kailash
    hm, I'm getting 207.50.
  • dhavalp
    dhavalp edited July 2016
    Where did you check? On the Portal or the websocket API? And most importantly when did you check today morning or yesterday after market hours? Because in morning it was again in sync but yesterday it wasnt especially during last 5 mins of trade.
  • Kailash
    I connected to the stream with the Python client and printed the ticks to the console.
  • sampath_topc
    Kailsh, if i using my own java client.. we wont face these issues? or this python client is a wrapper over kite which even my java client must access to interact with kite?
  • sampath_topc
    and paying 2000 rs for an API that comes with too many bugs especially when one dealing with automated orders isn't acceptable. if you are not confident you cant run this successfully stop selling these. this is not beta version where you catch bugs when people report them to you. very bad technical team and way of running a business.
  • dhavalp
    Hi Kailash,

    Can you tell me the latency in price. I see too much of a variation.
  • Kailash
    @dhavalp We have been unable to reproduce the latency issues at our end. We have tested the Python WebSocket client on multiple versions of Linux with variable number of instrument subscriptions. Moreover, as I've said before, websocket.kite.trade is exactly the same channel Kite web uses. Is there any possibility you can try out the Java streaming library? We're releasing a Javascript client at the end of this week. Will you be able to try the JS client?

    @sampath_topc You have posted about 10 comments over the last couple months, mostly about pricing and making comparisons with Google and Yahoo finance APIs. Please understand that if you're unhappy with the pricing, you are free not to use the APIs (which you aren't). Making the same type of comments over and over does not contribute anything.

    We have our reasons to charge for the APIs. We acknowledge that there are issues and we have discussed the issues and our action plans for resolving them transparently on the forum.
  • Kailash
    @dhavalp To add, we'll give you a dev version of the Python client this week that uses the Autobahn WebSocket library. If that works for you, we'll merge it into the main branch.
  • dhavalp
    OK Kailash thanks for the reply. I am not sure what to say if you are not able to reproduce the issue. I have given you enough examples. Let me check the JS API. BTW on the other note I was asking about the actual latency not between API and the portal but in general like there has to be come latency when we use servers at co-location and fetch data using these APIs. Or you are saying its real time?
  • Kailash
    @dhavalp I'll let you know once the Autobahn Python client + JS clients are ready.

    If you want real time ticks, there is no other way but to get co-location. The WebSocket API has a minimum latency of 700ms-1s. You will not get more than one tick for an instrument in this interval.
  • dhavalp
    Let me see if I can arrange some thing to show a demo. There is surely a latency. For me 700ms is no latency I see some times missed ticks + delay of up to 5 seconds. there is no issue with internet and its a high end amazon server.
  • Skipper
    Skipper edited August 2016
    Hi, on Aug 17th around the market opening time we noticed Nifty Aug futures prices (among other Nifty Option prices) were not updating normally. I give below the first entry and last entry in a period when the same price was coming for 30 seconds. The entries were logged in our virtual machine at Mumbai. Why is this happening? Thanks in advance.

    09:17:17.920:- [instrumentToken=11389186, lastTradedQty=75, avgTradedPrice=8645.09, vol=169500, buyQty=416550, sellQty=430200, openPrice=8650.25, highPrice=8654.9, lowPrice=8637.6, closePrice=8659.9, ltp=8653.95, bidEntry1=MarketDepth [qty=750, price=8653.0, orders=65536], bidEntry2=MarketDepth [qty=225, price=8652.95, orders=65536], bidEntry3=MarketDepth [qty=75, price=8652.75, orders=65536], bidEntry4=MarketDepth [qty=75, price=8651.75, orders=65536], bidEntry5=MarketDepth [qty=150, price=8651.7, orders=65536], offerEntry1=MarketDepth [qty=75, price=8653.35, orders=65536], offerEntry2=MarketDepth [qty=75, price=8653.75, orders=65536], offerEntry3=MarketDepth [qty=75, price=8653.95, orders=65536], offerEntry4=MarketDepth [qty=450, price=8654.0, orders=65536], offerEntry5=MarketDepth [qty=375, price=8654.15, orders=196608]]

    09:17:47.952:- [instrumentToken=11389186, lastTradedQty=75, avgTradedPrice=8645.09, vol=169500, buyQty=416550, sellQty=430200, openPrice=8650.25, highPrice=8654.9, lowPrice=8637.6, closePrice=8659.9, ltp=8653.95, bidEntry1=MarketDepth [qty=750, price=8653.0, orders=65536], bidEntry2=MarketDepth [qty=225, price=8652.95, orders=65536], bidEntry3=MarketDepth [qty=75, price=8652.75, orders=65536], bidEntry4=MarketDepth [qty=75, price=8651.75, orders=65536], bidEntry5=MarketDepth [qty=150, price=8651.7, orders=65536], offerEntry1=MarketDepth [qty=75, price=8653.35, orders=65536], offerEntry2=MarketDepth [qty=75, price=8653.75, orders=65536], offerEntry3=MarketDepth [qty=75, price=8653.95, orders=65536], offerEntry4=MarketDepth [qty=450, price=8654.0, orders=65536], offerEntry5=MarketDepth [qty=375, price=8654.15, orders=196608]]
  • Kailash
    LTP may not have changed but values in the market depth may have. Most of your `orders` values are 65536, which is being casted incorrectly. It is usually a single or three digit number.
  • Skipper
    Kailash,

    What you see for Nifty Futures market data above is the same set of values (price, qty, market depth etc.) being sent by kite through Websockets for 30 seconds. These values ARE coming from the kite server and they did not change for 30 seconds. We are also noticing similar behavior with other option instruments with the Nifty underlying.As you can see above, even the market depth is not changing.

    The Nifty Futures is a VERY liquid instrument. There is NO WAY the prices will stay the same for even a couple of seconds let alone 30 seconds. In fact they change so many times within a second especially during market open which is when the above prices were received from websockets.

    We run Algo trading and it is imperative that the prices are updated correctly at least every second. The problem is REAL and please find a way to address this.

    BTW, we use a Java platform with Websockets to receive kite market data.
  • Vivek
    @dhavalp @garpitg @Skipper Can you please try out our official Node js module and verify with if you are still getting delayed ticks.
  • Skipper
    @vivek
    I am not sure how that is going to help solve the problem we are facing in our Java platform. We need to stay in pure java and cannot switch to JS. Do you have a java client environment where you can reproduce the problem we are facing, so you can troubleshoot it?
  • Vivek
    Vivek edited August 2016
    @Skipper We have almost 40,000 concurrent users online on Kite web and Kite Android and we haven't received any issues in price delay.
  • Vivek
    @dhavalp @garpitg Here is a rough implementation of Kite connect Python websocket api with autobahn - https://github.com/rainmattertech/pykiteconnect/tree/autobahn

    There are few changes to callbacks but the existing example should work. Please try and let us know if you are experiencing delay in price.
  • dhavalp
    @vivek See people might not be using it or matching it with the actual live price. Or they might not have an issue with a bit of delay. Others if not complaining does not mean that they havent received the issue or the issue doesnt exist. Moreover Yesterday I got a price as 0 in IDFC. sometime I still receive very big avg_traded_price, such as 4294962713 for BAJFINANCE All these issues comes up on regular basis.
  • Vivek
    @dhavalp Yeah since others also reported the issue we came up with different version of Pykiteconnect - https://github.com/rainmattertech/pykiteconnect/tree/autobahn
    If you get a chance please test and share feedback with us. We will checked the other issue you have mentioned.
  • Kailash
    @dhavalp We're actively monitoring this at our end almost every day but we still haven't been able to reproduce the issue. As Vivek has said above, we've released a beta library that uses a different WebSocket library altogether. Can you give it shot?
  • ankur0101
    @Skipper, where your server is located? Its in your office or at any data center? I believe if it is in office, it may give a lag because of Internet connectivity. Very soon I will try to use Kite API from AWS ec2 servers.
Sign In or Register to comment.