@icgio/icg-exchanges-wrapper 1.14.251 → 1.14.253
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/middleware/orders.js +8 -3
- package/package.json +1 -1
package/middleware/orders.js
CHANGED
|
@@ -500,10 +500,12 @@ module.exports = class Orders {
|
|
|
500
500
|
trade.amount = round_amount(exchange, pair, trade.amount)
|
|
501
501
|
let { type, order_id } = trade
|
|
502
502
|
let order_info = _.get(this.order_info, [exchange, pair, type, order_id])
|
|
503
|
+
if (!order_info) {
|
|
504
|
+
return
|
|
505
|
+
}
|
|
503
506
|
const trade_amount = round_amount(exchange, pair, trade.amount)
|
|
504
507
|
const order_info_f_amount = round_amount(exchange, pair, order_info.f_amount)
|
|
505
|
-
if (
|
|
506
|
-
} else if (_.includes(['CANCELED', 'CANCELING'], order_info.status) && trade_amount > order_info_f_amount) {
|
|
508
|
+
if (_.includes(['CANCELED', 'CANCELING'], order_info.status) && trade_amount > order_info_f_amount) {
|
|
507
509
|
// console.log('TRADES: %s ORDER FILLED', order_info.status, trade, order_info)
|
|
508
510
|
this.update_order_info(
|
|
509
511
|
exchange,
|
|
@@ -660,6 +662,9 @@ module.exports = class Orders {
|
|
|
660
662
|
open_orders[exchange][pair].open_orders.map((order) => {
|
|
661
663
|
if (_.get(this.order_info, [exchange, pair, order.type, order.order_id])) {
|
|
662
664
|
let order_info = this.order_info[exchange][pair][order.type][order.order_id]
|
|
665
|
+
if (!order_info) {
|
|
666
|
+
return
|
|
667
|
+
}
|
|
663
668
|
const order_f_amount = round_amount(exchange, pair, order.f_amount)
|
|
664
669
|
const order_info_f_amount = round_amount(exchange, pair, order_info.f_amount)
|
|
665
670
|
if (_.includes(['N-FILLED', 'P-FILLED'], order_info.status) && order_f_amount > order_info_f_amount && order_f_amount / order_info.t_amount > this.f_filled_threshold) {
|
|
@@ -741,7 +746,7 @@ module.exports = class Orders {
|
|
|
741
746
|
// If CANCELING orders are no longer in open_orders, infer they are canceled.
|
|
742
747
|
const open_orders_ids_set = new Set(open_orders[exchange][pair].open_orders.map((o) => o.order_id))
|
|
743
748
|
this.get_order_info_status_all(exchange, pair, 'both', 'CANCELING').map((order_info) => {
|
|
744
|
-
if (!open_orders_ids_set.has(order_info.order_id)) {
|
|
749
|
+
if (order_info.order_id && !open_orders_ids_set.has(order_info.order_id)) {
|
|
745
750
|
this.update_order_info(
|
|
746
751
|
exchange,
|
|
747
752
|
pair,
|