ccxt 4.1.91 → 4.1.94

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.
package/dist/cjs/ccxt.js CHANGED
@@ -168,7 +168,7 @@ var woo$1 = require('./src/pro/woo.js');
168
168
 
169
169
  //-----------------------------------------------------------------------------
170
170
  // this is updated by vss.js when building
171
- const version = '4.1.91';
171
+ const version = '4.1.94';
172
172
  Exchange["default"].ccxtVersion = version;
173
173
  const exchanges = {
174
174
  'ace': ace,
@@ -3137,7 +3137,7 @@ class binance extends binance$1 {
3137
3137
  * @see https://binance-docs.github.io/apidocs/futures/en/#24hr-ticker-price-change-statistics // swap
3138
3138
  * @see https://binance-docs.github.io/apidocs/delivery/en/#24hr-ticker-price-change-statistics // future
3139
3139
  * @see https://binance-docs.github.io/apidocs/voptions/en/#24hr-ticker-price-change-statistics // option
3140
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
3140
+ * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
3141
3141
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3142
3142
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
3143
3143
  */
@@ -3152,22 +3152,24 @@ class binance extends binance$1 {
3152
3152
  [type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
3153
3153
  let subType = undefined;
3154
3154
  [subType, params] = this.handleSubTypeAndParams('fetchTickers', market, params);
3155
- const query = this.omit(params, 'type');
3156
- let defaultMethod = undefined;
3155
+ let response = undefined;
3157
3156
  if (type === 'option') {
3158
- defaultMethod = 'eapiPublicGetTicker';
3157
+ response = await this.eapiPublicGetTicker(params);
3159
3158
  }
3160
3159
  else if (this.isLinear(type, subType)) {
3161
- defaultMethod = 'fapiPublicGetTicker24hr';
3160
+ response = await this.fapiPublicGetTicker24hr(params);
3162
3161
  }
3163
3162
  else if (this.isInverse(type, subType)) {
3164
- defaultMethod = 'dapiPublicGetTicker24hr';
3163
+ response = await this.dapiPublicGetTicker24hr(params);
3165
3164
  }
3166
3165
  else {
3167
- defaultMethod = 'publicGetTicker24hr';
3166
+ const request = {};
3167
+ if (symbols !== undefined) {
3168
+ const marketIds = this.marketIds(symbols);
3169
+ request['symbols'] = this.json(marketIds);
3170
+ }
3171
+ response = await this.publicGetTicker24hr(this.extend(request, params));
3168
3172
  }
3169
- const method = this.safeString(this.options, 'fetchTickersMethod', defaultMethod);
3170
- const response = await this[method](query);
3171
3173
  return this.parseTickers(response, symbols);
3172
3174
  }
3173
3175
  parseOHLCV(ohlcv, market = undefined) {
@@ -890,14 +890,19 @@ class bingx extends bingx$1 {
890
890
  const type = (cost === undefined) ? 'spot' : 'swap';
891
891
  const currencyId = this.safeString2(trade, 'currency', 'N');
892
892
  const currencyCode = this.safeCurrencyCode(currencyId);
893
- const m = this.safeValue(trade, 'm', false);
893
+ const m = this.safeValue(trade, 'm');
894
894
  const marketId = this.safeString(trade, 's');
895
895
  const isBuyerMaker = this.safeValue2(trade, 'buyerMaker', 'isBuyerMaker');
896
- let takeOrMaker = (isBuyerMaker || m) ? 'maker' : 'taker';
896
+ let takeOrMaker = undefined;
897
+ if ((isBuyerMaker !== undefined) || (m !== undefined)) {
898
+ takeOrMaker = (isBuyerMaker || m) ? 'maker' : 'taker';
899
+ }
897
900
  let side = this.safeStringLower2(trade, 'side', 'S');
898
901
  if (side === undefined) {
899
- side = (isBuyerMaker || m) ? 'sell' : 'buy';
900
- takeOrMaker = 'taker';
902
+ if ((isBuyerMaker !== undefined) || (m !== undefined)) {
903
+ side = (isBuyerMaker || m) ? 'sell' : 'buy';
904
+ takeOrMaker = 'taker';
905
+ }
901
906
  }
902
907
  return this.safeTrade({
903
908
  'id': this.safeStringN(trade, ['id', 't']),
@@ -910,7 +915,7 @@ class bingx extends bingx$1 {
910
915
  'side': this.parseOrderSide(side),
911
916
  'takerOrMaker': takeOrMaker,
912
917
  'price': this.safeString2(trade, 'price', 'p'),
913
- 'amount': this.safeStringN(trade, ['qty', 'amount', 'q']),
918
+ 'amount': this.safeStringN(trade, ['qty', 'volume', 'amount', 'q']),
914
919
  'cost': cost,
915
920
  'fee': {
916
921
  'cost': this.parseNumber(Precise["default"].stringAbs(this.safeString2(trade, 'commission', 'n'))),
@@ -1346,7 +1351,7 @@ class bingx extends bingx$1 {
1346
1351
  async fetchBalance(params = {}) {
1347
1352
  /**
1348
1353
  * @method
1349
- * @name cryptocom#fetchBalance
1354
+ * @name bingx#fetchBalance
1350
1355
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
1351
1356
  * @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Query%20Assets
1352
1357
  * @see https://bingx-api.github.io/docs/#/swapV2/account-api.html#Get%20Perpetual%20Swap%20Account%20Asset%20Information
@@ -36,7 +36,7 @@ class bitget extends bitget$1 {
36
36
  'cancelOrder': true,
37
37
  'cancelOrders': true,
38
38
  'closeAllPositions': true,
39
- 'closePosition': false,
39
+ 'closePosition': true,
40
40
  'createMarketBuyOrderWithCost': true,
41
41
  'createMarketOrderWithCost': false,
42
42
  'createMarketSellOrderWithCost': false,
@@ -3567,7 +3567,7 @@ class bitget extends bitget$1 {
3567
3567
  }
3568
3568
  parseOrder(order, market = undefined) {
3569
3569
  //
3570
- // createOrder, editOrder
3570
+ // createOrder, editOrder, closePosition
3571
3571
  //
3572
3572
  // {
3573
3573
  // "clientOid": "abe95dbe-6081-4a6f-a2d3-ae49601cd479",
@@ -3845,8 +3845,13 @@ class bitget extends bitget$1 {
3845
3845
  'status': 'rejected',
3846
3846
  }, market);
3847
3847
  }
3848
+ const isContractOrder = ('posSide' in order);
3849
+ let marketType = isContractOrder ? 'contract' : 'spot';
3850
+ if (market !== undefined) {
3851
+ marketType = market['type'];
3852
+ }
3848
3853
  const marketId = this.safeString(order, 'symbol');
3849
- market = this.safeMarket(marketId, market);
3854
+ market = this.safeMarket(marketId, market, undefined, marketType);
3850
3855
  const timestamp = this.safeInteger2(order, 'cTime', 'ctime');
3851
3856
  const updateTimestamp = this.safeInteger(order, 'uTime');
3852
3857
  const rawStatus = this.safeString2(order, 'status', 'state');
@@ -5286,13 +5291,14 @@ class bitget extends bitget$1 {
5286
5291
  * @param {int} [params.until] the latest time in ms to fetch entries for
5287
5292
  * @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)
5288
5293
  * @param {string} [params.isPlan] *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
5294
+ * @param {string} [params.productType] *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
5289
5295
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
5290
5296
  */
5291
- if (symbol === undefined) {
5292
- throw new errors.ArgumentsRequired(this.id + ' fetchClosedOrders() requires a symbol argument');
5293
- }
5294
5297
  await this.loadMarkets();
5295
- const market = this.market(symbol);
5298
+ let market = undefined;
5299
+ if (symbol !== undefined) {
5300
+ market = this.market(symbol);
5301
+ }
5296
5302
  const response = await this.fetchCanceledAndClosedOrders(symbol, since, limit, params);
5297
5303
  const result = [];
5298
5304
  for (let i = 0; i < response.length; i++) {
@@ -5322,13 +5328,14 @@ class bitget extends bitget$1 {
5322
5328
  * @param {int} [params.until] the latest time in ms to fetch entries for
5323
5329
  * @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)
5324
5330
  * @param {string} [params.isPlan] *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
5331
+ * @param {string} [params.productType] *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
5325
5332
  * @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
5326
5333
  */
5327
- if (symbol === undefined) {
5328
- throw new errors.ArgumentsRequired(this.id + ' fetchCanceledOrders() requires a symbol argument');
5329
- }
5330
5334
  await this.loadMarkets();
5331
- const market = this.market(symbol);
5335
+ let market = undefined;
5336
+ if (symbol !== undefined) {
5337
+ market = this.market(symbol);
5338
+ }
5332
5339
  const response = await this.fetchCanceledAndClosedOrders(symbol, since, limit, params);
5333
5340
  const result = [];
5334
5341
  for (let i = 0; i < response.length; i++) {
@@ -5345,19 +5352,25 @@ class bitget extends bitget$1 {
5345
5352
  const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
5346
5353
  let market = undefined;
5347
5354
  if (sandboxMode) {
5348
- const sandboxSymbol = this.convertSymbolForSandbox(symbol);
5349
- market = this.market(sandboxSymbol);
5355
+ if (symbol !== undefined) {
5356
+ const sandboxSymbol = this.convertSymbolForSandbox(symbol);
5357
+ symbol = sandboxSymbol;
5358
+ }
5350
5359
  }
5351
- else {
5360
+ let request = {};
5361
+ if (symbol !== undefined) {
5352
5362
  market = this.market(symbol);
5363
+ request['symbol'] = market['id'];
5353
5364
  }
5365
+ let marketType = undefined;
5366
+ [marketType, params] = this.handleMarketTypeAndParams('fetchCanceledAndClosedOrders', market, params);
5354
5367
  let marginMode = undefined;
5355
5368
  [marginMode, params] = this.handleMarginModeAndParams('fetchCanceledAndClosedOrders', params);
5356
5369
  let paginate = false;
5357
5370
  [paginate, params] = this.handleOptionAndParams(params, 'fetchCanceledAndClosedOrders', 'paginate');
5358
5371
  if (paginate) {
5359
5372
  let cursorReceived = undefined;
5360
- if (market['spot']) {
5373
+ if (marketType === 'spot') {
5361
5374
  if (marginMode !== undefined) {
5362
5375
  cursorReceived = 'minId';
5363
5376
  }
@@ -5367,9 +5380,6 @@ class bitget extends bitget$1 {
5367
5380
  }
5368
5381
  return await this.fetchPaginatedCallCursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, cursorReceived, 'idLessThan');
5369
5382
  }
5370
- let request = {
5371
- 'symbol': market['id'],
5372
- };
5373
5383
  let response = undefined;
5374
5384
  const stop = this.safeValue2(params, 'stop', 'trigger');
5375
5385
  params = this.omit(params, ['stop', 'trigger']);
@@ -5380,7 +5390,7 @@ class bitget extends bitget$1 {
5380
5390
  if (limit !== undefined) {
5381
5391
  request['limit'] = limit;
5382
5392
  }
5383
- if ((market['swap']) || (market['future']) || (marginMode !== undefined)) {
5393
+ if ((marketType === 'swap') || (marketType === 'future') || (marginMode !== undefined)) {
5384
5394
  const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
5385
5395
  params = this.omit(params, 'clientOrderId');
5386
5396
  if (clientOrderId !== undefined) {
@@ -5388,7 +5398,7 @@ class bitget extends bitget$1 {
5388
5398
  }
5389
5399
  }
5390
5400
  const now = this.milliseconds();
5391
- if (market['spot']) {
5401
+ if (marketType === 'spot') {
5392
5402
  if (marginMode !== undefined) {
5393
5403
  if (since === undefined) {
5394
5404
  since = now - 7776000000;
@@ -5403,6 +5413,9 @@ class bitget extends bitget$1 {
5403
5413
  }
5404
5414
  else {
5405
5415
  if (stop) {
5416
+ if (symbol === undefined) {
5417
+ throw new errors.ArgumentsRequired(this.id + ' fetchCanceledAndClosedOrders() requires a symbol argument');
5418
+ }
5406
5419
  const endTime = this.safeIntegerN(params, ['endTime', 'until', 'till']);
5407
5420
  params = this.omit(params, ['until', 'till']);
5408
5421
  if (since === undefined) {
@@ -5611,7 +5624,7 @@ class bitget extends bitget$1 {
5611
5624
  // }
5612
5625
  //
5613
5626
  const data = this.safeValue(response, 'data', {});
5614
- if (market['spot']) {
5627
+ if (marketType === 'spot') {
5615
5628
  if ((marginMode !== undefined) || stop) {
5616
5629
  return this.safeValue(data, 'orderList', []);
5617
5630
  }
@@ -6299,11 +6312,10 @@ class bitget extends bitget$1 {
6299
6312
  //
6300
6313
  // closeAllPositions
6301
6314
  //
6302
- // {
6303
- // "symbol": "XRPUSDT_UMCBL",
6304
- // "orderId": "1111861847410757635",
6305
- // "clientOid": "1111861847410757637"
6306
- // }
6315
+ // {
6316
+ // "orderId": "1120923953904893955",
6317
+ // "clientOid": "1120923953904893956"
6318
+ // }
6307
6319
  //
6308
6320
  const marketId = this.safeString(position, 'symbol');
6309
6321
  market = this.safeMarket(marketId, market, undefined, 'contract');
@@ -6372,7 +6384,7 @@ class bitget extends bitget$1 {
6372
6384
  const percentage = Precise["default"].stringMul(Precise["default"].stringDiv(unrealizedPnl, initialMargin, 4), '100');
6373
6385
  return this.safePosition({
6374
6386
  'info': position,
6375
- 'id': undefined,
6387
+ 'id': this.safeString(position, 'orderId'),
6376
6388
  'symbol': symbol,
6377
6389
  'notional': this.parseNumber(notional),
6378
6390
  'marginMode': marginMode,
@@ -7992,65 +8004,94 @@ class bitget extends bitget$1 {
7992
8004
  'info': info,
7993
8005
  };
7994
8006
  }
8007
+ async closePosition(symbol, side = undefined, params = {}) {
8008
+ /**
8009
+ * @method
8010
+ * @name bitget#closePosition
8011
+ * @description closes an open position for a market
8012
+ * @see https://www.bitget.com/api-doc/contract/trade/Flash-Close-Position
8013
+ * @param {string} symbol unified CCXT market symbol
8014
+ * @param {string} [side] one-way mode: 'buy' or 'sell', hedge-mode: 'long' or 'short'
8015
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
8016
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
8017
+ */
8018
+ await this.loadMarkets();
8019
+ const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
8020
+ let market = undefined;
8021
+ if (sandboxMode) {
8022
+ const sandboxSymbol = this.convertSymbolForSandbox(symbol);
8023
+ market = this.market(sandboxSymbol);
8024
+ }
8025
+ else {
8026
+ market = this.market(symbol);
8027
+ }
8028
+ let productType = undefined;
8029
+ [productType, params] = this.handleProductTypeAndParams(market, params);
8030
+ const request = {
8031
+ 'symbol': market['id'],
8032
+ 'productType': productType,
8033
+ };
8034
+ if (side !== undefined) {
8035
+ request['holdSide'] = side;
8036
+ }
8037
+ const response = await this.privateMixPostV2MixOrderClosePositions(this.extend(request, params));
8038
+ //
8039
+ // {
8040
+ // "code": "00000",
8041
+ // "msg": "success",
8042
+ // "requestTime": 1702975017017,
8043
+ // "data": {
8044
+ // "successList": [
8045
+ // {
8046
+ // "orderId": "1120923953904893955",
8047
+ // "clientOid": "1120923953904893956"
8048
+ // }
8049
+ // ],
8050
+ // "failureList": [],
8051
+ // "result": false
8052
+ // }
8053
+ // }
8054
+ //
8055
+ const data = this.safeValue(response, 'data', {});
8056
+ const order = this.safeValue(data, 'successList', []);
8057
+ return this.parseOrder(order[0], market);
8058
+ }
7995
8059
  async closeAllPositions(params = {}) {
7996
8060
  /**
7997
8061
  * @method
7998
- * @name bitget#closePositions
7999
- * @description closes open positions for a market
8000
- * @see https://bitgetlimited.github.io/apidoc/en/mix/#close-all-position
8001
- * @param {object} [params] extra parameters specific to the okx api endpoint
8002
- * @param {string} [params.subType] 'linear' or 'inverse'
8003
- * @param {string} [params.settle] *required and only valid when params.subType === "linear"* 'USDT' or 'USDC'
8004
- * @returns {object[]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
8062
+ * @name bitget#closeAllPositions
8063
+ * @description closes all open positions for a market type
8064
+ * @see https://www.bitget.com/api-doc/contract/trade/Flash-Close-Position
8065
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
8066
+ * @param {string} [params.productType] 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
8067
+ * @returns {object[]} A list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
8005
8068
  */
8006
8069
  await this.loadMarkets();
8007
- let subType = undefined;
8008
- let settle = undefined;
8009
- [subType, params] = this.handleSubTypeAndParams('closeAllPositions', undefined, params);
8010
- settle = this.safeString(params, 'settle', 'USDT');
8011
- params = this.omit(params, ['settle']);
8012
- const productType = this.safeString(params, 'productType');
8013
- const request = {};
8014
- if (productType === undefined) {
8015
- const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
8016
- let localProductType = undefined;
8017
- if (subType === 'inverse') {
8018
- localProductType = 'dmcbl';
8019
- }
8020
- else {
8021
- if (settle === 'USDT') {
8022
- localProductType = 'umcbl';
8023
- }
8024
- else if (settle === 'USDC') {
8025
- localProductType = 'cmcbl';
8026
- }
8027
- }
8028
- if (sandboxMode) {
8029
- localProductType = 's' + localProductType;
8030
- }
8031
- request['productType'] = localProductType;
8032
- }
8033
- const response = await this.privateMixPostMixV1OrderCloseAllPositions(this.extend(request, params));
8034
- //
8035
- // {
8036
- // "code": "00000",
8037
- // "msg": "success",
8038
- // "requestTime": 1700814442466,
8039
- // "data": {
8040
- // "orderInfo": [
8041
- // {
8042
- // "symbol": "XRPUSDT_UMCBL",
8043
- // "orderId": "1111861847410757635",
8044
- // "clientOid": "1111861847410757637"
8045
- // },
8046
- // ],
8047
- // "failure": [],
8048
- // "result": true
8049
- // }
8050
- // }
8070
+ let productType = undefined;
8071
+ [productType, params] = this.handleProductTypeAndParams(undefined, params);
8072
+ const request = {
8073
+ 'productType': productType,
8074
+ };
8075
+ const response = await this.privateMixPostV2MixOrderClosePositions(this.extend(request, params));
8076
+ //
8077
+ // {
8078
+ // "code": "00000",
8079
+ // "msg": "success",
8080
+ // "requestTime": 1702975017017,
8081
+ // "data": {
8082
+ // "successList": [
8083
+ // {
8084
+ // "orderId": "1120923953904893955",
8085
+ // "clientOid": "1120923953904893956"
8086
+ // }
8087
+ // ],
8088
+ // "failureList": [],
8089
+ // "result": false
8090
+ // }
8091
+ // }
8051
8092
  //
8052
8093
  const data = this.safeValue(response, 'data', {});
8053
- const orderInfo = this.safeValue(data, 'orderInfo', []);
8094
+ const orderInfo = this.safeValue(data, 'successList', []);
8054
8095
  return this.parsePositions(orderInfo, undefined, params);
8055
8096
  }
8056
8097
  handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
@@ -1541,18 +1541,9 @@ class bitrue extends bitrue$1 {
1541
1541
  const first = this.safeString(symbols, 0);
1542
1542
  const market = this.market(first);
1543
1543
  if (market['swap']) {
1544
- request['contractName'] = market['id'];
1545
- if (market['linear']) {
1546
- response = await this.fapiV1PublicGetTicker(this.extend(request, params));
1547
- }
1548
- else if (market['inverse']) {
1549
- response = await this.dapiV1PublicGetTicker(this.extend(request, params));
1550
- }
1551
- response['symbol'] = market['id'];
1552
- data = [response];
1544
+ throw new errors.NotSupported(this.id + ' fetchTickers does not support swap markets, please use fetchTicker instead');
1553
1545
  }
1554
1546
  else if (market['spot']) {
1555
- request['symbol'] = market['id'];
1556
1547
  response = await this.spotV1PublicGetTicker24hr(this.extend(request, params));
1557
1548
  data = response;
1558
1549
  }
@@ -1563,7 +1554,7 @@ class bitrue extends bitrue$1 {
1563
1554
  else {
1564
1555
  [type, params] = this.handleMarketTypeAndParams('fetchTickers', undefined, params);
1565
1556
  if (type !== 'spot') {
1566
- throw new errors.NotSupported(this.id + ' fetchTickers only support spot when symbols is not set');
1557
+ throw new errors.NotSupported(this.id + ' fetchTickers only support spot when symbols are not proved');
1567
1558
  }
1568
1559
  response = await this.spotV1PublicGetTicker24hr(this.extend(request, params));
1569
1560
  data = response;
@@ -296,6 +296,7 @@ class bybit extends bybit$1 {
296
296
  'v5/account/fee-rate': 10,
297
297
  'v5/account/info': 5,
298
298
  'v5/account/transaction-log': 1,
299
+ 'v5/account/smp-group': 1,
299
300
  'v5/account/mmp-state': 5,
300
301
  // asset
301
302
  'v5/asset/exchange/order-record': 5,
@@ -197,6 +197,8 @@ class coinbase extends coinbase$1 {
197
197
  'brokerage/products/{product_id}',
198
198
  'brokerage/products/{product_id}/candles',
199
199
  'brokerage/products/{product_id}/ticker',
200
+ 'brokerage/portfolios',
201
+ 'brokerage/portfolios/{portfolio_uuid}',
200
202
  'brokerage/transaction_summary',
201
203
  'brokerage/product_book',
202
204
  'brokerage/best_bid_ask',
@@ -208,9 +210,17 @@ class coinbase extends coinbase$1 {
208
210
  'brokerage/orders/batch_cancel',
209
211
  'brokerage/orders/edit',
210
212
  'brokerage/orders/edit_preview',
213
+ 'brokerage/portfolios',
214
+ 'brokerage/portfolios/move_funds',
211
215
  'brokerage/convert/quote',
212
216
  'brokerage/convert/trade/{trade_id}',
213
217
  ],
218
+ 'put': [
219
+ 'brokerage/portfolios/{portfolio_uuid}',
220
+ ],
221
+ 'delete': [
222
+ 'brokerage/portfolios/{portfolio_uuid}',
223
+ ],
214
224
  },
215
225
  },
216
226
  },
@@ -266,7 +276,9 @@ class coinbase extends coinbase$1 {
266
276
  'invalid_scope': errors.AuthenticationError,
267
277
  'not_found': errors.ExchangeError,
268
278
  'rate_limit_exceeded': errors.RateLimitExceeded,
269
- 'internal_server_error': errors.ExchangeError, // 500 Internal server error
279
+ 'internal_server_error': errors.ExchangeError,
280
+ 'UNSUPPORTED_ORDER_CONFIGURATION': errors.BadRequest,
281
+ 'INSUFFICIENT_FUND': errors.BadRequest,
270
282
  },
271
283
  'broad': {
272
284
  'request timestamp expired': errors.InvalidNonce,
@@ -2271,6 +2283,8 @@ class coinbase extends coinbase$1 {
2271
2283
  params = this.omit(params, ['timeInForce', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'stopPrice', 'stop_price', 'stopDirection', 'stop_direction', 'clientOrderId', 'postOnly', 'post_only', 'end_time']);
2272
2284
  const response = await this.v3PrivatePostBrokerageOrders(this.extend(request, params));
2273
2285
  //
2286
+ // successful order
2287
+ //
2274
2288
  // {
2275
2289
  // "success": true,
2276
2290
  // "failure_reason": "UNKNOWN_FAILURE_REASON",
@@ -2284,9 +2298,37 @@ class coinbase extends coinbase$1 {
2284
2298
  // "order_configuration": null
2285
2299
  // }
2286
2300
  //
2301
+ // failed order
2302
+ //
2303
+ // {
2304
+ // "success": false,
2305
+ // "failure_reason": "UNKNOWN_FAILURE_REASON",
2306
+ // "order_id": "",
2307
+ // "error_response": {
2308
+ // "error": "UNSUPPORTED_ORDER_CONFIGURATION",
2309
+ // "message": "source is not enabled for trading",
2310
+ // "error_details": "",
2311
+ // "new_order_failure_reason": "UNSUPPORTED_ORDER_CONFIGURATION"
2312
+ // },
2313
+ // "order_configuration": {
2314
+ // "limit_limit_gtc": {
2315
+ // "base_size": "100",
2316
+ // "limit_price": "40000",
2317
+ // "post_only": false
2318
+ // }
2319
+ // }
2320
+ // }
2321
+ //
2287
2322
  const success = this.safeValue(response, 'success');
2288
2323
  if (success !== true) {
2289
- throw new errors.BadRequest(this.id + ' createOrder() has failed, check your arguments and parameters');
2324
+ const errorResponse = this.safeValue(response, 'error_response');
2325
+ const errorTitle = this.safeString(errorResponse, 'error');
2326
+ const errorMessage = this.safeString(errorResponse, 'message');
2327
+ if (errorResponse !== undefined) {
2328
+ this.throwExactlyMatchedException(this.exceptions['exact'], errorTitle, errorMessage);
2329
+ this.throwBroadlyMatchedException(this.exceptions['broad'], errorTitle, errorMessage);
2330
+ throw new errors.ExchangeError(errorMessage);
2331
+ }
2290
2332
  }
2291
2333
  const data = this.safeValue(response, 'success_response', {});
2292
2334
  return this.parseOrder(data, market);