How to connect using Real-Time SDK EMA C# and RIC for FX

tboonte
tboonte Newcomer
edited July 24 in EMA

Hello,

This actually a two questions post.

I am trying to connect to RTO using EMA (LSEG.Ema.Core 3.4.0), however, I am struggling to do so (more on this later.)

First, I am able to login and connect with websocket using example from MarketPriceRTOClientCredAuthExample project (I was given <client_id> and <client_secret>.)

Now that I am connected and able to receive "Ping" and send "Pong", but I am unable to get real-time data for RIC "/TRI.N" in the sample. Output from running the example below.

07/24/2025 9:25:51 AM SENT on Session1:
{
"ID": 2,
"Key": {
"Name": "/TRI.N",
"Service": "ELEKTRON_DD"
}
}

07/24/2025 9:25:52 AM RECEIVED on Session1:
[
{
"ID": 2,
"Type": "Status",
"Key": {
"Service": "ELEKTRON_DD",
"Name": "/TRI.N"
},
"State": {
"Stream": "Closed",
"Data": "Suspect",
"Code": "NotEntitled",
"Text": "Access Denied: User req to PE(5050)"
}
}
]

Tried with different RIC such as "IBM.N"; no luck.

I need to get two set of data, first FX data ie. USDTHB, I tried "USDTHB", "USDTHB=" these did not work.

Another set of data is US Equity data, I am subscribed to NASDAQ, but I do not know what would be the RIC for let's say MSFT, AMZN, etc.

OK, that was the first question.

The second question is, I would like to use RTO using provided library instead of websocket.

I use the code below, I have tried different combination of with/without TokenScope(), Host(), TokenUrlV2, ServiceDiscoveryUrl() but no joy.

            var config = new OmmConsumerConfig()
.ClientId(<client_id>)
.ClientSecret(<client_secret>)
.OperationModel(OperationModelMode.USER_DISPATCH)
.TokenScope("trapi.streaming.pricing.read") //From this point on I have tried different combination but no luck
.Host("api.refinitiv.com:443")
.TokenUrlV2("https://api.refinitiv.com/auth/oauth2/v2/token")
.ServiceDiscoveryUrl("https://api.refinitiv.com/streaming/pricing/v1/");
// create OMM consumer consumer = new OmmConsumer(config);

It would throw exception when executing

consumer = new OmmConsumer(config);

at LSEG.Ema.Access.OmmBaseImpl1.HandleLoginReqTimeout()
at LSEG.Ema.Access.OmmConsumerImpl.HandleAdminDomains()
at LSEG.Ema.Access.OmmBaseImpl
1.Initialize()
at LSEG.Ema.Access.OmmConsumer.Initialize()
at LSEG.Ema.Access.OmmConsumer..ctor(OmmConsumerConfig config)
at tutorial2.BasicConsumer.Main(String[] args) in C:\Working\temp\ema_csharp_consumer\tutorial2 - Requesting MarketPrice data\BasicConsumer.cs:line 76

Wonder if anyone can help share some pointer.

Best,

Wit

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @tboonte

    Thank you for reaching out to us.

    The error ("Access Denied: User req to PE(5050)") indicates that the account doesn't have permission to access the subscribed RIC.

    Regarding RICs, you can the RIC Search Tool to search for RICs.

    To connect to RTO with EMA C#, you can refer to the 113_MP_SessionMgmt example in the package. The example uses the Consumer_4 and Channel_4 in the EMA configuration file.

  • Hello @tboonte

    There are others RTO examples as follows:

    The 113 example is the easiest one.

  • tboonte
    tboonte Newcomer
    edited July 29

    Hi @wasin.w

    I tried Example 113 with

    -clientId and -clientSecret command line arguments.

    Copy over EmaConfig.xml and changed DefaultConsumer to Consumer_4.

    Also update code to use "Consumer_4"

    public static void Main(string[] args)
    {
    OmmConsumer? consumer = null;
    try
    {
    OmmConsumerConfig config = new();
    if (!ReadCommandlineArgs(args, config))
    return;
    consumer = new (config.ConsumerName("Consumer_4"));
    consumer.RegisterClient(new RequestMsg().ServiceName("ELEKTRON_DD").Name(itemName), new AppClient());
    Thread.Sleep(900000); // API calls OnRefreshMsg(), OnUpdateMsg() and OnStatusMsg()
    }
    catch (OmmException ommException)
    {
    Console.WriteLine(ommException.Message);
    }
    finally
    {
    consumer?.Uninitialize();

    }
    }

    I got error below

    image.png

    Then I tried Example 450, with -clientId and -clientSecret flags

    I am able to get list of service endpoints, but I got the error below

    image.png

    What did I do wrong?

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    Please refer to the answer on this discussion.