Need API code to extract 'total sales', current and 12m forward, Net Margin, profits forward 12m, of

Options
yl75
yl75 Newcomer

Hello,

Need API code to extract 'total sales', current and 12m forward, Net Margin, profits forward 12m, of SP500 and STOXX600, and Total Labor cost, ideally for the two equity indexes, if not at country level?". I started the way below but does not work. May be you can correct it pls, takes probably a few seconds for you

More generally, I would also need a list (?) where to find all codes coresponding to the variables I find on the workspace. Most importantly, There are the RIC, the fields.

Thanks

Yann

from lseg.data.content import symbol_conversion
import lseg.data as ld
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from pymongo import MongoClient

Ouvrir une session

ld.open_session()

Récupérer données daily de marché

df_daily = ld.get_history(
universe=['.SPX', '.STOXX'],
fields=['TRDPRC_1', 'TR.RevenueMean', 'TR.NetProfitMean'],
interval="daily",
start="2025-01-01",
end="2025-08-01",
)

print(df_daily)
ld.close_session(df_daily)

Tagged:

Answers

  • Hi @yl75 ,

    You can use Data Item Browser | Devportal inside the Workspace application to search for RICs and fields that can be used with get_data() function with the fields' description.

    Regarding the script to retrieve the data that you mention, the moderators on this forum do not have deep expertise in every type of content available through LSEG products. Such expertise is available through the Helpdesk. If the Helpdesk can show you how to retrieve it using a formula in Workspace Excel, then the moderators on this forum can help you translate it into get_data method of the Data Library. The Helpdesk can be reached via LSEG Support and you may request from them the Workspace Excel formula to retrieve the data you would like to get.

  • yl75
    yl75 Newcomer

    Txs Raksina