How can we pull futures curve for different dates in python?
For example, how would I pull prices of 0#CL: for today, and compare it to yesterday?
@Ezekiel.Relles
Thank you for reaching out to us.
0#CL: is a chain RIC so you can use the Chain method in the LSEG Data Library for Python to expand this chain. Then, use the expanded RICs to retrieve data from the TR fields by using the ld.get_data method. The sample code is on GitHub.
For example:
chain = Chain("0#CL:") print(chain.constituents) df = ld.get_data( universe = chain.constituents, fields = ['TR.SettlementPrice(SDate=2026-01-22)','TR.SettlementPrice(SDate=2026-01-23)'], header_type = ld.HeaderType.NAME) print(df)
I use the TR.SettlementPrice field. You need to contact the helpdesk support team to verify this field or get other fields.