Skip to content

Commit 110420e

Browse files
authored
Handle unknown liquidity as None (#109)
TWS will sometimes return UNSET_INTEGER (2**31 -1). If we panic, it will prevent enumerating the orders. This is compliant with the C# client behavior: https://github.com/quantrocket-llc/ibapi/blob/e3542aa3e05a2b752eb33742f81a50d4ac0aa1d8/source/csharpclient/client/Execution.cs#L31 Also, we note that the C# comment lists 0 = Unknown.
1 parent 058cee2 commit 110420e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/orders.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -864,11 +864,10 @@ pub enum Liquidity {
864864
impl From<i32> for Liquidity {
865865
fn from(val: i32) -> Self {
866866
match val {
867-
0 => Liquidity::None,
868867
1 => Liquidity::AddedLiquidity,
869868
2 => Liquidity::RemovedLiquidity,
870869
3 => Liquidity::LiquidityRoutedOut,
871-
_ => panic!("unsupported Liquidity({val})"),
870+
_ => Liquidity::None,
872871
}
873872
}
874873
}

0 commit comments

Comments
 (0)