Last active
August 25, 2022 01:35
-
-
Save Fabiocke/dd3f9054c3e47c715198a54b9366f5a2 to your computer and use it in GitHub Desktop.
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
| import yfinance as yf | |
| from datetime import datetime, timedelta | |
| def cotacoes(ticker, dias): | |
| # formata o nome do ticker | |
| start = (datetime.today()-timedelta(dias)).strftime('%Y-%m-%d') | |
| ticker=ticker+'.SA' if ticker[-3:] != '.SA' else ticker | |
| # busca o ticker no yahoo finance | |
| df = yf.download(ticker, start) | |
| return df |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment