New posts are disabled while we improve the user experience.

You can browse the site, or for urgent issues, raise a query at MyAccount.

question

Upvotes
1 0 0 1

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?

workspace#technologyapipython apicodebook
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Upvote
87.8k 294 53 79

@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.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.