Closed arodus closed 7 months ago
Hi Arodus, this is really curious behavior which should be further investigated. How does it even happen that a freshly submitted order ends up being in CancelPending state right away? Are you able to trace exactly where it switches to this state?
Hi @zurpet, Martin explained it here: https://github.com/QuantConnect/Lean.Brokerages.ByBit/pull/12#discussion_r1410684480
Expected Behavior
Orders are being canceled at all times without issues.
Actual Behavior
Some orders can not always be canceled, it happens in multiple occasions but It seems I found one way to reliably reproduce it. (See reproducing the problem)
Potential Solution
Don't raise an error when the status is
CancelPending
here: https://github.com/QuantConnect/Lean.Brokerages.ByBit/blob/a5b3f02c04838b5bb0a66e496b8ca958f0518a95/QuantConnect.BybitBrokerage/BybitBrokerage.Brokerage.cs#L201-L206It seems that sometimes the order status is already
CancelPending
even though the cancel request was never sent to the brokerage.Reproducing the Problem
Checklist
master
branch