feat(execution): reconcile timed-out orders safely
This commit is contained in:
@@ -10,8 +10,10 @@ from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from threading import Lock
|
||||
from typing import Optional
|
||||
|
||||
from trex_core.application.broker_port import (
|
||||
BalanceItem,
|
||||
@@ -126,8 +128,22 @@ class OwnershipAwareBroker:
|
||||
def submit_order(self, req: OrderRequest) -> OrderAck:
|
||||
return self._delegate.submit_order(req)
|
||||
|
||||
def poll_fill(self, broker_order_id: str, *, side: str, symbol: str) -> FillStatus:
|
||||
result = self._delegate.poll_fill(broker_order_id, side=side, symbol=symbol)
|
||||
def poll_fill(
|
||||
self,
|
||||
broker_order_id: str,
|
||||
*,
|
||||
side: str,
|
||||
symbol: str,
|
||||
order_date: Optional[str] = None,
|
||||
submitted_at: Optional[datetime] = None,
|
||||
) -> FillStatus:
|
||||
result = self._delegate.poll_fill(
|
||||
broker_order_id,
|
||||
side=side,
|
||||
symbol=symbol,
|
||||
order_date=order_date,
|
||||
submitted_at=submitted_at,
|
||||
)
|
||||
if result.execution_id and result.filled_qty > 0 and (
|
||||
result.is_filled or result.is_partial_cancel
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user