diff --git a/ohlc/ohlc.py b/ohlc/ohlc.py index 2246c32..d1f90da 100644 --- a/ohlc/ohlc.py +++ b/ohlc/ohlc.py @@ -3,7 +3,13 @@ from datetime import datetime from iqfeed import get_daily_data, get_historical_data, minutes as to_minutes def ohlc(symbol: str, minutes: int = None, start_date: datetime = None, end_date: datetime = None): + start_date = start_date or datetime.today() + end_date = end_date or datetime.today() + + start_date = datetime.combine(start_date, datetime.min.time()) + end_date = datetime.combine(end_date, datetime.max.time()) + if minutes is None: - return get_daily_data(symbol, start_date, end_date or datetime.today()) + return get_daily_data(symbol, start_date, end_date) else: - return get_historical_data(symbol, interval = to_minutes(minutes), start_date = start_date, end_date = end_date or datetime.today()) \ No newline at end of file + return get_historical_data(symbol, interval = to_minutes(minutes), start_date = start_date, end_date = end_date) \ No newline at end of file