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

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

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

    image

    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

    image



Answers