question

Upvotes
Accepted
1 0 0 1

How to retrieve the names and tickers from a List (DSWS)

Using Codebook, How do we map the names/tickers in the result below? It only shows Instrument number:


# get constituent list

df1 = ds.get_data(tickers='LS&PCOMP|L', fields=['P'], kind=0)

# get a subset of first 50 instruments

#slist = ','.join(df1['Instrument'].tolist()[0:50])

# get timeseries data for it

df2 = ds.get_data(tickers=slist, fields=['P','WC01001'], start='2022-02-01', end='2022-02-01', kind=1)

display(df2)

python#technology#contentdsws-api
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
Upvotes
Accepted
5.5k 21 2 6

Hi @dan.gabriel@lseg.com,


May I suggest that you look for the field you are after in the Datastream Portal? Specifically in the Datatype Search:

1679916989297.png


1679917010576.png


# get timeseries data for it
df2 = ds.get_data(
    tickers=slist,
    # fields=['P', 'WC01001', 'RIC'],
    fields=['RIC'],
    start='2022-02-01', end='2022-02-01',
    kind=0)
display(df2)





1679916989297.png (62.5 KiB)
1679917010576.png (26.3 KiB)
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.

ex resulting dataframe:



1679917144418.png

1679917144418.png (34.6 KiB)
In addition, does client need weightings permission seperately in DSWS to get the Constituent list for fee access Indices

@jonathan.legrand


Thank you for the update. Just a question, I am using the below code but for some reason it does not work for LS&PCOMP but works for a sample I did with less than 50 constituents: LPSECOMP,LDAXINDX

List.PNG

Is there a special case for greater than 50 constitutents.

Regards,


Dan


list.png (24.0 KiB)

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.