diff --git a/iqfeed/iqfeed.py b/iqfeed/iqfeed.py index 8b4ba96..1cf1726 100644 --- a/iqfeed/iqfeed.py +++ b/iqfeed/iqfeed.py @@ -69,12 +69,12 @@ def get_historical_data(symbol: str, interval: int, end_filter_time: datetime = datetime.strptime('160000', '%H%M%S').time()) -> pd.DataFrame: message = 'HIT,{symbol},{interval},{begin},{end},,{begin_filter},{end_filter},1\n'.format( - symbol=symbol, - interval=interval, - begin=start_date.strftime('%Y%m%d %H%M%S'), - end=end_date.strftime('%Y%m%d %H%M%S') if end_date else '', - begin_filter=start_filter_time.strftime('%H%M%S') if start_filter_time else '', - end_filter=end_filter_time.strftime('%H%M%S') if end_filter_time else '' + symbol = symbol, + interval = interval, + begin = start_date.strftime('%Y%m%d %H%M%S'), + end = end_date.strftime('%Y%m%d %H%M%S') if end_date else '', + begin_filter = start_filter_time.strftime('%H%M%S') if start_filter_time else '', + end_filter = end_filter_time.strftime('%H%M%S') if end_filter_time else '' ) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) @@ -89,7 +89,7 @@ def get_historical_data(symbol: str, interval: int, data = data.replace(',\n','\n')[:-1] data = StringIO(data) - return pd.read_csv(data, index_col=False, + return pd.read_csv(data, index_col = False, names=['Date', 'High', 'Low', 'Open', 'Close', 'Total Volume', 'Period Volume']) if __name__ == '__main__':