Using the Python API, How do I retrieve the last price on an equity converted to US Dollars?

I tried:

ek.get_data(["9501.T", "1810.HK","SAF.PA"], ['CF_LAST', 'TR.PriceClose(curn=USD)'])

That gives me the last price in the local currency, and the closing price in USD. But, I want the last price in USD. When I try: CF_LAST(curn=USD), I get the message: "The 'CURN' is unrecognized."

Also, where do I find a guide that shows the names of the data values I can query for a ticker?

Best Answer

  • chavalit-jintamalit
    Answer ✓

    Hi @Brent Gregory

    The "CF_LAST" is a realtime field, it only reports in local currency.

    image


    You can try retrieving currency value and apply it to the CF_LAST in the application.

    df,e = ek.get_data('HKD=','CF_LAST')
    df1,e = ek.get_data('1810.HK','CF_LAST')
    df1['CF_LAST_USD'] = df1['CF_LAST'] * df['CF_LAST'][0]
    df1

    image

Answers