question

Upvotes
Accepted
1 0 1 2

DSWS does not align dates correctly in Python

I'm using PyDSWS to get Datastream data with Python. For some reason my timeseries are shifted by one day. So if I pull a historical price series, today's price has yesterdays date (01/30/2019), yesterdays price has the date from a day before and so on. Is this related to some timezone settings? My Datastream Excel Add-in works properly.

datastream-apidsws-apidate
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.

Hello @igor.popov,

Can you please send the code example for one instrument so I can review? Also, what is your timezone setting?

Kind regards,

Monika

Hi Monia, my Eikon is set to Dublin timezone (the correct one), and the code I am using is this:

df = ds.get_data(tickers='FR0000045072', fields='P', start='-1Y', end='TODAY', freq='D')
Thank you
Upvotes
Accepted
1.1k 3 3 3

@igor.popov

When using the date in request please use following formats:

  • Absolute dates in the format “YYYY-MM-DD” or “YYYYMMDD”.
    e.g. “2018-06-01” or “20160601”.
  • Relative dates using day, week, month, quarter or year offsets:
    e.g. “-0D”, “-10D”, “-5W”, “-3M”, “-8Q”, “-50Y”, etc. The offsets are relative to the current date.

In this case for end date use either '2019-01-31' or '-0D' in the same way it is done in Datastream Excel Add-in: =DSGRID("FR0000045072","P","-1Y","-0D","D",.... In that case the results are the same.

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
1 0 1 2

Thank you, but unfortunately I have tried this before and it does not solve the problem. If I use '2019-01-31' as the end date it still ends on 2019-01-30 and the price is still incorrect (still misaligned). If I use '-0D' the end date becomes 2019-01-29 (2 days ago) and the prices are still misaligned. Thank you.

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.