question

Upvotes
Accepted
3 0 1 0

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 5.0 MiB each and 10.0 MiB total.

Upvotes
Accepted
38.1k 71 35 53

@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 5.0 MiB each and 10.0 MiB total.

Upvotes
38.1k 71 35 53

@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 5.0 MiB each and 10.0 MiB total.

Upvotes
3 0 1 0

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 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea