For a deeper look into our Elektron API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
5 1 2 7

How can I retrieve the FX currency rates using RFA C#.NET code?

I am not able to find any example for retrieving FX currency rates using RFA .NET code. I have downloaded the RFA QuickStart Consumer code, but it is related to market price which is not useful for this purpose.

elektronrefinitiv-realtimeelektron-sdkrfaforex
icon clock
10 |1500

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

Update: When my code tries to connect with EZD service (running in the background), it gives error

Static: (Severity) Warning: RSSL Channel closing on connection "Default::Connection_RSSL localhost:14002" due to "channel disconnect"

I am able to connect with EZD now. There was URL access issue through proxy, which I sorted out to make it work

Upvotes
Accepted
24.9k 87 10 22

Hi @anil.s

The above suggests you are getting a Status Messsage response - which should provide some clues, but since this is a very basic example it does not dump the Status out to console.

A few things to check

  1. You have correctly populated the ExampleRFA.cfg with your connectivity parameters.
  2. When you build the example, the build process results in the ExampleRFA.cfg etc being copied to the Release or Debug folder (as per your selected build). Please check the appropriate build folder and ensure the ExampleRFA.cfg in the build/runtime folder has the correct connectivity parameters and not the default config file.
  3. Enable trace for your connection by adding the following line to the ExampleRFA.cfg (in the build/runtime folder)

\Connections\Connection_RSSL\traceMsgToFile = true

The above should generate an XML trace file in the build folder called 'Connection_RSSL_xxxx.xml' which you can upload for analysis.

You can also add some extra code to the ProcessMarketPrice method to dump the Status text out to console when it does not pass the IF statement you mentioned above

 if ((respMsg.HintMask & RespMsg.HintMaskFlag.Payload) != 0)
{           
....
....
}
else if ((respMsg.HintMask & RespMsg.HintMaskFlag.RespStatus) != 0)
{               
  RespStatus status = respMsg.RespStatus;
  Console.WriteLine("Status:" + status.StatusText);
}

If after confirming your build folder has the correctly populated ExampleRFA.cfg file, you continue to have problems, then please upload the console output and the trace xml file.

icon clock
10 |1500

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

Thanks @Umar

I filled in the missing port numbers and hostname values in my cfg file and then it started workig. After running the example, I started getting the currency price in console.

Upvote
24.9k 87 10 22

Hi @anil.s

If you know the RIC code for the currency rate, you can use that instead of the sample RIC code that is being used in the QuickStart Consumer code.

So, for example if the Quickstart example is using "TRI.N" for the RIC, you could replace this with "EUR=" or "GBP=" for Euro or Sterling related prices.

You can Consume the "CURRENCIES" RIC to get the Currencies Speed Guide page, which lists the codes for other Currency related pages. e.g. "G7CCY/1" details the guide pages for G7 Currencies. The pages show the RIC codes needed to drill down - e.g. "EUR/1" is Euro guide page. From there you can see the various Euro related RICs e.g. EUR="

You can use the convenient GUI viewing tool SpeedGuide to view the above pages.

icon clock
10 |1500

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

I downloaded SpeedGuide and executed it with my server configuration. localhost:14002. The server is running in the background, however the connection failed with message "Received ChannelDownReconnecting event on channel Channel. Error initializing channel errorid=-1 text=Connection refused"

Here is the log generated after using SpeedGuide. This log entries are taken from ezd.txt located at EZD server installation location.

<LLPC0312.1.ezd: Error: Tue Jan 30 13:32:30.439557 2018>
SIPC Server initialization failed on port 14002: <..\..\..\src\ipc\sipcsrvr.c:1062> sipcBindSocket() failed (10048)
<END>< LLPC0312.1.ezd: Error: Tue Jan 30 13:32:30.439588 2018>
Unable to start Sink Sipc Server.

I am able to connect with EZD now. There was URL access issue through proxy, which I sorted out to make it work

Upvote
4.4k 10 6 9

Hi @anil.s

The term “Market Price” is actually used to denote information which contains trades and quotes. You can retrieve FX rate from Market Price.

In order to retrieve FX rate, you have to specify FX rate's RIC as the item name.

Some sample FX rate RICs are

JPY=
GBP=
EUR=

The above RICs are USD cross rate. For non-USD cross rates, you have to use "<Currency Code A><Currency Code B>=". For example:

GBPJPY=
EURCAD=

(Try swapping A - B currency if the request return not found).

icon clock
10 |1500

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

Upvote
16.7k 43 12 19

If you need help in finding out the RIC for FX instrument, try the RIC Search tool available in the developers portal in the Home page > under Resources. Type in the name of currency and select FX and Money category to restrict results.

The last entry in the table is a RIC, which can be used in the RFA Quickstart consumer example.

icon clock
10 |1500

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

Now I am able to conenct with EZD server, but my code execution does not pass the following IF condition. It comes out of the IF block.

if ((respMsg.HintMask & RespMsg.HintMaskFlag.Payload) != 0)

I have provided attribute name as "GBPINR=R" and using service "ELEKTRON_DD"

The HintMask coming as 10, Payload coming as 64