Convert date column to date object when returning historical intraday data
This commit is contained in:
parent
0f696e4a77
commit
ace4fe91ea
@ -93,8 +93,11 @@ def get_historical_data(symbol: str, interval: int, date: datetime = None,
|
||||
data = data.replace(',\n','\n')[:-1]
|
||||
|
||||
data = StringIO(data)
|
||||
return pd.read_csv(data, index_col = False,
|
||||
data = pd.read_csv(data, index_col = False,
|
||||
names=['Date', 'High', 'Low', 'Open', 'Close', 'Total Volume', 'Period Volume'])
|
||||
data['Date'] = pd.to_datetime(data['Date'])
|
||||
data['Date'] = data['Date'].dt.date
|
||||
return data
|
||||
|
||||
if __name__ == '__main__':
|
||||
symbols = ['SPY']
|
||||
|
Loading…
Reference in New Issue
Block a user