Python Websocket sent multiple batch requests but only one is accepted

Hi

I'm writing a python websoket program to get all HK equities(0001.HK to 9999.HK(main board) and 10000.HK to 99999.HK(CBBCs, warrants, CNY stocks)).

Since there's a MaxMsgSize of 65535 (per batch request I assume?). I try to sent 5 batch requests(requesting 0001.HK to 9999.HK about 1999 RICs per request) but only one batch request is accepted. As shown below

Why is that?

Thank you

.batch-request-accepted.png1to1999.png

Best Answer

  • nick.zincone
    nick.zincone admin
    Answer ✓

    Hi @tobywong

    The MaxMsgSize represents the total number of bytes sent in your request. Given each item is a variable number of bytes, you will have to calculate/estimate the number of items based on a calculation. I think only 1 batch got through because it resulted in a allowable number of total bytes.

Answers