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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
201 3 2 1

defining FIDs in websocket API for streaming prices

I use the Python example : market_price_edpgw_authentication

I can run the example but I want to optimize the solution. There is no need to get in the initialization all the available FIDs. I only want to see with the initialization 10-15 FIDs and only want to receive updates for these FIDS. How do I define the FIDS in the request . In the demo video "view" was used but that isn't supported in the Python example.

treprdp-apiwebsocketsrrto
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.

Upvote
Accepted
9.5k 10 5 7

Hello @wim.ooms

You can add 'View' in the request to specify your preference fields. The example below show how to request BID(FID 22) and ASK(FID 25) field below:

 mp_req_json = {
        'ID': 2,
        'Key': {
            'Name': ric_name,
            'Service': service
        },
         'View': [
            22,
            25
        ]
    }

The example output:

SENT:
{
  "ID":2,
  "Key":{
    "Name":"JPY=",
    "Service":"ELEKTRON_DD"
  },
  "View":[
    22,
    25
  ]
}
RECEIVED: 
[
  {
    "Fields":{
      "ASK":106.86,
      "BID":106.83
    },
    "ID":2,
    "Key":{
      "Name":"JPY=",
      "Service":"ELEKTRON_DD"
    },
    "PermData":"AwEBUmw=",
    "Qos":{
      "Rate":"JitConflated",
      "Timeliness":"Realtime"
    },
    "SeqNumber":9406,
    "State":{
      "Data":"Ok",
      "Stream":"Open",
      "Text":"*All is well"
    },
    "Type":"Refresh"
  }
]

You can find view Python example in market_price_batch_view.py shipped with WebSocket API Sample Applications

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.

Upvote
11.5k 16 7 10

Hello @wim.ooms

Please refer to this Filtering the Field List – specifying a View tutorial regarding the View feature in Elektron WebSocket API.

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