@icgio/icg-exchanges-wrapper 1.12.63 → 1.12.65
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 +19 -11
- package/package.json +2 -2
package/middleware/orders.js
CHANGED
|
@@ -268,22 +268,30 @@ module.exports = class Orders {
|
|
|
268
268
|
let rates_with_routes = this.rates_with_routes[exchange][pair]
|
|
269
269
|
let routes
|
|
270
270
|
if (method === 'buy') {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
271
|
+
let closest_level = _.minBy(rates_with_routes.asks, (ask) => {
|
|
272
|
+
return Math.abs(ask[0] - price)
|
|
273
|
+
})
|
|
274
|
+
routes = [closest_level[2]]
|
|
275
|
+
// for (let ask of rates_with_routes.asks) {
|
|
276
|
+
// if (ask[0] === price) {
|
|
277
|
+
// routes = [ask[2]]
|
|
278
|
+
// }
|
|
279
|
+
// }
|
|
276
280
|
} else {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
281
|
+
let closest_level = _.minBy(rates_with_routes.bids, (bid) => {
|
|
282
|
+
return Math.abs(bid[0] - price)
|
|
283
|
+
})
|
|
284
|
+
routes = [closest_level[2]]
|
|
285
|
+
// for (let bid of rates_with_routes.bids) {
|
|
286
|
+
// if (bid[0] === price) {
|
|
287
|
+
// routes = [bid[2]]
|
|
288
|
+
// }
|
|
289
|
+
// }
|
|
282
290
|
}
|
|
283
291
|
if (routes) {
|
|
284
292
|
this.Exchanges[exchange].limit_trade_with_routes(pair, method, price, amount, routes, cb)
|
|
285
293
|
} else {
|
|
286
|
-
this.error_log('
|
|
294
|
+
this.error_log('dex no routes:', rates_with_routes, price)
|
|
287
295
|
}
|
|
288
296
|
} else if (limiter_on) {
|
|
289
297
|
this.Exchanges[exchange].limit_trade(pair, method, price, amount, cb)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icgio/icg-exchanges-wrapper",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.65",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"homepage": "https://github.com/icgio/icg-exchanges-wrapper#readme",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@icgio/icg-exchanges": "^1.30.
|
|
20
|
+
"@icgio/icg-exchanges": "^1.30.53",
|
|
21
21
|
"@icgio/icg-exchanges-data": "^1.8.48",
|
|
22
22
|
"@icgio/icg-utils": "^1.7.65",
|
|
23
23
|
"influx": "^5.7.0",
|