@icgio/icg-utils 1.7.24 → 1.7.26

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 +27 -25
  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
@@ -422,28 +424,28 @@ module.exports.combine_orderbooks = (orderbooks_dict, length = undefined) => {
422
424
  // console.log(
423
425
  // module.exports.combine_orderbooks(
424
426
  // {
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: {
427
+ // binance: {
438
428
  // asks: [
439
- // [4, 4],
440
- // [5, 5],
441
- // [8, 8],
429
+ // [1, 1],
430
+ // [2, 2],
431
+ // [3, 3],
442
432
  // ],
443
433
  // bids: [
444
- // // [0.6, 0.9],
445
- // // [0.5, 0.2],
446
- // // [0.2, 0.2],
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],
447
449
  // ],
448
450
  // },
449
451
  // poloniex: {
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.26",
4
4
  "description": "Utils package.",
5
5
  "main": "index.js",
6
6
  "directories": {