@icgio/icg-exchanges-wrapper 1.15.35 → 1.15.37
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 +25 -0
- package/package.json +3 -3
package/middleware/orders.js
CHANGED
|
@@ -73,6 +73,22 @@ const MARKET_HISTORY_DEFAULT_MS = 10 * 60 * 1000
|
|
|
73
73
|
const TRADES_DEFAULT_MS = 7 * 24 * 60 * 60 * 1000
|
|
74
74
|
const NO_CALLBACK_TIMEOUT_MS = 2 * 60 * 1000
|
|
75
75
|
const PROCESS_RATES_THROTTLE_MS = 75
|
|
76
|
+
const ORDER_TYPE_PRIORITY = {
|
|
77
|
+
arb: 1,
|
|
78
|
+
self: 2,
|
|
79
|
+
maker_1: 3,
|
|
80
|
+
maker_1_taker: 3,
|
|
81
|
+
maker_2: 4,
|
|
82
|
+
maker_3: 5,
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const getOrderPriority = (order_type, is_cancel = false) => {
|
|
86
|
+
const priority = ORDER_TYPE_PRIORITY[order_type]
|
|
87
|
+
if (priority == null) {
|
|
88
|
+
return Infinity
|
|
89
|
+
}
|
|
90
|
+
return is_cancel ? priority - 0.5 : priority
|
|
91
|
+
}
|
|
76
92
|
|
|
77
93
|
module.exports = class Orders {
|
|
78
94
|
constructor(exchange_cur_quote_cur_dict, cd, settings) {
|
|
@@ -332,11 +348,17 @@ module.exports = class Orders {
|
|
|
332
348
|
// }
|
|
333
349
|
}
|
|
334
350
|
if (routes) {
|
|
351
|
+
if (this.Exchanges[exchange].private_limiter) {
|
|
352
|
+
this.Exchanges[exchange].private_limiter.priority = getOrderPriority(order_type)
|
|
353
|
+
}
|
|
335
354
|
this.Exchanges[exchange].limit_trade_with_routes(pair, method, price, amount, routes, cb)
|
|
336
355
|
} else {
|
|
337
356
|
console.error('dex no routes:', rates_with_routes, price)
|
|
338
357
|
}
|
|
339
358
|
} else if (limiter_on) {
|
|
359
|
+
if (this.Exchanges[exchange].private_limiter) {
|
|
360
|
+
this.Exchanges[exchange].private_limiter.priority = getOrderPriority(order_type)
|
|
361
|
+
}
|
|
340
362
|
this.Exchanges[exchange].limit_trade(pair, method, price, amount, cb)
|
|
341
363
|
} else {
|
|
342
364
|
this.Exchanges[exchange].limit_trade_base(pair, method, price, amount, cb)
|
|
@@ -403,6 +425,9 @@ module.exports = class Orders {
|
|
|
403
425
|
order.order_type + ' canceling',
|
|
404
426
|
)
|
|
405
427
|
;((order.exchange = exchange), (order.pair = pair))
|
|
428
|
+
if (this.Exchanges[exchange].private_limiter) {
|
|
429
|
+
this.Exchanges[exchange].private_limiter.priority = getOrderPriority(order.order_type, true)
|
|
430
|
+
}
|
|
406
431
|
this.Exchanges[exchange].cancel_order_by_order(order, (res) => {
|
|
407
432
|
if (res.success || (!res.success && res.error === 'order-not-open' && original_status === 'CANCELING')) {
|
|
408
433
|
this.update_order_info(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icgio/icg-exchanges-wrapper",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.37",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
},
|
|
18
18
|
"homepage": "https://github.com/icgio/icg-exchanges-wrapper#readme",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@icgio/icg-exchanges": "^1.32.
|
|
21
|
-
"@icgio/icg-utils": "^1.9.
|
|
20
|
+
"@icgio/icg-exchanges": "^1.32.188",
|
|
21
|
+
"@icgio/icg-utils": "^1.9.52",
|
|
22
22
|
"lodash": "^4.17.23",
|
|
23
23
|
"pg": "^8.17.2"
|
|
24
24
|
}
|