Retrieving chain instruments from ATS with Python

Is there any boilerplate Python code available for retrieving the underlying instruments of a (self created) chain on ATS? Thanks!

Best Answer

  • Hello @joris.hoendervangers1

    I suggest using WebSocket API. This API runs directly on your TREP infrastructure (Server Side API). It presents data in JSON format and uses WebSocket Standards-based. It can easy integration into multiple client technology including Python. Anyway, it requires TREP version 3.2.1 (or above) and enabling WebSocket API feature which is explained in ADS document. If you require further ADS or TREP helps, please submit your questions to TREP support team via Get Support

    You can find Python example application in the WebSocket API Sample Applications which can be downloaded from GitHub at https://github.com/Refinitiv/websocket-api . For the developer document, please refer to WebSocket API Developer Guide .

    I suggest you start with market_price.py shipped with the WebSocket API Sample Applications. Please modify host, port, user to yours and send_market_price_request(ws) function to request your chain from your ATS service on TREP. For example, I requested 0#.DJI from the service named API_ELEKTRON_EPD_RSSL:

        mp_req_json = {
    'ID': 2,
    'Key': {
    'Name': '0#.DJI',
    'Service': "API_ELEKTRON_EPD_RSSL"
    },
    }

    When I run the python application, it shows the underlying instruments of the requested chain:

    image

    Hope this help.

Answers