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" ]}
Hello @3352edee-c7b3-42de-95ff-77348a2fc138_deprecated_0bbe7cc3-29e3-4fb6-9839-cd518b6f430b
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.
thanks! What is the meaning of the id 2 or 3 here? Does it matter?
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.
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"}