1
Offline regression tests / windows (3.11) (push) Canceled after 0s
Offline regression tests / windows (3.12) (push) Canceled after 0s
Offline regression tests / windows (3.13) (push) Canceled after 0s

This commit is contained in:
listik committed 2026-10-23 23:38:37 +03:00
1 parent 3ae4e18211
commit 730adb3ff2
9 files changed
+206 -33

No files matched your search

+6
View File
@@ -143,6 +143,9 @@ class Position:
features: dict = field(default_factory=dict)
uid: int = 0 # unique per ledger, so one of several open positions can be closed by hand
margin: float = 0.0 # fixed at entry; changing leverage later must not release collateral
close_decision_time: float = 0.0
close_decision_price: float = 0.0
close_reason: str = ""
@dataclass
@@ -406,6 +409,9 @@ class Ledger:
self.balance, self._unrealized = old_balance, old_unrealized
self._position_marks[pos.uid] = previous_mark
return None
pos.close_decision_time = now
pos.close_decision_price = price
pos.close_reason = reason
for hook in self.hooks:
hook("close", pos)
if self.trades_path: