Skip to content

Commit

Permalink
Handle unknown liquidity as None (#109)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
drpngx committed Feb 9, 2024
1 parent 058cee2 commit 110420e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/orders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -864,11 +864,10 @@ pub enum Liquidity {
impl From<i32> for Liquidity {
fn from(val: i32) -> Self {
match val {
0 => Liquidity::None,
1 => Liquidity::AddedLiquidity,
2 => Liquidity::RemovedLiquidity,
3 => Liquidity::LiquidityRoutedOut,
_ => panic!("unsupported Liquidity({val})"),
_ => Liquidity::None,
}
}
}
Expand Down

0 comments on commit 110420e

Please sign in to comment.