question

Upvotes
Accepted
1 0 0 1

MID_PRICE discrepancy between Excel & Python API

For the 6pm Malta FX, below is the code:

rd.get_history(fx_list, ['MID_PRICE'], interval='minute', end=this_date, count=1)

Generally, this is working and we are getting the same rates EXCEPT for a few instances, and I would like to know why there are these differences

=RHistory($B$3:NQ$3,"MID_PRICE.Timestamp;MID_PRICE.Close","END:"&$V$2+$F$1&" TIMEZONE:"&H$1&" INTERVAL:1M NBROWS:1",,"TSREPEAT:NO SORT:ASC")


Tried RDP in RW and CODEBOOK but not able to replicate

rdp-and-api.png api-vs-excel.png

#technologyrdp-apiexcelforex
api-vs-excel.png (51.5 KiB)
rdp-and-api.png (65.7 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.

1 Answer

· Write an Answer
Upvotes
Accepted
78.1k 246 52 72

@David.VenturaIII

Sorry for the issue you are facing, let me see if I can help you in resolving this.

RDP returns data in GMT and you specify CET in the RHistory function. On 17 Oct 2022, CET is two hours ahead of GMT (CET = GMT + 2:00),

Therefore, the GMT time for CET 18:00 on 17 Oct 2022 is 16:00.

rd.get_history(["EURNOK="], ['MID_PRICE'], interval='minute', end="2022-10-17T16:05:00", count=10)

The output is:

1668573423606.png

The value 10.3476 shows at 15:59:00 because it uses the startPeriod as the default of the summaryTimestampLabel parameter.

The summaryTimestampLabel parameter controls the timestamp label in the response to be either at the start summarization period or at the end of summarization period. The parameter is available in the intraday-summaries and interday-summaries APIs and its possible values are as follows:

- startPeriod indicates that the data returned is labelled at the start of summarization period.
- endPeriod indicates that the data returned is labelled at the end of summarization period.

I checked can found that the get_history function doesn't procide a paramter to change the value of the summaryTimestampLabel parameter so to change its value you need to use the historical pricing example instead (Content__Historical_Pricing.ipynb).

response = historical_pricing.summaries.Definition(
    universe = "EURNOK=", 
    interval = Intervals.ONE_MINUTE,     
    count = 10,
    fields=["MID_PRICE"],
    end ="2022-10-17T16:05:00Z",
    extended_params={"summaryTimestampLabel":"endPeriod"}
).get_data()
response.data.df

The output is:

1668573775452.png

I hope this will help.


1668573423606.png (35.6 KiB)
1668573775452.png (47.4 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.

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.