LtP Data of all instruments are not comming

Pratap
Pratap edited December 2017 in PHP client
i am trying to get ltp data for instruments inserted in database but it returns less data then given instruments if i give 11 instruments it returns me only 7 instruments data how it is possible I am posting my code here
function calll(val)
{
//alert(val);
ws= new WebSocket("wss://websocket.kite.trade/?api_key=xxxx&user_id=yyyy&public_token=xyzw");
message = "{\"a\": \"mode\", \"v\": [\"ltp\", ["+val+"]]}";
// alert(message);
ws.binaryType = 'arraybuffer'
ws.send(message)
ws.onmessage = function (event) {
var dat=convert(event.data);
//alert(event.data);
// alert(dat);
if(dat.length>1)
{
var curr=0;
var count=(dat[1]) |
(dat[0] << 8);
// alert(count);
curr=curr+2;
for(i=0;i<count;i++)
{
var l=(dat[curr+1]) |
(dat[curr] << 8);
curr=curr+2;
var result = ((dat[curr+3]) |
(dat[curr+2] << 8) |
(dat[curr+1] << 16) |
(dat[curr] << 24));
// alert(result);
curr=curr+4;
var price = ((dat[curr+3]) |
(dat[curr+2] << 8) |
(dat[curr+1] << 16) |
(dat[curr] << 24));
curr=curr+4;
price=price/100;
//alert(result+","+price);
}
//alert(count+","+ByCount);

// alert(result);
}
//alert(makeInt(dat[11],dat[10],dat[9],dat[8]);
}
function convert(data) {
return new Uint8Array(data);
}
Here when i send 10 instruments token in val variable it shows alert of message properly
in onmessage() it shows 7 count only
  • sujith
    You can check out example for Websockets.

    Once you subscribe you will get first tick post that you will only get ticks if the value changes.
  • Vickygs
    I am new to Kite Connect. Can someone please tell if there are any charges for using ticker data through API?
Sign In or Register to comment.