investpy
investpy copied to clipboard
Brazilian Symbols Not Being Found
The following symbols of brazilian companies are not being found when get_stock_historical_data() is being called:
RECV3 - https://www.investing.com/equities/petroreconcavo CBAV3 - https://www.investing.com/equities/companhia-brasileira-de-aluminio RZAG11 - https://www.investing.com/equities/fi-nas-cadeias-prod-agroind-riza DEVA11 - https://www.investing.com/equities/devant-recebiveis-imobiliarios-fii XPCI11 - https://www.investing.com/equities/xp-credito-imobiliario-real-estate RECR11 - https://www.investing.com/equities/fi-imobiliario-ubs
Also the ETF IVVB11 is not being found when I'm using get_etf_historical_data() function ( https://www.investing.com/etfs/fundo-de-invest-ishares-sp-500 ).
lista = inv.etfs.get_etfs(country=pais) nome_da_etf = lista.full_name[lista["symbol"]=="IVVB11"] print(nome_da_etf)
teste=inv.get_etf_historical_data(etf=nome_da_etf.to_string(index=False), country=pais, from_date=data_inicial, to_date=data_e_hora_em_texto).dropna()['Close'] print(teste)
5 Fundo de Investimento Ishares S&P 500 Name: full_name, dtype: object
RuntimeError Traceback (most recent call last)
in () 3 print(nome_da_etf) 4 ----> 5 teste=inv.get_etf_historical_data(etf=nome_da_etf.to_string(index=False), country=pais, from_date=data_inicial, to_date=data_e_hora_em_texto).dropna()['Close'] 6 print(teste) /usr/local/lib/python3.7/dist-packages/investpy/etfs.py in get_etf_historical_data(etf, country, from_date, to_date, stock_exchange, as_json, order, interval) 729 if etf not in list(etfs["name"].apply(unidecode).str.lower()): 730 raise RuntimeError( --> 731 "ERR#0019: etf " + etf + " not found, check if it is correct." 732 ) 733
RuntimeError: ERR#0019: etf fundo de investimento ishares s&p 500 not found, check if it is correct.
You can use the SearchObj
to get such symbols. Like so, using package tessa (https://github.com/ymyke/tessa):
import tessa
df, currency = tessa.price_history(query="{'id_': 1172772, 'name': 'Petroreconcavo SA', 'symbol': 'RECV3', 'country': 'brazil', 'tag': '/equities/petroreconcavo', 'pair_type': 'stocks', 'exchange': 'BM&FBovespa'}", type_="searchobj")
You can find the SearchObj
like so:
import tessa
res = tessa.search("RECV3", "brazil", "stock")
# Then inspect the different results in res and pick the one that fits