End Goal: create a boolean array displaying True for times over 15:55:00
I am using an Alpaca API to obtain stock data.
vbt.settings.data['tz_localize'] = 'EST'
vbt.settings.data['tz_convert'] = 'EST'
data = vbt.AlpacaData.download('SPY', start='2022-11-1', end='2022-11-2', timeframe='5m', limit=1000)
close = data.get('Close')
close = close.between_time('08:30', '16:00')
From close
, I would like to obtain only the timestamp. this is where I'm stuck.
print(close)
returns:
timestamp
2022-11-01 08:30:00-05:00 389.860
2022-11-01 08:35:00-05:00 389.890
2022-11-01 08:40:00-05:00 389.730
2022-11-01 08:45:00-05:00 388.430
2022-11-01 08:50:00-05:00 387.990
...
2022-11-01 15:40:00-05:00 384.320
2022-11-01 15:45:00-05:00 384.170
2022-11-01 15:50:00-05:00 384.151
2022-11-01 15:55:00-05:00 384.230
2022-11-01 16:00:00-05:00 384.240
Name: Close, Length: 91, dtype: float64
I have tried to use "timestamp" in various ways to extract the timestamp from this array, however nothing I have tried is working.
After obtaining the timestamp in an array I intend to create a boolean function such as np.where(currenttime > 15:55, 1, 0)
Thoughts?