I am struggling to find the way to get in Python historic OPEN/HIGH/LOW/CLOSE or at least CLOSE for single stocks, adjusted for dividends and other corporate actions. Can you tell me what is the right field? I can’t find it in DIB.
Hello @Rilecs
You can use the https://developers.lseg.com/en/api-catalog/lseg-data-platform/lseg-data-library-for-python Access Layer get_history() method to get Pricing and Fundamental & Reference history data.
Note: The new historical pricing service does not map to the exact same OPEN/HIGH/LOW/CLOSE fields as the older APIs had limited fields and generally created a consolidated view independent of the type of asset.
You need to contact the Workspace Content Support team to help you confirm which fields that equivalent to OPEN, HIGH, LOW, and CLOSE for you interested RICs.
Example:
@Rilecs
Thank you for reaching out to us.
For a content-related question, please contact the helpdesk support team directly. You need to ask for the Excel formula, such as =RDP.Data and RDP.HistoricalPricing, that can be used to retrieve the required data. Then, we can help you converting that formula to Python code.
Typically, the historical prices are available through the TR fields and real-time fields. For example, the TR.CLOSEPRICE field supports the Adjusted parameter.
The ld.get_history method also supports the adjustments parameter.
adjustments : Tells the system whether to apply or not CORAX (Corporate Actions) events or exchange/manual corrections or price and volume adjustment according to trade/quote qualifier summarization actions to historical time series data.Important note: This parameter only applies to pricing fields retrieved from the underlying Historical Pricing RDP API (fields that do not start with "TR.", such as BID and ASK). For the other fields (fields beginning with "TR." such as TR.Revenue) this parameter is ignored.Type: String expressed in ISO8601 with UTC onlyOptional: YesSupported values:exchangeCorrection - Apply exchange correction adjustment to historical pricingmanualCorrection - Apply manual correction adjustment to historical pricing i.e. annotations made by content analystsCCH - Apply Capital Change adjustment to historical Pricing due to Corporate Actions e.g. stock splitCRE - Apply Currency Redenomination adjustment when there is redenomination of currencyRTS - Apply LSEG TimeSeries adjustment to adjust both historical price and volumeRPO - Apply LSEG Price Only adjustment to adjust historical price only not volumeunadjusted - Not apply both exchange/manual correct and CORAXqualifiers - For tick, tas and taq intervals only. Apply price or volume adjustment to historical pricing according to trade/quote qualifier summarization actions e.g. noPrice, noVolume, noPriceAndVolume, noBid, noAsk, noBidAndAsk, outOfSessionIntraday, outOfSessionInterday.
For example:
df = ld.get_history(universe=['MSFT.O'], fields = ['TRDPRC_1','HIGH_1','LOW_1','OPEN_PRC','ACVOL_UNS'], adjustments=['exchangeCorrection','manualCorrection','CCH','CRE','RPO','RTS'], start='2022-01-01', end='2025-02-12') df
I am using the LSEG Data Library for Python and the examples are on GitHub.