From cf9263aef6572a0f57368244e35d71086ab14ba3 Mon Sep 17 00:00:00 2001 From: rsmb7z <105105941+rsmb7z@users.noreply.github.com> Date: Wed, 24 Apr 2024 17:53:47 +0300 Subject: [PATCH] Remove outdated symbology handling for CBOT instruments --- .../interactive_brokers/parsing/instruments.py | 18 +++++------------- .../interactive_brokers/test_parsing.py | 4 ++-- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/nautilus_trader/adapters/interactive_brokers/parsing/instruments.py b/nautilus_trader/adapters/interactive_brokers/parsing/instruments.py index b982baaf8911..5f7e3e57d86d 100644 --- a/nautilus_trader/adapters/interactive_brokers/parsing/instruments.py +++ b/nautilus_trader/adapters/interactive_brokers/parsing/instruments.py @@ -578,19 +578,11 @@ def instrument_id_to_ib_contract_simplified_symbology( # noqa: C901 (too comple ) elif instrument_id.venue.value in VENUES_FUT: if m := RE_FUT.match(instrument_id.symbol.value): - if instrument_id.venue.value == "CBOT": - # IB still using old symbology after merger of CBOT with CME - return IBContract( - secType="FUT", - exchange=instrument_id.venue.value, - localSymbol=f"{m['symbol'].ljust(4)} {FUTURES_CODE_TO_MONTH[m['month']]} {m['year']}", - ) - else: - return IBContract( - secType="FUT", - exchange=instrument_id.venue.value, - localSymbol=f"{m['symbol']}{m['month']}{m['year'][-1]}", - ) + return IBContract( + secType="FUT", + exchange=instrument_id.venue.value, + localSymbol=f"{m['symbol']}{m['month']}{m['year'][-1]}", + ) elif m := RE_IND.match(instrument_id.symbol.value): return IBContract( secType="CONTFUT", diff --git a/tests/integration_tests/adapters/interactive_brokers/test_parsing.py b/tests/integration_tests/adapters/interactive_brokers/test_parsing.py index 49f2d160f256..f2b309e8c4e1 100644 --- a/tests/integration_tests/adapters/interactive_brokers/test_parsing.py +++ b/tests/integration_tests/adapters/interactive_brokers/test_parsing.py @@ -56,7 +56,7 @@ (IBContract(secType="CONTFUT", exchange="SNFE", symbol="SPI"), "SPI.SNFE"), (IBContract(secType="FUT", exchange="CME", localSymbol="ESH3"), "ESH23.CME"), (IBContract(secType="FUT", exchange="CME", localSymbol="M6EH3"), "M6EH23.CME"), - (IBContract(secType="FUT", exchange="CBOT", localSymbol="MYM JUN 23"), "MYMM23.CBOT"), + (IBContract(secType="FUT", exchange="CBOT", localSymbol="MYMM3"), "MYMM23.CBOT"), (IBContract(secType="FUT", exchange="NYMEX", localSymbol="MCLV3"), "MCLV23.NYMEX"), (IBContract(secType="FUT", exchange="SNFE", localSymbol="APH3"), "APH23.SNFE"), (IBContract(secType="FOP", exchange="NYBOT", localSymbol="EX2G3 P4080"), "EX2G23P4080.NYBOT"), @@ -75,7 +75,7 @@ (IBContract(secType="OPT", exchange="SMART", localSymbol="AAPL 230217P00155000"), "AAPL 230217P00155000=OPT.SMART"), (IBContract(secType="FUT", exchange="CME", localSymbol="ESH3"), "ESH3=FUT.CME"), (IBContract(secType="FUT", exchange="CME", localSymbol="M6EH3"), "M6EH3=FUT.CME"), - (IBContract(secType="FUT", exchange="CBOT", localSymbol="MYM JUN 23"), "MYM JUN 23=FUT.CBOT"), + (IBContract(secType="FUT", exchange="CBOT", localSymbol="MYMM3"), "MYMM3=FUT.CBOT"), (IBContract(secType="FUT", exchange="NYMEX", localSymbol="MCLV3"), "MCLV3=FUT.NYMEX"), (IBContract(secType="FUT", exchange="SNFE", localSymbol="APH3"), "APH3=FUT.SNFE"), (IBContract(secType="FOP", exchange="NYBOT", localSymbol="EX2G3 P4080"), "EX2G3 P4080=FOP.NYBOT"),