@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.
Files changed (2) hide show
  1. package/lib/utils.js +51 -49
  2. 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
- result.push(picked)
405
- let picked_exchange = picked[2]
406
- if (count[picked_exchange] < orderbooks_dict[picked_exchange][type].length - 1) {
407
- count[picked_exchange] += 1
408
- } else {
409
- count[picked_exchange] = -1 // -1 means finished
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
- // console.log(
423
- // module.exports.combine_orderbooks(
424
- // {
425
- // // binance: {
426
- // // // asks: [
427
- // // // [1, 1],
428
- // // // [2, 2],
429
- // // // [3, 3],
430
- // // // ],
431
- // // // bids: [
432
- // // // [0.9, 0.9],
433
- // // // [0.5, 0.5],
434
- // // // [0.3, 0.2],
435
- // // // ],
436
- // // },
437
- // bittrex: {
438
- // asks: [
439
- // [4, 4],
440
- // [5, 5],
441
- // [8, 8],
442
- // ],
443
- // bids: [
444
- // // [0.6, 0.9],
445
- // // [0.5, 0.2],
446
- // // [0.2, 0.2],
447
- // ],
448
- // },
449
- // poloniex: {
450
- // asks: [
451
- // [1, 1],
452
- // [6, 6],
453
- // [7, 7],
454
- // ],
455
- // bids: [
456
- // [0.95, 0.9],
457
- // [0.7, 0.5],
458
- // [0.4, 0.2],
459
- // ],
460
- // },
461
- // },
462
- // 100
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) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-utils",
3
- "version": "1.7.24",
3
+ "version": "1.7.25",
4
4
  "description": "Utils package.",
5
5
  "main": "index.js",
6
6
  "directories": {