@icgio/icg-utils 1.7.24 → 1.7.25
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/lib/utils.js +51 -49
- package/package.json +1 -1
package/lib/utils.js
CHANGED
|
@@ -401,12 +401,14 @@ module.exports.combine_orderbooks = (orderbooks_dict, length = undefined) => {
|
|
|
401
401
|
picked = orderbooks_dict[exchange][type][count[exchange]]
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
count[picked_exchange]
|
|
408
|
-
|
|
409
|
-
|
|
404
|
+
if (picked) {
|
|
405
|
+
result.push(picked)
|
|
406
|
+
let picked_exchange = picked[2]
|
|
407
|
+
if (count[picked_exchange] < orderbooks_dict[picked_exchange][type].length - 1) {
|
|
408
|
+
count[picked_exchange] += 1
|
|
409
|
+
} else {
|
|
410
|
+
count[picked_exchange] = -1 // -1 means finished
|
|
411
|
+
}
|
|
410
412
|
}
|
|
411
413
|
if (result.length === length) {
|
|
412
414
|
break
|
|
@@ -419,49 +421,49 @@ module.exports.combine_orderbooks = (orderbooks_dict, length = undefined) => {
|
|
|
419
421
|
return { asks, bids }
|
|
420
422
|
}
|
|
421
423
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
//
|
|
426
|
-
//
|
|
427
|
-
//
|
|
428
|
-
//
|
|
429
|
-
//
|
|
430
|
-
//
|
|
431
|
-
//
|
|
432
|
-
//
|
|
433
|
-
//
|
|
434
|
-
//
|
|
435
|
-
//
|
|
436
|
-
//
|
|
437
|
-
|
|
438
|
-
//
|
|
439
|
-
//
|
|
440
|
-
//
|
|
441
|
-
//
|
|
442
|
-
//
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
//
|
|
451
|
-
//
|
|
452
|
-
//
|
|
453
|
-
//
|
|
454
|
-
//
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
424
|
+
console.log(
|
|
425
|
+
module.exports.combine_orderbooks(
|
|
426
|
+
{
|
|
427
|
+
// binance: {
|
|
428
|
+
// // asks: [
|
|
429
|
+
// // [1, 1],
|
|
430
|
+
// // [2, 2],
|
|
431
|
+
// // [3, 3],
|
|
432
|
+
// // ],
|
|
433
|
+
// // bids: [
|
|
434
|
+
// // [0.9, 0.9],
|
|
435
|
+
// // [0.5, 0.5],
|
|
436
|
+
// // [0.3, 0.2],
|
|
437
|
+
// // ],
|
|
438
|
+
// },
|
|
439
|
+
bittrex: {
|
|
440
|
+
// asks: [
|
|
441
|
+
// // [4, 4],
|
|
442
|
+
// // [5, 5],
|
|
443
|
+
// // [8, 8],
|
|
444
|
+
// ],
|
|
445
|
+
bids: [
|
|
446
|
+
[0.6, 0.9],
|
|
447
|
+
[0.5, 0.2],
|
|
448
|
+
[0.2, 0.2],
|
|
449
|
+
],
|
|
450
|
+
},
|
|
451
|
+
poloniex: {
|
|
452
|
+
// asks: [
|
|
453
|
+
// // [1, 1],
|
|
454
|
+
// // [6, 6],
|
|
455
|
+
// // [7, 7],
|
|
456
|
+
// ],
|
|
457
|
+
bids: [
|
|
458
|
+
[0.95, 0.9],
|
|
459
|
+
[0.7, 0.5],
|
|
460
|
+
[0.4, 0.2],
|
|
461
|
+
],
|
|
462
|
+
},
|
|
463
|
+
},
|
|
464
|
+
100
|
|
465
|
+
)
|
|
466
|
+
)
|
|
465
467
|
// console.log(module.exports.combine_orderbooks({}, 100))
|
|
466
468
|
|
|
467
469
|
module.exports.arb_opportunities_from_combined_orderbook = (orderbook_combined, profit_percentage = 0, amount_cap = 0) => {
|