Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 2 3 4

Downloading data in a bulk, some Calendar Years (CY) are not recognized in some years for some variables, hence eikon does not download the data

I am downloading data in a bulk for all public firms in 47 countries, I used the add-in first to download some data but when I realized that this method was inefficient, I moved to Phyton. I used exactly the same code to download the data in the add-in and in Phyton, but for some reason, when I downloaded through Phyton some data of some variables for some specific years would be completely missing. I know this because I compared the data downloaded through phyton with the data downloaded previously by using de add-in.

More notably, all the data of firms from China ('CN') in most of variables I tried to download were missing from 1999 to 2016 and for some reason, all the data from the same variables was completely downloaded from 2017 to 2020. All using the same CODE in one run! The same happened for Latin American countries ("'PE', 'CL', 'BR', 'CO', 'MX', 'AR', 'EC'") in 2013, but this happened ONLY for 2013, the data was completely downloaded for all variables in the rest of the years.

I actually run it again to see whether this was a random occurrence and it was not, it happened again every time I run the code! I tried also to download using only the year (e.g. 2013) instead of CY2013, and then, the data is downloaded completely but I am not sure whether the default is CY and not fiscal year. Moreover, the data for market capitalization changes completely when I used only the year (e.g. 2013) instead of CY2013.

I would really appreciate any guidance in this respect, considering that I am downloading now the annual data, but I am planning to download the quarterly data soon and there will be more scope for problems in the downloading process...

I highly appreciate any guidance and thank you in advance for the attention given to this question

I am using this code in phyton:

#=========

#Regions to be downloaded

#You can take out the regions that you do not need anymore here

region_list = [g7, adv_other, asia, lac, asia_CN, asia_IN] #each region has the ISO2 codes of the countries from which I am getting the data

#=========

#Variables to be downloaded

fields = ''

fields = fields + 'TR.HeadquartersCountry' + ' ' +'TR.TotalAssetsReported' + ' ' + 'TR.TotalDebtOutstanding' + ' ' + 'TR.TotalRevenue' + ' ' + 'TR.TotalLiabilities' + ' '

fields = fields + 'TR.CashandEquivalents' + ' ' + 'TR.CashandSTInvestments' + ' ' + 'TR.PptyPlantEqpmtTtlGross' + ' '

fields = fields + 'TR.PropertyPlantEquipmentTotalNet' + ' ' + 'TR.CapitalExpenditures' + ' '

fields = fields + 'TR.InterestExpense' + ' ' + 'TR.CostofRevenueTotal' + ' ' + 'TR.SgaExpenseTotal' + ' ' + 'TR.TotalEquity' + ' '

fields = fields + 'TR.CapitalExpendituresCFStmt' + ' ' + 'TR.TotalCurrentAssets' + ' ' + 'TR.TotalCurrentLiabilities' + ' '

fields = fields + 'TR.TotalLongTermDebt' + ' ' + 'TR.HistPE' + ' '

fields = fields + 'TR.EBITDA' + ' '

fields = fields + 'TR.EBIT' + ' ' + 'TR.ROATotalAssetsPercent' + ' ' + 'TR.TotalInventory' + ' '

fields = fields + 'TR.NetIncomeCFStmt' + ' ' + 'TR.LTDebt' + ' ' + 'TR.TangibleBookValueRptd' + ' ' + 'TR.HQCountryCode'


fields_series = fields.split()


#=========

# Time period of the data


#yearly data

periods = ''

for yr in range(1999, 2021, 1):

periods = periods + ' ' + 'CY'+ str(yr)


periods_yr = periods.split()


#=========

#Some values to store

currency = 'USD'

scale = 6

#=========

#Downloading the data

for region in region_list:


#saving the name of the region

region_name = [ k for k,v in locals().items() if v is region ][0]

print("Refinitiv is downloading data to " + region_name)

for j in periods_yr: #for j in range(len(periods)):

df1, err = ek.get_data(firms_ric_list[region_name],

'TR.CompanyMarketCap',

{'Scale': scale,

#'FRQ' : frequency,

'SDate': j,

'Curn' : currency,

'NULL':'BLANK',

'FXRate':'PeriodEnd'})

dfj, err = ek.get_data(firms_ric_list[region_name],

fields_series,

{'Scale': scale,

#'FRQ' : frequency,

'Curn' : currency,

'ConsolBasis':'Consolidated',

'ReportType':'Final',

'reportingstate':'Rsdt',

'NULL':'BLANK',

'FXRate':'PeriodEnd',

'Period': j})

df1 = pd.merge(df1, dfj, on='Instrument')

#including all other vars in the excel sheet

with pd.ExcelWriter(os.path.join(d_bs_yr_dir, 'bs_' + region_name + '.xlsx'), engine='openpyxl',mode='a') as writer:

df1.to_excel(writer, sheet_name= j, index=True)

#printing the batch name

print( j + " was downloaded")

eikoneikon-data-apirefinitiv-dataplatform-eikonworkspaceworkspace-data-apibulk-download
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hello @RHERESI

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?


If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,


AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,


AHS


1 Answer

· Write an Answer
Upvotes
Accepted
78.9k 250 52 74

@RHERESI

I have tested with the following code with 'CY2000'.

currency = 'USD'
scale = 6
j= 'CY2000'
rics = ['600781.SS',
 '000001.SZ',
 '000002.SZ',
 '000004.SZ',
 '000005.SZ',
 '000008.SZ',
 '000009.SZ',
 '000010.SZ',
 '000011.SZ',
 '000012.SZ',
 '000014.SZ',
 '000016.SZ',
 '000017.SZ',
 '000018.SZ',
 '000020.SZ',
 '000021.SZ',
 '000023.SZ',
 '000025.SZ']
df1, err = ek.get_data(rics,
                       'TR.CompanyMarketCap',
                       {
                           'Scale': scale,
                           'SDate': j,
                           'Curn' : currency,
                           'NULL':'BLANK',
                           'FXRate':'PeriodEnd'
                       }
                      )
dfj, err = ek.get_data(rics,
                       fields_series,
                       {
                           'Scale': scale,
                           'Curn' : currency,
                           'ConsolBasis':'Consolidated',
                           'ReportType':'Final',
                           'reportingstate':'Rsdt',
                           'NULL':'BLANK',
                           'FXRate':'PeriodEnd',
                           'Period': j
                       })

I can get the data properly.

1630635688493.png

1630635723576.png

To verify the content, you need to use Eikon Excel to retrieve the same data.


If both Eikon Excel and Eikon Data API are unable to retrieve the data, it could be a content issue. Therefore, you need to contact the content support team via MyRefinitiv to verify the data.

If the problem only occurs with Eikon Data API, please share RICs that you are using so we can verify the problem.



1630635688493.png (19.7 KiB)
1630635723576.png (35.0 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.