diff --git a/daily_data.py b/daily_data.py index 6db405c..1f36c6d 100644 --- a/daily_data.py +++ b/daily_data.py @@ -3,13 +3,18 @@ from pandas import concat, DataFrame from ohlc import ohlc -def get_daily_data(symbol: str, start_date: datetime = datetime.today() - timedelta(days = 365), - end_date: datetime = datetime.today()) -> DataFrame: +def get_daily_data(symbol: str, start_date: datetime = None, end_date: datetime = None) -> DataFrame: + + if start_date is None: + start_date = datetime.today() - timedelta(days = 365) + if end_date is None: + end_date = datetime.today() + daily_data = ohlc(symbol = symbol, start_date = start_date, end_date = end_date) """ The daily bar is not available for the current day until after market close. - It must be calculated using intraday (e.g., 5-minute) bars while the market is open. + It must be calculated using intraday bars while the market is open. """ today = datetime.today().date() if today not in daily_data['Date'].values: