diff --git a/apps/orb_trader/engine.py b/apps/orb_trader/engine.py index 500c760..7e75775 100644 --- a/apps/orb_trader/engine.py +++ b/apps/orb_trader/engine.py @@ -14,8 +14,10 @@ Stop management logic mirrors orb_simulator.py:477-580 exactly. """ from __future__ import annotations +import copy import datetime as dt import logging +import time import uuid from typing import Any from zoneinfo import ZoneInfo @@ -347,7 +349,6 @@ class ORBTradingEngine: for d in sorted(self._enrichment[ticker].keys(), reverse=True): if d <= date_str: # Create a date_str entry inheriting from latest - import copy self._enrichment[ticker][date_str] = copy.copy( self._enrichment[ticker][d] ) @@ -579,7 +580,6 @@ class ORBTradingEngine: # Wait for fill (poll up to 30s) fill_price = entry_price_est order_rejected = False - import time for _ in range(6): time.sleep(5) try: @@ -793,7 +793,6 @@ class ORBTradingEngine: # (other sessions may hold the same ticker in the same Alpaca account). exit_price = current_stop # fallback if fill poll fails try: - import time close_order = self._broker.close_position(ticker, qty=int(pos.shares)) # Poll for actual broker fill price (captures gap-through losses) for _ in range(4): @@ -863,7 +862,6 @@ class ORBTradingEngine: try: # Use qty so only this session's shares are closed close_order = self._broker.close_position(pos.ticker, qty=int(pos.shares)) - import time exit_price = pos.entry_price for _ in range(4): time.sleep(3)