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?

Best Answer

  • Jirapongse
    Answer ✓

    @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

Answers

  • @Jirapongse

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

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

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

  • 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