question

Upvotes
Accepted
30 4 6 13

Pull Closing Prices Without Market Holidays

Hello, with this request in Excel using PI#S and DN (A2 = S&PCOMP ticker):


=@DSGRID(Data!$A$2,"X(PI#S)","2021-12-31","","DN","RowHeader=true;ColHeader=true;DispSeriesDescription=false;YearlyTSFormat=false;QuarterlyTSFormat=false;AutoRefresh=false","")

I am able to pull the S&P 500 last value excluding holidays (dates).

How I can translate this method in python code for CodeBook ? Could you provide an example that matches the same output I obtain in Excel ?

pythondatastream-apimarket-holidaysexchange-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

@Aleniles

You can try this one:

ds.get_data(tickers="@AMZN",fields =["PO", "PH","PL","P#S"], freq="DN", kind=1)

However, please contact the Refinitiv Datastream Web Service support team directly via MyRefinitiv to confirm it and ask for the way to obtain market holidays (dates) in Datastream for a given country.


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.

Upvote
80k 257 52 75

@Aleniles

The code looks like this.

Price = ds.get_data('S&PCOMP', fields=['X(PI#S)'], start='2021-12-31', freq='DN')
Price

The output is:

1652322459495.png




1652322459495.png (9.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.

Thanks! Is there also a way to obtain market holidays (dates) in Datastream for a given country using python ?

Upvotes
30 4 6 13

How to do the same (removing holidays) but fetching the Open, high, low and close using a stock like @AMZN ?

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.

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.