Skip to content

Commit 1c14da6

Browse files
committed
Treat pending IBKR orders as submitted
1 parent a3ac3d5 commit 1c14da6

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

application/execution_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def check_order_submitted(report, *, translator):
5454
order_id=order_id,
5555
),
5656
)
57-
if status in ["Submitted", "PreSubmitted"]:
57+
if status in {"PendingSubmit", "ApiPending", "ApiPendingSubmit", "Submitted", "PreSubmitted"}:
5858
return True, f"✅ {translator('submitted', order_id=order_id)}"
5959
return False, f"❌ {translator('failed', reason=status)}"
6060

tests/test_execution_service.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ def test_check_order_submitted_accepts_submitted_like_status():
6666
assert "submitted 123" in message
6767

6868

69+
def test_check_order_submitted_accepts_pending_submit_status():
70+
report = SimpleNamespace(broker_order_id="123", status="PendingSubmit")
71+
ok, message = check_order_submitted(report, translator=translate)
72+
assert ok is True
73+
assert "submitted 123" in message
74+
75+
6976
def test_execute_rebalance_submits_limit_buy_for_underweight_position(monkeypatch, tmp_path):
7077
class FakeIB:
7178
def openTrades(self):

0 commit comments

Comments
 (0)