Cancel remaining entries before fetching break-even fees
After the first take-profit fills, cancel outstanding entry orders before calculating remaining-position protection. Missing fee records still fail explicitly and leave existing stops in place without allowing the old entry to remain open. Cover complete and incomplete fees on Binance and Bybit, including cancellation before the recovery fetch and no duplicate cancellation. Verify the staged snapshot with 61 trading safety and plan tests.
This commit is contained in:
1 parent
d1a6325ed7
commit
641351a002
2 files changed
+44
No files matched your search
@@ -574,6 +574,11 @@ class Executor:
|
||||
for j in range(len(TAKE_PROFIT_STEPS[sizing["direction"]]))]
|
||||
stop = Decimal(sizing["entry"]["stop"])
|
||||
if tp_filled[0] > 0 and position is not None:
|
||||
# 撤销剩余入场不依赖手续费;先撤,避免保本计算失败后仍可能继续加仓。
|
||||
for row in active:
|
||||
if row.purpose == "entry":
|
||||
await self.cancel(client, row)
|
||||
active = [r for r in active if r.purpose != "entry"]
|
||||
fee_per_unit = await self.entry_fee_per_unit(session, client, plan.symbol, entry_rows)
|
||||
break_even = remaining_break_even(sizing["direction"], average, fee_per_unit,
|
||||
ESTIMATED_CLOSE_FEE_RATES[client.exchange], rules.tick_size)
|
||||
|
||||
Reference in new issue
Block a user