Sample Output of Streaming data

sekharrockz
@vivek Is it possible for you to share a sample websocket data of an instrument which is subscribed with full mode. You can share the 164Byte data.
  • Kailash
    Kailash edited May 2016
    Here's the numerical representation of a "full" packet (including marketdepth) in Javascript. It's 168 bytes. The instrument is GOLDGUINEAMAYFUT (MCX), token = 53253383
    Uint8Array([0, 1, 0, 164, 3, 44, 149, 7, 0, 36, 251, 48, 0, 0, 0, 1, 0, 37, 15, 170, 0, 0, 2, 200, 0, 0, 0, 218, 0, 0, 0, 154, 0, 37, 33, 220, 0, 37, 40, 28, 0, 36, 246, 28, 0, 37, 56, 32, 0, 0, 0, 1, 0, 36, 250, 204, 0, 1, 0, 0, 0, 0, 0, 1, 0, 36, 250, 4, 0, 1, 0, 0, 0, 0, 0, 16, 0, 36, 249, 160, 0, 2, 0, 0, 0, 0, 0, 1, 0, 36, 248, 216, 0, 1, 0, 0, 0, 0, 0, 1, 0, 36, 247, 72, 0, 1, 0, 0, 0, 0, 0, 1, 0, 36, 251, 248, 0, 1, 0, 0, 0, 0, 0, 1, 0, 36, 252, 192, 0, 1, 0, 0, 0, 0, 0, 2, 0, 36, 255, 224, 0, 1, 0, 0, 0, 0, 0, 1, 0, 37, 0, 168, 0, 1, 0, 0, 0, 0, 0, 1, 0, 37, 8, 20, 0, 1, 0, 0])
  • sekharrockz
    ok. is it possible to explain how to know the different values from this byte array, if not can i know, how to find the instrument token and last traded price from this array ?
  • sekharrockz
    sekharrockz edited May 2016
    ok, Another doubt.
    for the above example which you gave, i overlooked the instrument info for GOLDGUINEAMAYFUT in instruments.csv file which gets downloaded when we use your api.

    it says this:(csv format)
    53253383,208021,GOLDGUINEA16MAYFUT,GOLDGUINEA,0.0,2016-05-31,0.0,1.0,8,FUT,MCX,MCX

    here the trading symbol is:GOLDGUINEA16MAYFUT , can i know what does "16" mean in this string ?

  • Kailash
    The structure is detailed here -- https://kite.trade/docs/connect/v1/#message-structure

    Different languages have different ways of converting byte arrays to integers.

    From example in the previous post:
    • First two bytes is the number of packets in the message [0, 1] = (int16) 1 when converted to a 16-bit integer.
    • Next two bytes show the length of the first packet [0, 164] = (int16) 164 (means the packet is 164 bytes long).
    • The next 4 bytes is the token [3, 44, 149, 7] = (int32) 53253383
    • And the next 4 bytes (32 bit integer) is the LTP [0, 36, 251, 48] = (int32) 2423600 (paisa) = Rs 24236.00
  • muke5hy
    @Kailash Can you please show me working example in python for converting stream data,

    def onMessage(self, payload, isBinary):
    if isBinary:
    print(int(payload.encode('hex'), 16))
    Above code I am trying but seems it is wrong. Payload is response from server.
Sign In or Register to comment.