Need help to get parameters for api.refinitiv.com/discovery

raghava.belagola
edited January 21 in WebSocket API

Hi, i have a python script which is below

partial_df1 = rd.discovery.search(view = rd.discovery.Views.COMMODITY_QUOTES,                    top=10000,                    filter = "\                    SearchAllCategoryv2 eq 'Commodities'\                    and RICLength lt 10 \                    and RIC eq '0#*:'\                    and RIC ne '*IV:*'\                    and RIC ne '*-:*'\                    and DTSubjectName ne 'forecast' \                    and DTSubjectName ne 'foreacast' \                    and DTSubjectName ne 'Forecst' \                    and DTSubjectName ne 'forecasts' \                    and (not(RCSUnderlyingProductGenealogy in ('U:8' 'U:B' 'U:C' 'U:I' 'U:Q' 'U:D7')))",                    select = "RIC,DTSubjectName,RCSUnderlyingProductLeaf,ExchangeName,DisplayType,AssetType,ExchangeName, RCSAssetClass")

i need to port this to api.refinitiv discovery API. i tried few options but getting error. please help in getting right parameters.

i tried below

POST -

https://api.refinitiv.com/discovery/search/v1/explore

{  "View": "COMMODITYQUOTES",  "Filter": "SearchAllCategoryv2 eq 'Commodities'",  "Select": "RIC,DTSubjectName,RCSUnderlyingProductLeaf,ExchangeName,DisplayType,AssetType,ExchangeName, RCSAssetClass",  "Top": 20}

i tried

{  "View": "COMMODITY_QUOTES",  "Filter": "SearchAllCategoryv2 eq 'Commodities'",  "Select": "RIC,DTSubjectName,RCSUnderlyingProductLeaf,ExchangeName,DisplayType,AssetType,ExchangeName, RCSAssetClass",  "Top": 20}

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @raghava.belagola

    Thank you for reaching out to us.

    The endpoint of the rd.discovery.search method is https://api.refinitiv.com/discovery/search/v1/. The payload is:

    {
    "View": "CommodityQuotes",
    "Filter": "SearchAllCategoryv2 eq 'Commodities' and RICLength lt 10 and RIC eq '0#*:' and RIC ne '*IV:*' and RIC ne '*-:*' and DTSubjectName ne 'forecast' and DTSubjectName ne 'foreacast' and DTSubjectName ne 'Forecst' and DTSubjectName ne 'forecasts' and (not(RCSUnderlyingProductGenealogy in ('U:8' 'U:B' 'U:C' 'U:I' 'U:Q' 'U:D7')))",
    "Select": "RIC,DTSubjectName,RCSUnderlyingProductLeaf,ExchangeName,DisplayType,AssetType,ExchangeName, RCSAssetClass",
    "Top": 10000
    }

    The output is:

    image.png
  • Thanks.

    i also want api equivalent of

    uncl_raw_df = rd.get_data(universe=uncl_universe, fields=['LONGLINK1', 'LINK_1'])
    

    i could not find it in dev portal , please help

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @raghava.belagola

    You can enable the debug log in the library to check the endpoints that the library is using by running the following code before opening a session.

    config = rd.get_config()
    config.set_param("logs.transports.file.enabled", True)
    config.set_param("logs.transports.file.name", "lseg-data-lib.log")
    config.set_param("logs.level", "debug")

    Then, check the lseg-data-lib.log file.

    On the RDP, the library retrives this data from the WebSocket connection via Real-Time Optimized.

    Otherwise, you can try the snapshots endpoint instead (https://api.refinitiv.com/data/pricing/snapshots/v1/?universe=0%23.SETI&fields=LONGLINK1,LINK_1).

    image.png