ccxt 4.3.56 → 4.3.58

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 (47) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/alpaca.js +5 -1
  5. package/dist/cjs/src/base/ws/Client.js +34 -4
  6. package/dist/cjs/src/bigone.js +21 -1
  7. package/dist/cjs/src/bingx.js +127 -27
  8. package/dist/cjs/src/bitget.js +56 -47
  9. package/dist/cjs/src/coinmate.js +28 -35
  10. package/dist/cjs/src/coinone.js +13 -19
  11. package/dist/cjs/src/gate.js +117 -4
  12. package/dist/cjs/src/htx.js +91 -26
  13. package/dist/cjs/src/huobijp.js +65 -2
  14. package/dist/cjs/src/kucoin.js +3 -0
  15. package/dist/cjs/src/latoken.js +5 -1
  16. package/dist/cjs/src/okx.js +3 -0
  17. package/dist/cjs/src/pro/okx.js +3 -3
  18. package/dist/cjs/src/woo.js +1 -1
  19. package/js/ccxt.d.ts +1 -1
  20. package/js/ccxt.js +1 -1
  21. package/js/src/abstract/kucoin.d.ts +1 -0
  22. package/js/src/abstract/kucoinfutures.d.ts +1 -0
  23. package/js/src/alpaca.d.ts +1 -1
  24. package/js/src/alpaca.js +5 -1
  25. package/js/src/base/ws/Client.d.ts +2 -0
  26. package/js/src/base/ws/Client.js +34 -4
  27. package/js/src/bigone.d.ts +1 -1
  28. package/js/src/bigone.js +21 -1
  29. package/js/src/bingx.d.ts +1 -0
  30. package/js/src/bingx.js +127 -27
  31. package/js/src/bitget.d.ts +1 -1
  32. package/js/src/bitget.js +56 -47
  33. package/js/src/coinmate.js +28 -35
  34. package/js/src/coinone.js +13 -19
  35. package/js/src/gate.d.ts +3 -1
  36. package/js/src/gate.js +117 -4
  37. package/js/src/htx.d.ts +3 -2
  38. package/js/src/htx.js +91 -26
  39. package/js/src/huobijp.d.ts +3 -2
  40. package/js/src/huobijp.js +65 -2
  41. package/js/src/kucoin.js +3 -0
  42. package/js/src/latoken.d.ts +1 -1
  43. package/js/src/latoken.js +5 -1
  44. package/js/src/okx.js +3 -0
  45. package/js/src/pro/okx.js +3 -3
  46. package/js/src/woo.js +2 -2
  47. package/package.json +1 -1
package/dist/cjs/ccxt.js CHANGED
@@ -190,7 +190,7 @@ var woofipro$1 = require('./src/pro/woofipro.js');
190
190
 
191
191
  //-----------------------------------------------------------------------------
192
192
  // this is updated by vss.js when building
193
- const version = '4.3.56';
193
+ const version = '4.3.58';
194
194
  Exchange["default"].ccxtVersion = version;
195
195
  const exchanges = {
196
196
  'ace': ace,
@@ -809,7 +809,11 @@ class alpaca extends alpaca$1 {
809
809
  return this.parseOrders(response, undefined);
810
810
  }
811
811
  else {
812
- return response;
812
+ return [
813
+ this.safeOrder({
814
+ 'info': response,
815
+ }),
816
+ ];
813
817
  }
814
818
  }
815
819
  async fetchOrder(id, symbol = undefined, params = {}) {
@@ -12,6 +12,7 @@ var index = require('../../static_dependencies/scure-base/index.js');
12
12
 
13
13
  class Client {
14
14
  constructor(url, onMessageCallback, onErrorCallback, onCloseCallback, onConnectedCallback, config = {}) {
15
+ this.useMessageQueue = true;
15
16
  this.verbose = false;
16
17
  const defaults = {
17
18
  url,
@@ -25,6 +26,8 @@ class Client {
25
26
  futures: {},
26
27
  subscriptions: {},
27
28
  rejections: {},
29
+ messageQueue: {},
30
+ useMessageQueue: true,
28
31
  connected: undefined,
29
32
  error: undefined,
30
33
  connectionStarted: undefined,
@@ -55,6 +58,15 @@ class Client {
55
58
  if (messageHash in this.rejections) {
56
59
  future.reject(this.rejections[messageHash]);
57
60
  delete this.rejections[messageHash];
61
+ delete this.messageQueue[messageHash];
62
+ return future;
63
+ }
64
+ if (this.useMessageQueue) {
65
+ const queue = this.messageQueue[messageHash];
66
+ if (queue && queue.length) {
67
+ future.resolve(queue.shift());
68
+ delete this.futures[messageHash];
69
+ }
58
70
  }
59
71
  return future;
60
72
  }
@@ -62,10 +74,27 @@ class Client {
62
74
  if (this.verbose && (messageHash === undefined)) {
63
75
  this.log(new Date(), 'resolve received undefined messageHash');
64
76
  }
65
- if ((messageHash !== undefined) && (messageHash in this.futures)) {
66
- const promise = this.futures[messageHash];
67
- promise.resolve(result);
68
- delete this.futures[messageHash];
77
+ if (this.useMessageQueue === true) {
78
+ if (!(messageHash in this.messageQueue)) {
79
+ this.messageQueue[messageHash] = [];
80
+ }
81
+ const queue = this.messageQueue[messageHash];
82
+ queue.push(result);
83
+ while (queue.length > 10) { // limit size to 10 messages in the queue
84
+ queue.shift();
85
+ }
86
+ if ((messageHash !== undefined) && (messageHash in this.futures)) {
87
+ const promise = this.futures[messageHash];
88
+ promise.resolve(queue.shift());
89
+ delete this.futures[messageHash];
90
+ }
91
+ }
92
+ else {
93
+ if (messageHash in this.futures) {
94
+ const promise = this.futures[messageHash];
95
+ promise.resolve(result);
96
+ delete this.futures[messageHash];
97
+ }
69
98
  }
70
99
  return result;
71
100
  }
@@ -106,6 +135,7 @@ class Client {
106
135
  reset(error) {
107
136
  this.clearConnectionTimeout();
108
137
  this.clearPingInterval();
138
+ this.messageQueue = {};
109
139
  this.reject(error);
110
140
  }
111
141
  onConnectionTimeout() {
@@ -1621,7 +1621,27 @@ class bigone extends bigone$1 {
1621
1621
  // }
1622
1622
  // }
1623
1623
  //
1624
- return response;
1624
+ const data = this.safeDict(response, 'data', {});
1625
+ const cancelled = this.safeList(data, 'cancelled', []);
1626
+ const failed = this.safeList(data, 'failed', []);
1627
+ const result = [];
1628
+ for (let i = 0; i < cancelled.length; i++) {
1629
+ const orderId = cancelled[i];
1630
+ result.push(this.safeOrder({
1631
+ 'info': orderId,
1632
+ 'id': orderId,
1633
+ 'status': 'canceled',
1634
+ }));
1635
+ }
1636
+ for (let i = 0; i < failed.length; i++) {
1637
+ const orderId = failed[i];
1638
+ result.push(this.safeOrder({
1639
+ 'info': orderId,
1640
+ 'id': orderId,
1641
+ 'status': 'failed',
1642
+ }));
1643
+ }
1644
+ return result;
1625
1645
  }
1626
1646
  async fetchOrder(id, symbol = undefined, params = {}) {
1627
1647
  /**
@@ -669,6 +669,29 @@ class bingx extends bingx$1 {
669
669
  const markets = this.safeList(response, 'data', []);
670
670
  return this.parseMarkets(markets);
671
671
  }
672
+ async fetchInverseSwapMarkets(params) {
673
+ const response = await this.cswapV1PublicGetMarketContracts(params);
674
+ //
675
+ // {
676
+ // "code": 0,
677
+ // "msg": "",
678
+ // "timestamp": 1720074487610,
679
+ // "data": [
680
+ // {
681
+ // "symbol": "BNB-USD",
682
+ // "pricePrecision": 2,
683
+ // "minTickSize": "10",
684
+ // "minTradeValue": "10",
685
+ // "minQty": "1.00000000",
686
+ // "status": 1,
687
+ // "timeOnline": 1713175200000
688
+ // },
689
+ // ]
690
+ // }
691
+ //
692
+ const markets = this.safeList(response, 'data', []);
693
+ return this.parseMarkets(markets);
694
+ }
672
695
  parseMarket(market) {
673
696
  const id = this.safeString(market, 'symbol');
674
697
  const symbolParts = id.split('-');
@@ -676,7 +699,16 @@ class bingx extends bingx$1 {
676
699
  const quoteId = symbolParts[1];
677
700
  const base = this.safeCurrencyCode(baseId);
678
701
  const quote = this.safeCurrencyCode(quoteId);
679
- const currency = this.safeString(market, 'currency');
702
+ let currency = this.safeString(market, 'currency');
703
+ let checkIsInverse = false;
704
+ let checkIsLinear = true;
705
+ const minTickSize = this.safeNumber(market, 'minTickSize');
706
+ if (minTickSize !== undefined) {
707
+ // inverse swap market
708
+ currency = baseId;
709
+ checkIsInverse = true;
710
+ checkIsLinear = false;
711
+ }
680
712
  const settle = this.safeCurrencyCode(currency);
681
713
  let pricePrecision = this.safeNumber(market, 'tickSize');
682
714
  if (pricePrecision === undefined) {
@@ -696,8 +728,12 @@ class bingx extends bingx$1 {
696
728
  const fees = this.safeDict(this.fees, type, {});
697
729
  const contractSize = (swap) ? this.parseNumber('1') : undefined;
698
730
  const isActive = this.safeString(market, 'status') === '1';
699
- const isInverse = (spot) ? undefined : false;
700
- const isLinear = (spot) ? undefined : swap;
731
+ const isInverse = (spot) ? undefined : checkIsInverse;
732
+ const isLinear = (spot) ? undefined : checkIsLinear;
733
+ let timeOnline = this.safeInteger(market, 'timeOnline');
734
+ if (timeOnline === 0) {
735
+ timeOnline = undefined;
736
+ }
701
737
  return this.safeMarketStructure({
702
738
  'id': id,
703
739
  'symbol': symbol,
@@ -739,15 +775,15 @@ class bingx extends bingx$1 {
739
775
  'max': this.safeNumber(market, 'maxQty'),
740
776
  },
741
777
  'price': {
742
- 'min': undefined,
778
+ 'min': minTickSize,
743
779
  'max': undefined,
744
780
  },
745
781
  'cost': {
746
- 'min': this.safeNumber2(market, 'minNotional', 'tradeMinUSDT'),
782
+ 'min': this.safeNumberN(market, ['minNotional', 'tradeMinUSDT', 'minTradeValue']),
747
783
  'max': this.safeNumber(market, 'maxNotional'),
748
784
  },
749
785
  },
750
- 'created': undefined,
786
+ 'created': timeOnline,
751
787
  'info': market,
752
788
  });
753
789
  }
@@ -758,17 +794,21 @@ class bingx extends bingx$1 {
758
794
  * @description retrieves data on all markets for bingx
759
795
  * @see https://bingx-api.github.io/docs/#/spot/market-api.html#Query%20Symbols
760
796
  * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Contract%20Information
797
+ * @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Contract%20Information
761
798
  * @param {object} [params] extra parameters specific to the exchange API endpoint
762
799
  * @returns {object[]} an array of objects representing market data
763
800
  */
764
801
  const requests = [this.fetchSwapMarkets(params)];
765
802
  const isSandbox = this.safeBool(this.options, 'sandboxMode', false);
766
803
  if (!isSandbox) {
804
+ requests.push(this.fetchInverseSwapMarkets(params));
767
805
  requests.push(this.fetchSpotMarkets(params)); // sandbox is swap only
768
806
  }
769
807
  const promises = await Promise.all(requests);
770
- const spotMarkets = this.safeList(promises, 0, []);
771
- const swapMarkets = this.safeList(promises, 1, []);
808
+ const linearSwapMarkets = this.safeList(promises, 0, []);
809
+ const inverseSwapMarkets = this.safeList(promises, 1, []);
810
+ const spotMarkets = this.safeList(promises, 2, []);
811
+ const swapMarkets = this.arrayConcat(linearSwapMarkets, inverseSwapMarkets);
772
812
  return this.arrayConcat(spotMarkets, swapMarkets);
773
813
  }
774
814
  async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
@@ -780,13 +820,14 @@ class bingx extends bingx$1 {
780
820
  * @see https://bingx-api.github.io/docs/#/spot/market-api.html#Candlestick%20chart%20data
781
821
  * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#%20K-Line%20Data
782
822
  * @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#K-Line%20Data%20-%20Mark%20Price
823
+ * @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Get%20K-line%20Data
783
824
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
784
825
  * @param {string} timeframe the length of time each candle represents
785
826
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
786
827
  * @param {int} [limit] the maximum amount of candles to fetch
787
828
  * @param {object} [params] extra parameters specific to the exchange API endpoint
788
829
  * @param {int} [params.until] timestamp in ms of the latest candle to fetch
789
- * @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)
830
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
790
831
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
791
832
  */
792
833
  await this.loadMarkets();
@@ -816,13 +857,18 @@ class bingx extends bingx$1 {
816
857
  response = await this.spotV1PublicGetMarketKline(this.extend(request, params));
817
858
  }
818
859
  else {
819
- const price = this.safeString(params, 'price');
820
- params = this.omit(params, 'price');
821
- if (price === 'mark') {
822
- response = await this.swapV1PrivateGetMarketMarkPriceKlines(this.extend(request, params));
860
+ if (market['inverse']) {
861
+ response = await this.cswapV1PublicGetMarketKlines(this.extend(request, params));
823
862
  }
824
863
  else {
825
- response = await this.swapV3PublicGetQuoteKlines(this.extend(request, params));
864
+ const price = this.safeString(params, 'price');
865
+ params = this.omit(params, 'price');
866
+ if (price === 'mark') {
867
+ response = await this.swapV1PrivateGetMarketMarkPriceKlines(this.extend(request, params));
868
+ }
869
+ else {
870
+ response = await this.swapV3PublicGetQuoteKlines(this.extend(request, params));
871
+ }
826
872
  }
827
873
  }
828
874
  //
@@ -1134,6 +1180,7 @@ class bingx extends bingx$1 {
1134
1180
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
1135
1181
  * @see https://bingx-api.github.io/docs/#/spot/market-api.html#Query%20depth%20information
1136
1182
  * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Get%20Market%20Depth
1183
+ * @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Query%20Depth%20Data
1137
1184
  * @param {string} symbol unified symbol of the market to fetch the order book for
1138
1185
  * @param {int} [limit] the maximum amount of order book entries to return
1139
1186
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1154,7 +1201,12 @@ class bingx extends bingx$1 {
1154
1201
  response = await this.spotV1PublicGetMarketDepth(this.extend(request, params));
1155
1202
  }
1156
1203
  else {
1157
- response = await this.swapV2PublicGetQuoteDepth(this.extend(request, params));
1204
+ if (market['inverse']) {
1205
+ response = await this.cswapV1PublicGetMarketDepth(this.extend(request, params));
1206
+ }
1207
+ else {
1208
+ response = await this.swapV2PublicGetQuoteDepth(this.extend(request, params));
1209
+ }
1158
1210
  }
1159
1211
  //
1160
1212
  // spot
@@ -1223,6 +1275,7 @@ class bingx extends bingx$1 {
1223
1275
  * @name bingx#fetchFundingRate
1224
1276
  * @description fetch the current funding rate
1225
1277
  * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Current%20Funding%20Rate
1278
+ * @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Price%20&%20Current%20Funding%20Rate
1226
1279
  * @param {string} symbol unified market symbol
1227
1280
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1228
1281
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
@@ -1232,7 +1285,13 @@ class bingx extends bingx$1 {
1232
1285
  const request = {
1233
1286
  'symbol': market['id'],
1234
1287
  };
1235
- const response = await this.swapV2PublicGetQuotePremiumIndex(this.extend(request, params));
1288
+ let response = undefined;
1289
+ if (market['inverse']) {
1290
+ response = await this.cswapV1PublicGetMarketPremiumIndex(this.extend(request, params));
1291
+ }
1292
+ else {
1293
+ response = await this.swapV2PublicGetQuotePremiumIndex(this.extend(request, params));
1294
+ }
1236
1295
  //
1237
1296
  // {
1238
1297
  // "code":0,
@@ -1384,9 +1443,10 @@ class bingx extends bingx$1 {
1384
1443
  /**
1385
1444
  * @method
1386
1445
  * @name bingx#fetchOpenInterest
1387
- * @description Retrieves the open interest of a currency
1446
+ * @description retrieves the open interest of a trading pair
1388
1447
  * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Get%20Swap%20Open%20Positions
1389
- * @param {string} symbol Unified CCXT market symbol
1448
+ * @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Get%20Swap%20Open%20Positions
1449
+ * @param {string} symbol unified CCXT market symbol
1390
1450
  * @param {object} [params] exchange specific parameters
1391
1451
  * @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
1392
1452
  */
@@ -1395,7 +1455,15 @@ class bingx extends bingx$1 {
1395
1455
  const request = {
1396
1456
  'symbol': market['id'],
1397
1457
  };
1398
- const response = await this.swapV2PublicGetQuoteOpenInterest(this.extend(request, params));
1458
+ let response = undefined;
1459
+ if (market['inverse']) {
1460
+ response = await this.cswapV1PublicGetMarketOpenInterest(this.extend(request, params));
1461
+ }
1462
+ else {
1463
+ response = await this.swapV2PublicGetQuoteOpenInterest(this.extend(request, params));
1464
+ }
1465
+ //
1466
+ // linear swap
1399
1467
  //
1400
1468
  // {
1401
1469
  // "code": 0,
@@ -1407,18 +1475,50 @@ class bingx extends bingx$1 {
1407
1475
  // }
1408
1476
  // }
1409
1477
  //
1410
- const data = this.safeDict(response, 'data', {});
1411
- return this.parseOpenInterest(data, market);
1478
+ // inverse swap
1479
+ //
1480
+ // {
1481
+ // "code": 0,
1482
+ // "msg": "",
1483
+ // "timestamp": 1720328247986,
1484
+ // "data": [
1485
+ // {
1486
+ // "symbol": "BTC-USD",
1487
+ // "openInterest": "749.1160",
1488
+ // "timestamp": 1720310400000
1489
+ // }
1490
+ // ]
1491
+ // }
1492
+ //
1493
+ let result = {};
1494
+ if (market['inverse']) {
1495
+ const data = this.safeList(response, 'data', []);
1496
+ result = this.safeDict(data, 0, {});
1497
+ }
1498
+ else {
1499
+ result = this.safeDict(response, 'data', {});
1500
+ }
1501
+ return this.parseOpenInterest(result, market);
1412
1502
  }
1413
1503
  parseOpenInterest(interest, market = undefined) {
1414
1504
  //
1415
- // {
1416
- // "openInterest": "3289641547.10",
1417
- // "symbol": "BTC-USDT",
1418
- // "time": 1672026617364
1419
- // }
1505
+ // linear swap
1506
+ //
1507
+ // {
1508
+ // "openInterest": "3289641547.10",
1509
+ // "symbol": "BTC-USDT",
1510
+ // "time": 1672026617364
1511
+ // }
1512
+ //
1513
+ // inverse swap
1514
+ //
1515
+ // {
1516
+ // "symbol": "BTC-USD",
1517
+ // "openInterest": "749.1160",
1518
+ // "timestamp": 1720310400000
1519
+ // }
1420
1520
  //
1421
- const timestamp = this.safeInteger(interest, 'time');
1521
+ const timestamp = this.safeInteger2(interest, 'time', 'timestamp');
1422
1522
  const id = this.safeString(interest, 'symbol');
1423
1523
  const symbol = this.safeSymbol(id, market, '-', 'swap');
1424
1524
  const openInterest = this.safeNumber(interest, 'openInterest');
@@ -5012,6 +5012,22 @@ class bitget extends bitget$1 {
5012
5012
  else {
5013
5013
  response = await this.privateMarginPostMarginV1IsolatedOrderBatchCancelOrder(this.extend(request, params));
5014
5014
  }
5015
+ //
5016
+ // {
5017
+ // "code": "00000",
5018
+ // "msg": "success",
5019
+ // "requestTime": 1700717155622,
5020
+ // "data": {
5021
+ // "resultList": [
5022
+ // {
5023
+ // "orderId": "1111453253721796609",
5024
+ // "clientOid": "2ae7fc8a4ff949b6b60d770ca3950e2d"
5025
+ // },
5026
+ // ],
5027
+ // "failure": []
5028
+ // }
5029
+ // }
5030
+ //
5015
5031
  }
5016
5032
  else {
5017
5033
  if (stop) {
@@ -5023,6 +5039,27 @@ class bitget extends bitget$1 {
5023
5039
  else {
5024
5040
  response = await this.privateSpotPostV2SpotTradeCancelSymbolOrder(this.extend(request, params));
5025
5041
  }
5042
+ //
5043
+ // {
5044
+ // "code": "00000",
5045
+ // "msg": "success",
5046
+ // "requestTime": 1700716953996,
5047
+ // "data": {
5048
+ // "symbol": "BTCUSDT"
5049
+ // }
5050
+ // }
5051
+ //
5052
+ const timestamp = this.safeInteger(response, 'requestTime');
5053
+ const responseData = this.safeDict(response, 'data');
5054
+ const marketId = this.safeString(responseData, 'symbol');
5055
+ return [
5056
+ this.safeOrder({
5057
+ 'info': response,
5058
+ 'symbol': this.safeSymbol(marketId, undefined, undefined, 'spot'),
5059
+ 'timestamp': timestamp,
5060
+ 'datetime': this.iso8601(timestamp),
5061
+ }),
5062
+ ];
5026
5063
  }
5027
5064
  }
5028
5065
  else {
@@ -5035,54 +5072,26 @@ class bitget extends bitget$1 {
5035
5072
  else {
5036
5073
  response = await this.privateMixPostV2MixOrderBatchCancelOrders(this.extend(request, params));
5037
5074
  }
5075
+ // {
5076
+ // "code": "00000",
5077
+ // "msg": "success",
5078
+ // "requestTime": "1680008815965",
5079
+ // "data": {
5080
+ // "successList": [
5081
+ // {
5082
+ // "orderId": "1024598257429823488",
5083
+ // "clientOid": "876493ce-c287-4bfc-9f4a-8b1905881313"
5084
+ // },
5085
+ // ],
5086
+ // "failureList": []
5087
+ // }
5088
+ // }
5038
5089
  }
5039
- //
5040
- // spot
5041
- //
5042
- // {
5043
- // "code": "00000",
5044
- // "msg": "success",
5045
- // "requestTime": 1700716953996,
5046
- // "data": {
5047
- // "symbol": "BTCUSDT"
5048
- // }
5049
- // }
5050
- //
5051
- // swap
5052
- //
5053
- // {
5054
- // "code": "00000",
5055
- // "msg": "success",
5056
- // "requestTime": "1680008815965",
5057
- // "data": {
5058
- // "successList": [
5059
- // {
5060
- // "orderId": "1024598257429823488",
5061
- // "clientOid": "876493ce-c287-4bfc-9f4a-8b1905881313"
5062
- // },
5063
- // ],
5064
- // "failureList": []
5065
- // }
5066
- // }
5067
- //
5068
- // spot margin
5069
- //
5070
- // {
5071
- // "code": "00000",
5072
- // "msg": "success",
5073
- // "requestTime": 1700717155622,
5074
- // "data": {
5075
- // "resultList": [
5076
- // {
5077
- // "orderId": "1111453253721796609",
5078
- // "clientOid": "2ae7fc8a4ff949b6b60d770ca3950e2d"
5079
- // },
5080
- // ],
5081
- // "failure": []
5082
- // }
5083
- // }
5084
- //
5085
- return response;
5090
+ const data = this.safeDict(response, 'data');
5091
+ const resultList = this.safeList2(data, 'resultList', 'successList');
5092
+ const failureList = this.safeList2(data, 'failure', 'failureList');
5093
+ const responseList = this.arrayConcat(resultList, failureList);
5094
+ return this.parseOrders(responseList);
5086
5095
  }
5087
5096
  async fetchOrder(id, symbol = undefined, params = {}) {
5088
5097
  /**
@@ -18,7 +18,7 @@ class coinmate extends coinmate$1 {
18
18
  'id': 'coinmate',
19
19
  'name': 'CoinMate',
20
20
  'countries': ['GB', 'CZ', 'EU'],
21
- 'rateLimit': 1000,
21
+ 'rateLimit': 600,
22
22
  'has': {
23
23
  'CORS': true,
24
24
  'spot': true,
@@ -167,28 +167,28 @@ class coinmate extends coinmate$1 {
167
167
  'trading': {
168
168
  'tierBased': true,
169
169
  'percentage': true,
170
- 'maker': this.parseNumber('0.0012'),
171
- 'taker': this.parseNumber('0.0025'),
170
+ 'taker': this.parseNumber('0.006'),
171
+ 'maker': this.parseNumber('0.004'),
172
172
  'tiers': {
173
173
  'taker': [
174
- [this.parseNumber('0'), this.parseNumber('0.0035')],
175
- [this.parseNumber('10000'), this.parseNumber('0.0023')],
176
- [this.parseNumber('100000'), this.parseNumber('0.0021')],
177
- [this.parseNumber('250000'), this.parseNumber('0.0020')],
178
- [this.parseNumber('500000'), this.parseNumber('0.0015')],
179
- [this.parseNumber('1000000'), this.parseNumber('0.0013')],
180
- [this.parseNumber('3000000'), this.parseNumber('0.0010')],
181
- [this.parseNumber('15000000'), this.parseNumber('0.0005')],
174
+ [this.parseNumber('0'), this.parseNumber('0.006')],
175
+ [this.parseNumber('10000'), this.parseNumber('0.003')],
176
+ [this.parseNumber('100000'), this.parseNumber('0.0023')],
177
+ [this.parseNumber('250000'), this.parseNumber('0.0021')],
178
+ [this.parseNumber('500000'), this.parseNumber('0.0018')],
179
+ [this.parseNumber('1000000'), this.parseNumber('0.0015')],
180
+ [this.parseNumber('3000000'), this.parseNumber('0.0012')],
181
+ [this.parseNumber('15000000'), this.parseNumber('0.001')],
182
182
  ],
183
183
  'maker': [
184
- [this.parseNumber('0'), this.parseNumber('0.003')],
185
- [this.parseNumber('10000'), this.parseNumber('0.0011')],
186
- [this.parseNumber('100000'), this.parseNumber('0.0010')],
187
- [this.parseNumber('250000'), this.parseNumber('0.0008')],
184
+ [this.parseNumber('0'), this.parseNumber('0.004')],
185
+ [this.parseNumber('10000'), this.parseNumber('0.002')],
186
+ [this.parseNumber('100000'), this.parseNumber('0.0012')],
187
+ [this.parseNumber('250000'), this.parseNumber('0.0009')],
188
188
  [this.parseNumber('500000'), this.parseNumber('0.0005')],
189
189
  [this.parseNumber('1000000'), this.parseNumber('0.0003')],
190
190
  [this.parseNumber('3000000'), this.parseNumber('0.0002')],
191
- [this.parseNumber('15000000'), this.parseNumber('0')],
191
+ [this.parseNumber('15000000'), this.parseNumber('-0.0004')],
192
192
  ],
193
193
  },
194
194
  },
@@ -1093,26 +1093,19 @@ class coinmate extends coinmate$1 {
1093
1093
  return { 'url': url, 'method': method, 'body': body, 'headers': headers };
1094
1094
  }
1095
1095
  handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
1096
- if (response !== undefined) {
1097
- if ('error' in response) {
1098
- // {"error":true,"errorMessage":"Minimum Order Size 0.01 ETH","data":null}
1099
- if (response['error']) {
1100
- const message = this.safeString(response, 'errorMessage');
1101
- const feedback = this.id + ' ' + message;
1102
- this.throwExactlyMatchedException(this.exceptions['exact'], message, feedback);
1103
- this.throwBroadlyMatchedException(this.exceptions['broad'], message, feedback);
1104
- throw new errors.ExchangeError(this.id + ' ' + this.json(response));
1105
- }
1106
- }
1096
+ if (response === undefined) {
1097
+ return undefined; // fallback to default error handler
1107
1098
  }
1108
- if (code > 400) {
1109
- if (body) {
1110
- const feedback = this.id + ' ' + body;
1111
- this.throwExactlyMatchedException(this.exceptions['exact'], body, feedback);
1112
- this.throwBroadlyMatchedException(this.exceptions['broad'], body, feedback);
1113
- throw new errors.ExchangeError(feedback); // unknown message
1114
- }
1115
- throw new errors.ExchangeError(this.id + ' ' + body);
1099
+ //
1100
+ // {"error":true,"errorMessage":"Api internal error","data":null}
1101
+ // {"error":true,"errorMessage":"Access denied.","data":null}
1102
+ //
1103
+ const errorMessage = this.safeString(response, 'errorMessage');
1104
+ if (errorMessage !== undefined) {
1105
+ const feedback = this.id + ' ' + body;
1106
+ this.throwExactlyMatchedException(this.exceptions['exact'], errorMessage, feedback);
1107
+ this.throwBroadlyMatchedException(this.exceptions['broad'], errorMessage, feedback);
1108
+ throw new errors.ExchangeError(feedback); // unknown message
1116
1109
  }
1117
1110
  return undefined;
1118
1111
  }