Defining a currency when looking at historical price data

Hi,

I'm trying to look at various stocks over the past 10 years. I have several stocks that are non-USD. How can I amend the following query to return the USD version of TRDPRC1:

ld.open_session()
response = historical_pricing.summaries.Definition(

universe = ['AAPL.O', 'SHEL.L''],

interval = historical_pricing.Intervals.DAILY,

fields = ['TRDPRC_1', 'TRNOVR_UNS'],

start = dt.date(2015, 5, 18),

end = dt.date(2025, 5, 19), ).get_data()
df = response.data.df
ld.close_session()

Kind regards

Jas

Answers

  • Hello @Jasdeep

    There are two ways to do this -

    You can use the get_data function along with the fields that support history to apply the currency conversion on the server side. For e.g:

    ld.get_data(
        universe = ['AAPL.O', 'SHEL.L'], 
        fields = ['TR.CLOSEPRICE', 'TR.TURNOVER'],
        parameters = {'SDate': '2015-05-18', 'EDate': '2016-05-19', 'Frq': 'D', 'Curn':'USD'}
    )
    

    The fields which are supported can be found in the Data Item Browser (DIB) in Workspace.

    Other option is to invoke the historical data API call that you show, and additionally, get the historical data for currency cross rate, and then apply it to the dataframe in Python. For e.g. RIC code for Pound Sterling is GBP=. This approach is more flexible, since the user code controls all data manipulation.