ccxt 4.2.45 → 4.2.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.
Files changed (90) hide show
  1. package/CHANGELOG.md +5405 -8414
  2. package/README.md +4 -4
  3. package/change.sh +5 -3
  4. package/dist/ccxt.browser.js +824 -64
  5. package/dist/ccxt.browser.min.js +7 -7
  6. package/dist/cjs/ccxt.js +1 -1
  7. package/dist/cjs/src/base/ws/Cache.js +13 -5
  8. package/dist/cjs/src/base/ws/OrderBook.js +2 -2
  9. package/dist/cjs/src/binance.js +34 -12
  10. package/dist/cjs/src/bitfinex2.js +1 -0
  11. package/dist/cjs/src/bithumb.js +5 -0
  12. package/dist/cjs/src/btcturk.js +11 -0
  13. package/dist/cjs/src/bybit.js +185 -2
  14. package/dist/cjs/src/coinbase.js +9 -5
  15. package/dist/cjs/src/coincheck.js +11 -0
  16. package/dist/cjs/src/coinmate.js +114 -1
  17. package/dist/cjs/src/coinsph.js +32 -1
  18. package/dist/cjs/src/coinspot.js +7 -0
  19. package/dist/cjs/src/cryptocom.js +2 -2
  20. package/dist/cjs/src/currencycom.js +22 -0
  21. package/dist/cjs/src/deribit.js +34 -1
  22. package/dist/cjs/src/exmo.js +22 -0
  23. package/dist/cjs/src/gemini.js +15 -0
  24. package/dist/cjs/src/hitbtc.js +2 -0
  25. package/dist/cjs/src/hollaex.js +27 -1
  26. package/dist/cjs/src/idex.js +60 -1
  27. package/dist/cjs/src/indodax.js +106 -1
  28. package/dist/cjs/src/latoken.js +3 -0
  29. package/dist/cjs/src/mercado.js +3 -0
  30. package/dist/cjs/src/oceanex.js +3 -0
  31. package/dist/cjs/src/okx.js +1 -0
  32. package/dist/cjs/src/pro/bitget.js +12 -8
  33. package/dist/cjs/src/pro/bitmart.js +11 -11
  34. package/dist/cjs/src/pro/bitmex.js +4 -4
  35. package/dist/cjs/src/pro/cex.js +2 -2
  36. package/dist/cjs/src/pro/gemini.js +4 -3
  37. package/dist/cjs/src/timex.js +65 -0
  38. package/js/ccxt.d.ts +1 -1
  39. package/js/ccxt.js +1 -1
  40. package/js/src/abstract/bequant.d.ts +2 -0
  41. package/js/src/abstract/bitcoincom.d.ts +2 -0
  42. package/js/src/abstract/bithumb.d.ts +5 -0
  43. package/js/src/abstract/coinmate.d.ts +12 -0
  44. package/js/src/abstract/fmfwio.d.ts +2 -0
  45. package/js/src/abstract/hitbtc.d.ts +2 -0
  46. package/js/src/abstract/hitbtc3.d.ts +2 -0
  47. package/js/src/abstract/hollaex.d.ts +3 -0
  48. package/js/src/abstract/okx.d.ts +1 -0
  49. package/js/src/base/Exchange.d.ts +9 -7
  50. package/js/src/base/ws/Cache.d.ts +5 -1
  51. package/js/src/base/ws/Cache.js +13 -5
  52. package/js/src/base/ws/OrderBook.d.ts +5 -1
  53. package/js/src/base/ws/OrderBook.js +3 -3
  54. package/js/src/binance.d.ts +1 -1
  55. package/js/src/binance.js +34 -12
  56. package/js/src/bitfinex2.js +1 -0
  57. package/js/src/bithumb.js +5 -0
  58. package/js/src/btcturk.js +11 -0
  59. package/js/src/bybit.d.ts +2 -0
  60. package/js/src/bybit.js +185 -2
  61. package/js/src/coinbase.js +9 -5
  62. package/js/src/coincheck.js +11 -0
  63. package/js/src/coinmate.d.ts +3 -1
  64. package/js/src/coinmate.js +114 -1
  65. package/js/src/coinsph.js +32 -1
  66. package/js/src/coinspot.js +7 -0
  67. package/js/src/cryptocom.js +2 -2
  68. package/js/src/currencycom.js +22 -0
  69. package/js/src/deribit.js +34 -1
  70. package/js/src/exmo.js +22 -0
  71. package/js/src/gemini.js +15 -0
  72. package/js/src/hitbtc.js +2 -0
  73. package/js/src/hollaex.js +27 -1
  74. package/js/src/idex.d.ts +14 -0
  75. package/js/src/idex.js +60 -1
  76. package/js/src/indodax.d.ts +3 -0
  77. package/js/src/indodax.js +106 -1
  78. package/js/src/latoken.js +3 -0
  79. package/js/src/mercado.js +3 -0
  80. package/js/src/oceanex.js +3 -0
  81. package/js/src/okx.js +1 -0
  82. package/js/src/pro/bitget.js +12 -8
  83. package/js/src/pro/bitmart.js +11 -11
  84. package/js/src/pro/bitmex.js +4 -4
  85. package/js/src/pro/cex.js +2 -2
  86. package/js/src/pro/gemini.js +4 -3
  87. package/js/src/timex.d.ts +14 -0
  88. package/js/src/timex.js +65 -0
  89. package/package.json +1 -1
  90. package/skip-tests.json +4 -0
package/js/src/bybit.js CHANGED
@@ -4482,11 +4482,194 @@ export default class bybit extends Exchange {
4482
4482
  const data = this.safeValue(result, 'dataList', []);
4483
4483
  return this.parseOrders(data, market, since, limit);
4484
4484
  }
4485
+ async fetchOrderClassic(id, symbol = undefined, params = {}) {
4486
+ /**
4487
+ * @method
4488
+ * @name bybit#fetchOrderClassic
4489
+ * @description fetches information on an order made by the user *classic accounts only*
4490
+ * @see https://bybit-exchange.github.io/docs/v5/order/order-list
4491
+ * @param {string} symbol unified symbol of the market the order was made in
4492
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4493
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
4494
+ */
4495
+ if (symbol === undefined) {
4496
+ throw new ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
4497
+ }
4498
+ await this.loadMarkets();
4499
+ const market = this.market(symbol);
4500
+ if (market['spot']) {
4501
+ throw new NotSupported(this.id + ' fetchOrder() is not supported for spot markets');
4502
+ }
4503
+ const request = {
4504
+ 'orderId': id,
4505
+ };
4506
+ const result = await this.fetchOrders(symbol, undefined, undefined, this.extend(request, params));
4507
+ const length = result.length;
4508
+ if (length === 0) {
4509
+ const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
4510
+ const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
4511
+ throw new OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
4512
+ }
4513
+ if (length > 1) {
4514
+ throw new InvalidOrder(this.id + ' returned more than one order');
4515
+ }
4516
+ return this.safeValue(result, 0);
4517
+ }
4485
4518
  async fetchOrder(id, symbol = undefined, params = {}) {
4486
- throw new NotSupported(this.id + ' fetchOrder() is not supported after the 5/02 update, please use fetchOpenOrder or fetchClosedOrder');
4519
+ /**
4520
+ * @method
4521
+ * @name bybit#fetchOrderClassic
4522
+ * @description *classic accounts only/ spot not supported* fetches information on an order made by the user *classic accounts only*
4523
+ * @see https://bybit-exchange.github.io/docs/v5/order/order-list
4524
+ * @param {string} symbol unified symbol of the market the order was made in
4525
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4526
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
4527
+ */
4528
+ const res = await this.isUnifiedEnabled();
4529
+ const enableUnifiedAccount = this.safeBool(res, 1);
4530
+ if (enableUnifiedAccount) {
4531
+ throw new NotSupported(this.id + ' fetchOrder() is not supported after the 5/02 update for UTA accounts, please use fetchOpenOrder or fetchClosedOrder');
4532
+ }
4533
+ return await this.fetchOrderClassic(id, symbol, params);
4487
4534
  }
4488
4535
  async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
4489
- throw new NotSupported(this.id + ' fetchOrders() is not supported after the 5/02 update, please use fetchOpenOrders, fetchClosedOrders or fetchCanceledOrders');
4536
+ const res = await this.isUnifiedEnabled();
4537
+ /**
4538
+ * @method
4539
+ * @name bybit#fetchOrders
4540
+ * @description *classic accounts only/ spot not supported* fetches information on multiple orders made by the user *classic accounts only/ spot not supported*
4541
+ * @see https://bybit-exchange.github.io/docs/v5/order/order-list
4542
+ * @param {string} symbol unified market symbol of the market orders were made in
4543
+ * @param {int} [since] the earliest time in ms to fetch orders for
4544
+ * @param {int} [limit] the maximum number of order structures to retrieve
4545
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4546
+ * @param {boolean} [params.stop] true if stop order
4547
+ * @param {string} [params.type] market type, ['swap', 'option']
4548
+ * @param {string} [params.subType] market subType, ['linear', 'inverse']
4549
+ * @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
4550
+ * @param {int} [params.until] the latest time in ms to fetch entries for
4551
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
4552
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
4553
+ */
4554
+ const enableUnifiedAccount = this.safeBool(res, 1);
4555
+ if (enableUnifiedAccount) {
4556
+ throw new NotSupported(this.id + ' fetchOrders() is not supported after the 5/02 update for UTA accounts, please use fetchOpenOrders, fetchClosedOrders or fetchCanceledOrders');
4557
+ }
4558
+ return await this.fetchOrdersClassic(symbol, since, limit, params);
4559
+ }
4560
+ async fetchOrdersClassic(symbol = undefined, since = undefined, limit = undefined, params = {}) {
4561
+ /**
4562
+ * @method
4563
+ * @name bybit#fetchOrders
4564
+ * @description fetches information on multiple orders made by the user *classic accounts only*
4565
+ * @see https://bybit-exchange.github.io/docs/v5/order/order-list
4566
+ * @param {string} symbol unified market symbol of the market orders were made in
4567
+ * @param {int} [since] the earliest time in ms to fetch orders for
4568
+ * @param {int} [limit] the maximum number of order structures to retrieve
4569
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4570
+ * @param {boolean} [params.stop] true if stop order
4571
+ * @param {string} [params.type] market type, ['swap', 'option', 'spot']
4572
+ * @param {string} [params.subType] market subType, ['linear', 'inverse']
4573
+ * @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
4574
+ * @param {int} [params.until] the latest time in ms to fetch entries for
4575
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
4576
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
4577
+ */
4578
+ await this.loadMarkets();
4579
+ let paginate = false;
4580
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
4581
+ if (paginate) {
4582
+ return await this.fetchPaginatedCallCursor('fetchOrders', symbol, since, limit, params, 'nextPageCursor', 'nextPageCursor', undefined, 50);
4583
+ }
4584
+ const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
4585
+ const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
4586
+ const request = {};
4587
+ let market = undefined;
4588
+ let isUsdcSettled = false;
4589
+ if (symbol !== undefined) {
4590
+ market = this.market(symbol);
4591
+ isUsdcSettled = market['settle'] === 'USDC';
4592
+ request['symbol'] = market['id'];
4593
+ }
4594
+ let type = undefined;
4595
+ [type, params] = this.getBybitType('fetchOrders', market, params);
4596
+ if (((type === 'option') || isUsdcSettled) && !isUnifiedAccount) {
4597
+ return await this.fetchUsdcOrders(symbol, since, limit, params);
4598
+ }
4599
+ if (type === 'spot') {
4600
+ throw new NotSupported(this.id + ' fetchOrders() is not supported for spot markets');
4601
+ }
4602
+ request['category'] = type;
4603
+ const isStop = this.safeBoolN(params, ['trigger', 'stop'], false);
4604
+ params = this.omit(params, ['trigger', 'stop']);
4605
+ if (isStop) {
4606
+ request['orderFilter'] = 'StopOrder';
4607
+ }
4608
+ if (limit !== undefined) {
4609
+ request['limit'] = limit;
4610
+ }
4611
+ if (since !== undefined) {
4612
+ request['startTime'] = since;
4613
+ }
4614
+ const until = this.safeInteger2(params, 'until', 'till'); // unified in milliseconds
4615
+ const endTime = this.safeInteger(params, 'endTime', until); // exchange-specific in milliseconds
4616
+ params = this.omit(params, ['endTime', 'till', 'until']);
4617
+ if (endTime !== undefined) {
4618
+ request['endTime'] = endTime;
4619
+ }
4620
+ const response = await this.privateGetV5OrderHistory(this.extend(request, params));
4621
+ //
4622
+ // {
4623
+ // "retCode": 0,
4624
+ // "retMsg": "OK",
4625
+ // "result": {
4626
+ // "nextPageCursor": "03234de9-1332-41eb-b805-4a9f42c136a3%3A1672220109387%2C03234de9-1332-41eb-b805-4a9f42c136a3%3A1672220109387",
4627
+ // "category": "linear",
4628
+ // "list": [
4629
+ // {
4630
+ // "symbol": "BTCUSDT",
4631
+ // "orderType": "Limit",
4632
+ // "orderLinkId": "test-001",
4633
+ // "orderId": "03234de9-1332-41eb-b805-4a9f42c136a3",
4634
+ // "cancelType": "CancelByUser",
4635
+ // "avgPrice": "0",
4636
+ // "stopOrderType": "UNKNOWN",
4637
+ // "lastPriceOnCreated": "16656.5",
4638
+ // "orderStatus": "Cancelled",
4639
+ // "takeProfit": "",
4640
+ // "cumExecValue": "0",
4641
+ // "triggerDirection": 0,
4642
+ // "blockTradeId": "",
4643
+ // "rejectReason": "EC_PerCancelRequest",
4644
+ // "isLeverage": "",
4645
+ // "price": "18000",
4646
+ // "orderIv": "",
4647
+ // "createdTime": "1672220109387",
4648
+ // "tpTriggerBy": "UNKNOWN",
4649
+ // "positionIdx": 0,
4650
+ // "timeInForce": "GoodTillCancel",
4651
+ // "leavesValue": "0",
4652
+ // "updatedTime": "1672220114123",
4653
+ // "side": "Sell",
4654
+ // "triggerPrice": "",
4655
+ // "cumExecFee": "0",
4656
+ // "slTriggerBy": "UNKNOWN",
4657
+ // "leavesQty": "0",
4658
+ // "closeOnTrigger": false,
4659
+ // "cumExecQty": "0",
4660
+ // "reduceOnly": false,
4661
+ // "qty": "0.1",
4662
+ // "stopLoss": "",
4663
+ // "triggerBy": "UNKNOWN"
4664
+ // }
4665
+ // ]
4666
+ // },
4667
+ // "retExtInfo": {},
4668
+ // "time": 1672221263862
4669
+ // }
4670
+ //
4671
+ const data = this.addPaginationCursorToResult(response);
4672
+ return this.parseOrders(data, market, since, limit);
4490
4673
  }
4491
4674
  async fetchClosedOrder(id, symbol = undefined, params = {}) {
4492
4675
  /**
@@ -65,6 +65,8 @@ export default class coinbase extends Exchange {
65
65
  'fetchCrossBorrowRate': false,
66
66
  'fetchCrossBorrowRates': false,
67
67
  'fetchCurrencies': true,
68
+ 'fetchDepositAddress': 'emulated',
69
+ 'fetchDepositAddresses': false,
68
70
  'fetchDepositAddressesByNetwork': true,
69
71
  'fetchDeposits': true,
70
72
  'fetchFundingHistory': false,
@@ -1743,17 +1745,18 @@ export default class coinbase extends Exchange {
1743
1745
  * @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-accounts#list-accounts
1744
1746
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1745
1747
  * @param {boolean} [params.v3] default false, set true to use v3 api endpoint
1748
+ * @param {object} [params.type] "spot" (default) or "swap"
1746
1749
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
1747
1750
  */
1748
1751
  await this.loadMarkets();
1749
- const request = {
1750
- 'limit': 250,
1751
- };
1752
+ const request = {};
1752
1753
  let response = undefined;
1753
1754
  const isV3 = this.safeBool(params, 'v3', false);
1754
- params = this.omit(params, 'v3');
1755
+ const type = this.safeString(params, 'type');
1756
+ params = this.omit(params, ['v3', 'type']);
1755
1757
  const method = this.safeString(this.options, 'fetchBalance', 'v3PrivateGetBrokerageAccounts');
1756
1758
  if ((isV3) || (method === 'v3PrivateGetBrokerageAccounts')) {
1759
+ request['limit'] = 250;
1757
1760
  response = await this.v3PrivateGetBrokerageAccounts(this.extend(request, params));
1758
1761
  }
1759
1762
  else {
@@ -1830,6 +1833,7 @@ export default class coinbase extends Exchange {
1830
1833
  // "size": 9
1831
1834
  // }
1832
1835
  //
1836
+ params['type'] = type;
1833
1837
  return this.parseCustomBalance(response, params);
1834
1838
  }
1835
1839
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
@@ -3404,7 +3408,7 @@ export default class coinbase extends Exchange {
3404
3408
  async fetchDepositAddressesByNetwork(code, params = {}) {
3405
3409
  /**
3406
3410
  * @method
3407
- * @name ascendex#fetchDepositAddress
3411
+ * @name coinbase#fetchDepositAddress
3408
3412
  * @description fetch the deposit address for a currency associated with this account
3409
3413
  * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postcoinbaseaccountaddresses
3410
3414
  * @param {string} code unified currency code
@@ -192,6 +192,7 @@ export default class coincheck extends Exchange {
192
192
  * @method
193
193
  * @name coincheck#fetchBalance
194
194
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
195
+ * @see https://coincheck.com/documents/exchange/api#order-transactions-pagination
195
196
  * @param {object} [params] extra parameters specific to the exchange API endpoint
196
197
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
197
198
  */
@@ -204,6 +205,7 @@ export default class coincheck extends Exchange {
204
205
  * @method
205
206
  * @name coincheck#fetchOpenOrders
206
207
  * @description fetch all unfilled currently open orders
208
+ * @see https://coincheck.com/documents/exchange/api#order-opens
207
209
  * @param {string} symbol unified market symbol
208
210
  * @param {int} [since] the earliest time in ms to fetch open orders for
209
211
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -279,6 +281,7 @@ export default class coincheck extends Exchange {
279
281
  * @method
280
282
  * @name coincheck#fetchOrderBook
281
283
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
284
+ * @see https://coincheck.com/documents/exchange/api#order-book
282
285
  * @param {string} symbol unified symbol of the market to fetch the order book for
283
286
  * @param {int} [limit] the maximum amount of order book entries to return
284
287
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -335,6 +338,7 @@ export default class coincheck extends Exchange {
335
338
  * @method
336
339
  * @name coincheck#fetchTicker
337
340
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
341
+ * @see https://coincheck.com/documents/exchange/api#ticker
338
342
  * @param {string} symbol unified symbol of the market to fetch the ticker for
339
343
  * @param {object} [params] extra parameters specific to the exchange API endpoint
340
344
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -448,6 +452,7 @@ export default class coincheck extends Exchange {
448
452
  * @method
449
453
  * @name coincheck#fetchMyTrades
450
454
  * @description fetch all trades made by the user
455
+ * @see https://coincheck.com/documents/exchange/api#order-transactions-pagination
451
456
  * @param {string} symbol unified market symbol
452
457
  * @param {int} [since] the earliest time in ms to fetch trades for
453
458
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -491,6 +496,7 @@ export default class coincheck extends Exchange {
491
496
  * @method
492
497
  * @name coincheck#fetchTrades
493
498
  * @description get the list of most recent trades for a particular symbol
499
+ * @see https://coincheck.com/documents/exchange/api#public-trades
494
500
  * @param {string} symbol unified symbol of the market to fetch trades for
495
501
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
496
502
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -524,6 +530,7 @@ export default class coincheck extends Exchange {
524
530
  * @method
525
531
  * @name coincheck#fetchTradingFees
526
532
  * @description fetch the trading fees for multiple markets
533
+ * @see https://coincheck.com/documents/exchange/api#account-info
527
534
  * @param {object} [params] extra parameters specific to the exchange API endpoint
528
535
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
529
536
  */
@@ -570,6 +577,7 @@ export default class coincheck extends Exchange {
570
577
  * @method
571
578
  * @name coincheck#createOrder
572
579
  * @description create a trade order
580
+ * @see https://coincheck.com/documents/exchange/api#order-new
573
581
  * @param {string} symbol unified symbol of the market to create an order in
574
582
  * @param {string} type 'market' or 'limit'
575
583
  * @param {string} side 'buy' or 'sell'
@@ -606,6 +614,7 @@ export default class coincheck extends Exchange {
606
614
  * @method
607
615
  * @name coincheck#cancelOrder
608
616
  * @description cancels an open order
617
+ * @see https://coincheck.com/documents/exchange/api#order-cancel
609
618
  * @param {string} id order id
610
619
  * @param {string} symbol not used by coincheck cancelOrder ()
611
620
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -621,6 +630,7 @@ export default class coincheck extends Exchange {
621
630
  * @method
622
631
  * @name coincheck#fetchDeposits
623
632
  * @description fetch all deposits made to an account
633
+ * @see https://coincheck.com/documents/exchange/api#account-deposits
624
634
  * @param {string} code unified currency code
625
635
  * @param {int} [since] the earliest time in ms to fetch deposits for
626
636
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -669,6 +679,7 @@ export default class coincheck extends Exchange {
669
679
  * @method
670
680
  * @name coincheck#fetchWithdrawals
671
681
  * @description fetch all withdrawals made from an account
682
+ * @see https://coincheck.com/documents/exchange/api#withdraws
672
683
  * @param {string} code unified currency code
673
684
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
674
685
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/coinmate.js';
2
- import type { Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, Transaction } from './base/types.js';
2
+ import type { Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction } from './base/types.js';
3
3
  /**
4
4
  * @class coinmate
5
5
  * @augments Exchange
@@ -11,6 +11,8 @@ export default class coinmate extends Exchange {
11
11
  fetchBalance(params?: {}): Promise<Balances>;
12
12
  fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
13
13
  fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
14
+ fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
15
+ parseTicker(ticker: any, market?: Market): Ticker;
14
16
  fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
15
17
  parseTransactionStatus(status: any): string;
16
18
  parseTransaction(transaction: any, currency?: Currency): Transaction;
@@ -65,6 +65,7 @@ export default class coinmate extends Exchange {
65
65
  'fetchPositionsRisk': false,
66
66
  'fetchPremiumIndexOHLCV': false,
67
67
  'fetchTicker': true,
68
+ 'fetchTickers': true,
68
69
  'fetchTrades': true,
69
70
  'fetchTradingFee': true,
70
71
  'fetchTradingFees': false,
@@ -99,6 +100,8 @@ export default class coinmate extends Exchange {
99
100
  'get': [
100
101
  'orderBook',
101
102
  'ticker',
103
+ 'tickerAll',
104
+ 'products',
102
105
  'transactions',
103
106
  'tradingPairs',
104
107
  ],
@@ -147,6 +150,16 @@ export default class coinmate extends Exchange {
147
150
  'unconfirmedEthereumDeposits',
148
151
  'unconfirmedLitecoinDeposits',
149
152
  'unconfirmedRippleDeposits',
153
+ 'cancelAllOpenOrders',
154
+ 'withdrawVirtualCurrency',
155
+ 'virtualCurrencyDepositAddresses',
156
+ 'unconfirmedVirtualCurrencyDeposits',
157
+ 'adaWithdrawal',
158
+ 'adaDepositAddresses',
159
+ 'unconfirmedAdaDeposits',
160
+ 'solWithdrawal',
161
+ 'solDepositAddresses',
162
+ 'unconfirmedSolDeposits',
150
163
  ],
151
164
  },
152
165
  },
@@ -191,6 +204,8 @@ export default class coinmate extends Exchange {
191
204
  'XRP': 'privatePostRippleWithdrawal',
192
205
  'DASH': 'privatePostDashWithdrawal',
193
206
  'DAI': 'privatePostDaiWithdrawal',
207
+ 'ADA': 'privatePostAdaWithdrawal',
208
+ 'SOL': 'privatePostSolWithdrawal',
194
209
  },
195
210
  },
196
211
  },
@@ -215,6 +230,7 @@ export default class coinmate extends Exchange {
215
230
  * @method
216
231
  * @name coinmate#fetchMarkets
217
232
  * @description retrieves data on all markets for coinmate
233
+ * @see https://coinmate.docs.apiary.io/#reference/trading-pairs/get-trading-pairs/get
218
234
  * @param {object} [params] extra parameters specific to the exchange API endpoint
219
235
  * @returns {object[]} an array of objects representing market data
220
236
  */
@@ -321,6 +337,7 @@ export default class coinmate extends Exchange {
321
337
  * @method
322
338
  * @name coinmate#fetchBalance
323
339
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
340
+ * @see https://coinmate.docs.apiary.io/#reference/balance/get-balances/post
324
341
  * @param {object} [params] extra parameters specific to the exchange API endpoint
325
342
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
326
343
  */
@@ -333,6 +350,7 @@ export default class coinmate extends Exchange {
333
350
  * @method
334
351
  * @name coinmate#fetchOrderBook
335
352
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
353
+ * @see https://coinmate.docs.apiary.io/#reference/order-book/get-order-book/get
336
354
  * @param {string} symbol unified symbol of the market to fetch the order book for
337
355
  * @param {int} [limit] the maximum amount of order book entries to return
338
356
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -354,6 +372,7 @@ export default class coinmate extends Exchange {
354
372
  * @method
355
373
  * @name coinmate#fetchTicker
356
374
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
375
+ * @see https://coinmate.docs.apiary.io/#reference/ticker/get-ticker/get
357
376
  * @param {string} symbol unified symbol of the market to fetch the ticker for
358
377
  * @param {object} [params] extra parameters specific to the exchange API endpoint
359
378
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -364,7 +383,82 @@ export default class coinmate extends Exchange {
364
383
  'currencyPair': market['id'],
365
384
  };
366
385
  const response = await this.publicGetTicker(this.extend(request, params));
367
- const ticker = this.safeValue(response, 'data');
386
+ //
387
+ // {
388
+ // "error": false,
389
+ // "errorMessage": null,
390
+ // "data": {
391
+ // "last": 0.55105,
392
+ // "high": 0.56439,
393
+ // "low": 0.54358,
394
+ // "amount": 37038.993381,
395
+ // "bid": 0.54595,
396
+ // "ask": 0.55324,
397
+ // "change": 3.03659243,
398
+ // "open": 0.53481,
399
+ // "timestamp": 1708074779
400
+ // }
401
+ // }
402
+ //
403
+ const data = this.safeValue(response, 'data');
404
+ return this.parseTicker(data, market);
405
+ }
406
+ async fetchTickers(symbols = undefined, params = {}) {
407
+ /**
408
+ * @method
409
+ * @name coinmate#fetchTickers
410
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
411
+ * @see https://coinmate.docs.apiary.io/#reference/ticker/get-ticker-all/get
412
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
413
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
414
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
415
+ */
416
+ await this.loadMarkets();
417
+ symbols = this.marketSymbols(symbols);
418
+ const response = await this.publicGetTickerAll(params);
419
+ //
420
+ // {
421
+ // "error": false,
422
+ // "errorMessage": null,
423
+ // "data": {
424
+ // "LTC_BTC": {
425
+ // "last": "0.001337",
426
+ // "high": "0.001348",
427
+ // "low": "0.001332",
428
+ // "amount": "34.75472959",
429
+ // "bid": "0.001348",
430
+ // "ask": "0.001356",
431
+ // "change": "-0.74239050",
432
+ // "open": "0.001347",
433
+ // "timestamp": "1708074485"
434
+ // }
435
+ // }
436
+ // }
437
+ //
438
+ const data = this.safeValue(response, 'data', {});
439
+ const keys = Object.keys(data);
440
+ const result = {};
441
+ for (let i = 0; i < keys.length; i++) {
442
+ const market = this.market(keys[i]);
443
+ const ticker = this.parseTicker(this.safeValue(data, keys[i]), market);
444
+ result[market['symbol']] = ticker;
445
+ }
446
+ return this.filterByArrayTickers(result, 'symbol', symbols);
447
+ }
448
+ parseTicker(ticker, market = undefined) {
449
+ //
450
+ // {
451
+ // "last": "0.001337",
452
+ // "high": "0.001348",
453
+ // "low": "0.001332",
454
+ // "amount": "34.75472959",
455
+ // "bid": "0.001348",
456
+ // "ask": "0.001356",
457
+ // "change": "-0.74239050",
458
+ // "open": "0.001347",
459
+ // "timestamp": "1708074485"
460
+ // }
461
+ //
368
462
  const timestamp = this.safeTimestamp(ticker, 'timestamp');
369
463
  const last = this.safeNumber(ticker, 'last');
370
464
  return this.safeTicker({
@@ -395,6 +489,7 @@ export default class coinmate extends Exchange {
395
489
  * @method
396
490
  * @name coinmate#fetchDepositsWithdrawals
397
491
  * @description fetch history of deposits and withdrawals
492
+ * @see https://coinmate.docs.apiary.io/#reference/transfers/get-transfer-history/post
398
493
  * @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
399
494
  * @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
400
495
  * @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
@@ -507,6 +602,12 @@ export default class coinmate extends Exchange {
507
602
  * @method
508
603
  * @name coinmate#withdraw
509
604
  * @description make a withdrawal
605
+ * @see https://coinmate.docs.apiary.io/#reference/bitcoin-withdrawal-and-deposit/withdraw-bitcoins/post
606
+ * @see https://coinmate.docs.apiary.io/#reference/litecoin-withdrawal-and-deposit/withdraw-litecoins/post
607
+ * @see https://coinmate.docs.apiary.io/#reference/ethereum-withdrawal-and-deposit/withdraw-ethereum/post
608
+ * @see https://coinmate.docs.apiary.io/#reference/ripple-withdrawal-and-deposit/withdraw-ripple/post
609
+ * @see https://coinmate.docs.apiary.io/#reference/cardano-withdrawal-and-deposit/withdraw-cardano/post
610
+ * @see https://coinmate.docs.apiary.io/#reference/solana-withdrawal-and-deposit/withdraw-solana/post
510
611
  * @param {string} code unified currency code
511
612
  * @param {float} amount the amount to withdraw
512
613
  * @param {string} address the address to withdraw to
@@ -560,6 +661,7 @@ export default class coinmate extends Exchange {
560
661
  * @method
561
662
  * @name coinmate#fetchMyTrades
562
663
  * @description fetch all trades made by the user
664
+ * @see https://coinmate.docs.apiary.io/#reference/trade-history/get-trade-history/post
563
665
  * @param {string} symbol unified market symbol
564
666
  * @param {int} [since] the earliest time in ms to fetch trades for
565
667
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -652,6 +754,7 @@ export default class coinmate extends Exchange {
652
754
  * @method
653
755
  * @name coinmate#fetchTrades
654
756
  * @description get the list of most recent trades for a particular symbol
757
+ * @see https://coinmate.docs.apiary.io/#reference/transactions/transactions/get
655
758
  * @param {string} symbol unified symbol of the market to fetch trades for
656
759
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
657
760
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -689,6 +792,7 @@ export default class coinmate extends Exchange {
689
792
  * @method
690
793
  * @name coinmate#fetchTradingFee
691
794
  * @description fetch the trading fees for a market
795
+ * @see https://coinmate.docs.apiary.io/#reference/trader-fees/get-trading-fees/post
692
796
  * @param {string} symbol unified market symbol
693
797
  * @param {object} [params] extra parameters specific to the exchange API endpoint
694
798
  * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
@@ -725,6 +829,7 @@ export default class coinmate extends Exchange {
725
829
  * @method
726
830
  * @name coinmate#fetchOpenOrders
727
831
  * @description fetch all unfilled currently open orders
832
+ * @see https://coinmate.docs.apiary.io/#reference/order/get-open-orders/post
728
833
  * @param {string} symbol unified market symbol
729
834
  * @param {int} [since] the earliest time in ms to fetch open orders for
730
835
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -740,6 +845,7 @@ export default class coinmate extends Exchange {
740
845
  * @method
741
846
  * @name coinmate#fetchOrders
742
847
  * @description fetches information on multiple orders made by the user
848
+ * @see https://coinmate.docs.apiary.io/#reference/order/order-history/post
743
849
  * @param {string} symbol unified market symbol of the market orders were made in
744
850
  * @param {int} [since] the earliest time in ms to fetch orders for
745
851
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -863,6 +969,10 @@ export default class coinmate extends Exchange {
863
969
  * @method
864
970
  * @name coinmate#createOrder
865
971
  * @description create a trade order
972
+ * @see https://coinmate.docs.apiary.io/#reference/order/buy-limit-order/post
973
+ * @see https://coinmate.docs.apiary.io/#reference/order/sell-limit-order/post
974
+ * @see https://coinmate.docs.apiary.io/#reference/order/buy-instant-order/post
975
+ * @see https://coinmate.docs.apiary.io/#reference/order/sell-instant-order/post
866
976
  * @param {string} symbol unified symbol of the market to create an order in
867
977
  * @param {string} type 'market' or 'limit'
868
978
  * @param {string} side 'buy' or 'sell'
@@ -903,6 +1013,8 @@ export default class coinmate extends Exchange {
903
1013
  * @method
904
1014
  * @name coinmate#fetchOrder
905
1015
  * @description fetches information on an order made by the user
1016
+ * @see https://coinmate.docs.apiary.io/#reference/order/get-order-by-orderid/post
1017
+ * @see https://coinmate.docs.apiary.io/#reference/order/get-order-by-clientorderid/post
906
1018
  * @param {string} symbol unified symbol of the market the order was made in
907
1019
  * @param {object} [params] extra parameters specific to the exchange API endpoint
908
1020
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -924,6 +1036,7 @@ export default class coinmate extends Exchange {
924
1036
  * @method
925
1037
  * @name coinmate#cancelOrder
926
1038
  * @description cancels an open order
1039
+ * @see https://coinmate.docs.apiary.io/#reference/order/cancel-order/post
927
1040
  * @param {string} id order id
928
1041
  * @param {string} symbol not used by coinmate cancelOrder ()
929
1042
  * @param {object} [params] extra parameters specific to the exchange API endpoint