question

Upvotes
Accepted
1 0 0 1

Can I get a C# example to do request/response over TREP using the EEP service.

I was successfully able to integrate the Websocket API in my project but there are some use cases that require some more thought. I would like to know the best way to retrieve data using Request/Response over TREP. I am currently using C# to make this request. Can someone point me to such an example?

elektronrefinitiv-realtimetrepc#infrastructure
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
Accepted
13k 32 12 18

Hello @ahmad.siddiqi, You can download the samples package from Elektron SDK downloads page. In the WebSocket API Sample Applications download, there are examples of MarketPrice, MarketByPrice and MarketByOrder etc in C#.

Please note that websockets have to be enabled in your TREP infrastructure (on ADS).

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
1 0 0 1

This is fine but isn't there a way to do simple request/response to get data or is the only way to get data is by doing a WebSocket call? Is there another api I can hit over TREP to request some data instead of writing a complicated WebSocket wrapper?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
13k 32 12 18

There is an Elektron SDK available in both C++ and Java only. The SDK will allow you to use API to get the data. You can follow step by step tutorials for these in the developers portal. I may apprise you, that while SDK is better suited for low latency, high volume data, it is also complex to use compared to Websocket API - which is based on simple JSON format.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
1 0 0 1

Thanks for the quick response. Do you have a C# example of EMA and ETA? How do people typically use C# for communicating through these channels?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
13k 32 12 18

Sorry, only C++ and Java are supported API for EMA or ETA.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
1 0 0 1

Ok thats fine. Using websockets if I request data in a batch looks to me like there is no guarantee that the data will come back in one response. Is there a way to determine when the client receives all the data requested via the batch?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
13k 32 12 18

In batch request, each instrument will have its own stream, identified by ID. See the batch request sample and these articles:

https://developers.refinitiv.com/content/elektron-websocket-api-tutorials-batch-request

https://developers.refinitiv.com/article/understanding-elektron-websocket-api-batch-and-view-feature

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
20.3k 73 10 20

Hi @ahmad.siddiqi

As well as my colleagues explanation of how each item in a Batch has its own stream ID, there is alternative simpler technique you could use to confirm if you have received a response for all items.

If you look at my Python Websocket example on Github, you will note that when the number of RefreshMsg + Closed status responses = the number of items in my batch, then I mark this as all items responded to. If you are using Streaming requests (rather than Snapshot), then you can expect to continue receiving UpdateMsgs in line with market activity for your subscribed instruments.

# Cleanup and exit - if autoExit and we have received response to all requests
if (autoExit and (reqCnt==imgCnt+closedCnt)):
    cleanup(ws)

So, for all valid subscription requests you should receive a RefreshMsg. For any invalid requests e.g. invalid RIC or items you are not permissioned for, you would receive a StatusMsg with a Suspect State (as demonstrated in my code).

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea