question

Upvotes
Accepted
3 0 0 5

Codebook Python vs standard Python - different outputs (get_historical_price_summaries)

Hello,

yesterday shortly after 6 PM (CET) I've tried to fetch EURAB6E10Y= last availible values, on one hour interval (code below). Running it on codebook python kernell returned exact values from 6PM, while running it on Python installed in my computer it showed that last availible value is from 5PM.

How is it even possible that the same function, in almost the same time, returns different values?

The same happend few days ago (4.12), when I tried to fetch WIPLNOND= values for 3.12 6PM. In codebook i got 3.12 6PM value as output, but in my python 2.12 6PM. After that I dropped "end=cut_datetime" and "count=2" parameters to see what would happened, and finally value from 3.12 6PM appeared on my screen.

Could You help me to understand why this function is working differently in this two enviorments?

Maybe there is a better way to fetch ecah day last availible at 6PM data for this instruments?

cut_datetime = datetime.datetime(2021,12,6,16,0,1) # 16 is 6PM in my timezone
 
rdp.get_historical_price_summaries("EURAB6E10Y=", rdp.Intervals.ONE_HOUR, end=cut_datetime, count=2, fields=["MID_PRICE"]).iloc[-1]
refinitiv-dataplatform-eikoncodebook
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvote
Accepted
9.7k 49 38 60

Hi @rafal.belka

The historical pricing service expects time specification to be in utc. Try this instead for both environments:

cut_datetime = datetime.datetime(2021,12,6,16,0,1,tzinfo=datetime.timezone.utc)

And 16 is 4 P.M. If you want 6.PM. UTC, ensure it is 18.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
3 0 0 5

Thanks @nick.zincone!

Today I will try adding tzinfo to my datetime object. I hope it's solution for my problem.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
3 0 0 5

@nick.zincone It worked, thank You!

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea