@icgio/icg-exchanges 1.40.46 → 1.40.47

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.
@@ -305,7 +305,10 @@ module.exports = class Kucoin extends ExchangeBase {
305
305
  })
306
306
  }
307
307
  limit_trade_base(pair, method, price, amount, order_options, cb) {
308
- if (typeof order_options === 'function') { cb = order_options; order_options = {} }
308
+ if (typeof order_options === 'function') {
309
+ cb = order_options
310
+ order_options = {}
311
+ }
309
312
  if (parseFloat(amount) === 0) {
310
313
  cb({ success: false, error: error_codes.amount_too_small })
311
314
  return
@@ -338,7 +341,10 @@ module.exports = class Kucoin extends ExchangeBase {
338
341
  })
339
342
  }
340
343
  limit_trade(pair, method, price, amount, order_options, cb) {
341
- if (typeof order_options === 'function') { cb = order_options; order_options = {} }
344
+ if (typeof order_options === 'function') {
345
+ cb = order_options
346
+ order_options = {}
347
+ }
342
348
  if (parseFloat(amount) === 0) {
343
349
  cb({ success: false, error: error_codes.amount_too_small })
344
350
  return
@@ -474,6 +480,7 @@ module.exports = class Kucoin extends ExchangeBase {
474
480
  .map((t) => {
475
481
  return {
476
482
  order_id: t.orderId.toString(),
483
+ ...(t.tradeId != null ? { trade_id: t.tradeId.toString() } : {}),
477
484
  pair,
478
485
  type: t.side,
479
486
  price: parseFloat(t.price),
@@ -510,6 +517,7 @@ module.exports = class Kucoin extends ExchangeBase {
510
517
  .map((t) => {
511
518
  return {
512
519
  order_id: t.orderId.toString(),
520
+ ...(t.tradeId != null ? { trade_id: t.tradeId.toString() } : {}),
513
521
  pair: post_process_pair(t.symbol),
514
522
  type: t.side,
515
523
  price: parseFloat(t.price),
@@ -550,6 +558,7 @@ module.exports = class Kucoin extends ExchangeBase {
550
558
  let trades = body.data.items.map((o) => {
551
559
  return {
552
560
  order_id: o.orderId.toString(),
561
+ ...(o.tradeId != null ? { trade_id: o.tradeId.toString() } : {}),
553
562
  pair,
554
563
  type: o.side,
555
564
  price: parseFloat(o.price),
@@ -695,15 +704,17 @@ module.exports = class Kucoin extends ExchangeBase {
695
704
  let url = 'https://api.kucoin.com/api/v2/accounts/inner-transfer?' + qs.stringify(params)
696
705
  needle.get(url, options, (err, res, body) => {
697
706
  if (body && body.data && Array.isArray(body.data.items) && body.code === '200000') {
698
- let result = body.data.items.map((t) => this.build_transfer_result({
699
- amount: parseFloat(t.amount),
700
- currency: post_process_cur(t.currency),
701
- from: ACCOUNT_TYPE_MAP[t.from] || t.from,
702
- to: ACCOUNT_TYPE_MAP[t.to] || t.to,
703
- status: t.status === 'SUCCESS' ? 'SUCCESS' : t.status === 'PENDING' ? 'PENDING' : t.status === 'PROCESSING' ? 'PENDING' : t.status,
704
- time: new Date(t.createdAt),
705
- transferId: t.orderId,
706
- }))
707
+ let result = body.data.items.map((t) =>
708
+ this.build_transfer_result({
709
+ amount: parseFloat(t.amount),
710
+ currency: post_process_cur(t.currency),
711
+ from: ACCOUNT_TYPE_MAP[t.from] || t.from,
712
+ to: ACCOUNT_TYPE_MAP[t.to] || t.to,
713
+ status: t.status === 'SUCCESS' ? 'SUCCESS' : t.status === 'PENDING' ? 'PENDING' : t.status === 'PROCESSING' ? 'PENDING' : t.status,
714
+ time: new Date(t.createdAt),
715
+ transferId: t.orderId,
716
+ }),
717
+ )
707
718
  cb({ success: true, body: result })
708
719
  } else if (body && body.code === '429000') {
709
720
  cb({ success: false, error: error_codes.service_unavailable, body })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-exchanges",
3
- "version": "1.40.46",
3
+ "version": "1.40.47",
4
4
  "description": "icgio exchanges package",
5
5
  "main": "./exchanges.js",
6
6
  "scripts": {