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
.
Best 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.
0
Answers
-
The above shows the ID of the batch requests
0 -
The rest of the batch requests
0 -
Thank you for reaching out to us.
It could be the limitation on the server. The server may not have enough resources to process all requested items.
Typically, the application should implement throttling which limits the number of requested items over a set time. For example, after sending the first batch, the application needs to wait for all item responses before sending the next batch request. With this method, the server could have enough reesouces to handl all requested items.
Otherwise, you can contact the server team directly via MyRefinitiv to verify what the problem is.
0 -
@nick.zincone So the MaxMsgSize is the limit for all the batch requests combined. Not 65535 bytes per batch request?
0 -
But I need to keep subscribed to the RICs for the real time update. If I wait for all item responses(but it will not end. Since it's not a snapshot) and then send the next batch request, will I unsubsribed to the previous batch of RICs?
0 -
@tobywong, the max size represents the maximum number of bytes in a request. What you should do if log the size of each batch you send out - the size of the complete message you send on the WebSocket channel. Each batch you send will contain a different size because each batch contains entries that contain a variable number of bytes.0
-
@tobywong
If there are 1999 items in the batch request and all items are valid, the server will send 1999 refresh messages to the application. The application can count the number of the retrieved refresh messages.
WebSocket is not high performance. Please make sure that the application is powerful enough to handle the update rate of all subcribed items.
0 -
@nick.zincone
Is the MaxMsgSize 65535 bytes limit for one batch request or all the batch requests combined? Since if it's for one request, the other batch requests should go through. Because all the RICs in these batch requests are in the format of 0001.HK, 9999.HK, 5650.HK etc.
0 -
The MaxMsgSize bytes limit is for one batch request. Each request is independent and should go through so long as they do not exceed the limit. Are you getting any error(s) when you say "not going through"? I would intentionally reduce the size of the batches - start small - to see if each goes through then increase the sizes. What were the results of the sizes you logged before you sent out each request?
0 -
I copy the batch request (in JSON format) and store them seperately as JSON files then check their size. They're about 40,000 bytes each.
There's no error message. The server on accept one of the batch request and ignore the rest.
0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛