LSEG api get_history doesnt have CLOSE

valstar
valstar Explorer
edited March 26 in Eikon Data APIs

I’m migrating from eikon to lseg. I’ve been advised to migrate eikons get_timeseries to lseg get_history.

With eikon I can get the CLOSE values (see below in a.).

Lseg doesn’t have CLOSE or anything similar. (see below in b.)

This is using your own codebook.

Please advise.

a. Refinitiv.Eikon

df_hist_ek = ek.get_timeseries(

    ["CAD="],

    start_date='2025-03-18',

    end_date='2025-03-24',

    interval='daily'

)

df_hist_ek

CAD=

CLOSE

HIGH

LOW

OPEN

COUNT

Date

2025-03-18

1.4299

1.4319

1.4267

1.4287

57761

2025-03-19

1.4324

1.4349

1.4293

1.4298

56450

2025-03-20

1.4323

1.4401

1.4311

1.4325

55030

2025-03-21

1.4349

1.4373

1.4311

1.4325

51312

2025-03-24

1.4318

1.4358

1.4287

1.4349

51661

b. Lseg-data

df_hist_ld=ld.get_history(

    universe=["CAD="],

    interval='daily',

    start='2025-03-18',

    end='2025-03-24'

)

df_hist_ld

CAD=

BID

ASK

BID_HIGH_1

BID_LOW_1

OPEN_BID

MID_PRICE

NUM_BIDS

ASK_LOW_1

ASK_HIGH_1

ASIAOP_BID

...

ASIACL_BID

EUROP_BID

EURHI_BID

EURLO_BID

EURCL_BID

AMEROP_BID

AMERHI_BID

AMERLO_BID

AMERCL_BID

OPEN_ASK

Date

2025-03-19

1.4324

1.4329

1.4349

1.4293

1.4298

1.43265

56450

1.4296

1.4352

1.4298

...

1.4326

1.4309

1.4337

1.4305

1.433

1.4328

1.4349

1.4306

1.4324

1.4303

Best Answer

  • nick.zincone
    nick.zincone admin
    Answer ✓

    Hi @valstar

    The new historical pricing service does not map to the exact same fields as the older APIs had limited fields and generally created a consolidated view independent of the type of asset. In the case of "CAD=", the field list will be more specific (and accurate) based on the actual type of asset (currency). So, for currencies, the actual accurate fields names will be different than that of an equity.

    So, to create an equivalent, try this:

    image.png

    You will see this matches the ek.get_timeseries() call result.

Answers

  • Hi @valstar ,

    I would advise using the fields argument of the get_history function. you can find more information about it here:

    https://developers.lseg.com/en/api-catalog/lseg-data-platform/lseg-data-library-for-python/tutorials#tutorial-4-get_history

  • valstar
    valstar Explorer

    Hello Jonathan and Nick,

    Thanks for the answers.

    Regarding Jonathan's response: I omitted the fields parameter in the get_history call because it fails when I include fields="CLOSE" and if I omit it I get the full list of available fields. Did that exactly to show that there were no obvious equivalents.

    As for Nick's answer: Yes, I realized that I could emulate the old result in this specific case by selecting some of the fields. My issue is more, for example, on how can I be sure that the old CLOSE will always match the BID for currencies? Is there some resource/docs that I can use for dealing with this issue of equivalence between old and new apis, for currencies and for other assets?

    Regards

  • Hi @valstar
    In this case I would advise looking into the Data Item Browser to find the field you're after:

    Data Item Browser | Devportal



    Trying it myself, I got:

    image.png
    df= ld.get_history(
    universe=["CAD="],
    fields=["TR.AMERICACLOSEBIDPRICE", "TR.ASIACLOSEBIDPRICE", "TR.EUROPECLOSEBIDPRICE"],
    start='2025-03-18',
    end='2025-03-24',
    interval='daily')
    image.png