Im having trouble the get aligned data with dates for some instruments

Options

Im having trouble with the API. As you can see below, the resultant dataframe comes with null values on the last dates, and values on the first dates. The problem is that the "MATD3.SA" didnt exist before 2021.
On excel, with same parameters, the dataframe comes alright, with null values up to 2014. So why is this happening on here?

dic_parametros_fundamentals_Q = {
'SDate': -140,
'Period': 'FQ0',
'EDate': 0,
'Frq': 'M' } df_chunk = fundamental_and_reference.Definition(
universe='MATD3.SA',
fields=['TR.CompanyMarketCap.calcdate', 'TR.F.TotRevenue.fperiod',
'TR.F.TotRevenue.fperiod'],
parameters=dic_parametros_fundamentals_Q ).get_data().data.df
print(display(df_chunk)) display(df_chunk ):

image.png

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @augusto_krappa

    1. I will contact the product team to verify this issue
    2. You can use the LSEG Data Library for Python to connect to the desktop.workspace session. The code will be like this:
    ld.open_session(app_key="<APP KEY>")
    

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @augusto_krappa

    Thank you for reaching out to us.

    Are you using to the Data Platform session?

    I got the same output when using the platform session.

    image.png

    However, the output is correct when using the desktop.workspace session.

    image.png

    You may need to check the version of library that you are using. I am using LSEG Data Library for Python (2.1.1).

  • im using:

    import lseg.data as ld
    from lseg.data.content import pricing
    from lseg.data.content import fundamental_and_reference

    def ld_connect(APP_KEY = os.environ['REFINITIV_EDP_API'], USER = os.environ['REFINITIV_USER'], PASS = os.environ['REFINITIV_PASSWORD']):
    session = ld.session.platform.Definition(
    app_key = APP_KEY,
    grant = ld.session.platform.GrantPassword(
    username = USER,
    password = PASS
    ),
    signon_control = True
    ).get_session()
    session.open()
    ld.session.set_default(session)
    print("LSEG connected")
    return session


  • Could you help my to adjust my

    def ld_connect
    

    with a bool value to choose to connect through 'platform session' or 'desktop.workspace session'? The platform session would be the right solution for me, but the content is wrong… so i cannot use it

    Thanks

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @augusto_krappa

    To use the desktop.workspace session, you need to have a desktop account and the Workspace desktop application must be running on the same machine.

    When using the desktop.workspace session, the library retrieves data through the Workspace desktop application.

    You need to contact your LSEG account team or sales team for a desktop account.

  • Yes I know that. But we have 2 problems here:
    1) the new API returns WRONG values and we are leaving it just like that?!
    2) the documentation is hard for me to follow, so, do you have any example of code to set up a connection, please?

    Thank you

  • wasin.w
    wasin.w admin

    Hello @augusto_krappa

    You can also create a file name lseg-data.config.json with the following content

    {
    "logs": {
    "level": "debug",
    "transports": {
    "console": {
    "enabled": false
    },
    "file": {
    "enabled": false,
    "name": "lseg-data-lib.log"
    }
    }
    },
    "sessions": {
    "default": "desktop.workspace",
    "desktop": {
    "workspace": {
    "app-key": "YOUR APP-KEY"
    }
    }
    }
    }

    Then place a file in the same location as your python application. You can use the following code to open a session.

    ld.open_session()
    

    There are set of tutorials that might help you available on https://developers.lseg.com/en/api-catalog/lseg-data-platform/lseg-data-library-for-python/tutorials page.

  • thank you