ccxt 4.1.91 → 4.1.95

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/js/src/bitget.js CHANGED
@@ -39,7 +39,7 @@ export default class bitget extends Exchange {
39
39
  'cancelOrder': true,
40
40
  'cancelOrders': true,
41
41
  'closeAllPositions': true,
42
- 'closePosition': false,
42
+ 'closePosition': true,
43
43
  'createMarketBuyOrderWithCost': true,
44
44
  'createMarketOrderWithCost': false,
45
45
  'createMarketSellOrderWithCost': false,
@@ -3570,7 +3570,7 @@ export default class bitget extends Exchange {
3570
3570
  }
3571
3571
  parseOrder(order, market = undefined) {
3572
3572
  //
3573
- // createOrder, editOrder
3573
+ // createOrder, editOrder, closePosition
3574
3574
  //
3575
3575
  // {
3576
3576
  // "clientOid": "abe95dbe-6081-4a6f-a2d3-ae49601cd479",
@@ -3848,8 +3848,13 @@ export default class bitget extends Exchange {
3848
3848
  'status': 'rejected',
3849
3849
  }, market);
3850
3850
  }
3851
+ const isContractOrder = ('posSide' in order);
3852
+ let marketType = isContractOrder ? 'contract' : 'spot';
3853
+ if (market !== undefined) {
3854
+ marketType = market['type'];
3855
+ }
3851
3856
  const marketId = this.safeString(order, 'symbol');
3852
- market = this.safeMarket(marketId, market);
3857
+ market = this.safeMarket(marketId, market, undefined, marketType);
3853
3858
  const timestamp = this.safeInteger2(order, 'cTime', 'ctime');
3854
3859
  const updateTimestamp = this.safeInteger(order, 'uTime');
3855
3860
  const rawStatus = this.safeString2(order, 'status', 'state');
@@ -4999,26 +5004,35 @@ export default class bitget extends Exchange {
4999
5004
  * @param {string} [params.isPlan] *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
5000
5005
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
5001
5006
  */
5002
- if (symbol === undefined) {
5003
- throw new ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument');
5004
- }
5005
5007
  await this.loadMarkets();
5006
5008
  const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
5007
5009
  let market = undefined;
5008
- if (sandboxMode) {
5009
- const sandboxSymbol = this.convertSymbolForSandbox(symbol);
5010
- market = this.market(sandboxSymbol);
5010
+ let type = undefined;
5011
+ let request = {};
5012
+ let marginMode = undefined;
5013
+ [marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
5014
+ if (symbol !== undefined) {
5015
+ if (sandboxMode) {
5016
+ const sandboxSymbol = this.convertSymbolForSandbox(symbol);
5017
+ market = this.market(sandboxSymbol);
5018
+ }
5019
+ else {
5020
+ market = this.market(symbol);
5021
+ }
5022
+ request['symbol'] = market['id'];
5023
+ const defaultType = this.safeString2(this.options, 'fetchOpenOrders', 'defaultType', 'spot');
5024
+ const marketType = ('type' in market) ? market['type'] : defaultType;
5025
+ type = this.safeString(params, 'type', marketType);
5011
5026
  }
5012
5027
  else {
5013
- market = this.market(symbol);
5028
+ const defaultType = this.safeString2(this.options, 'fetchOpenOrders', 'defaultType', 'spot');
5029
+ type = this.safeString(params, 'type', defaultType);
5014
5030
  }
5015
- let marginMode = undefined;
5016
- [marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
5017
5031
  let paginate = false;
5018
5032
  [paginate, params] = this.handleOptionAndParams(params, 'fetchOpenOrders', 'paginate');
5019
5033
  if (paginate) {
5020
5034
  let cursorReceived = undefined;
5021
- if (market['spot']) {
5035
+ if (type === 'spot') {
5022
5036
  if (marginMode !== undefined) {
5023
5037
  cursorReceived = 'minId';
5024
5038
  }
@@ -5028,9 +5042,6 @@ export default class bitget extends Exchange {
5028
5042
  }
5029
5043
  return await this.fetchPaginatedCallCursor('fetchOpenOrders', symbol, since, limit, params, cursorReceived, 'idLessThan');
5030
5044
  }
5031
- let request = {
5032
- 'symbol': market['id'],
5033
- };
5034
5045
  let response = undefined;
5035
5046
  const stop = this.safeValue2(params, 'stop', 'trigger');
5036
5047
  params = this.omit(params, ['stop', 'trigger']);
@@ -5041,46 +5052,48 @@ export default class bitget extends Exchange {
5041
5052
  if (limit !== undefined) {
5042
5053
  request['limit'] = limit;
5043
5054
  }
5044
- if ((market['swap']) || (market['future']) || (marginMode !== undefined)) {
5055
+ if ((type === 'swap') || (type === 'future') || (marginMode !== undefined)) {
5045
5056
  const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
5046
5057
  params = this.omit(params, 'clientOrderId');
5047
5058
  if (clientOrderId !== undefined) {
5048
5059
  request['clientOid'] = clientOrderId;
5049
5060
  }
5050
5061
  }
5051
- if (market['spot']) {
5062
+ let query = undefined;
5063
+ query = this.omit(params, ['type']);
5064
+ if (type === 'spot') {
5052
5065
  if (marginMode !== undefined) {
5053
5066
  if (since === undefined) {
5054
5067
  since = this.milliseconds() - 7776000000;
5055
5068
  request['startTime'] = since;
5056
5069
  }
5057
5070
  if (marginMode === 'isolated') {
5058
- response = await this.privateMarginGetV2MarginIsolatedOpenOrders(this.extend(request, params));
5071
+ response = await this.privateMarginGetV2MarginIsolatedOpenOrders(this.extend(request, query));
5059
5072
  }
5060
5073
  else if (marginMode === 'cross') {
5061
- response = await this.privateMarginGetV2MarginCrossedOpenOrders(this.extend(request, params));
5074
+ response = await this.privateMarginGetV2MarginCrossedOpenOrders(this.extend(request, query));
5062
5075
  }
5063
5076
  }
5064
5077
  else {
5065
5078
  if (stop) {
5066
- response = await this.privateSpotGetV2SpotTradeCurrentPlanOrder(this.extend(request, params));
5079
+ response = await this.privateSpotGetV2SpotTradeCurrentPlanOrder(this.extend(request, query));
5067
5080
  }
5068
5081
  else {
5069
- response = await this.privateSpotGetV2SpotTradeUnfilledOrders(this.extend(request, params));
5082
+ response = await this.privateSpotGetV2SpotTradeUnfilledOrders(this.extend(request, query));
5070
5083
  }
5071
5084
  }
5072
5085
  }
5073
5086
  else {
5074
5087
  let productType = undefined;
5075
- [productType, params] = this.handleProductTypeAndParams(market, params);
5088
+ [productType, query] = this.handleProductTypeAndParams(market, query);
5076
5089
  request['productType'] = productType;
5077
5090
  if (stop) {
5078
- const planType = this.safeString(params, 'planType', 'normal_plan');
5091
+ const planType = this.safeString(query, 'planType', 'normal_plan');
5079
5092
  request['planType'] = planType;
5080
- response = await this.privateMixGetV2MixOrderOrdersPlanPending(this.extend(request, params));
5093
+ response = await this.privateMixGetV2MixOrderOrdersPlanPending(this.extend(request, query));
5081
5094
  }
5082
5095
  else {
5083
- response = await this.privateMixGetV2MixOrderOrdersPending(this.extend(request, params));
5096
+ response = await this.privateMixGetV2MixOrderOrdersPending(this.extend(request, query));
5084
5097
  }
5085
5098
  }
5086
5099
  //
@@ -5259,7 +5272,7 @@ export default class bitget extends Exchange {
5259
5272
  // }
5260
5273
  //
5261
5274
  const data = this.safeValue(response, 'data');
5262
- if (market['spot']) {
5275
+ if (type === 'spot') {
5263
5276
  if ((marginMode !== undefined) || stop) {
5264
5277
  const resultList = this.safeValue(data, 'orderList', []);
5265
5278
  return this.parseOrders(resultList, market, since, limit);
@@ -5289,13 +5302,14 @@ export default class bitget extends Exchange {
5289
5302
  * @param {int} [params.until] the latest time in ms to fetch entries for
5290
5303
  * @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)
5291
5304
  * @param {string} [params.isPlan] *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
5305
+ * @param {string} [params.productType] *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
5292
5306
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
5293
5307
  */
5294
- if (symbol === undefined) {
5295
- throw new ArgumentsRequired(this.id + ' fetchClosedOrders() requires a symbol argument');
5296
- }
5297
5308
  await this.loadMarkets();
5298
- const market = this.market(symbol);
5309
+ let market = undefined;
5310
+ if (symbol !== undefined) {
5311
+ market = this.market(symbol);
5312
+ }
5299
5313
  const response = await this.fetchCanceledAndClosedOrders(symbol, since, limit, params);
5300
5314
  const result = [];
5301
5315
  for (let i = 0; i < response.length; i++) {
@@ -5325,13 +5339,14 @@ export default class bitget extends Exchange {
5325
5339
  * @param {int} [params.until] the latest time in ms to fetch entries for
5326
5340
  * @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)
5327
5341
  * @param {string} [params.isPlan] *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
5342
+ * @param {string} [params.productType] *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
5328
5343
  * @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
5329
5344
  */
5330
- if (symbol === undefined) {
5331
- throw new ArgumentsRequired(this.id + ' fetchCanceledOrders() requires a symbol argument');
5332
- }
5333
5345
  await this.loadMarkets();
5334
- const market = this.market(symbol);
5346
+ let market = undefined;
5347
+ if (symbol !== undefined) {
5348
+ market = this.market(symbol);
5349
+ }
5335
5350
  const response = await this.fetchCanceledAndClosedOrders(symbol, since, limit, params);
5336
5351
  const result = [];
5337
5352
  for (let i = 0; i < response.length; i++) {
@@ -5348,19 +5363,25 @@ export default class bitget extends Exchange {
5348
5363
  const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
5349
5364
  let market = undefined;
5350
5365
  if (sandboxMode) {
5351
- const sandboxSymbol = this.convertSymbolForSandbox(symbol);
5352
- market = this.market(sandboxSymbol);
5366
+ if (symbol !== undefined) {
5367
+ const sandboxSymbol = this.convertSymbolForSandbox(symbol);
5368
+ symbol = sandboxSymbol;
5369
+ }
5353
5370
  }
5354
- else {
5371
+ let request = {};
5372
+ if (symbol !== undefined) {
5355
5373
  market = this.market(symbol);
5374
+ request['symbol'] = market['id'];
5356
5375
  }
5376
+ let marketType = undefined;
5377
+ [marketType, params] = this.handleMarketTypeAndParams('fetchCanceledAndClosedOrders', market, params);
5357
5378
  let marginMode = undefined;
5358
5379
  [marginMode, params] = this.handleMarginModeAndParams('fetchCanceledAndClosedOrders', params);
5359
5380
  let paginate = false;
5360
5381
  [paginate, params] = this.handleOptionAndParams(params, 'fetchCanceledAndClosedOrders', 'paginate');
5361
5382
  if (paginate) {
5362
5383
  let cursorReceived = undefined;
5363
- if (market['spot']) {
5384
+ if (marketType === 'spot') {
5364
5385
  if (marginMode !== undefined) {
5365
5386
  cursorReceived = 'minId';
5366
5387
  }
@@ -5370,9 +5391,6 @@ export default class bitget extends Exchange {
5370
5391
  }
5371
5392
  return await this.fetchPaginatedCallCursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, cursorReceived, 'idLessThan');
5372
5393
  }
5373
- let request = {
5374
- 'symbol': market['id'],
5375
- };
5376
5394
  let response = undefined;
5377
5395
  const stop = this.safeValue2(params, 'stop', 'trigger');
5378
5396
  params = this.omit(params, ['stop', 'trigger']);
@@ -5383,7 +5401,7 @@ export default class bitget extends Exchange {
5383
5401
  if (limit !== undefined) {
5384
5402
  request['limit'] = limit;
5385
5403
  }
5386
- if ((market['swap']) || (market['future']) || (marginMode !== undefined)) {
5404
+ if ((marketType === 'swap') || (marketType === 'future') || (marginMode !== undefined)) {
5387
5405
  const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
5388
5406
  params = this.omit(params, 'clientOrderId');
5389
5407
  if (clientOrderId !== undefined) {
@@ -5391,7 +5409,7 @@ export default class bitget extends Exchange {
5391
5409
  }
5392
5410
  }
5393
5411
  const now = this.milliseconds();
5394
- if (market['spot']) {
5412
+ if (marketType === 'spot') {
5395
5413
  if (marginMode !== undefined) {
5396
5414
  if (since === undefined) {
5397
5415
  since = now - 7776000000;
@@ -5406,6 +5424,9 @@ export default class bitget extends Exchange {
5406
5424
  }
5407
5425
  else {
5408
5426
  if (stop) {
5427
+ if (symbol === undefined) {
5428
+ throw new ArgumentsRequired(this.id + ' fetchCanceledAndClosedOrders() requires a symbol argument');
5429
+ }
5409
5430
  const endTime = this.safeIntegerN(params, ['endTime', 'until', 'till']);
5410
5431
  params = this.omit(params, ['until', 'till']);
5411
5432
  if (since === undefined) {
@@ -5614,7 +5635,7 @@ export default class bitget extends Exchange {
5614
5635
  // }
5615
5636
  //
5616
5637
  const data = this.safeValue(response, 'data', {});
5617
- if (market['spot']) {
5638
+ if (marketType === 'spot') {
5618
5639
  if ((marginMode !== undefined) || stop) {
5619
5640
  return this.safeValue(data, 'orderList', []);
5620
5641
  }
@@ -6302,11 +6323,10 @@ export default class bitget extends Exchange {
6302
6323
  //
6303
6324
  // closeAllPositions
6304
6325
  //
6305
- // {
6306
- // "symbol": "XRPUSDT_UMCBL",
6307
- // "orderId": "1111861847410757635",
6308
- // "clientOid": "1111861847410757637"
6309
- // }
6326
+ // {
6327
+ // "orderId": "1120923953904893955",
6328
+ // "clientOid": "1120923953904893956"
6329
+ // }
6310
6330
  //
6311
6331
  const marketId = this.safeString(position, 'symbol');
6312
6332
  market = this.safeMarket(marketId, market, undefined, 'contract');
@@ -6375,7 +6395,7 @@ export default class bitget extends Exchange {
6375
6395
  const percentage = Precise.stringMul(Precise.stringDiv(unrealizedPnl, initialMargin, 4), '100');
6376
6396
  return this.safePosition({
6377
6397
  'info': position,
6378
- 'id': undefined,
6398
+ 'id': this.safeString(position, 'orderId'),
6379
6399
  'symbol': symbol,
6380
6400
  'notional': this.parseNumber(notional),
6381
6401
  'marginMode': marginMode,
@@ -7995,65 +8015,94 @@ export default class bitget extends Exchange {
7995
8015
  'info': info,
7996
8016
  };
7997
8017
  }
8018
+ async closePosition(symbol, side = undefined, params = {}) {
8019
+ /**
8020
+ * @method
8021
+ * @name bitget#closePosition
8022
+ * @description closes an open position for a market
8023
+ * @see https://www.bitget.com/api-doc/contract/trade/Flash-Close-Position
8024
+ * @param {string} symbol unified CCXT market symbol
8025
+ * @param {string} [side] one-way mode: 'buy' or 'sell', hedge-mode: 'long' or 'short'
8026
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
8027
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
8028
+ */
8029
+ await this.loadMarkets();
8030
+ const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
8031
+ let market = undefined;
8032
+ if (sandboxMode) {
8033
+ const sandboxSymbol = this.convertSymbolForSandbox(symbol);
8034
+ market = this.market(sandboxSymbol);
8035
+ }
8036
+ else {
8037
+ market = this.market(symbol);
8038
+ }
8039
+ let productType = undefined;
8040
+ [productType, params] = this.handleProductTypeAndParams(market, params);
8041
+ const request = {
8042
+ 'symbol': market['id'],
8043
+ 'productType': productType,
8044
+ };
8045
+ if (side !== undefined) {
8046
+ request['holdSide'] = side;
8047
+ }
8048
+ const response = await this.privateMixPostV2MixOrderClosePositions(this.extend(request, params));
8049
+ //
8050
+ // {
8051
+ // "code": "00000",
8052
+ // "msg": "success",
8053
+ // "requestTime": 1702975017017,
8054
+ // "data": {
8055
+ // "successList": [
8056
+ // {
8057
+ // "orderId": "1120923953904893955",
8058
+ // "clientOid": "1120923953904893956"
8059
+ // }
8060
+ // ],
8061
+ // "failureList": [],
8062
+ // "result": false
8063
+ // }
8064
+ // }
8065
+ //
8066
+ const data = this.safeValue(response, 'data', {});
8067
+ const order = this.safeValue(data, 'successList', []);
8068
+ return this.parseOrder(order[0], market);
8069
+ }
7998
8070
  async closeAllPositions(params = {}) {
7999
8071
  /**
8000
8072
  * @method
8001
- * @name bitget#closePositions
8002
- * @description closes open positions for a market
8003
- * @see https://bitgetlimited.github.io/apidoc/en/mix/#close-all-position
8004
- * @param {object} [params] extra parameters specific to the okx api endpoint
8005
- * @param {string} [params.subType] 'linear' or 'inverse'
8006
- * @param {string} [params.settle] *required and only valid when params.subType === "linear"* 'USDT' or 'USDC'
8007
- * @returns {object[]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
8073
+ * @name bitget#closeAllPositions
8074
+ * @description closes all open positions for a market type
8075
+ * @see https://www.bitget.com/api-doc/contract/trade/Flash-Close-Position
8076
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
8077
+ * @param {string} [params.productType] 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
8078
+ * @returns {object[]} A list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
8008
8079
  */
8009
8080
  await this.loadMarkets();
8010
- let subType = undefined;
8011
- let settle = undefined;
8012
- [subType, params] = this.handleSubTypeAndParams('closeAllPositions', undefined, params);
8013
- settle = this.safeString(params, 'settle', 'USDT');
8014
- params = this.omit(params, ['settle']);
8015
- const productType = this.safeString(params, 'productType');
8016
- const request = {};
8017
- if (productType === undefined) {
8018
- const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
8019
- let localProductType = undefined;
8020
- if (subType === 'inverse') {
8021
- localProductType = 'dmcbl';
8022
- }
8023
- else {
8024
- if (settle === 'USDT') {
8025
- localProductType = 'umcbl';
8026
- }
8027
- else if (settle === 'USDC') {
8028
- localProductType = 'cmcbl';
8029
- }
8030
- }
8031
- if (sandboxMode) {
8032
- localProductType = 's' + localProductType;
8033
- }
8034
- request['productType'] = localProductType;
8035
- }
8036
- const response = await this.privateMixPostMixV1OrderCloseAllPositions(this.extend(request, params));
8037
- //
8038
- // {
8039
- // "code": "00000",
8040
- // "msg": "success",
8041
- // "requestTime": 1700814442466,
8042
- // "data": {
8043
- // "orderInfo": [
8044
- // {
8045
- // "symbol": "XRPUSDT_UMCBL",
8046
- // "orderId": "1111861847410757635",
8047
- // "clientOid": "1111861847410757637"
8048
- // },
8049
- // ],
8050
- // "failure": [],
8051
- // "result": true
8052
- // }
8053
- // }
8081
+ let productType = undefined;
8082
+ [productType, params] = this.handleProductTypeAndParams(undefined, params);
8083
+ const request = {
8084
+ 'productType': productType,
8085
+ };
8086
+ const response = await this.privateMixPostV2MixOrderClosePositions(this.extend(request, params));
8087
+ //
8088
+ // {
8089
+ // "code": "00000",
8090
+ // "msg": "success",
8091
+ // "requestTime": 1702975017017,
8092
+ // "data": {
8093
+ // "successList": [
8094
+ // {
8095
+ // "orderId": "1120923953904893955",
8096
+ // "clientOid": "1120923953904893956"
8097
+ // }
8098
+ // ],
8099
+ // "failureList": [],
8100
+ // "result": false
8101
+ // }
8102
+ // }
8054
8103
  //
8055
8104
  const data = this.safeValue(response, 'data', {});
8056
- const orderInfo = this.safeValue(data, 'orderInfo', []);
8105
+ const orderInfo = this.safeValue(data, 'successList', []);
8057
8106
  return this.parsePositions(orderInfo, undefined, params);
8058
8107
  }
8059
8108
  handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
package/js/src/bitrue.js CHANGED
@@ -1544,18 +1544,9 @@ export default class bitrue extends Exchange {
1544
1544
  const first = this.safeString(symbols, 0);
1545
1545
  const market = this.market(first);
1546
1546
  if (market['swap']) {
1547
- request['contractName'] = market['id'];
1548
- if (market['linear']) {
1549
- response = await this.fapiV1PublicGetTicker(this.extend(request, params));
1550
- }
1551
- else if (market['inverse']) {
1552
- response = await this.dapiV1PublicGetTicker(this.extend(request, params));
1553
- }
1554
- response['symbol'] = market['id'];
1555
- data = [response];
1547
+ throw new NotSupported(this.id + ' fetchTickers does not support swap markets, please use fetchTicker instead');
1556
1548
  }
1557
1549
  else if (market['spot']) {
1558
- request['symbol'] = market['id'];
1559
1550
  response = await this.spotV1PublicGetTicker24hr(this.extend(request, params));
1560
1551
  data = response;
1561
1552
  }
@@ -1566,7 +1557,7 @@ export default class bitrue extends Exchange {
1566
1557
  else {
1567
1558
  [type, params] = this.handleMarketTypeAndParams('fetchTickers', undefined, params);
1568
1559
  if (type !== 'spot') {
1569
- throw new NotSupported(this.id + ' fetchTickers only support spot when symbols is not set');
1560
+ throw new NotSupported(this.id + ' fetchTickers only support spot when symbols are not proved');
1570
1561
  }
1571
1562
  response = await this.spotV1PublicGetTicker24hr(this.extend(request, params));
1572
1563
  data = response;
package/js/src/bybit.js CHANGED
@@ -299,6 +299,7 @@ export default class bybit extends Exchange {
299
299
  'v5/account/fee-rate': 10,
300
300
  'v5/account/info': 5,
301
301
  'v5/account/transaction-log': 1,
302
+ 'v5/account/smp-group': 1,
302
303
  'v5/account/mmp-state': 5,
303
304
  // asset
304
305
  'v5/asset/exchange/order-record': 5,
@@ -200,6 +200,8 @@ export default class coinbase extends Exchange {
200
200
  'brokerage/products/{product_id}',
201
201
  'brokerage/products/{product_id}/candles',
202
202
  'brokerage/products/{product_id}/ticker',
203
+ 'brokerage/portfolios',
204
+ 'brokerage/portfolios/{portfolio_uuid}',
203
205
  'brokerage/transaction_summary',
204
206
  'brokerage/product_book',
205
207
  'brokerage/best_bid_ask',
@@ -211,9 +213,17 @@ export default class coinbase extends Exchange {
211
213
  'brokerage/orders/batch_cancel',
212
214
  'brokerage/orders/edit',
213
215
  'brokerage/orders/edit_preview',
216
+ 'brokerage/portfolios',
217
+ 'brokerage/portfolios/move_funds',
214
218
  'brokerage/convert/quote',
215
219
  'brokerage/convert/trade/{trade_id}',
216
220
  ],
221
+ 'put': [
222
+ 'brokerage/portfolios/{portfolio_uuid}',
223
+ ],
224
+ 'delete': [
225
+ 'brokerage/portfolios/{portfolio_uuid}',
226
+ ],
217
227
  },
218
228
  },
219
229
  },
@@ -269,7 +279,9 @@ export default class coinbase extends Exchange {
269
279
  'invalid_scope': AuthenticationError,
270
280
  'not_found': ExchangeError,
271
281
  'rate_limit_exceeded': RateLimitExceeded,
272
- 'internal_server_error': ExchangeError, // 500 Internal server error
282
+ 'internal_server_error': ExchangeError,
283
+ 'UNSUPPORTED_ORDER_CONFIGURATION': BadRequest,
284
+ 'INSUFFICIENT_FUND': BadRequest,
273
285
  },
274
286
  'broad': {
275
287
  'request timestamp expired': InvalidNonce,
@@ -2274,6 +2286,8 @@ export default class coinbase extends Exchange {
2274
2286
  params = this.omit(params, ['timeInForce', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'stopPrice', 'stop_price', 'stopDirection', 'stop_direction', 'clientOrderId', 'postOnly', 'post_only', 'end_time']);
2275
2287
  const response = await this.v3PrivatePostBrokerageOrders(this.extend(request, params));
2276
2288
  //
2289
+ // successful order
2290
+ //
2277
2291
  // {
2278
2292
  // "success": true,
2279
2293
  // "failure_reason": "UNKNOWN_FAILURE_REASON",
@@ -2287,9 +2301,37 @@ export default class coinbase extends Exchange {
2287
2301
  // "order_configuration": null
2288
2302
  // }
2289
2303
  //
2304
+ // failed order
2305
+ //
2306
+ // {
2307
+ // "success": false,
2308
+ // "failure_reason": "UNKNOWN_FAILURE_REASON",
2309
+ // "order_id": "",
2310
+ // "error_response": {
2311
+ // "error": "UNSUPPORTED_ORDER_CONFIGURATION",
2312
+ // "message": "source is not enabled for trading",
2313
+ // "error_details": "",
2314
+ // "new_order_failure_reason": "UNSUPPORTED_ORDER_CONFIGURATION"
2315
+ // },
2316
+ // "order_configuration": {
2317
+ // "limit_limit_gtc": {
2318
+ // "base_size": "100",
2319
+ // "limit_price": "40000",
2320
+ // "post_only": false
2321
+ // }
2322
+ // }
2323
+ // }
2324
+ //
2290
2325
  const success = this.safeValue(response, 'success');
2291
2326
  if (success !== true) {
2292
- throw new BadRequest(this.id + ' createOrder() has failed, check your arguments and parameters');
2327
+ const errorResponse = this.safeValue(response, 'error_response');
2328
+ const errorTitle = this.safeString(errorResponse, 'error');
2329
+ const errorMessage = this.safeString(errorResponse, 'message');
2330
+ if (errorResponse !== undefined) {
2331
+ this.throwExactlyMatchedException(this.exceptions['exact'], errorTitle, errorMessage);
2332
+ this.throwBroadlyMatchedException(this.exceptions['broad'], errorTitle, errorMessage);
2333
+ throw new ExchangeError(errorMessage);
2334
+ }
2293
2335
  }
2294
2336
  const data = this.safeValue(response, 'success_response', {});
2295
2337
  return this.parseOrder(data, market);
@@ -6,6 +6,7 @@ import type { Balances, Int, Market, Order, OrderBook, OrderSide, OrderType, Str
6
6
  */
7
7
  export default class coinone extends Exchange {
8
8
  describe(): any;
9
+ fetchCurrencies(params?: {}): Promise<{}>;
9
10
  fetchMarkets(params?: {}): Promise<any[]>;
10
11
  parseBalance(response: any): Balances;
11
12
  fetchBalance(params?: {}): Promise<Balances>;