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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
3 0 1 3

Websocket api. How to get MID rates for FX rates

Good Day!

We are currently receiving BID and ASK information for FX rates via weboscket api. C#
We have a need to get the MID-market exchange rate using the Refinitiv Real-time optimised product.

We could not find a suitable field in the protocol specification (https://developers.refinitiv.com/en/api-catalog/refinitiv-real-time-opnsrc/refinitiv-websocket-api)

How can we get a mid-market exchange rate? If we can't get it through the websocket api, what api can we use to get it?

apiwebsockets
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.

Upvotes
Accepted
26.4k 62 17 14

Hello @Valery

I just want to add some information added to my colleague's answer.

You can use the WebSocket API View Feature to request only interested fields from the Refinitiv Real-Time.


Example Code:

    string view = "{"
        + "\"ID\": 2,"
        + "\"Key\": {\"Name\":\"" + _ric + "\",\"Service\":\"" + _service + "\"},"
        + "\"View\":[\"BID\",\"ASK\",\"MID_PRICE\",\"MID_NET_CH\",\"MID_CLOSE\"]"
        + "}";
    SendMessage(view);

Result:

RECEIVED on Session1:
[
  {
    "ID": 2,
    "Type": "Refresh",
    "Key": {
      "Service": "ELEKTRON_DD",
      "Name": "EUR="
    },
    "State": {
      "Stream": "Open",
      "Data": "Ok"
    },
    "Qos": {
      "Timeliness": "Realtime",
      "Rate": "JitConflated"
    },
    "PermData": "AwEBUmw=",
    "SeqNumber": 40558,
    "Fields": {
      "BID": 1.0531,
      "ASK": 1.0535,
      "MID_PRICE": 1.0533,
      "MID_NET_CH": 0.0008,
      "MID_CLOSE": 1.0525
    }
  }
]

An example of the View feature in C# is the MarketPriceBatchViewExample.cs example file in the GitHub https://github.com/Refinitiv/websocket-api/tree/master/Applications/Examples/CSharp link. The file is for the deployed RTDS connection but the View logic is the same as the RTO connection.

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.

Hi wasin.w,


Thank you for information. We will try.

Upvotes
83.1k 281 53 77

@Valery

I found several fields regarding mid-price.

MID_PRICE  "MID-PRICE"            134  NULL        PRICE              17  REAL64           7
!
! The mid-price between the bid and ask prices.
!
MID_NET_CH "MID-PRICE NETCH"      135  NULL        PRICE              17  REAL64           7
!
! The difference between the current mid-price held in MID_PRICE and the historic 
! mid-price MID_CLOSE.
!
MID_CLOSE  "MID-PRICE CLOSE"      136  NULL        PRICE              17  REAL64           7
!
! The closing mid-price.
!

You can also refer to the Data Model Discovery tool to find all available Real-Time fields for each RIC, such as 3312 - FX Alliance LLC (FXall) FX Spot [Refinitiv Real-Time/Misc.]

I hope it can help.


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.

Thank you for information about Data Model Discovery tool. It was very helpful

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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