@ex-master/core
Advanced tools
Comparing version 0.1.63 to 0.1.64
@@ -50,5 +50,5 @@ "use strict"; | ||
else { | ||
activeOrderMap.delete(id); | ||
this.dashboard.info(`order ${id} became inactive`); | ||
activeOrder.becomeInactiveResolver(order); | ||
this.dashboard.info(`order ${id} became inactive`); | ||
activeOrderMap.delete(id); | ||
} | ||
@@ -139,4 +139,7 @@ }); | ||
this.dashboard.info(`cancel order [${group}] "${label}"`); | ||
this.activeOrderMap.set(id, { ...order, canceling: Date.now() }); | ||
await this.client.cancelOrder(order); | ||
let activeOrderMap = this.activeOrderMap; | ||
if (activeOrderMap.has(id)) { | ||
activeOrderMap.set(id, { ...order, canceling: Date.now() }); | ||
await this.client.cancelOrder(order); | ||
} | ||
return becomeInactive; | ||
@@ -156,7 +159,13 @@ } | ||
let now = Date.now(); | ||
let activeOrderMap = this.activeOrderMap; | ||
let pendingCancelOrders = []; | ||
for (let order of orders) { | ||
this.activeOrderMap.set(order.id, { ...order, canceling: now }); | ||
if (!activeOrderMap.has(order.id)) { | ||
continue; | ||
} | ||
activeOrderMap.set(order.id, { ...order, canceling: now }); | ||
pendingCancelOrders.push(order); | ||
} | ||
await this.client.cancelOrders(orders); | ||
return Promise.all(orders.map(order => order.becomeInactive)); | ||
await this.client.cancelOrders(pendingCancelOrders); | ||
return Promise.all(pendingCancelOrders.map(order => order.becomeInactive)); | ||
} | ||
@@ -163,0 +172,0 @@ ensurePrecision(value, precision, align) { |
{ | ||
"name": "@ex-master/core", | ||
"version": "0.1.63", | ||
"version": "0.1.64", | ||
"main": "bld/index.js", | ||
@@ -5,0 +5,0 @@ "types": "bld/index.d.ts", |
34901
852