how to get date in dsws

Hi team, I've got a question regarding dsws. If retrieving single filed and startdate = -0D, then the result will not showing the actual date of the data.

e.g.

df = ds.get_data(tickers = '@:CNM1E1', fields = ['A12FE'], start = '-0D')

the result will be showing index, instrument, datatype, value and currency

1689564877355.png


However, if requesting multiple fileds, then it will return date automatically

e.g.

df = ds.get_data(tickers = '@:CNM1E1', fields = ['A12FE','A18GRO'], start = '-10D')

the result will be

1689564962889.png

If I need requesting single field while getting the Date, how should I modify the code? Thanks in advance for answering!

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @Julian.Bai

    This could be a limitation in the API. It will not display the date field if there is only one date available in the response.

    You may raise this issue with the development team via GitHub.

    The retName parameter is not available anymore. You can use the following code to get the return name.

    df = ds.get_data(tickers = '@:CNM1E1|N', fields = ['A12FE'],start = '-0D',kind = 0)
    df

    1689581197976.png


Answers