You may refer to the compressed script in the PDF . We tried replicating but getting the same error as well.
Is there a problem with the codebook? It is taking a long time to load the data, and all the variable columns are completely filled with NAs.
import pandas as pd
import numpy as np
import refinitiv.data as rd # refinitiv
import time
from refinitiv.data.discovery import Screener # buscar screener de firmas
from pandas import read_csv # leitura de csv
from datetime import datetime
from IPython.display import display
abre sessao refinitiv
rd.open_session()
vars_t = [
'TR.TickerSymbol',
'TR.CompanyName',
'TR.ExchangeCountry',
'TR.Instrument',
'TR.TotalAssets.Date',
'TR.OperatingIncome',
'TR.TotalAssets',
'TR.F.NetIncBefMinIntr',
'TR.TotalEquity',
"TR.IncorporationDate",
"TR.CompanyInceptionDate",
'TR.CompanyMarketCap',
'TR.CurrentPortionLongTermDebt',
'TR.LongTermDebt',
'TR.SharesOutstanding',
'TR.PriceClose',
'TR.AccumulatedVolume',
'TR.Turnover',
'TR.IPODate',
'TR.IntangibleAssets',
'TR.NetIntangibleAssets',
'TR.Goodwill',
'TR.Trademarks',
'TR.ResearchAndDevelopment',
'TR.Revenue',
'TR.TRBCEconomicSector',
'TR.NetSalesRevenue',
'TR.F.IntangExclGoodwNetTot',
'TR.F.BrandsPatentsGross',
'TR.F.BrandsPatentsAccumAmort',
'TR.F.BrandsPatentsNet'
]
parametros contabeis
parametros anuais
parms={
'Period': 'FY0',
'Frq':'FY',
'EDate': '2003-01-01',
'SDate': '0FY',
#'Curn': 'Native' # para moeda local
'Curn': 'USD'
}
parametros trimestrais
'''parms_q={
'Period': 'FQ0',
'Frq':'FQ',
'EDate': '2000-01-01',
'SDate': '0FQ',
'Curn': 'USD'
}'''
define screener
rics = Screener('U(IN(Equity(active or inactive, public, primary))/UNV:Public/), '
'IN(TR.HQCountryCode,"BR","CO","MX","PE","CL"),'
'IN(TR.InstrumentType,"Ordinary Shares","Preference Shares","Unit"), ')
print(list(rics))
df = rd.get_data(
universe = rics,
fields = vars_t,
parameters = parms
)
display(df)
salva excel com dados coletados no diretório principal
df.to_excel('df_principal.xlsx', index=False)