@Kailash @vivek Bid & Ask Orders returns wrong value.Rest all fields, I'm getting correct values. Could You Please check whether these fields are correctly packed and sent from Kite Server..? I'm correctly unpacking the Binary Data, if there is mistake in unpacking, I should get wrong values in all fields.But this is not the case.Only Bid & Ask Orders are giving wrong Value.I compared with market Depth of Kite.Zerodha.com. Could you tell me data type.. is it Int32 or ..? Same is happening for all stocks.
Here is the Sample I'm getting. *******Bid********** ********Ask******** Orders Qty Price Price Qty Orders 65536 75 8582.25 8582.75 250 13107 (Should be 2)
Hm, that's strange. The feed on kite.zerodha.com and the feed you get are exactly the same. Can you share the VB code where the unpacking is happening?
Also, 65536 is what you get when a 16 bit int overflows. Are you sure you're casting those values as 32 bit ints?
@Kailash Here is the code... Dim bidorders1_arr(4) As Byte Array.Copy(Pkt, 54, bidorders1_arr, 0, 4) 'Pkt is the Quote Packet for the Instrument. Array.Reverse(bidorders1_arr, 0, 4) 'BigEndian to LittleEndian Dim bidorders1 As Int32 = BitConverter.ToInt32(bidorders1_arr, 0)
Im using the above for all fields, all works fine except Bid & Ask Orders.
@Kailash As a temp solution, I'm dividing the Orders Value by 65536 to Get orders. Pls check it in Your End. I also check my code for any Errors. What confusing is, if it's a code mistake or unpacking error, then all fields should have wrong value, But only Orders field is having problem.
Please look into the issue. && Please create 'VB.Net Client' Category in the Forum. Planning to release the Vb.Net Library with all Functions Exposed by Kite Connect in couple of Days for the use .Net Developers.
@Kailash I subscribed to RELIANCE (TOKEN: 738561). This repeated today too. Please see the following quotes streamed between 9:22 and 9:23 am. Please see 'Orders' field below.
Im using VB.Net & Correctly unpacking as per Endianness
Only Bid & Ask Orders are getting Wrong Value.
Also, 65536 is what you get when a 16 bit int overflows. Are you sure you're casting those values as 32 bit ints?
Here is the code...
Dim bidorders1_arr(4) As Byte
Array.Copy(Pkt, 54, bidorders1_arr, 0, 4) 'Pkt is the Quote Packet for the Instrument.
Array.Reverse(bidorders1_arr, 0, 4) 'BigEndian to LittleEndian
Dim bidorders1 As Int32 = BitConverter.ToInt32(bidorders1_arr, 0)
Im using the above for all fields, all works fine except Bid & Ask Orders.
As a temp solution, I'm dividing the Orders Value by 65536 to Get orders.
Pls check it in Your End.
I also check my code for any Errors.
What confusing is, if it's a code mistake or unpacking error, then all fields should have wrong value,
But only Orders field is having problem.
Please also Check this https://kite.trade/forum/discussion/645/websockets-returns-wrong-average-price-for-bse-stocks
I think Kite.Trade itself returning wrong Avg Price for BSE Stocks.
I am experiencing the same problem with your python client too... please see the below streaming data I got...
{'buy': [{'quantity': 205, 'orders': 196608, 'price': 1093.15}, {'quantity': 483, 'orders': 327680, 'price': 1093.0},
@botany02's temp solution is correct... I am able to verify on kite...
Please look into the issue.
&& Please create 'VB.Net Client' Category in the Forum.
Planning to release the Vb.Net Library with all Functions Exposed by Kite Connect in couple of Days for the use .Net Developers.
@botany02 I thought this issue was fixed a couple days ago? We'll create the category once the client is out to avoid confusion.
Thanks.
The issue fixed earlier related to https://kite.trade/forum/discussion/645/websockets-returns-wrong-average-price-for-bse-stocks
[{'buy_quantity': 269356, 'ohlc': {'high': 1097.0, 'close': 1087.55, 'open': 1097.0, 'low': 1071.0}, 'depth': {'sell': [{'quantity': 639, 'orders': 196608, 'price': 1082.7}, {'quantity': 212, 'orders': 131072, 'price': 1082.75}, {'quantity': 49, 'orders': 65536, 'price': 1082.8}, {'quantity': 1, 'orders': 65536, 'price': 1082.85}, {'quantity': 192, 'orders': 196608, 'price': 1082.9}], 'buy': [{'quantity': 17, 'orders': 65536, 'price': 1082.45}, {'quantity': 91, 'orders': 65536, 'price': 1082.35}, {'quantity': 166, 'orders': 131072, 'price': 1082.25}, {'quantity': 67, 'orders': 65536, 'price': 1082.2}, {'quantity': 68, 'orders': 131072, 'price': 1082.15}]}, 'average_price': 1083.74, 'last_price': 1082.45, 'sell_quantity': 293079, 'change': -0.46894395659968824, 'instrument_token': 738561, 'mode': 'quote', 'tradeable': True, 'last_quantity': 53, 'volume': 1641055}]
[{'buy_quantity': 269626, 'ohlc': {'high': 1097.0, 'close': 1087.55, 'open': 1097.0, 'low': 1071.0}, 'depth': {'sell': [{'quantity': 229, 'orders': 131072, 'price': 1082.8}, {'quantity': 1, 'orders': 65536, 'price': 1082.85}, {'quantity': 187, 'orders': 196608, 'price': 1082.9}, {'quantity': 932, 'orders': 262144, 'price': 1082.95}, {'quantity': 727, 'orders': 786432, 'price': 1083.0}], 'buy': [{'quantity': 17, 'orders': 65536, 'price': 1082.45}, {'quantity': 91, 'orders': 65536, 'price': 1082.35}, {'quantity': 75, 'orders': 65536, 'price': 1082.3}, {'quantity': 91, 'orders': 65536, 'price': 1082.25}, {'quantity': 67, 'orders': 65536, 'price': 1082.2}]}, 'average_price': 1083.74, 'last_price': 1082.8, 'sell_quantity': 290873, 'change': -0.43676152820559977, 'instrument_token': 738561, 'mode': 'quote', 'tradeable': True, 'last_quantity': 20, 'volume': 1641975}]