@chainstream-io/sdk 0.0.8 → 0.0.10

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 (59) hide show
  1. package/dist/api/stream.js +240 -190
  2. package/dist/api/stream.js.map +1 -1
  3. package/dist/api/stream.model.d.ts +19 -1
  4. package/dist/api/stream.model.js.map +1 -1
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.js +1 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/openapi/apis/DexApi.d.ts +5 -2
  9. package/dist/openapi/apis/DexApi.js +79 -4
  10. package/dist/openapi/apis/DexApi.js.map +1 -1
  11. package/dist/openapi/apis/TradeApi.d.ts +3 -1
  12. package/dist/openapi/apis/TradeApi.js +76 -1
  13. package/dist/openapi/apis/TradeApi.js.map +1 -1
  14. package/dist/openapi/index.d.ts +1 -1
  15. package/dist/openapi/index.js.map +1 -1
  16. package/dist/openapi/models/CreateTokenInput.d.ts +34 -0
  17. package/dist/openapi/models/CreateTokenInput.js +72 -0
  18. package/dist/openapi/models/CreateTokenInput.js.map +1 -0
  19. package/dist/openapi/models/ObjectSerializer.d.ts +2 -1
  20. package/dist/openapi/models/ObjectSerializer.js +7 -4
  21. package/dist/openapi/models/ObjectSerializer.js.map +1 -1
  22. package/dist/openapi/models/QuoteResponse.d.ts +25 -0
  23. package/dist/openapi/models/QuoteResponse.js +52 -0
  24. package/dist/openapi/models/QuoteResponse.js.map +1 -0
  25. package/dist/openapi/models/TokenExtraDTO.d.ts +5 -5
  26. package/dist/openapi/models/TokenExtraDTO.js +10 -10
  27. package/dist/openapi/models/TokenExtraDTO.js.map +1 -1
  28. package/dist/openapi/models/TradeDetailDTO.d.ts +1 -1
  29. package/dist/openapi/models/TradeDetailDTO.js +2 -2
  30. package/dist/openapi/models/TradeDetailDTO.js.map +1 -1
  31. package/dist/openapi/models/all.d.ts +2 -1
  32. package/dist/openapi/models/all.js +2 -1
  33. package/dist/openapi/models/all.js.map +1 -1
  34. package/dist/openapi/types/ObjectParamAPI.d.ts +31 -2
  35. package/dist/openapi/types/ObjectParamAPI.js +16 -4
  36. package/dist/openapi/types/ObjectParamAPI.js.map +1 -1
  37. package/dist/openapi/types/ObservableAPI.d.ts +10 -5
  38. package/dist/openapi/types/ObservableAPI.js +44 -8
  39. package/dist/openapi/types/ObservableAPI.js.map +1 -1
  40. package/dist/openapi/types/PromiseAPI.d.ts +10 -5
  41. package/dist/openapi/types/PromiseAPI.js +24 -8
  42. package/dist/openapi/types/PromiseAPI.js.map +1 -1
  43. package/package.json +1 -1
  44. package/src/api/stream.model.ts +21 -1
  45. package/src/api/stream.ts +178 -136
  46. package/src/index.ts +1 -1
  47. package/src/openapi/.openapi-generator/FILES +2 -1
  48. package/src/openapi/apis/DexApi.ts +149 -7
  49. package/src/openapi/apis/TradeApi.ts +154 -1
  50. package/src/openapi/index.ts +1 -1
  51. package/src/openapi/models/{DexCreateTokenInput.ts → CreateTokenInput.ts} +5 -5
  52. package/src/openapi/models/ObjectSerializer.ts +7 -4
  53. package/src/openapi/models/QuoteResponse.ts +89 -0
  54. package/src/openapi/models/TokenExtraDTO.ts +20 -20
  55. package/src/openapi/models/TradeDetailDTO.ts +4 -4
  56. package/src/openapi/models/all.ts +2 -1
  57. package/src/openapi/types/ObjectParamAPI.ts +192 -7
  58. package/src/openapi/types/ObservableAPI.ts +114 -11
  59. package/src/openapi/types/PromiseAPI.ts +88 -11
@@ -217,12 +217,30 @@ class StreamApi {
217
217
  }
218
218
  subscribeNewToken({ chain, callback, filter, }) {
219
219
  const channel = `dex-new-token:${chain}`;
220
- return this.subscribe(channel, (data) => callback({
221
- tokenAddress: data.a,
222
- name: data.n,
223
- symbol: data.s,
224
- createdAtMs: data.cts,
225
- }), filter, "subscribeNewToken");
220
+ return this.subscribe(channel, (data) => {
221
+ const result = {
222
+ tokenAddress: data.a,
223
+ name: data.n,
224
+ symbol: data.s,
225
+ createdAtMs: data.cts,
226
+ };
227
+ if (data.dec) {
228
+ result.decimals = data.dec;
229
+ }
230
+ if (data.lf) {
231
+ result.launchFrom = {};
232
+ if (data.lf.pa) {
233
+ result.launchFrom.programAddress = data.lf.pa;
234
+ }
235
+ if (data.lf.pf) {
236
+ result.launchFrom.protocolFamily = data.lf.pf;
237
+ }
238
+ if (data.lf.pn) {
239
+ result.launchFrom.protocolName = data.lf.pn;
240
+ }
241
+ }
242
+ callback(result);
243
+ }, filter, "subscribeNewToken");
226
244
  }
227
245
  subscribeNewTokensMetadata({ chain, callback, }) {
228
246
  const channel = `dex-new-tokens-metadata:${chain}`;
@@ -313,306 +331,338 @@ class StreamApi {
313
331
  return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((item) => {
314
332
  const result = {};
315
333
  if (item.t) {
316
- result.tokenAddress = item.t.a;
334
+ result.metadata = {
335
+ tokenAddress: item.t.a,
336
+ };
317
337
  if (item.t.n) {
318
- result.name = item.t.n;
338
+ result.metadata.name = item.t.n;
319
339
  }
320
340
  if (item.t.s) {
321
- result.symbol = item.t.s;
341
+ result.metadata.symbol = item.t.s;
322
342
  }
323
343
  if (item.t.iu) {
324
- result.imageUrl = item.t.iu;
344
+ result.metadata.imageUrl = item.t.iu;
325
345
  }
326
346
  if (item.t.de) {
327
- result.description = item.t.de;
347
+ result.metadata.description = item.t.de;
348
+ }
349
+ if (item.t.d) {
350
+ result.metadata.decimals = item.t.dec;
351
+ }
352
+ if (item.t.cts) {
353
+ result.metadata.createdAtMs = item.t.cts;
354
+ }
355
+ if (item.t.lf) {
356
+ result.metadata.launchFrom = {};
357
+ if (item.t.lf.pa) {
358
+ result.metadata.launchFrom.programAddress = item.t.lf.pa;
359
+ }
360
+ if (item.t.lf.pf) {
361
+ result.metadata.launchFrom.protocolFamily = item.t.lf.pf;
362
+ }
363
+ if (item.t.lf.pn) {
364
+ result.metadata.launchFrom.protocolName = item.t.lf.pn;
365
+ }
366
+ }
367
+ if (item.t.mt) {
368
+ result.metadata.migratedTo = {};
369
+ if (item.t.mt.pa) {
370
+ result.metadata.migratedTo.programAddress = item.t.mt.pa;
371
+ }
372
+ if (item.t.mt.pf) {
373
+ result.metadata.migratedTo.protocolFamily = item.t.mt.pf;
374
+ }
375
+ if (item.t.mt.pn) {
376
+ result.metadata.migratedTo.protocolName = item.t.mt.pn;
377
+ }
328
378
  }
329
379
  if (item.t.sm) {
330
- result.socialMedia = {};
380
+ result.metadata.socialMedia = {};
331
381
  if (item.t.sm.tw) {
332
- result.socialMedia.twitter = item.t.sm.tw;
382
+ result.metadata.socialMedia.twitter = item.t.sm.tw;
333
383
  }
334
384
  if (item.t.sm.tg) {
335
- result.socialMedia.telegram = item.t.sm.tg;
385
+ result.metadata.socialMedia.telegram = item.t.sm.tg;
336
386
  }
337
387
  if (item.t.sm.w) {
338
- result.socialMedia.website = item.t.sm.w;
388
+ result.metadata.socialMedia.website = item.t.sm.w;
339
389
  }
340
390
  if (item.t.sm.tt) {
341
- result.socialMedia.tiktok = item.t.sm.tt;
391
+ result.metadata.socialMedia.tiktok = item.t.sm.tt;
342
392
  }
343
393
  if (item.t.sm.dc) {
344
- result.socialMedia.discord = item.t.sm.dc;
394
+ result.metadata.socialMedia.discord = item.t.sm.dc;
345
395
  }
346
396
  if (item.t.sm.fb) {
347
- result.socialMedia.facebook = item.t.sm.fb;
397
+ result.metadata.socialMedia.facebook = item.t.sm.fb;
348
398
  }
349
399
  if (item.t.sm.gh) {
350
- result.socialMedia.github = item.t.sm.gh;
400
+ result.metadata.socialMedia.github = item.t.sm.gh;
351
401
  }
352
402
  if (item.t.sm.ig) {
353
- result.socialMedia.instagram = item.t.sm.ig;
403
+ result.metadata.socialMedia.instagram = item.t.sm.ig;
354
404
  }
355
405
  if (item.t.sm.li) {
356
- result.socialMedia.linkedin = item.t.sm.li;
406
+ result.metadata.socialMedia.linkedin = item.t.sm.li;
357
407
  }
358
408
  if (item.t.sm.md) {
359
- result.socialMedia.medium = item.t.sm.md;
409
+ result.metadata.socialMedia.medium = item.t.sm.md;
360
410
  }
361
411
  if (item.t.sm.rd) {
362
- result.socialMedia.reddit = item.t.sm.rd;
412
+ result.metadata.socialMedia.reddit = item.t.sm.rd;
363
413
  }
364
414
  if (item.t.sm.yt) {
365
- result.socialMedia.youtube = item.t.sm.yt;
415
+ result.metadata.socialMedia.youtube = item.t.sm.yt;
366
416
  }
367
417
  if (item.t.sm.bb) {
368
- result.socialMedia.bitbucket = item.t.sm.bb;
418
+ result.metadata.socialMedia.bitbucket = item.t.sm.bb;
369
419
  }
370
420
  }
371
421
  if (item.t.cts) {
372
- result.createdAtMs = item.t.cts;
422
+ result.metadata.createdAtMs = item.t.cts;
373
423
  }
374
424
  }
375
- if (item.h) {
376
- if (item.h.a) {
377
- result.tokenAddress = item.h.a;
378
- }
379
- if (item.h.h !== undefined) {
380
- result.holders = item.h.h;
425
+ if (item.bc) {
426
+ result.bondingCurve = {};
427
+ if (item.bc.pr) {
428
+ result.bondingCurve.progressRatio = this.formatScientificNotation(item.bc.pr);
381
429
  }
382
- if (item.h.t100a !== undefined) {
383
- result.top100Amount = this.formatScientificNotation(item.h.t100a);
430
+ }
431
+ if (item.h) {
432
+ result.holder = {
433
+ tokenAddress: item.h.a,
434
+ timestamp: item.h.ts || 0,
435
+ };
436
+ if (item.h.h) {
437
+ result.holder.holders = item.h.h;
384
438
  }
385
- if (item.h.t10a !== undefined) {
386
- result.top10Amount = this.formatScientificNotation(item.h.t10a);
439
+ if (item.h.t100a) {
440
+ result.holder.top100Amount = this.formatScientificNotation(item.h.t100a);
387
441
  }
388
- if (item.h.t100h !== undefined) {
389
- result.top100Holders = item.h.t100h;
442
+ if (item.h.t10a) {
443
+ result.holder.top10Amount = this.formatScientificNotation(item.h.t10a);
390
444
  }
391
- if (item.h.t10h !== undefined) {
392
- result.top10Holders = item.h.t10h;
445
+ if (item.h.t100h) {
446
+ result.holder.top100Holders = item.h.t100h;
393
447
  }
394
- if (item.h.t100r !== undefined) {
395
- result.top100Ratio = this.formatScientificNotation(item.h.t100r);
448
+ if (item.h.t10h) {
449
+ result.holder.top10Holders = item.h.t10h;
396
450
  }
397
- if (item.h.t10r !== undefined) {
398
- result.top10Ratio = this.formatScientificNotation(item.h.t10r);
451
+ if (item.h.t100r) {
452
+ result.holder.top100Ratio = this.formatScientificNotation(item.h.t100r);
399
453
  }
400
- if (item.h.ts !== undefined) {
401
- result.timestamp = item.h.ts;
454
+ if (item.h.t10r) {
455
+ result.holder.top10Ratio = this.formatScientificNotation(item.h.t10r);
402
456
  }
403
457
  }
404
458
  if (item.s) {
405
- if (item.s.a) {
406
- result.tokenAddress = item.s.a;
407
- }
408
- if (item.s.s !== undefined) {
409
- result.supply = item.s.s;
459
+ result.supply = {
460
+ tokenAddress: item.s.a,
461
+ timestamp: item.s.ts || 0,
462
+ };
463
+ if (item.s.s) {
464
+ result.supply.supply = item.s.s;
410
465
  }
411
- if (item.s.mc !== undefined) {
412
- result.marketCapInUsd = item.s.mc;
413
- }
414
- if (item.s.ts !== undefined) {
415
- result.timestamp = item.s.ts;
466
+ if (item.s.mc) {
467
+ result.supply.marketCapInUsd = item.s.mc;
416
468
  }
417
469
  }
418
470
  if (item.ts) {
419
- if (item.ts.a) {
420
- result.address = item.ts.a;
421
- }
422
- if (item.ts.t !== undefined) {
423
- result.timestamp = item.ts.t;
424
- }
425
- if (item.ts.b1m !== undefined) {
426
- result.buys1m = item.ts.b1m;
471
+ result.stat = {
472
+ address: item.ts.a,
473
+ timestamp: item.ts.t || 0,
474
+ };
475
+ if (item.ts.b1m) {
476
+ result.stat.buys1m = item.ts.b1m;
427
477
  }
428
- if (item.ts.s1m !== undefined) {
429
- result.sells1m = item.ts.s1m;
478
+ if (item.ts.s1m) {
479
+ result.stat.sells1m = item.ts.s1m;
430
480
  }
431
- if (item.ts.be1m !== undefined) {
432
- result.buyers1m = item.ts.be1m;
481
+ if (item.ts.be1m) {
482
+ result.stat.buyers1m = item.ts.be1m;
433
483
  }
434
- if (item.ts.se1m !== undefined) {
435
- result.sellers1m = item.ts.se1m;
484
+ if (item.ts.se1m) {
485
+ result.stat.sellers1m = item.ts.se1m;
436
486
  }
437
- if (item.ts.bviu1m !== undefined) {
438
- result.buyVolumeInUsd1m = this.formatScientificNotation(item.ts.bviu1m);
487
+ if (item.ts.bviu1m) {
488
+ result.stat.buyVolumeInUsd1m = this.formatScientificNotation(item.ts.bviu1m);
439
489
  }
440
- if (item.ts.sviu1m !== undefined) {
441
- result.sellVolumeInUsd1m = this.formatScientificNotation(item.ts.sviu1m);
490
+ if (item.ts.sviu1m) {
491
+ result.stat.sellVolumeInUsd1m = this.formatScientificNotation(item.ts.sviu1m);
442
492
  }
443
- if (item.ts.p1m !== undefined) {
444
- result.price1m = this.formatScientificNotation(item.ts.p1m);
493
+ if (item.ts.p1m) {
494
+ result.stat.price1m = this.formatScientificNotation(item.ts.p1m);
445
495
  }
446
- if (item.ts.oiu1m !== undefined) {
447
- result.openInUsd1m = this.formatScientificNotation(item.ts.oiu1m);
496
+ if (item.ts.oiu1m) {
497
+ result.stat.openInUsd1m = this.formatScientificNotation(item.ts.oiu1m);
448
498
  }
449
- if (item.ts.ciu1m !== undefined) {
450
- result.closeInUsd1m = this.formatScientificNotation(item.ts.ciu1m);
499
+ if (item.ts.ciu1m) {
500
+ result.stat.closeInUsd1m = this.formatScientificNotation(item.ts.ciu1m);
451
501
  }
452
- if (item.ts.b5m !== undefined) {
453
- result.buys5m = item.ts.b5m;
502
+ if (item.ts.b5m) {
503
+ result.stat.buys5m = item.ts.b5m;
454
504
  }
455
- if (item.ts.s5m !== undefined) {
456
- result.sells5m = item.ts.s5m;
505
+ if (item.ts.s5m) {
506
+ result.stat.sells5m = item.ts.s5m;
457
507
  }
458
- if (item.ts.be5m !== undefined) {
459
- result.buyers5m = item.ts.be5m;
508
+ if (item.ts.be5m) {
509
+ result.stat.buyers5m = item.ts.be5m;
460
510
  }
461
- if (item.ts.se5m !== undefined) {
462
- result.sellers5m = item.ts.se5m;
511
+ if (item.ts.se5m) {
512
+ result.stat.sellers5m = item.ts.se5m;
463
513
  }
464
- if (item.ts.bviu5m !== undefined) {
465
- result.buyVolumeInUsd5m = this.formatScientificNotation(item.ts.bviu5m);
514
+ if (item.ts.bviu5m) {
515
+ result.stat.buyVolumeInUsd5m = this.formatScientificNotation(item.ts.bviu5m);
466
516
  }
467
- if (item.ts.sviu5m !== undefined) {
468
- result.sellVolumeInUsd5m = this.formatScientificNotation(item.ts.sviu5m);
517
+ if (item.ts.sviu5m) {
518
+ result.stat.sellVolumeInUsd5m = this.formatScientificNotation(item.ts.sviu5m);
469
519
  }
470
- if (item.ts.p5m !== undefined) {
471
- result.price5m = this.formatScientificNotation(item.ts.p5m);
520
+ if (item.ts.p5m) {
521
+ result.stat.price5m = this.formatScientificNotation(item.ts.p5m);
472
522
  }
473
- if (item.ts.oiu5m !== undefined) {
474
- result.openInUsd5m = this.formatScientificNotation(item.ts.oiu5m);
523
+ if (item.ts.oiu5m) {
524
+ result.stat.openInUsd5m = this.formatScientificNotation(item.ts.oiu5m);
475
525
  }
476
- if (item.ts.ciu5m !== undefined) {
477
- result.closeInUsd5m = this.formatScientificNotation(item.ts.ciu5m);
526
+ if (item.ts.ciu5m) {
527
+ result.stat.closeInUsd5m = this.formatScientificNotation(item.ts.ciu5m);
478
528
  }
479
- if (item.ts.b15m !== undefined) {
480
- result.buys15m = item.ts.b15m;
529
+ if (item.ts.b15m) {
530
+ result.stat.buys15m = item.ts.b15m;
481
531
  }
482
- if (item.ts.s15m !== undefined) {
483
- result.sells15m = item.ts.s15m;
532
+ if (item.ts.s15m) {
533
+ result.stat.sells15m = item.ts.s15m;
484
534
  }
485
- if (item.ts.be15m !== undefined) {
486
- result.buyers15m = item.ts.be15m;
535
+ if (item.ts.be15m) {
536
+ result.stat.buyers15m = item.ts.be15m;
487
537
  }
488
- if (item.ts.se15m !== undefined) {
489
- result.sellers15m = item.ts.se15m;
538
+ if (item.ts.se15m) {
539
+ result.stat.sellers15m = item.ts.se15m;
490
540
  }
491
- if (item.ts.bviu15m !== undefined) {
492
- result.buyVolumeInUsd15m = this.formatScientificNotation(item.ts.bviu15m);
541
+ if (item.ts.bviu15m) {
542
+ result.stat.buyVolumeInUsd15m = this.formatScientificNotation(item.ts.bviu15m);
493
543
  }
494
- if (item.ts.sviu15m !== undefined) {
495
- result.sellVolumeInUsd15m = this.formatScientificNotation(item.ts.sviu15m);
544
+ if (item.ts.sviu15m) {
545
+ result.stat.sellVolumeInUsd15m = this.formatScientificNotation(item.ts.sviu15m);
496
546
  }
497
- if (item.ts.p15m !== undefined) {
498
- result.price15m = this.formatScientificNotation(item.ts.p15m);
547
+ if (item.ts.p15m) {
548
+ result.stat.price15m = this.formatScientificNotation(item.ts.p15m);
499
549
  }
500
- if (item.ts.oiu15m !== undefined) {
501
- result.openInUsd15m = this.formatScientificNotation(item.ts.oiu15m);
550
+ if (item.ts.oiu15m) {
551
+ result.stat.openInUsd15m = this.formatScientificNotation(item.ts.oiu15m);
502
552
  }
503
- if (item.ts.ciu15m !== undefined) {
504
- result.closeInUsd15m = this.formatScientificNotation(item.ts.ciu15m);
553
+ if (item.ts.ciu15m) {
554
+ result.stat.closeInUsd15m = this.formatScientificNotation(item.ts.ciu15m);
505
555
  }
506
- if (item.ts.b30m !== undefined) {
507
- result.buys30m = item.ts.b30m;
556
+ if (item.ts.b30m) {
557
+ result.stat.buys30m = item.ts.b30m;
508
558
  }
509
- if (item.ts.s30m !== undefined) {
510
- result.sells30m = item.ts.s30m;
559
+ if (item.ts.s30m) {
560
+ result.stat.sells30m = item.ts.s30m;
511
561
  }
512
- if (item.ts.be30m !== undefined) {
513
- result.buyers30m = item.ts.be30m;
562
+ if (item.ts.be30m) {
563
+ result.stat.buyers30m = item.ts.be30m;
514
564
  }
515
- if (item.ts.se30m !== undefined) {
516
- result.sellers30m = item.ts.se30m;
565
+ if (item.ts.se30m) {
566
+ result.stat.sellers30m = item.ts.se30m;
517
567
  }
518
- if (item.ts.bviu30m !== undefined) {
519
- result.buyVolumeInUsd30m = this.formatScientificNotation(item.ts.bviu30m);
568
+ if (item.ts.bviu30m) {
569
+ result.stat.buyVolumeInUsd30m = this.formatScientificNotation(item.ts.bviu30m);
520
570
  }
521
- if (item.ts.sviu30m !== undefined) {
522
- result.sellVolumeInUsd30m = this.formatScientificNotation(item.ts.sviu30m);
571
+ if (item.ts.sviu30m) {
572
+ result.stat.sellVolumeInUsd30m = this.formatScientificNotation(item.ts.sviu30m);
523
573
  }
524
- if (item.ts.p30m !== undefined) {
525
- result.price30m = this.formatScientificNotation(item.ts.p30m);
574
+ if (item.ts.p30m) {
575
+ result.stat.price30m = this.formatScientificNotation(item.ts.p30m);
526
576
  }
527
- if (item.ts.oiu30m !== undefined) {
528
- result.openInUsd30m = this.formatScientificNotation(item.ts.oiu30m);
577
+ if (item.ts.oiu30m) {
578
+ result.stat.openInUsd30m = this.formatScientificNotation(item.ts.oiu30m);
529
579
  }
530
- if (item.ts.ciu30m !== undefined) {
531
- result.closeInUsd30m = this.formatScientificNotation(item.ts.ciu30m);
580
+ if (item.ts.ciu30m) {
581
+ result.stat.closeInUsd30m = this.formatScientificNotation(item.ts.ciu30m);
532
582
  }
533
- if (item.ts.b1h !== undefined) {
534
- result.buys1h = item.ts.b1h;
583
+ if (item.ts.b1h) {
584
+ result.stat.buys1h = item.ts.b1h;
535
585
  }
536
- if (item.ts.s1h !== undefined) {
537
- result.sells1h = item.ts.s1h;
586
+ if (item.ts.s1h) {
587
+ result.stat.sells1h = item.ts.s1h;
538
588
  }
539
- if (item.ts.be1h !== undefined) {
540
- result.buyers1h = item.ts.be1h;
589
+ if (item.ts.be1h) {
590
+ result.stat.buyers1h = item.ts.be1h;
541
591
  }
542
- if (item.ts.se1h !== undefined) {
543
- result.sellers1h = item.ts.se1h;
592
+ if (item.ts.se1h) {
593
+ result.stat.sellers1h = item.ts.se1h;
544
594
  }
545
- if (item.ts.bviu1h !== undefined) {
546
- result.buyVolumeInUsd1h = this.formatScientificNotation(item.ts.bviu1h);
595
+ if (item.ts.bviu1h) {
596
+ result.stat.buyVolumeInUsd1h = this.formatScientificNotation(item.ts.bviu1h);
547
597
  }
548
- if (item.ts.sviu1h !== undefined) {
549
- result.sellVolumeInUsd1h = this.formatScientificNotation(item.ts.sviu1h);
598
+ if (item.ts.sviu1h) {
599
+ result.stat.sellVolumeInUsd1h = this.formatScientificNotation(item.ts.sviu1h);
550
600
  }
551
- if (item.ts.p1h !== undefined) {
552
- result.price1h = this.formatScientificNotation(item.ts.p1h);
601
+ if (item.ts.p1h) {
602
+ result.stat.price1h = this.formatScientificNotation(item.ts.p1h);
553
603
  }
554
- if (item.ts.oiu1h !== undefined) {
555
- result.openInUsd1h = this.formatScientificNotation(item.ts.oiu1h);
604
+ if (item.ts.oiu1h) {
605
+ result.stat.openInUsd1h = this.formatScientificNotation(item.ts.oiu1h);
556
606
  }
557
- if (item.ts.ciu1h !== undefined) {
558
- result.closeInUsd1h = this.formatScientificNotation(item.ts.ciu1h);
607
+ if (item.ts.ciu1h) {
608
+ result.stat.closeInUsd1h = this.formatScientificNotation(item.ts.ciu1h);
559
609
  }
560
- if (item.ts.b4h !== undefined) {
561
- result.buys4h = item.ts.b4h;
610
+ if (item.ts.b4h) {
611
+ result.stat.buys4h = item.ts.b4h;
562
612
  }
563
- if (item.ts.s4h !== undefined) {
564
- result.sells4h = item.ts.s4h;
613
+ if (item.ts.s4h) {
614
+ result.stat.sells4h = item.ts.s4h;
565
615
  }
566
- if (item.ts.be4h !== undefined) {
567
- result.buyers4h = item.ts.be4h;
616
+ if (item.ts.be4h) {
617
+ result.stat.buyers4h = item.ts.be4h;
568
618
  }
569
- if (item.ts.se4h !== undefined) {
570
- result.sellers4h = item.ts.se4h;
619
+ if (item.ts.se4h) {
620
+ result.stat.sellers4h = item.ts.se4h;
571
621
  }
572
- if (item.ts.bviu4h !== undefined) {
573
- result.buyVolumeInUsd4h = this.formatScientificNotation(item.ts.bviu4h);
622
+ if (item.ts.bviu4h) {
623
+ result.stat.buyVolumeInUsd4h = this.formatScientificNotation(item.ts.bviu4h);
574
624
  }
575
- if (item.ts.sviu4h !== undefined) {
576
- result.sellVolumeInUsd4h = this.formatScientificNotation(item.ts.sviu4h);
625
+ if (item.ts.sviu4h) {
626
+ result.stat.sellVolumeInUsd4h = this.formatScientificNotation(item.ts.sviu4h);
577
627
  }
578
- if (item.ts.p4h !== undefined) {
579
- result.price4h = this.formatScientificNotation(item.ts.p4h);
628
+ if (item.ts.p4h) {
629
+ result.stat.price4h = this.formatScientificNotation(item.ts.p4h);
580
630
  }
581
- if (item.ts.oiu4h !== undefined) {
582
- result.openInUsd4h = this.formatScientificNotation(item.ts.oiu4h);
631
+ if (item.ts.oiu4h) {
632
+ result.stat.openInUsd4h = this.formatScientificNotation(item.ts.oiu4h);
583
633
  }
584
- if (item.ts.ciu4h !== undefined) {
585
- result.closeInUsd4h = this.formatScientificNotation(item.ts.ciu4h);
634
+ if (item.ts.ciu4h) {
635
+ result.stat.closeInUsd4h = this.formatScientificNotation(item.ts.ciu4h);
586
636
  }
587
- if (item.ts.b24h !== undefined) {
588
- result.buys24h = item.ts.b24h;
637
+ if (item.ts.b24h) {
638
+ result.stat.buys24h = item.ts.b24h;
589
639
  }
590
- if (item.ts.s24h !== undefined) {
591
- result.sells24h = item.ts.s24h;
640
+ if (item.ts.s24h) {
641
+ result.stat.sells24h = item.ts.s24h;
592
642
  }
593
- if (item.ts.be24h !== undefined) {
594
- result.buyers24h = item.ts.be24h;
643
+ if (item.ts.be24h) {
644
+ result.stat.buyers24h = item.ts.be24h;
595
645
  }
596
- if (item.ts.se24h !== undefined) {
597
- result.sellers24h = item.ts.se24h;
646
+ if (item.ts.se24h) {
647
+ result.stat.sellers24h = item.ts.se24h;
598
648
  }
599
- if (item.ts.bviu24h !== undefined) {
600
- result.buyVolumeInUsd24h = this.formatScientificNotation(item.ts.bviu24h);
649
+ if (item.ts.bviu24h) {
650
+ result.stat.buyVolumeInUsd24h = this.formatScientificNotation(item.ts.bviu24h);
601
651
  }
602
- if (item.ts.sviu24h !== undefined) {
603
- result.sellVolumeInUsd24h = this.formatScientificNotation(item.ts.sviu24h);
652
+ if (item.ts.sviu24h) {
653
+ result.stat.sellVolumeInUsd24h = this.formatScientificNotation(item.ts.sviu24h);
604
654
  }
605
- if (item.ts.p24h !== undefined) {
606
- result.price24h = this.formatScientificNotation(item.ts.p24h);
655
+ if (item.ts.p24h) {
656
+ result.stat.price24h = this.formatScientificNotation(item.ts.p24h);
607
657
  }
608
- if (item.ts.oiu24h !== undefined) {
609
- result.openInUsd24h = this.formatScientificNotation(item.ts.oiu24h);
658
+ if (item.ts.oiu24h) {
659
+ result.stat.openInUsd24h = this.formatScientificNotation(item.ts.oiu24h);
610
660
  }
611
- if (item.ts.ciu24h !== undefined) {
612
- result.closeInUsd24h = this.formatScientificNotation(item.ts.ciu24h);
661
+ if (item.ts.ciu24h) {
662
+ result.stat.closeInUsd24h = this.formatScientificNotation(item.ts.ciu24h);
613
663
  }
614
- if (item.ts.p !== undefined) {
615
- result.price = this.formatScientificNotation(item.ts.p);
664
+ if (item.ts.p) {
665
+ result.stat.price = this.formatScientificNotation(item.ts.p);
616
666
  }
617
667
  }
618
668
  return result;