Running into something odd with futures calendar spreads and hoping someone's seen it.
I subscribe to a bunch of calendar spreads as BAG combos (-1 front + 1 back, exchange="SMART", native exchange on the legs). Works fine right after a gateway restart. But after the gateway's been running a
while, reqMktData on specific combos starts returning an empty ticker — bid/ask/last/close all NaN, ticker.ticks stays empty — and it never recovers on its own. No error callback, nothing.
The confusing part:
- The individual legs quote fine the whole time (same connection,
reqMktData on each leg gives live bid/ask/size).
- Other combos on the same exchange quote fine simultaneously. Today I had
NGQ26/NGV26 (NYMEX) and ZWZ6/ZWN7 (CBOT) both dead while NGN26/NGU26, NGU26/NGV26 and ZWN6/ZWU6 were all live. So it's
per-conId, not per-exchange and not a farm outage.
reqHistoricalData on the dead combos returns nothing either (though I used whatToShow=TRADES, so that one's not conclusive on its own).
reqMarketDataType(2)/(3) (frozen/delayed) makes no difference — still empty.
- Market data farms all report OK (2104), no 354 / 10089, no "market data lines" error, nothing.
Only thing that fixes it is restarting the gateway.
ib.reqMarketDataType(1)
front = Contract(symbol="NG", secType="FUT", exchange="NYMEX", localSymbol="NGQ26")
back = Contract(symbol="NG", secType="FUT", exchange="NYMEX", localSymbol="NGV26")
ib.qualifyContracts(front, back)
combo = Contract(symbol="NG", secType="BAG", exchange="SMART", currency="USD")
combo.comboLegs = [
ComboLeg(conId=front.conId, ratio=1, action="SELL", exchange="NYMEX"),
ComboLeg(conId=back.conId, ratio=1, action="BUY", exchange="NYMEX"),
]
t = ib.reqMktData(combo, "", False, False)
ib.sleep(5)
print(t.bid, t.ask, len(t.ticks)) # nan nan 0 (but the two legs quote fine)
I tried to reproduce it deliberately and couldn't, which is the frustrating bit:
- hammering one combo with 40x subscribe/cancel in a single connection → stays alive
- 25x connect → subscribe → cancel → immediate disconnect (no sleep, to race the cancel) → stays alive
So it doesn't seem tied to subscribe/cancel volume or to cancel-vs-disconnect races, at least not the way I can force it. The combos that died had only been subscribed ~2-3 times across separate processes
before going dark.
Environment: ib_async 2.1.0, Python 3.10.12, IB Gateway 10.45 (gnzsnz/ib-gateway docker image), Linux.
Is this a known gateway-side thing? Mostly wondering if anyone has a reliable repro or a workaround short of restarting, or knows whether it's worth reporting to IBKR directly since it smells server-side.
Running into something odd with futures calendar spreads and hoping someone's seen it.
I subscribe to a bunch of calendar spreads as BAG combos (
-1 front + 1 back,exchange="SMART", native exchange on the legs). Works fine right after a gateway restart. But after the gateway's been running awhile,
reqMktDataon specific combos starts returning an empty ticker —bid/ask/last/closeall NaN,ticker.ticksstays empty — and it never recovers on its own. No error callback, nothing.The confusing part:
reqMktDataon each leg gives live bid/ask/size).NGQ26/NGV26(NYMEX) andZWZ6/ZWN7(CBOT) both dead whileNGN26/NGU26,NGU26/NGV26andZWN6/ZWU6were all live. So it'sper-conId, not per-exchange and not a farm outage.
reqHistoricalDataon the dead combos returns nothing either (though I usedwhatToShow=TRADES, so that one's not conclusive on its own).reqMarketDataType(2)/(3)(frozen/delayed) makes no difference — still empty.Only thing that fixes it is restarting the gateway.
I tried to reproduce it deliberately and couldn't, which is the frustrating bit:
So it doesn't seem tied to subscribe/cancel volume or to cancel-vs-disconnect races, at least not the way I can force it. The combos that died had only been subscribed ~2-3 times across separate processes
before going dark.
Environment: ib_async 2.1.0, Python 3.10.12, IB Gateway 10.45 (gnzsnz/ib-gateway docker image), Linux.
Is this a known gateway-side thing? Mostly wondering if anyone has a reliable repro or a workaround short of restarting, or knows whether it's worth reporting to IBKR directly since it smells server-side.