Why IBKR Weekly and Monthly Bars Can Be Dated One Day Late
Summary
The document reports a historical data issue in Interactive Brokers requests: weekly and monthly bars for an IBIS-listed stock are labeled one day later than expected, while daily bars for the same contract and bars for NYSE appear correctly dated. The author compares returned dates and notes that changing the date format and TWS timezone settings did not resolve the discrepancy. The data is retrieved through the IB API and converted to a dataframe, with the author ruling out that conversion as the source of the shift.
The post raises, but does not answer, two questions: whether the offset is related to exchange timezones, and why intraday timestamps refer to a bar's opening time while weekly and monthly dates generally refer to the interval's end. It offers no verified cause or fix, so it is useful as a data-quality diagnostic example rather than a settled method. Users should validate bar boundaries and exchange-specific date conventions before relying on aggregated historical data.
Key ideas
- Weekly and monthly bars for the cited IBIS contract appear dated one day later than expected.
- The reported daily bars and NYSE results do not show the same discrepancy.
- Changing date formatting and TWS timezone settings did not fix the reported shift.
- The post leaves the timezone cause and interval timestamp convention unresolved.
Tags
Full text
# Interactive Brokers API - Wrong date for historical data for weekly and monthly bars
# Interactive Brokers API - Wrong date for historical data for weekly and monthly bars
I'm currently trying to fetch historical data from Interactive Brokers using the `ib_async` package. Depending on the exchange I use, the weekly and monthly bars will have a wrong date.
This is the relevant code
```
bars = self.ib.reqHistoricalData(
contract,
endDateTime='',
durationStr=duration_str,
barSizeSetting=bar_size_str,
whatToShow=what_to_show,
useRTH=useRTH,
formatDate=2,
keepUpToDate=False
)
df = util.df(bars)
```
I have compared daily to weekly and monthly bars. The daily bars have the correct date, but the weekly and monthly bars are always off by one day. I have compared `IBIS` and `NYSE` as exchange, and it only happens for IBIS. NYSE has the correct dates.
```
contract = Stock('SIE', 'IBIS', 'EUR')
```
Daily result
```
date open high low close volume average barCount
0 2025-11-19 217.30 220.56 216.04 218.6 592127.0 218.520 4972
1 2025-11-20 220.84 224.14 219.50 221.7 689447.0 221.824 5718
2 2025-11-21 217.46 220.26 216.64 219.1 685580.0 218.328 6150
```
Weekly result
```
date open high low close volume average barCount
45 2025-11-08 244.56 247.50 233.50 237.06 2576031.0 241.758 23801
46 2025-11-15 243.20 252.66 225.24 230.26 4323219.0 237.940 38550
47 2025-11-22 229.84 230.16 216.04 219.10 3577868.0 220.662 29671
```
The last bar should have the same date, since it's the end of the week. Instead, the weekly bars (and also monthly bars) end one day later on Saturday.
Since this doesn't happen on NYSE, I suppose it has something to do with the timezone. Setting `formatDate` to 1 doesn't solve the issue. I have also tried changing the timezone settings in TWS, which didn't solve the issue either.
I have also checked if it's an issue with the package or if it has to do with converting the bars into a dataframe, which is not the case.
The dirty solution would be to manually change the date for weekly and monthly bars, but I'd like to avoid that. Does anyone have an idea, how to solve this?
Also, unrelated to the question above: When requesting smaller timeframe data, e.g. 5 minute bars, the provided time is the open of the bar. For weekly and monthly bars, the provided day (except in the case of IBIS above) is the last day of the interval. Am I doing something wrong or am I not seeing something? What is the reasoning behind this?Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.