Use dscode to retrieve data

How can I use a list of dscode values to retrieve cross-sectional data on close price, volume, ask price, and bid price from the Refinitive API?

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @mengxiao.li.2024

    Thank you for reaching out to us.

    You need to convert dscodes to RICs.

    You can use the Search API in CodeBook.

    import lseg.data as ld
    from lseg.data.content import search
    ld.open_session()
    response = search.lookup.Definition(
        view=search.Views.SEARCH_ALL,                             
        scope="DsQuotationNumber",                                                      
        terms="906187,992816",               
        select="BusinessEntity,DocumentTitle,DsQuotationNumber,RIC",                
    ).get_data()


    response.data.df

    Then, use the get_data or get_history method with RICs to retrieve the data. For example:

    ld.get_history(["IBM","AAPL.O"])

    For the get_data method, you can use the Data Item Browser tool to get a list of available fields and parameters.