diff --git a/iqfeed/iqfeed.py b/iqfeed/iqfeed.py index 1caff0a..e39fe93 100644 --- a/iqfeed/iqfeed.py +++ b/iqfeed/iqfeed.py @@ -95,11 +95,9 @@ def get_historical_data(symbol: str, interval: int, date: datetime = None, data = StringIO(data) data = pd.read_csv(data, index_col = False, names=['Date', 'High', 'Low', 'Open', 'Close', 'Total Volume', 'Period Volume']) - if data.empty: - return data - - data['Date'] = pd.to_datetime(data['Date']) - data['Date'] = data['Date'].dt.date + if not data.empty: + data['Date'] = pd.to_datetime(data['Date']) + data['Date'] = data['Date'].dt.date return data if __name__ == '__main__':