Obtain FX rate "mid_price.close" from API

We currently obtain an FX rate using an Excel macro -- the key part is this:

xll.rhistory(...rics...,"MID_PRICE.Timestamp;MID_PRICE.Close"...

We're trying to get the same figures through a Python API. The Eikon API doesn't have 'mid-price'. The Refinitiv data API has 'mid-price' but not 'mid-price.close'.

Using rd.get_history without specifying fields gives a range of rates, none of which match the rates we get from Excel.

Using ek.get_timeseries or ek.get_data only gives close, high, low and open -- none of which match the Excel rates either.

Is there a way of obtaining the 'MID_PRICE.Close' Excel macro figure through a Python API?

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @operations04

    Thanks for reaching out to us.

    I checked with JPY= and found that the MID_PRICE from rd.ge_history matches 'MID_PRICE.Close'

    The following is the data from rd.get_history.

    1666236896220.png

    Then, comparing the data from Excel.

    1666236937159.png


    Please provide sample RICs that data from rd.get_history is different from Excel.

Answers

  • Thank you for the response. And apologies for not being more specific!

    One RIC that exhibits the problem is EURGBP=


    fx-discrepancy.jpg


    The data on the left comes from the Refinitiv-Data API, using:

    rd.get_history(['EURGBP='], interval='daily', end='2022-10-18', count=4)

    And the data on the right comes from an Excel macro, using:

    _xll.rhistory($B$3:NQ$3,"MID_PRICE.Timestamp;MID_PRICE.Close"...


    Please let us know if any more information would be helpful in diagnosing what's going on here.

    Thank you.

  • @operations04

    Thank you for the information.

    I am not sure about _xll.rhistory. I used @RHistory method in Eikon Excel.

    =@RHistory("EURGBP=","MID_PRICE.Timestamp;MID_PRICE.Close","INTERVAL:1D",,"TSREPEAT:NO CH:Fd",F8)

    The output is:

    1666259332128.png