ccxt 4.4.32 → 4.4.34

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 (118) hide show
  1. package/README.md +8 -7
  2. package/dist/ccxt.browser.min.js +6 -6
  3. package/dist/cjs/ccxt.js +4 -1
  4. package/dist/cjs/src/abstract/ellipx.js +9 -0
  5. package/dist/cjs/src/alpaca.js +2 -0
  6. package/dist/cjs/src/base/Exchange.js +116 -1
  7. package/dist/cjs/src/binance.js +164 -6
  8. package/dist/cjs/src/bingx.js +156 -9
  9. package/dist/cjs/src/bitbank.js +5 -0
  10. package/dist/cjs/src/bitbns.js +2 -0
  11. package/dist/cjs/src/bitfinex2.js +2 -1
  12. package/dist/cjs/src/bitget.js +177 -44
  13. package/dist/cjs/src/bitmex.js +2 -0
  14. package/dist/cjs/src/bitopro.js +3 -0
  15. package/dist/cjs/src/bitrue.js +1 -0
  16. package/dist/cjs/src/btcmarkets.js +2 -0
  17. package/dist/cjs/src/bybit.js +148 -13
  18. package/dist/cjs/src/cex.js +16 -6
  19. package/dist/cjs/src/coinbase.js +5 -24
  20. package/dist/cjs/src/coinbaseexchange.js +2 -1
  21. package/dist/cjs/src/coinex.js +2 -0
  22. package/dist/cjs/src/coinone.js +7 -7
  23. package/dist/cjs/src/coinsph.js +7 -7
  24. package/dist/cjs/src/coinspot.js +39 -39
  25. package/dist/cjs/src/cryptocom.js +36 -34
  26. package/dist/cjs/src/ellipx.js +1871 -0
  27. package/dist/cjs/src/gate.js +2 -1
  28. package/dist/cjs/src/hyperliquid.js +16 -2
  29. package/dist/cjs/src/kraken.js +1 -0
  30. package/dist/cjs/src/krakenfutures.js +3 -1
  31. package/dist/cjs/src/kucoinfutures.js +1 -1
  32. package/dist/cjs/src/lbank.js +1 -0
  33. package/dist/cjs/src/okcoin.js +2 -0
  34. package/dist/cjs/src/okx.js +104 -9
  35. package/dist/cjs/src/onetrading.js +14 -1
  36. package/dist/cjs/src/paradex.js +2 -0
  37. package/dist/cjs/src/phemex.js +35 -7
  38. package/dist/cjs/src/poloniex.js +3 -1
  39. package/dist/cjs/src/poloniexfutures.js +3 -1
  40. package/dist/cjs/src/pro/idex.js +5 -0
  41. package/dist/cjs/src/pro/okx.js +11 -1
  42. package/dist/cjs/src/pro/probit.js +4 -2
  43. package/dist/cjs/src/pro/woo.js +15 -15
  44. package/dist/cjs/src/vertex.js +2 -0
  45. package/dist/cjs/src/woo.js +69 -69
  46. package/examples/js/cli.js +1 -1
  47. package/js/ccxt.d.ts +5 -2
  48. package/js/ccxt.js +4 -2
  49. package/js/src/abstract/bingx.d.ts +16 -0
  50. package/js/src/abstract/bitbank.d.ts +5 -0
  51. package/js/src/abstract/bitfinex2.d.ts +1 -0
  52. package/js/src/abstract/coinbaseexchange.d.ts +1 -0
  53. package/js/src/abstract/ellipx.d.ts +28 -0
  54. package/js/src/abstract/ellipx.js +11 -0
  55. package/js/src/abstract/kraken.d.ts +1 -0
  56. package/js/src/alpaca.js +2 -0
  57. package/js/src/base/Exchange.d.ts +11 -0
  58. package/js/src/base/Exchange.js +116 -1
  59. package/js/src/binance.js +164 -6
  60. package/js/src/bingx.d.ts +3 -1
  61. package/js/src/bingx.js +156 -9
  62. package/js/src/bitbank.js +5 -0
  63. package/js/src/bitbns.js +2 -0
  64. package/js/src/bitfinex2.js +2 -1
  65. package/js/src/bitget.d.ts +4 -4
  66. package/js/src/bitget.js +177 -44
  67. package/js/src/bitmex.js +2 -0
  68. package/js/src/bitopro.d.ts +1 -0
  69. package/js/src/bitopro.js +3 -0
  70. package/js/src/bitrue.js +1 -0
  71. package/js/src/btcmarkets.d.ts +1 -0
  72. package/js/src/btcmarkets.js +2 -0
  73. package/js/src/bybit.d.ts +3 -2
  74. package/js/src/bybit.js +149 -14
  75. package/js/src/cex.d.ts +1 -0
  76. package/js/src/cex.js +17 -7
  77. package/js/src/coinbase.d.ts +2 -1
  78. package/js/src/coinbase.js +5 -24
  79. package/js/src/coinbaseexchange.js +2 -1
  80. package/js/src/coinex.js +2 -0
  81. package/js/src/coinone.js +7 -7
  82. package/js/src/coinsph.js +7 -7
  83. package/js/src/coinspot.js +39 -39
  84. package/js/src/cryptocom.d.ts +1 -1
  85. package/js/src/cryptocom.js +36 -34
  86. package/js/src/ellipx.d.ts +236 -0
  87. package/js/src/ellipx.js +1874 -0
  88. package/js/src/gate.d.ts +2 -2
  89. package/js/src/gate.js +2 -1
  90. package/js/src/hyperliquid.d.ts +2 -1
  91. package/js/src/hyperliquid.js +16 -2
  92. package/js/src/kraken.js +1 -0
  93. package/js/src/krakenfutures.js +3 -1
  94. package/js/src/kucoinfutures.d.ts +1 -1
  95. package/js/src/kucoinfutures.js +1 -1
  96. package/js/src/lbank.js +1 -0
  97. package/js/src/okcoin.js +2 -0
  98. package/js/src/okx.d.ts +1 -1
  99. package/js/src/okx.js +104 -9
  100. package/js/src/onetrading.d.ts +5 -0
  101. package/js/src/onetrading.js +15 -2
  102. package/js/src/paradex.js +2 -0
  103. package/js/src/phemex.d.ts +4 -0
  104. package/js/src/phemex.js +35 -7
  105. package/js/src/poloniex.d.ts +1 -1
  106. package/js/src/poloniex.js +3 -1
  107. package/js/src/poloniexfutures.d.ts +1 -1
  108. package/js/src/poloniexfutures.js +3 -1
  109. package/js/src/pro/idex.d.ts +5 -0
  110. package/js/src/pro/idex.js +5 -0
  111. package/js/src/pro/okx.js +11 -1
  112. package/js/src/pro/probit.js +4 -2
  113. package/js/src/pro/woo.d.ts +11 -11
  114. package/js/src/pro/woo.js +15 -15
  115. package/js/src/vertex.js +2 -0
  116. package/js/src/woo.d.ts +60 -60
  117. package/js/src/woo.js +69 -69
  118. package/package.json +3 -3
package/js/src/bybit.js CHANGED
@@ -7,7 +7,7 @@
7
7
  // ---------------------------------------------------------------------------
8
8
  import Exchange from './abstract/bybit.js';
9
9
  import { TICK_SIZE } from './base/functions/number.js';
10
- import { AuthenticationError, ExchangeError, ArgumentsRequired, PermissionDenied, InvalidOrder, OrderNotFound, InsufficientFunds, BadRequest, RateLimitExceeded, InvalidNonce, NotSupported, RequestTimeout, MarginModeAlreadySet, NoChange, ManualInteractionNeeded, BadSymbol } from './base/errors.js';
10
+ import { AuthenticationError, ExchangeError, ArgumentsRequired, PermissionDenied, AccountSuspended, InvalidOrder, OrderNotFound, InsufficientFunds, BadRequest, RateLimitExceeded, InvalidNonce, NotSupported, RequestTimeout, MarginModeAlreadySet, NoChange, ManualInteractionNeeded, BadSymbol } from './base/errors.js';
11
11
  import { Precise } from './base/Precise.js';
12
12
  import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
13
13
  import { rsa } from './base/functions/rsa.js';
@@ -554,7 +554,7 @@ export default class bybit extends Exchange {
554
554
  '10005': PermissionDenied,
555
555
  '10006': RateLimitExceeded,
556
556
  '10007': AuthenticationError,
557
- '10008': AuthenticationError,
557
+ '10008': AccountSuspended,
558
558
  '10009': AuthenticationError,
559
559
  '10010': PermissionDenied,
560
560
  '10014': BadRequest,
@@ -998,7 +998,7 @@ export default class bybit extends Exchange {
998
998
  'enableUnifiedMargin': undefined,
999
999
  'enableUnifiedAccount': undefined,
1000
1000
  'unifiedMarginStatus': undefined,
1001
- 'createMarketBuyOrderRequiresPrice': true,
1001
+ 'createMarketBuyOrderRequiresPrice': false,
1002
1002
  'createUnifiedMarginAccount': false,
1003
1003
  'defaultType': 'swap',
1004
1004
  'defaultSubType': 'linear',
@@ -1058,6 +1058,123 @@ export default class bybit extends Exchange {
1058
1058
  '1d': '1d',
1059
1059
  },
1060
1060
  },
1061
+ 'features': {
1062
+ 'default': {
1063
+ 'sandbox': true,
1064
+ 'createOrder': {
1065
+ 'marginMode': false,
1066
+ 'triggerPrice': true,
1067
+ 'triggerPriceType': {
1068
+ 'last': true,
1069
+ 'mark': true,
1070
+ 'index': true,
1071
+ },
1072
+ 'triggerDirection': true,
1073
+ 'stopLossPrice': true,
1074
+ 'takeProfitPrice': true,
1075
+ 'attachedStopLossTakeProfit': {
1076
+ 'triggerPriceType': {
1077
+ 'last': true,
1078
+ 'mark': true,
1079
+ 'index': true,
1080
+ },
1081
+ 'limitPrice': true,
1082
+ },
1083
+ 'timeInForce': {
1084
+ 'GTC': true,
1085
+ 'IOC': true,
1086
+ 'FOK': true,
1087
+ 'PO': true,
1088
+ 'GTD': false,
1089
+ },
1090
+ 'hedged': true,
1091
+ // exchange-supported features
1092
+ 'selfTradePrevention': true,
1093
+ 'trailing': true,
1094
+ 'twap': false,
1095
+ 'iceberg': false,
1096
+ 'oco': false,
1097
+ },
1098
+ 'createOrders': {
1099
+ 'max': 10,
1100
+ },
1101
+ 'fetchMyTrades': {
1102
+ 'marginMode': false,
1103
+ 'limit': 100,
1104
+ 'daysBack': 365 * 2,
1105
+ 'untilDays': 7, // days between start-end
1106
+ },
1107
+ 'fetchOrder': {
1108
+ 'marginMode': false,
1109
+ 'trigger': true,
1110
+ 'trailing': false,
1111
+ },
1112
+ 'fetchOpenOrders': {
1113
+ 'marginMode': false,
1114
+ 'limit': 50,
1115
+ 'trigger': true,
1116
+ 'trailing': false,
1117
+ },
1118
+ 'fetchOrders': undefined,
1119
+ 'fetchClosedOrders': {
1120
+ 'marginMode': false,
1121
+ 'limit': 50,
1122
+ 'daysBackClosed': 365 * 2,
1123
+ 'daysBackCanceled': 1,
1124
+ 'untilDays': 7,
1125
+ 'trigger': true,
1126
+ 'trailing': false,
1127
+ },
1128
+ 'fetchOHLCV': {
1129
+ 'limit': 1000,
1130
+ },
1131
+ },
1132
+ 'spot': {
1133
+ 'extends': 'default',
1134
+ 'createOrder': {
1135
+ 'marginMode': false,
1136
+ 'triggerPrice': true,
1137
+ 'triggerPriceType': undefined,
1138
+ 'triggerDirection': false,
1139
+ 'stopLossPrice': true,
1140
+ 'takeProfitPrice': true,
1141
+ 'attachedStopLossTakeProfit': {
1142
+ 'triggerPriceType': undefined,
1143
+ 'limitPrice': true,
1144
+ },
1145
+ 'timeInForce': {
1146
+ 'GTC': true,
1147
+ 'IOC': true,
1148
+ 'FOK': true,
1149
+ 'PO': true,
1150
+ 'GTD': false,
1151
+ },
1152
+ 'hedged': true,
1153
+ // exchange-supported features
1154
+ 'selfTradePrevention': true,
1155
+ 'trailing': true,
1156
+ 'twap': false,
1157
+ 'iceberg': false,
1158
+ 'oco': false,
1159
+ },
1160
+ },
1161
+ 'swap': {
1162
+ 'linear': {
1163
+ 'extends': 'default',
1164
+ },
1165
+ 'inverse': {
1166
+ 'extends': 'default',
1167
+ },
1168
+ },
1169
+ 'future': {
1170
+ 'linear': {
1171
+ 'extends': 'default',
1172
+ },
1173
+ 'inverse': {
1174
+ 'extends': 'default',
1175
+ },
1176
+ },
1177
+ },
1061
1178
  'fees': {
1062
1179
  'trading': {
1063
1180
  'feeSide': 'get',
@@ -1103,7 +1220,7 @@ export default class bybit extends Exchange {
1103
1220
  }
1104
1221
  addPaginationCursorToResult(response) {
1105
1222
  const result = this.safeDict(response, 'result', {});
1106
- const data = this.safeValueN(result, ['list', 'rows', 'data', 'dataList'], []);
1223
+ const data = this.safeListN(result, ['list', 'rows', 'data', 'dataList'], []);
1107
1224
  const paginationCursor = this.safeString2(result, 'nextPageCursor', 'cursor');
1108
1225
  const dataLength = data.length;
1109
1226
  if ((paginationCursor !== undefined) && (dataLength > 0)) {
@@ -1114,12 +1231,12 @@ export default class bybit extends Exchange {
1114
1231
  return data;
1115
1232
  }
1116
1233
  /**
1117
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1118
1234
  * @method
1119
1235
  * @name bybit#isUnifiedEnabled
1120
1236
  * @see https://bybit-exchange.github.io/docs/v5/user/apikey-info#http-request
1121
1237
  * @see https://bybit-exchange.github.io/docs/v5/account/account-info
1122
1238
  * @description returns [enableUnifiedMargin, enableUnifiedAccount] so the user can check if unified account is enabled
1239
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1123
1240
  * @returns {any} [enableUnifiedMargin, enableUnifiedAccount]
1124
1241
  */
1125
1242
  async isUnifiedEnabled(params = {}) {
@@ -2213,6 +2330,7 @@ export default class bybit extends Exchange {
2213
2330
  * @param {string[]} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
2214
2331
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2215
2332
  * @param {string} [params.subType] *contract only* 'linear', 'inverse'
2333
+ * @param {string} [params.baseCoin] *option only* base coin, default is 'BTC'
2216
2334
  * @returns {object} an array of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
2217
2335
  */
2218
2336
  async fetchTickers(symbols = undefined, params = {}) {
@@ -2262,11 +2380,12 @@ export default class bybit extends Exchange {
2262
2380
  if (type === 'spot' && passedSubType === undefined) {
2263
2381
  request['category'] = 'spot';
2264
2382
  }
2265
- else if (type === 'swap' || type === 'future' || subType !== undefined) {
2266
- request['category'] = subType;
2267
- }
2268
2383
  else if (type === 'option') {
2269
2384
  request['category'] = 'option';
2385
+ request['baseCoin'] = this.safeString(params, 'baseCoin', 'BTC');
2386
+ }
2387
+ else if (type === 'swap' || type === 'future' || subType !== undefined) {
2388
+ request['category'] = subType;
2270
2389
  }
2271
2390
  const response = await this.publicGetV5MarketTickers(this.extend(request, params));
2272
2391
  //
@@ -3112,7 +3231,7 @@ export default class bybit extends Exchange {
3112
3231
  'datetime': this.iso8601(timestamp),
3113
3232
  };
3114
3233
  const responseResult = this.safeDict(response, 'result', {});
3115
- const currencyList = this.safeValueN(responseResult, ['loanAccountList', 'list', 'balance']);
3234
+ const currencyList = this.safeListN(responseResult, ['loanAccountList', 'list', 'balance']);
3116
3235
  if (currencyList === undefined) {
3117
3236
  // usdc wallet
3118
3237
  const code = 'USDC';
@@ -3489,11 +3608,19 @@ export default class bybit extends Exchange {
3489
3608
  market = this.safeMarket(marketId, market, undefined, marketType);
3490
3609
  const symbol = market['symbol'];
3491
3610
  const timestamp = this.safeInteger2(order, 'createdTime', 'createdAt');
3611
+ const marketUnit = this.safeString(order, 'marketUnit', 'baseCoin');
3492
3612
  const id = this.safeString(order, 'orderId');
3493
3613
  const type = this.safeStringLower(order, 'orderType');
3494
3614
  const price = this.safeString(order, 'price');
3495
- const amount = this.safeString(order, 'qty');
3496
- const cost = this.safeString(order, 'cumExecValue');
3615
+ let amount = undefined;
3616
+ let cost = undefined;
3617
+ if (marketUnit === 'baseCoin') {
3618
+ amount = this.safeString(order, 'qty');
3619
+ cost = this.safeString(order, 'cumExecValue');
3620
+ }
3621
+ else {
3622
+ cost = this.safeString(order, 'cumExecValue');
3623
+ }
3497
3624
  const filled = this.safeString(order, 'cumExecQty');
3498
3625
  const remaining = this.safeString(order, 'leavesQty');
3499
3626
  const lastTradeTimestamp = this.safeInteger2(order, 'updatedTime', 'updatedAt');
@@ -3858,7 +3985,7 @@ export default class bybit extends Exchange {
3858
3985
  // classic accounts
3859
3986
  // for market buy it requires the amount of quote currency to spend
3860
3987
  let createMarketBuyOrderRequiresPrice = true;
3861
- [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
3988
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice');
3862
3989
  if (createMarketBuyOrderRequiresPrice) {
3863
3990
  if ((price === undefined) && (cost === undefined)) {
3864
3991
  throw new InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
@@ -3870,7 +3997,15 @@ export default class bybit extends Exchange {
3870
3997
  }
3871
3998
  }
3872
3999
  else {
3873
- request['qty'] = this.getCost(symbol, this.numberToString(amount));
4000
+ if (cost !== undefined) {
4001
+ request['qty'] = this.getCost(symbol, this.numberToString(cost));
4002
+ }
4003
+ else if (price !== undefined) {
4004
+ request['qty'] = this.getCost(symbol, Precise.stringMul(amountString, priceString));
4005
+ }
4006
+ else {
4007
+ request['qty'] = this.getCost(symbol, this.numberToString(amount));
4008
+ }
3874
4009
  }
3875
4010
  }
3876
4011
  else {
@@ -3967,7 +4102,7 @@ export default class bybit extends Exchange {
3967
4102
  const side = this.safeString(rawOrder, 'side');
3968
4103
  const amount = this.safeValue(rawOrder, 'amount');
3969
4104
  const price = this.safeValue(rawOrder, 'price');
3970
- const orderParams = this.safeValue(rawOrder, 'params', {});
4105
+ const orderParams = this.safeDict(rawOrder, 'params', {});
3971
4106
  const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams, isUta);
3972
4107
  ordersRequests.push(orderRequest);
3973
4108
  }
package/js/src/cex.d.ts CHANGED
@@ -194,6 +194,7 @@ export default class cex extends Exchange {
194
194
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
195
195
  * @param {object} [params] extra parameters specific to the exchange API endpoint
196
196
  * @param {string} [params.accountId] account-id to use (default is empty string)
197
+ * @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
197
198
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
198
199
  */
199
200
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
package/js/src/cex.js CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  // ---------------------------------------------------------------------------
8
8
  import Exchange from './abstract/cex.js';
9
- import { ExchangeError, ArgumentsRequired, NullResponse, PermissionDenied, InsufficientFunds, BadRequest } from './base/errors.js';
9
+ import { ExchangeError, ArgumentsRequired, NullResponse, PermissionDenied, InsufficientFunds, BadRequest, AuthenticationError } from './base/errors.js';
10
10
  import { Precise } from './base/Precise.js';
11
11
  import { TICK_SIZE } from './base/functions/number.js';
12
12
  import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
@@ -21,7 +21,7 @@ export default class cex extends Exchange {
21
21
  'id': 'cex',
22
22
  'name': 'CEX.IO',
23
23
  'countries': ['GB', 'EU', 'CY', 'RU'],
24
- 'rateLimit': 1667,
24
+ 'rateLimit': 300,
25
25
  'pro': true,
26
26
  'has': {
27
27
  'CORS': undefined,
@@ -33,6 +33,8 @@ export default class cex extends Exchange {
33
33
  'cancelAllOrders': true,
34
34
  'cancelOrder': true,
35
35
  'createOrder': true,
36
+ 'createStopOrder': true,
37
+ 'createTriggerOrder': true,
36
38
  'fetchAccounts': true,
37
39
  'fetchBalance': true,
38
40
  'fetchClosedOrder': true,
@@ -121,7 +123,8 @@ export default class cex extends Exchange {
121
123
  'check failed': BadRequest,
122
124
  'Insufficient funds': InsufficientFunds,
123
125
  'Get deposit address for main account is not allowed': PermissionDenied,
124
- 'Market Trigger orders are not allowed': BadRequest, // for some reason, triggerPrice does not work for market orders
126
+ 'Market Trigger orders are not allowed': BadRequest,
127
+ 'key not passed or incorrect': AuthenticationError,
125
128
  },
126
129
  },
127
130
  'timeframes': {
@@ -852,7 +855,7 @@ export default class cex extends Exchange {
852
855
  const code = this.safeCurrencyCode(key);
853
856
  const account = {
854
857
  'used': this.safeString(balance, 'balanceOnHold'),
855
- 'free': this.safeString(balance, 'balance'),
858
+ 'total': this.safeString(balance, 'balance'),
856
859
  };
857
860
  result[code] = account;
858
861
  }
@@ -939,7 +942,7 @@ export default class cex extends Exchange {
939
942
  // },
940
943
  // ...
941
944
  //
942
- const data = this.safeValue(response, 'data', []);
945
+ const data = this.safeList(response, 'data', []);
943
946
  return this.parseOrders(data, market, since, limit);
944
947
  }
945
948
  /**
@@ -1008,10 +1011,16 @@ export default class cex extends Exchange {
1008
1011
  }
1009
1012
  parseOrderStatus(status) {
1010
1013
  const statuses = {
1014
+ 'PENDING_NEW': 'open',
1015
+ 'NEW': 'open',
1016
+ 'PARTIALLY_FILLED': 'open',
1011
1017
  'FILLED': 'closed',
1018
+ 'EXPIRED': 'expired',
1019
+ 'REJECTED': 'rejected',
1020
+ 'PENDING_CANCEL': 'canceling',
1012
1021
  'CANCELLED': 'canceled',
1013
1022
  };
1014
- return this.safeString(statuses, status, undefined);
1023
+ return this.safeString(statuses, status, status);
1015
1024
  }
1016
1025
  parseOrder(order, market = undefined) {
1017
1026
  //
@@ -1061,7 +1070,7 @@ export default class cex extends Exchange {
1061
1070
  const currencyId = this.safeString(order, 'feeCurrency');
1062
1071
  const feeCode = this.safeCurrencyCode(currencyId);
1063
1072
  fee['currency'] = feeCode;
1064
- fee['fee'] = feeAmount;
1073
+ fee['cost'] = feeAmount;
1065
1074
  }
1066
1075
  const timestamp = this.safeInteger(order, 'serverCreateTimestamp');
1067
1076
  const requestedBase = this.safeNumber(order, 'requestedAmountCcy1');
@@ -1105,6 +1114,7 @@ export default class cex extends Exchange {
1105
1114
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1106
1115
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1107
1116
  * @param {string} [params.accountId] account-id to use (default is empty string)
1117
+ * @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
1108
1118
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1109
1119
  */
1110
1120
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
@@ -195,7 +195,8 @@ export default class coinbase extends Exchange {
195
195
  * @see https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getfcmbalancesummary
196
196
  * @param {object} [params] extra parameters specific to the exchange API endpoint
197
197
  * @param {boolean} [params.v3] default false, set true to use v3 api endpoint
198
- * @param {object} [params.type] "spot" (default) or "swap" or "future"
198
+ * @param {string} [params.type] "spot" (default) or "swap" or "future"
199
+ * @param {int} [params.limit] default 250, maximum number of accounts to return
199
200
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
200
201
  */
201
202
  fetchBalance(params?: {}): Promise<Balances>;
@@ -2243,7 +2243,8 @@ export default class coinbase extends Exchange {
2243
2243
  * @see https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getfcmbalancesummary
2244
2244
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2245
2245
  * @param {boolean} [params.v3] default false, set true to use v3 api endpoint
2246
- * @param {object} [params.type] "spot" (default) or "swap" or "future"
2246
+ * @param {string} [params.type] "spot" (default) or "swap" or "future"
2247
+ * @param {int} [params.limit] default 250, maximum number of accounts to return
2247
2248
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
2248
2249
  */
2249
2250
  async fetchBalance(params = {}) {
@@ -2263,7 +2264,7 @@ export default class coinbase extends Exchange {
2263
2264
  response = await this.v3PrivateGetBrokerageAccounts(this.extend(request, params));
2264
2265
  }
2265
2266
  else {
2266
- request['limit'] = 100;
2267
+ request['limit'] = 250;
2267
2268
  response = await this.v2PrivateGetAccounts(this.extend(request, params));
2268
2269
  }
2269
2270
  //
@@ -2379,28 +2380,8 @@ export default class coinbase extends Exchange {
2379
2380
  const pagination = this.safeDict(response, 'pagination', {});
2380
2381
  const cursor = this.safeString(pagination, 'next_starting_after');
2381
2382
  if ((cursor !== undefined) && (cursor !== '')) {
2382
- const lastFee = this.safeDict(last, 'fee');
2383
- last['next_starting_after'] = cursor;
2384
- ledger[lastIndex] = {
2385
- 'info': this.safeDict(last, 'info'),
2386
- 'id': this.safeString(last, 'id'),
2387
- 'timestamp': this.safeInteger(last, 'timestamp'),
2388
- 'datetime': this.safeString(last, 'datetime'),
2389
- 'direction': this.safeString(last, 'direction'),
2390
- 'account': this.safeString(last, 'account'),
2391
- 'referenceId': undefined,
2392
- 'referenceAccount': undefined,
2393
- 'type': this.safeString(last, 'type'),
2394
- 'currency': this.safeString(last, 'currency'),
2395
- 'amount': this.safeNumber(last, 'amount'),
2396
- 'before': undefined,
2397
- 'after': undefined,
2398
- 'status': this.safeString(last, 'status'),
2399
- 'fee': {
2400
- 'cost': this.safeNumber(lastFee, 'cost'),
2401
- 'currency': this.safeString(lastFee, 'currency'),
2402
- },
2403
- };
2383
+ last['info']['next_starting_after'] = cursor;
2384
+ ledger[lastIndex] = last;
2404
2385
  }
2405
2386
  return ledger;
2406
2387
  }
@@ -119,7 +119,8 @@ export default class coinbaseexchange extends Exchange {
119
119
  'products/{id}/ticker',
120
120
  'products/{id}/trades',
121
121
  'time',
122
- 'products/spark-lines', // experimental
122
+ 'products/spark-lines',
123
+ 'products/volume-summary',
123
124
  ],
124
125
  },
125
126
  'private': {
package/js/src/coinex.js CHANGED
@@ -58,6 +58,7 @@ export default class coinex extends Exchange {
58
58
  'createOrders': true,
59
59
  'createReduceOnlyOrder': true,
60
60
  'createStopLossOrder': true,
61
+ 'createStopOrder': true,
61
62
  'createTakeProfitOrder': true,
62
63
  'createTriggerOrder': true,
63
64
  'editOrder': true,
@@ -4773,6 +4774,7 @@ export default class coinex extends Exchange {
4773
4774
  'not_pass': 'failed',
4774
4775
  'cancel': 'canceled',
4775
4776
  'finish': 'ok',
4777
+ 'finished': 'ok',
4776
4778
  'fail': 'failed',
4777
4779
  };
4778
4780
  return this.safeString(statuses, status, status);
package/js/src/coinone.js CHANGED
@@ -236,7 +236,7 @@ export default class coinone extends Exchange {
236
236
  // }
237
237
  //
238
238
  const result = {};
239
- const currencies = this.safeValue(response, 'currencies', []);
239
+ const currencies = this.safeList(response, 'currencies', []);
240
240
  for (let i = 0; i < currencies.length; i++) {
241
241
  const entry = currencies[i];
242
242
  const id = this.safeString(entry, 'symbol');
@@ -317,7 +317,7 @@ export default class coinone extends Exchange {
317
317
  // ]
318
318
  // }
319
319
  //
320
- const tickers = this.safeValue(response, 'tickers', []);
320
+ const tickers = this.safeList(response, 'tickers', []);
321
321
  const result = [];
322
322
  for (let i = 0; i < tickers.length; i++) {
323
323
  const entry = this.safeValue(tickers, i);
@@ -572,7 +572,7 @@ export default class coinone extends Exchange {
572
572
  // ]
573
573
  // }
574
574
  //
575
- const data = this.safeValue(response, 'tickers', []);
575
+ const data = this.safeList(response, 'tickers', []);
576
576
  const ticker = this.safeDict(data, 0, {});
577
577
  return this.parseTicker(ticker, market);
578
578
  }
@@ -605,8 +605,8 @@ export default class coinone extends Exchange {
605
605
  //
606
606
  const timestamp = this.safeInteger(ticker, 'timestamp');
607
607
  const last = this.safeString(ticker, 'last');
608
- const asks = this.safeValue(ticker, 'best_asks');
609
- const bids = this.safeValue(ticker, 'best_bids');
608
+ const asks = this.safeList(ticker, 'best_asks', []);
609
+ const bids = this.safeList(ticker, 'best_bids', []);
610
610
  const baseId = this.safeString(ticker, 'target_currency');
611
611
  const quoteId = this.safeString(ticker, 'quote_currency');
612
612
  const base = this.safeCurrencyCode(baseId);
@@ -660,7 +660,7 @@ export default class coinone extends Exchange {
660
660
  //
661
661
  const timestamp = this.safeInteger(trade, 'timestamp');
662
662
  market = this.safeMarket(undefined, market);
663
- const isSellerMaker = this.safeValue(trade, 'is_seller_maker');
663
+ const isSellerMaker = this.safeBool(trade, 'is_seller_maker');
664
664
  let side = undefined;
665
665
  if (isSellerMaker !== undefined) {
666
666
  side = isSellerMaker ? 'sell' : 'buy';
@@ -1093,7 +1093,7 @@ export default class coinone extends Exchange {
1093
1093
  // }
1094
1094
  // }
1095
1095
  //
1096
- const walletAddress = this.safeValue(response, 'walletAddress', {});
1096
+ const walletAddress = this.safeDict(response, 'walletAddress', {});
1097
1097
  const keys = Object.keys(walletAddress);
1098
1098
  const result = {};
1099
1099
  for (let i = 0; i < keys.length; i++) {
package/js/src/coinsph.js CHANGED
@@ -547,7 +547,7 @@ export default class coinsph extends Exchange {
547
547
  // ]
548
548
  // }
549
549
  //
550
- const markets = this.safeValue(response, 'symbols');
550
+ const markets = this.safeList(response, 'symbols', []);
551
551
  const result = [];
552
552
  for (let i = 0; i < markets.length; i++) {
553
553
  const market = markets[i];
@@ -556,7 +556,7 @@ export default class coinsph extends Exchange {
556
556
  const quoteId = this.safeString(market, 'quoteAsset');
557
557
  const base = this.safeCurrencyCode(baseId);
558
558
  const quote = this.safeCurrencyCode(quoteId);
559
- const limits = this.indexBy(this.safeValue(market, 'filters'), 'filterType');
559
+ const limits = this.indexBy(this.safeList(market, 'filters', []), 'filterType');
560
560
  const amountLimits = this.safeValue(limits, 'LOT_SIZE', {});
561
561
  const priceLimits = this.safeValue(limits, 'PRICE_FILTER', {});
562
562
  const costLimits = this.safeValue(limits, 'NOTIONAL', {});
@@ -639,7 +639,7 @@ export default class coinsph extends Exchange {
639
639
  request['symbols'] = ids;
640
640
  }
641
641
  const defaultMethod = 'publicGetOpenapiQuoteV1Ticker24hr';
642
- const options = this.safeValue(this.options, 'fetchTickers', {});
642
+ const options = this.safeDict(this.options, 'fetchTickers', {});
643
643
  const method = this.safeString(options, 'method', defaultMethod);
644
644
  let tickers = undefined;
645
645
  if (method === 'publicGetOpenapiQuoteV1TickerPrice') {
@@ -671,7 +671,7 @@ export default class coinsph extends Exchange {
671
671
  'symbol': market['id'],
672
672
  };
673
673
  const defaultMethod = 'publicGetOpenapiQuoteV1Ticker24hr';
674
- const options = this.safeValue(this.options, 'fetchTicker', {});
674
+ const options = this.safeDict(this.options, 'fetchTicker', {});
675
675
  const method = this.safeString(options, 'method', defaultMethod);
676
676
  let ticker = undefined;
677
677
  if (method === 'publicGetOpenapiQuoteV1TickerPrice') {
@@ -1017,7 +1017,7 @@ export default class coinsph extends Exchange {
1017
1017
  'currency': this.safeCurrencyCode(feeCurrencyId),
1018
1018
  };
1019
1019
  }
1020
- const isBuyer = this.safeValue2(trade, 'isBuyer', 'isBuyerMaker', undefined);
1020
+ const isBuyer = this.safeBool2(trade, 'isBuyer', 'isBuyerMaker', undefined);
1021
1021
  let side = undefined;
1022
1022
  if (isBuyer !== undefined) {
1023
1023
  side = (isBuyer === true) ? 'buy' : 'sell';
@@ -1082,7 +1082,7 @@ export default class coinsph extends Exchange {
1082
1082
  return this.parseBalance(response);
1083
1083
  }
1084
1084
  parseBalance(response) {
1085
- const balances = this.safeValue(response, 'balances', []);
1085
+ const balances = this.safeList(response, 'balances', []);
1086
1086
  const result = {
1087
1087
  'info': response,
1088
1088
  'timestamp': undefined,
@@ -1529,7 +1529,7 @@ export default class coinsph extends Exchange {
1529
1529
  // }
1530
1530
  // ]
1531
1531
  //
1532
- const tradingFee = this.safeValue(response, 0, {});
1532
+ const tradingFee = this.safeDict(response, 0, {});
1533
1533
  return this.parseTradingFee(tradingFee, market);
1534
1534
  }
1535
1535
  /**