Increase max days when looking up daily data by 1 to account for the scenario where daily data is available for the current date

This commit is contained in:
moshferatu 2024-11-22 11:42:26 -08:00
parent 4e36de7bf0
commit 67754b0f93

View File

@ -42,11 +42,10 @@ def _get_daily_data(symbol: str, max_days: int) -> pd.DataFrame:
data = data.replace(',\n','\n')[:-1] data = data.replace(',\n','\n')[:-1]
data = StringIO(data) data = StringIO(data)
return pd.read_csv(data, index_col = False, return pd.read_csv(data, index_col = False, names = iqfeed_columns)
names=['Date', 'High', 'Low', 'Open', 'Close', 'Total Volume', 'Period Volume'])
def get_daily_data(symbol: str, start_date: datetime, end_date: datetime) -> pd.DataFrame: def get_daily_data(symbol: str, start_date: datetime, end_date: datetime) -> pd.DataFrame:
max_days = (datetime.today() - start_date).days max_days = (datetime.today() - start_date).days + 1
data = _get_daily_data(symbol, max_days) data = _get_daily_data(symbol, max_days)
# Filter data between start_date and end_date # Filter data between start_date and end_date