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.

Hi @lmotta ,

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?

If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,

AHS

@lmotta

Hi,

Please be informed that a reply has been verified as correct in answering the question, and marked as such.

Thanks,

AHS

Upvotes
Accepted
79.2k 251 52 74

@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
79.2k 251 52 74

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