Bug: UNSET_DOUBLE silently converted to 0.0 in CommissionReport fields
Version
ib_async 2.1.0
Description
In wrapper.py, the commissionReport handler converts IBKR's UNSET_DOUBLE sentinel value (1.7976931348623157e+308, meaning "not reported") to 0.0 for the realizedPNL and yield_ fields of CommissionReport.
This makes it impossible for consumers to distinguish between "IBKR did not report this value" and "the value is exactly zero" -- two semantically different states.
Related issues
Code reference
wrapper.py approximately lines 848-851 in version 2.1.0:
if report.realizedPNL >= UNSET_DOUBLE:
report.realizedPNL = 0.0
if report.yield_ >= UNSET_DOUBLE:
report.yield_ = 0.0
Expected behavior
UNSET_DOUBLE should be converted to math.nan (or None) rather than 0.0, preserving the semantic distinction between "not reported" and "zero."
Impact
Any system that tracks realized P&L or yield from commission reports cannot distinguish a genuine $0.00 realized P&L (e.g., a scratch trade) from a trade where IBKR simply has not yet reported the value. This can cause incorrect cost-basis calculations and misleading reporting.
Bug: UNSET_DOUBLE silently converted to 0.0 in CommissionReport fields
Version
ib_async 2.1.0
Description
In
wrapper.py, thecommissionReporthandler converts IBKR'sUNSET_DOUBLEsentinel value (1.7976931348623157e+308, meaning "not reported") to0.0for therealizedPNLandyield_fields ofCommissionReport.This makes it impossible for consumers to distinguish between "IBKR did not report this value" and "the value is exactly zero" -- two semantically different states.
Related issues
UNSET_DOUBLEleaking through as a raw huge float inreqPnLSingle. Those were about PnL, not CommissionReport.UNSET_DOUBLEto0.0instead of toNoneormath.nan.Code reference
wrapper.pyapproximately lines 848-851 in version 2.1.0:Expected behavior
UNSET_DOUBLEshould be converted tomath.nan(orNone) rather than0.0, preserving the semantic distinction between "not reported" and "zero."Impact
Any system that tracks realized P&L or yield from commission reports cannot distinguish a genuine $0.00 realized P&L (e.g., a scratch trade) from a trade where IBKR simply has not yet reported the value. This can cause incorrect cost-basis calculations and misleading reporting.