mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-12 09:48:07 +00:00
feat: 优化订单去重和取消逻辑,确保在处理STOP订单时避免精度损失
This commit is contained in:
@@ -108,13 +108,14 @@ export class LighterExchangeAdapter implements ExchangeAdapter {
|
||||
|
||||
async cancelOrder(params: { symbol: string; orderId: number | string }): Promise<void> {
|
||||
await this.ensureInitialized("cancelOrder");
|
||||
await this.gateway.cancelOrder({ orderId: params.orderId });
|
||||
// Accept both clientOrderId and order_index as strings; forward as-is to preserve precision
|
||||
await this.gateway.cancelOrder({ orderId: String(params.orderId) });
|
||||
}
|
||||
|
||||
async cancelOrders(params: { symbol: string; orderIdList: Array<number | string> }): Promise<void> {
|
||||
await this.ensureInitialized("cancelOrders");
|
||||
for (const orderId of params.orderIdList) {
|
||||
await this.gateway.cancelOrder({ orderId });
|
||||
await this.gateway.cancelOrder({ orderId: String(orderId) });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user