Getting odd sized packets for INDEX

chaudhariapurva
Hi when I connect to web socket and subscribe to
408065 in "full" mode
I get
{byte[168]} (which is correct)

but when I subscribe to index like nifty 50 I
256265 in "full" mode
OR
256265 in "quote" mode

I get
binary {byte[32]} (which is not correct)
its contents are
[0] 0 byte
[1] 1 byte
[2] 0 byte
[3] 28 byte
[4] 0 byte
[5] 3 byte
[6] 233 byte
[7] 9 byte
[8] 0 byte
[9] 13 byte
[10] 237 byte
[11] 45 byte
[12] 0 byte
[13] 13 byte
[14] 253 byte
[15] 24 byte
[16] 0 byte
[17] 13 byte
[18] 233 byte
[19] 14 byte
[20] 0 byte
[21] 13 byte
[22] 252 byte
[23] 215 byte
[24] 0 byte
[25] 13 byte
[26] 237 byte
[27] 45 byte
[28] 255 byte
[29] 255 byte
[30] 255 byte
[31] 220 byte

what is format of this data.?????
This is not mentioned in documentation.
Tagged:
  • chaudhariapurva
    chaudhariapurva edited March 2017
    I got the solution the format of
    packet is
    struct QuoteModeIndex
    {
    public uint Instrumenttocken; //4 bytes
    public uint Ltp; //4 byte
    public uint Highprice;
    public uint Lowprice;
    public uint Openprice;
    public uint Closeprice;
    public uint NetChangeFromClose;
    }
    @sujith

    Its a humble request to zerodha team to update documentations

  • sujith
    Hi @chaudhariapurva,
    Packet structure for NSE indices is as follows,

    0-4 will be metadata(token)
    4-8 will be last_price
    8-12 will be high
    12-16 will be low
    16-20 will be open
    20-24 will be close
    24-28 will be change

    For more information about parsing binary data, check out python client _parse_binary function here.
  • chaudhariapurva
    chaudhariapurva edited March 2017
    @sujith
    PLEASE UPDATE DOCUMENTATIONS FOR API
    SOME PPL HAVE A CUSTOM IMPLEMENTATION AND WE FACE HUGE ISSUE TO SOLVE PROBLEMS WHEN THEY ARISE.
    AND HOW TO GET BSE INDICES ??
    THANKS.
  • sujith
    @chaudhariapurva,
    We will update it soon.
This discussion has been closed.