question

Upvotes
Accepted
0 0 1 1

How to get only trading days in Datastream data?

Hi,


When I try to get data for the instrument <DOLc1> it is returning data for non-trading days.

I tried using Python Datastream module:

ds.get_data(tickers='<DOLc1>', fields=['PS'], freq='D', start='2021-01-01")

This will return, e.g., data for 2021-01-25, which was a holiday in Sao Paulo and the exchange was closed. My data in the end has lots of duplicated values due to this.

How can I ask Datastream the data without the non-trading days?

python#contentdatastream-apicalendarmarket-holidays
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
80k 257 52 75

@lmotta

Thank you for reaching out to us.

Please try the following code.

df1 = ds.get_data(tickers='<DOLc1>', fields=['PS#S'], freq='D', start='2021-01-01')

1688612162834.png


1688612162834.png (16.6 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
0 0 1 1

@Jirapongse

Thanks! It worked. I tested for a small and large sample.

As a final question: what does #S mean exactly?

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
80k 257 52 75

@lmotta

The #S qualifier unpads values where the underlying data point is stored as a null value - so displays N/A for null values rather than pad the last real value. This padding may occur where the closing price is not published by an exchange for a stock due to:

  • The stock does not trade
  • The stock is suspended
  • An exchange holiday

then the closing price is stored as a null. P#S will display this value as N/A.

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.

Thank you, this was very useful. Is there a documentation for expressions such as #S? I tried to find this in the Datastream function catalogue but #S is not considered a function there.

@lmotta

You can find it in the Datastream Navigator with the Datatype Search.

1688957048116.png


1688957048116.png (39.6 KiB)

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.