Skip to content

Commit c7f2a51

Browse files
committed
Fix bad ts_init value for IB weekly and monthly bar
Credit to @Endura2024 (#2355).
1 parent de70df7 commit c7f2a51

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

RELEASES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Released on TBD (UTC).
8080
- Fixed sub command issue in some adapters (#2343), thanks @faysou
8181
- Fixed `bypass_logging` fixture to keep log guard alive for entire test session
8282
- Fixed time parsing for IB adapter (#2360), thanks @faysou
83+
- Fixed bad `ts_init` value in IB weekly and monthly bar (#2355), thanks @Endura2024
8384

8485
### Documentation Updates
8586
- Added backtest clock and timers example (#2327), thanks @stefansimik

nautilus_trader/adapters/interactive_brokers/client/market_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,8 @@ async def _convert_ib_bar_date_to_unix_nanos(self, bar: BarData, bar_type: BarTy
543543
int
544544
545545
"""
546-
if bar_type.spec.aggregation == 14:
547-
# Day bars are always returned with bar date in YYYYMMDD format
546+
if bar_type.spec.aggregation in [14, 15, 16]:
547+
# Day/Week/Month bars are always returned with bar date in YYYYMMDD format
548548
ts = pd.to_datetime(bar.date, format="%Y%m%d", utc=True)
549549
else:
550550
ts = pd.Timestamp.fromtimestamp(int(bar.date), tz=pytz.utc)

0 commit comments

Comments
 (0)