ib_async
ib_async copied to clipboard
useRTH=False doesn't show post-market trades
Hey guys,
I'm trying to grab data outside of RTH for SPY, so I'd expect pre-market and post-market data, but I can only see pre-market data. Is there a way to include post-market data which should go from 4-8PM EST?
If there's a forum that lets people post questions like these, please share it here and I'll follow up there!
symbol = "SPY"
contract = Stock(symbol, "SMART", "USD")
bars = ib.reqHistoricalData(
contract,
endDateTime='',
durationStr="1 D",
barSizeSetting="1 min",
whatToShow="TRADES",
useRTH=False,
formatDate=1,
)
open high low close volume average \
date
2024-05-28 04:00:00-04:00 236.88 236.99 234.39 234.39 1651.0 235.718
2024-05-28 04:01:00-04:00 234.50 234.80 234.31 234.31 1218.0 234.483
2024-05-28 04:02:00-04:00 234.12 234.60 233.65 233.65 1630.0 234.104
2024-05-28 04:03:00-04:00 234.00 234.40 233.65 233.65 836.0 234.047
2024-05-28 04:04:00-04:00 233.65 233.65 233.65 233.65 0.0 233.650
... ... ... ... ... ... ...
2024-05-28 15:55:00-04:00 245.51 245.53 244.38 244.56 62659.0 244.784
2024-05-28 15:56:00-04:00 244.64 244.93 244.58 244.91 36765.0 244.793
2024-05-28 15:57:00-04:00 244.93 245.07 244.74 244.87 51299.0 244.895
2024-05-28 15:58:00-04:00 244.89 244.91 244.26 244.26 67822.0 244.530
2024-05-28 15:59:00-04:00 244.26 245.15 244.24 245.10 92951.0 244.723
barCount
date
2024-05-28 04:00:00-04:00 11
2024-05-28 04:01:00-04:00 8
2024-05-28 04:02:00-04:00 9
2024-05-28 04:03:00-04:00 8
2024-05-28 04:04:00-04:00 0
... ...
2024-05-28 15:55:00-04:00 416
2024-05-28 15:56:00-04:00 292
2024-05-28 15:57:00-04:00 326
2024-05-28 15:58:00-04:00 374
2024-05-28 15:59:00-04:00 617
[720 rows x 7 columns]