更新 MakerEngine,清理历史挂单并重置状态;修复 getPosition 函数以处理未定义的选项

This commit is contained in:
discountry
2025-09-24 01:26:55 +08:00
parent 633f5fb904
commit fa1579269a
2 changed files with 7 additions and 3 deletions
+4
View File
@@ -227,6 +227,8 @@ export class MakerEngine {
await this.exchange.cancelAllOrders({ symbol: this.config.symbol });
this.pendingCancelOrders.clear();
unlockOperating(this.locks, this.timers, this.pending, "LIMIT");
this.openOrders = [];
this.emitUpdate();
this.tradeLog.push("order", "启动时清理历史挂单");
this.initialOrderResetDone = true;
return true;
@@ -234,6 +236,8 @@ export class MakerEngine {
if (isUnknownOrderError(error)) {
this.tradeLog.push("order", "历史挂单已消失,跳过启动清理");
this.initialOrderResetDone = true;
this.openOrders = [];
this.emitUpdate();
return true;
}
this.tradeLog.push("error", `启动撤单失败: ${String(error)}`);