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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
21 0 0 1

Different views for Websocket API request

Is it possible to have a different view in the request for different ric's? Like:

{
  "ID": 2,
  "Key": {
    "Name": "EUR="
  },
  "View": [
    "PRIMACT_1",
    "CTBTR_1",
    "QUOTE_DATE"
  ]
},

{
  "ID": 3,
  "Key": {
    "Name": "CZ0"
  },
  "View": [
    "SETTLE",
    "SETTLEDATE"
  ]
}
treprdp-apiwebsocketsricsrrto
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
11.5k 16 7 10

Hello @3352edee-c7b3-42de-95ff-77348a2fc138

Yes, it is possible. Each item request message can has a different view.

Example from market_price.py:

req_msg = '[{"ID":2,"Key":{"Name":"EUR="},"View":["PRIMACT_1","CTBTR_1","QUOTE_DATE"]},{"ID":3,"Key":{"Name":"CZ0"},"View":["SETTLE","SETTLEDATE"]}]'
ws.send(json.dumps(json.loads(req_msg)))

Example results: result.txt

The RIC CZ0 has a few updates but it still receives a refresh message with fields "SETTLE" and "SETTLEDATE".

Please note that you can test and verify the Elektron WebSocket JSON request message with your local ADS server (3.2.1 and above) with the WebSocket API Try it Now! Documentation. The documentation is available Elektron WebSocket API download page. You can find more detail about this tool and Elektron WS JSON at Elektron WebSocket API Quick Start - Connecting to TREP page.


result.txt (24.9 KiB)
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
21 0 0 1

thanks! What is the meaning of the id 2 or 3 here? Does it matter?

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.

The ID (2 or 3 here) is a unique identifier for your request. The response message from server will contain that same identifier, so that application can associate responses to requests.

The ID should be unique for every request that an application sends.

Hello @3352edee-c7b3-42de-95ff-77348a2fc138

The ID is a reference of each item request stream. The ID must be used to identify which stream you want to modify (such as close item). It can also be used to match the request and responses.

Item request:

{
  "ID": 7,
  "Key": {
    "Name": "TRI.N"
  }
}
<br>

Item close:

{
  "ID": 7,
  "Type": "Close"
}
Click below to post an Idea Post Idea