question

Upvotes
Accepted
3 2 2 1

Datastream python API: time series list

Dear all,

I was wondering if there is a solution to get a time series list through the python api. It can easily be computed in Excel but I do not manage get the results in python. Thanks in advance

pythondatastream-apidsws-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.

Upvotes
Accepted
79.2k 251 52 74

@thomas.raffinot

Do you mean the symbol lookup?

You can look up symbols via API by using DS.SYMBOLOOKUP but its feature is quite limited.

df1 = ds.get_data(tickers="MSCI USA - DAILY", fields=["DS.SYMBOLLOOKUP(Count=50)"],  kind=0)

The output is:

We suggest clients to use the DataStream website instead to search for items.

After getting a list, you can use the API to retrieve time-series data.

item_list=ds.get_data(tickers="LFTSE1000518|L",fields =["NAME"], kind=0)
batch_list = np.array_split(item_list['Instrument'],len(item_list)/20)
data = None
for batch in batch_list:
    temp_dat = ds.get_data(tickers=','.join(batch), fields=['P','MV'], start='-3M', end='-1M') #kind=1
    if  data is None:
        data = temp_dat
    else:
        data = data.join(temp_dat)
data




1607510852012.png (43.7 KiB)
1607511794202.png (81.0 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.

Upvotes
79.2k 251 52 74

@thomas.raffinot

Please explain more about the question.

You can use the Python DatastreamWS API to retrieve time-series.

ds.get_data (tickers='@AAPL, @FB, @GOOGL, @MSFT, U:JPM', fields=['P','MV'], start='-3M', end='-1M') 

The output looks like:


1607500017779.png (53.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.

Upvotes
3 2 2 1

Thanks for your answer, I would like the equivalent of (I do not know the list of constituants in advance)


1607500714423.png (58.8 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.

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.