Data Request
Hi,
I'm trying to combine multiple requests for financial and company data, but I'm having trouble with the syntax.
(The EIKON support forwarded me here, I'm honestly not sure whether this is not a little to simple for this forum)
Basically I'm trying to derive the dividend information for the STOXX Europe 600 and the corresponding meta-information (name, iso-code, naicssector-code) and financial information which corresponds to the dividend information.
The Notebook file is uploaded separately (without EIKON app-key)
Any help is appreciated!
All the best,
Gabriel
dividends_data_without_appkey.txt
x = ek.get_data('.STOXX', ['TR.IndexConstituentRIC','TR.IndexConstituentName'])[0]
rics = x.iloc[:,1]
rics = rics.tolist()
# dividend data
df = ek.get_data(rics,
['TR.DivAnnouncementDate',
'TR.DivRecordDate',
'TR.DivUnadjustedGross',
'TR.DivType',
'TR.DivPaymentType',
'TR.DivCurr',
'TR.DivAnnouncementDate',
'TR.DivExDate',
'TR.DivPayDate',
'TR.DivEventStatus',
'TR.DivNotes',
'TR.DividendFrequency',
'TR.DivSourceOfFunds'],
{
"SDate":"2010-01-01","EDate":"2022-09-27",
})[0]
df.to_excel('stoxx_dividends_data.xlsx', sheet_name='sheet1', index=False)
df.head(10)
# meta-information
df = ek.get_data(
#'BAWG.VI',
rics,
['TR.CommonName',
'TR.CompanyIncorpRegion',
'TR.ISIN',
'TR.NAICSSector',
'TR.NAICSIndustryGroup',
'TR.NAICSIndustryGroupCode',
'TR.IssuerRating',
'TR.IssuerRating.Date'],
{
"SDate":"2010-01-01","EDate":"2022-09-27",
})[0]
df.to_excel('stoxx_meta_data.xlsx', sheet_name='sheet1', index=False)
df.head(10)
# financial data
df = ek.get_data(
'BAWG.VI',
#rics,
['TR.Revenue',
'TR.TotalOperatingExpense',
'TR.EBIT',
'TR.EBITDA',
'TR.NetIncomeBeforeTaxes',
'TR.NetIncomeAfterTaxes',
'TR.CashAndSTInvestments',
'TR.TotalAssetsReported',
'TR.TotalLiabilities',
'TR.NetDebt',
'TR.TotalEquity',
'TR.CompanyMarketCap',
'TR.Beta',
'TR.FreeCashFlow'],
{
"SDate":"2010-01-01","EDate":"2022-09-27",
})[0]
df.to_excel('stoxx_financial_data.xlsx', sheet_name='sheet1', index=False)
df.head(10)
# matched datasets (not working at the moment)
# dividend data
df = ek.get_data(rics,
['TR.DivAnnouncementDate',
'TR.DivRecordDate',
'TR.DivUnadjustedGross',
'TR.DivType',
'TR.DivPaymentType',
'TR.DivCurr',
'TR.DivAnnouncementDate',
'TR.DivExDate',
'TR.DivPayDate',
'TR.DivEventStatus',
'TR.DivNotes',
'TR.DividendFrequency',
'TR.DivSourceOfFunds',
'TR.CommonName',
'TR.CompanyIncorpRegion',
'TR.ISIN',
'TR.NAICSSector',
'TR.NAICSIndustryGroup',
'TR.NAICSIndustryGroupCode',
'TR.IssuerRating',
'TR.IssuerRating.Date',
'TR.Revenue',
'TR.TotalOperatingExpense',
'TR.EBIT',
'TR.EBITDA',
'TR.NetIncomeBeforeTaxes',
'TR.NetIncomeAfterTaxes',
'TR.CashAndSTInvestments',
'TR.TotalAssetsReported',
'TR.TotalLiabilities',
'TR.NetDebt',
'TR.TotalEquity',
'TR.CompanyMarketCap',
'TR.Beta',
'TR.FreeCashFlow'],
{
"SDate":"2010-01-01","EDate":"2022-09-27",
})[0]
df.to_excel('stoxx_dividends_data.xlsx', sheet_name='sheet1', index=False)
df.head(10)
Best Answer
-
Hi @gabriel.matejka ,
I changed some fields and forward filled some cells in the code below; was this closer to what you were looking for?
# dividend data
df1 = ek.get_data(
instruments = rics,
fields = ['TR.DivAnnouncementDate',
'TR.DivRecordDate',
'TR.DivUnadjustedGross',
'TR.DivType',
'TR.DivPaymentType',
'TR.DivCurr',
'TR.DivAnnouncementDate',
'TR.DivExDate',
'TR.DivPayDate',
'TR.DivEventStatus',
'TR.DivNotes',
'TR.DividendFrequency',
'TR.DivSourceOfFunds'],
parameters = {
"SDate":"2010-01-01","EDate":"2022-09-27"
})[0]
# df1.to_excel('stoxx_dividends_data.xlsx', sheet_name='sheet1', index=False)
print('df1:')
display(df1)
# meta-information
df2 = ek.get_data(
rics, # 'BAWG.VI'
['TR.CommonName',
'TR.IssuerRating.Date',
'TR.IssuerRating',
'TR.CompanyIncorpRegion',
'TR.ISIN',
'TR.NAICSSector',
'TR.NAICSIndustryGroup',
'TR.NAICSIndustryGroupCode'],
{
"SDate":"2010-01-01","EDate":"2022-09-27"
})[0]
# Some data here needs to be forward filled; see here for more info on that: https://stackoverflow.com/questions/27012151/forward-fill-specific-columns-in-pandas-dataframe
# replace field that's entirely space (or empty) with NaN (https://stackoverflow.com/questions/13445241/replacing-blank-values-white-space-with-nan-in-pandas)
import numpy as np
df2 = df2.replace('', np.nan, regex=True)
nanFilledColumns = ['Company Common Name', 'Incorp. Region Code', 'NAICS Sector Name']
df2[nanFilledColumns] = df2[nanFilledColumns].ffill()
# df2.to_excel('stoxx_meta_data.xlsx', sheet_name='sheet1', index=False)
print('df2:')
display(df2)
# financial data
df3 = ek.get_data(
'BAWG.VI',
['TR.F.TotRevenue.date',
'TR.F.TotRevenue',
'TR.F.TotRevenue',
'TR.TR.F.OpExpnTot',
'TR.EBIT',
'TR.EBITDA',
'TR.NetIncomeBeforeTaxes',
'TR.NetIncomeAfterTaxes',
'TR.F.CashSTInvstTot',
'TR.TotalAssetsReported',
'TR.TotalLiabilities',
'TR.F.NetDebtInclPrefEqMinIntrtoTotCap',
'TR.TotalEquity',
'TR.F.MktCap',
'TR.Beta',
'TR.FreeCashFlow'],
{
"SDate":"2010-01-01","EDate":"2022-09-27"
})[0]
# df3.to_excel('stoxx_financial_data.xlsx', sheet_name='sheet1', index=False)
df3.head(10)3
Answers
-
Hello @gabriel.matejka
What is the error or issue that you are encountering? I have tested your last request and it gets the following timeout error, is it the same issue?
According to your query, you request a lot of RICs and fields data for a wide range of time. I suggest you try to reduce the number of RICs and fields in the get_data function.
0 -
Hi @wasin.w,
yes, that was one of the issues. But I believe I could work around that by partitioning the requests.However, even when using only a single RIC the problem with the different data-types persists (this is actually more of an issue, because I would like to have all the data for the different dates etc. together without having to check this manually).
Here is a screenshot of how it looks when I do the request:
thank you for your help.All the best,
Gabriel
df = ek.get_data(
'BAWG.VI',
#rics,
['TR.DivAnnouncementDate',
'TR.DivRecordDate',
'TR.DivUnadjustedGross',
'TR.DivType',
'TR.DivPaymentType',
'TR.DivCurr',
'TR.DivAnnouncementDate',
'TR.DivExDate',
'TR.DivPayDate',
'TR.DivEventStatus',
'TR.DivNotes',
'TR.DividendFrequency',
'TR.DivSourceOfFunds',
'TR.CommonName',
'TR.CompanyIncorpRegion',
'TR.ISIN',
'TR.NAICSSector',
'TR.NAICSIndustryGroup',
'TR.NAICSIndustryGroupCode',
'TR.IssuerRating',
'TR.IssuerRating.Date',
'TR.Revenue',
'TR.TotalOperatingExpense',
'TR.EBIT',
'TR.EBITDA',
'TR.NetIncomeBeforeTaxes',
'TR.NetIncomeAfterTaxes',
'TR.CashAndSTInvestments',
'TR.TotalAssetsReported',
'TR.TotalLiabilities',
'TR.NetDebt',
'TR.TotalEquity',
'TR.CompanyMarketCap',
'TR.Beta',
'TR.FreeCashFlow'],
{
"SDate":"2010-01-01","EDate":"2022-09-27",
})[0]
df.to_excel('data_bawag.xlsx', sheet_name='sheet1', index=False)
df.head(10)
0 -
Hi @gabriel.matejka,
It does not look like the field 'revenue' exist for the RICs you're after, e.g.:
To find fields that exist for any one instrument, please use the Data Item Browser as per this video.
1 -
Yes, thank you for the support!!
All the best,Gabriel
0
Categories
- All Categories
- 6 AHS
- 39 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛