LSEG Data Library for Python

get_data

This method sends a request to the Delivery Platform (formerly Refinitiv Data Platform) to retrieve the data described in the fundamental_and_reference.Definition object.

Module

lseg.data.content.fundamental_and_reference

Syntax

get_data(session)

Parameters

Value Description Data type Optional Default value
session Session object. If session parameters are not defined, the default session will be used. Session object Yes None

Return value

Response

Usage

The following example demonstrates how to retrieve the revenue and gross profit for IBM.N and TRI.N:

response = fundamental_and_reference.Definition(
    universe=["TRI.N", "IBM.N"],
    fields=["TR.Revenue", "TR.GrossProfit"]
).get_data()

print(response.data.df)
Response
Instrument Revenue Gross Profit
0 TRI.N 6348000000 6022000000
1 IBM.N 57350000000 31485000000

The following example demonstrates how to retrieve the revenue and gross profit for all constituents of the chain:

response = fundamental_and_reference.Definition(
    universe=["0#.DJI"],
    fields=["TR.Revenue", "TR.GrossProfit"]
).get_data()

print(response.data.df)
Response
Instrument Revenue Gross Profit
0 GS.N 64989000000.0 54629000000.0
1 NKE.N 44538000000.0 19997000000.0
2 CSCO.OQ 49818000000.0 31894000000.0
3 JPM.N N/A N/A
4 DIS.N 67418000000.0 22287000000.0
5 INTC.OQ 79024000000.0 43815000000.0
6 DOW.N 54968000000.0 10777000000.0
7 MRK.N 48704000000.0 35463000000.0
8 CVX.N 155606000000.0 66234000000.0
9 AXP.N 42838000000.0 29380000000.0
10 VZ.N 133613000000.0 77312000000.0
11 HD.N 151157000000.0 50832000000.0
12 WBA.OQ 132509000000.0 28067000000.0
13 MCD.N 23222900000.0 12580200000.0
14 UNH.N N/A N/A
15 KO.N 38655000000.0 23298000000.0
16 JNJ.N 93775000000.0 63920000000.0
17 MSFT.OQ 168088000000.0 115856000000.0
18 HON.OQ 34392000000.0 10998000000.0
19 CRM.N 26492000000.0 19466000000.0
20 PG.N 76118000000.0 39144000000.0
21 IBM.N 57350000000.0 31485000000.0
22 MMM.N 35355000000.0 16579000000.0
23 AAPL.OQ 365817000000.0 152836000000.0
24 WMT.N 572754000000.0 143754000000.0
25 CAT.N 50971000000.0 15517000000.0
26 AMGN.OQ 25979000000.0 19525000000.0
27 V.N 24105000000.0 19135000000.0
28 TRV.N N/A N/A
29 BA.N 62286000000.0 3017000000.0

The following example demonstrates how to retrieve the revenue and gross profit for GOOG.O and APPL.O with applied global parameters:

response = fundamental_and_reference.Definition(
    universe=["GOOG.O", "AAPL.O"],
    fields=["TR.Revenue", "TR.GrossProfit"],
    parameters={"SDate": "0CY", "Curn": "CAD"}
).get_data()

print(response.data.df)
Response
Instrument Revenue Gross Profit
0 GOOG.O 232356871000 124493035000
1 AAPL.O 462831668400 193368107200

The following example demonstrates how to retrieve the revenue and gross profit for TRI.N and IBM.N with full names in the headers:

response = fundamental_and_reference.Definition(
    universe=["TRI.N", "IBM.N"],
    fields=["TR.Revenue", "TR.GrossProfit"],
    use_field_names_in_headers=True
).get_data()

print(response.data.df)
Response
Instrument TR.REVENUE TR.GROSSPROFIT
0 TRI.N 6348000000 6022000000
1 IBM.N 57350000000 31485000000

The following example demonstrates how to retrieve the revenue and gross profit for TRI.N and IBM.N using date as the row header:

response = fundamental_and_reference.Definition(
    universe=["TRI.N", "IBM.N"],
    fields=["TR.Revenue", "TR.GrossProfit"],
    row_headers="date"
).get_data()

print(response.data.df)
Response
TRI.N IBM.N
Revenue Gross Profit Revenue Gross Profit
Date
2021-12-31
6348000000 6022000000 57350000000 31485000000

None

322 words (1:42 mins)