Last active
May 14, 2021 14:07
-
-
Save rodrigobercini/8bbee7fc735ad7d696f7a2ec31df9610 to your computer and use it in GitHub Desktop.
Como extrair dados do Bovespa de graça com Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Instalando e importando yahooquery | |
from yahooquery import Ticker | |
# Período máximo | |
petr = Ticker("PETR4.SA") | |
petr.history(period='max') | |
# Datas específicas | |
petr.history(start='2005-05-01', end='2013-12-31') | |
# Intraday - 30 minutos | |
abev = Ticker('ABEV3.SA') | |
abev.history(period='60d', interval = "30m") | |
# Intraday - 1 minuto | |
abev = abev.history(period='7d', interval = "1m") | |
abev | |
# Informações financeiras | |
petr = Ticker("PETR4.SA") # Coleta dados | |
petr = petr.income_statement()# Chama função de Demonstração de resultados | |
petr = petr.transpose() # Transpõe a matriz | |
petr.columns = petr.iloc[0,:] # Renomeia colunas | |
petr = petr.iloc[2:,:-1] # Seleciona dados | |
petr = petr.iloc[:, ::-1] # Inverte colunas | |
petr |
Show . muito bom !!
Valeu pelo feedback, Vander! No artigo abaixo explico melhor o código.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Show . muito bom !!