Hi @wasin.w Thank you for your help! I tried the code your suggested early. it didn't work at all. it requests a lot of parameters, when I execute it, it just throwed exceptions which doesn't give much info. So I thought it might be an outdated program,won't work. So I started to use websocket-api/Applications/Examples/RDP/CSharp/MarketPriceRdpGwAuthenticationExample/ to send batch requests, it works. but I am still testing it with a lot of items.
I found one issue during my testing, I sent 60 instrument codes as a batch, then I got 130-140 response messages back, and then the program seems stuck and no error messages, after a while, I saw it start to do below again and again very slowly, and there is no error, seems still going, but just re authentication again and again and no response message coming back anymore. I thought once I sent requests out, the stream will be endless without stopping, what cause it stuck there?
here is the output, could you please help?
Sending authentication request (isRefresh True) to https://api.refinitiv.com:443/auth/oauth2/v1/token
RECEIVED:
{
"access_token": "xxxx"
"refresh_token": "xxxx",
"expires_in": "600",
"scope": "trapi.streaming.pricing.read",
"token_type": "Bearer"
}
SENT on Session1:
{
"ID": 1,
"Domain": "Login",
"Key": {
"NameType": "AuthnToken",
"Elements": {
"ApplicationId": "256",
"Position": "192.168.2.44",
"AuthenticationToken": "xxxxx"
}
},
"Refresh": false
}
@nick.zincone could you please help?
Batch request for CSharp RRTO

I used this sample code websocket-api/Applications/Examples/RDP/CSharp/MarketPriceRdpGwAuthenticationExample/ for requesting single stock market price data, it works perfectly. I reviewed the output data with our business product yesterday, they said we need to request not just one stock, it could be 500+ stocks market price. So, that program doesn't work for batch requests.
my questions here:
1. Could you suggest a .net batch version of this program websocket-api/Applications/Examples/RDP/CSharp/MarketPriceRdpGwAuthenticationExample/ ?
2. Is there a limit per batch? How could we implement 500+ stocks requesting data?
Best Answer
-
There is no specific equivalent .Net batch request example. However, the capability is not much more than creating a list of items within the request. For example:
{
"ID": 2,
"Streaming": true,
"Key": {
"Name": ["CAD=","EUR="]
},
"View": ["BID","ASK","DSPLY_NAME"]
}There is a limit on the size of the batch. Specifically, the WebSocket streaming services limit the size of a request based on a byte limit returned from the login. For example, within the login response, you will see the limit:
{
"ID": 1,
"Type": "Refresh",
"Domain": "Login",
"Key": {
"Name": "...",
...
},
..
"Elements": {
"PingTimeout": 30,
"MaxMsgSize": 61516
}
}The "MaxMsgSize" defines the size of the total cargo (JSON message) sent. You will need to perform some general calculation to determine the size of the message (in bytes) based on the list of items you plan to send in your batch.
Alternatively, you can use the Refinitiv Data Library for .Net. This library is built on top of the WebSocket service and provides a lot of value including session and token management, a simple Pricing interface, manages maximum message limits on behalf of the user. I would suggest you refer to the Pricing examples defined within GitHub.
Here is a simple batch request using the library:
0
Answers
-
Hi Nick,
Thank you for your comment! As you said I created a list of item in the example program I used websocket-pi/Applications/Examples/RDP/CSharp/MarketPriceRdpGwAuthenticationExample.
here is the output from this program, it doesn't output data anymore, saying access denied. could you help how to make it work for the 3 items sent? Thank you!
{
"ID": 2,
"Key": {
"Name": [
"TRI.N",
"IBM.N",
"T.N"
],
"Service": "ELEKTRON_DD"
}
}
RECEIVED on Session1:
[
{
"ID": 2,
"Type": "Status",
"State": {
"Stream": "Closed",
"Data": "Ok",
"Text": "Processed 3 total items from Batch Request. 3 Ok."
}
}
]
RECEIVED on Session1:
[
{
"ID": 4,
"Type": "Status",
"Key": {
"Service": "ELEKTRON_DD",
"Name": "IBM.N"
},
"State": {
"Stream": "Closed",
"Data": "Suspect",
"Code": "NotEntitled",
"Text": "Access Denied: User req to PE(62)"
}
}
]
RECEIVED on Session1:
[
{
"ID": 5,
"Type": "Status",
"Key": {
"Service": "ELEKTRON_DD",
"Name": "T.N"
},
"State": {
"Stream": "Closed",
"Data": "Suspect",
"Code": "NotEntitled",
"Text": "Access Denied: User req to PE(62)"
}
},
{
"ID": 3,
"Type": "Status",
"Key": {
"Service": "ELEKTRON_DD",
"Name": "TRI.N"
},
"State": {
"Stream": "Closed",
"Data": "Suspect",
"Code": "NotEntitled",
"Text": "Access Denied: User req to PE(6562)"
}
}
]
0 -
Hi @huanjie
The above output indicates you do not have permissions to request for the instruments: "TRI.N", "T.N", "IBM.N". You may need to confirm with your account manager what data you have been permissioned to access. You may want to try delayed RICs - for example: "/TRI.N", "/T.N", "/IBM.N".
0 -
Hi Nick, you are right, I put "/" in front of the names like "/TRI.N", "/T.N", "/IBM.N", it worked.
Thank you so much for your help! :-)
0 -
Hello @huanjie
Actually, the Batch example is available in MarketPriceBatchViewExample.cs RTDS example (websocket-api/Applications/Examples/CSharp/). The examples in this non-RDP folder are for the deployed RTDS connection. However, the logic of requesting a batch is the same as my colleague suggested.
0 -
Hi @wasin.w Thank you for your help! I tried the code your suggested early. it didn't work at all. it requests a lot of parameters, when I execute it, it just throwed exceptions which doesn't give much info. So I thought it might be an outdated program,won't work. So I started to use websocket-api/Applications/Examples/RDP/CSharp/MarketPriceRdpGwAuthenticationExample/ to send batch requests, it works. but I am still testing it with a lot of items.
I found one issue during my testing, I sent 60 instrument codes as a batch, then I got 130-140 response messages back, and then the program seems stuck and no error messages, after a while, I saw it start to do below again and again very slowly, and there is no error, seems still going, but just re authentication again and again and no response message coming back anymore. I thought once I sent requests out, the stream will be endless without stopping, what cause it stuck there?
here is the output, could you please help?
Sending authentication request (isRefresh True) to https://api.refinitiv.com:443/auth/oauth2/v1/token
RECEIVED:
{
"access_token": "xxxx"
"refresh_token": "xxxx",
"expires_in": "600",
"scope": "trapi.streaming.pricing.read",
"token_type": "Bearer"
}
SENT on Session1:
{
"ID": 1,
"Domain": "Login",
"Key": {
"NameType": "AuthnToken",
"Elements": {
"ApplicationId": "256",
"Position": "192.168.2.44",
"AuthenticationToken": "xxxxx"
}
},
"Refresh": false
}
@nick.zincone could you please help?
0 -
Hi @huanjie
I would first try to send "non-streaming" requests, i.e. "Streaming": false. For example:
{
"ID": 2,
"Streaming": false,
"Key": {
"Name": "AAPL.O"
},
"View": [
"BID",
"ASK",
"CF_LAST"
]
}This will confirm whether you received 60 responses (Refresh or Status). The above messages are to refresh the access token required by the streaming service - which is why you receive them periodically. As for not receiving anything else, this may have to do with when you are sending the requests - are they out of market hours. I would also suggest you reduce your batch size to just a few - to test if the behavior is as expected.
0 -
@nick Thank you for your help!
I figured it might not be an issue, because after we get those refresh and update complete, there could be no more messages to send. So I only see the token refreshed and re-authenticate, once next day market opened, we should continually receive more response messages.
So, I will deploy it and have it run for few days, if I can see data on each day, it should be good.
Thank you again!
0
Categories
- All Categories
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 684 Datastream
- 1.4K DSS
- 613 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 248 ETA
- 552 WebSocket API
- 37 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 630 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 191 TREP Infrastructure
- 228 TRKD
- 915 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 86 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛