import yfinance as yf | |
from utils import check_object, convert_column_names | |
def get_stock(ticker, start, end): | |
try: | |
df = yf.download(ticker, start=start, end=end, progress=False) | |
df.columns = map(convert_column_names, df.columns) | |
df.index.names = ['date'] | |
check_object(df) | |
return df | |
except Exception as e: | |
print('An error occured while downloading data\n' + str(e)) | |
return None | |