ccxt 4.2.44 → 4.2.45

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.
@@ -56,7 +56,9 @@ class bybit extends bybit$1 {
56
56
  'fetchBorrowInterest': false,
57
57
  'fetchBorrowRateHistories': false,
58
58
  'fetchBorrowRateHistory': false,
59
+ 'fetchCanceledAndClosedOrders': true,
59
60
  'fetchCanceledOrders': true,
61
+ 'fetchClosedOrder': true,
60
62
  'fetchClosedOrders': true,
61
63
  'fetchCrossBorrowRate': true,
62
64
  'fetchCrossBorrowRates': false,
@@ -84,10 +86,11 @@ class bybit extends bybit$1 {
84
86
  'fetchOHLCV': true,
85
87
  'fetchOpenInterest': true,
86
88
  'fetchOpenInterestHistory': true,
89
+ 'fetchOpenOrder': true,
87
90
  'fetchOpenOrders': true,
88
- 'fetchOrder': true,
91
+ 'fetchOrder': false,
89
92
  'fetchOrderBook': true,
90
- 'fetchOrders': true,
93
+ 'fetchOrders': false,
91
94
  'fetchOrderTrades': true,
92
95
  'fetchPosition': true,
93
96
  'fetchPositions': true,
@@ -3441,35 +3444,6 @@ class bybit extends bybit$1 {
3441
3444
  'trades': undefined,
3442
3445
  }, market);
3443
3446
  }
3444
- async fetchOrder(id, symbol = undefined, params = {}) {
3445
- /**
3446
- * @method
3447
- * @name bybit#fetchOrder
3448
- * @description fetches information on an order made by the user
3449
- * @see https://bybit-exchange.github.io/docs/v5/order/order-list
3450
- * @param {string} symbol unified symbol of the market the order was made in
3451
- * @param {object} [params] extra parameters specific to the exchange API endpoint
3452
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3453
- */
3454
- if (symbol === undefined) {
3455
- throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
3456
- }
3457
- await this.loadMarkets();
3458
- const request = {
3459
- 'orderId': id,
3460
- };
3461
- const result = await this.fetchOrders(symbol, undefined, undefined, this.extend(request, params));
3462
- const length = result.length;
3463
- if (length === 0) {
3464
- const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
3465
- const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
3466
- throw new errors.OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
3467
- }
3468
- if (length > 1) {
3469
- throw new errors.InvalidOrder(this.id + ' returned more than one order');
3470
- }
3471
- return this.safeValue(result, 0);
3472
- }
3473
3447
  async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
3474
3448
  /**
3475
3449
  * @method
@@ -4505,29 +4479,99 @@ class bybit extends bybit$1 {
4505
4479
  const data = this.safeValue(result, 'dataList', []);
4506
4480
  return this.parseOrders(data, market, since, limit);
4507
4481
  }
4482
+ async fetchOrder(id, symbol = undefined, params = {}) {
4483
+ throw new errors.NotSupported(this.id + ' fetchOrder() is not supported after the 5/02 update, please use fetchOpenOrder or fetchClosedOrder');
4484
+ }
4508
4485
  async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
4486
+ throw new errors.NotSupported(this.id + ' fetchOrders() is not supported after the 5/02 update, please use fetchOpenOrders, fetchClosedOrders or fetchCanceledOrders');
4487
+ }
4488
+ async fetchClosedOrder(id, symbol = undefined, params = {}) {
4489
+ /**
4490
+ * @method
4491
+ * @name bybit#fetchClosedOrder
4492
+ * @description fetches information on a closed order made by the user
4493
+ * @see https://bybit-exchange.github.io/docs/v5/order/order-list
4494
+ * @param {string} id order id
4495
+ * @param {string} [symbol] unified symbol of the market the order was made in
4496
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4497
+ * @param {boolean} [params.stop] set to true for fetching a closed stop order
4498
+ * @param {string} [params.type] market type, ['swap', 'option', 'spot']
4499
+ * @param {string} [params.subType] market subType, ['linear', 'inverse']
4500
+ * @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
4501
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
4502
+ */
4503
+ await this.loadMarkets();
4504
+ const request = {
4505
+ 'orderId': id,
4506
+ };
4507
+ const result = await this.fetchClosedOrders(symbol, undefined, undefined, this.extend(request, params));
4508
+ const length = result.length;
4509
+ if (length === 0) {
4510
+ const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
4511
+ const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
4512
+ throw new errors.OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
4513
+ }
4514
+ if (length > 1) {
4515
+ throw new errors.InvalidOrder(this.id + ' returned more than one order');
4516
+ }
4517
+ return this.safeValue(result, 0);
4518
+ }
4519
+ async fetchOpenOrder(id, symbol = undefined, params = {}) {
4520
+ /**
4521
+ * @method
4522
+ * @name bybit#fetchOpenOrder
4523
+ * @description fetches information on an open order made by the user
4524
+ * @see https://bybit-exchange.github.io/docs/v5/order/open-order
4525
+ * @param {string} id order id
4526
+ * @param {string} [symbol] unified symbol of the market the order was made in
4527
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4528
+ * @param {boolean} [params.stop] set to true for fetching an open stop order
4529
+ * @param {string} [params.type] market type, ['swap', 'option', 'spot']
4530
+ * @param {string} [params.subType] market subType, ['linear', 'inverse']
4531
+ * @param {string} [params.baseCoin] Base coin. Supports linear, inverse & option
4532
+ * @param {string} [params.settleCoin] Settle coin. Supports linear, inverse & option
4533
+ * @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
4534
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
4535
+ */
4536
+ await this.loadMarkets();
4537
+ const request = {
4538
+ 'orderId': id,
4539
+ };
4540
+ const result = await this.fetchOpenOrders(symbol, undefined, undefined, this.extend(request, params));
4541
+ const length = result.length;
4542
+ if (length === 0) {
4543
+ const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
4544
+ const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
4545
+ throw new errors.OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
4546
+ }
4547
+ if (length > 1) {
4548
+ throw new errors.InvalidOrder(this.id + ' returned more than one order');
4549
+ }
4550
+ return this.safeValue(result, 0);
4551
+ }
4552
+ async fetchCanceledAndClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
4509
4553
  /**
4510
4554
  * @method
4511
- * @name bybit#fetchOrders
4512
- * @description fetches information on multiple orders made by the user
4555
+ * @name bybit#fetchCanceledAndClosedOrders
4556
+ * @description fetches information on multiple canceled and closed orders made by the user
4513
4557
  * @see https://bybit-exchange.github.io/docs/v5/order/order-list
4514
- * @param {string} symbol unified market symbol of the market orders were made in
4558
+ * @param {string} [symbol] unified market symbol of the market orders were made in
4515
4559
  * @param {int} [since] the earliest time in ms to fetch orders for
4516
4560
  * @param {int} [limit] the maximum number of order structures to retrieve
4517
4561
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4518
- * @param {boolean} [params.stop] true if stop order
4562
+ * @param {boolean} [params.stop] set to true for fetching stop orders
4519
4563
  * @param {string} [params.type] market type, ['swap', 'option', 'spot']
4520
4564
  * @param {string} [params.subType] market subType, ['linear', 'inverse']
4521
4565
  * @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
4522
4566
  * @param {int} [params.until] the latest time in ms to fetch entries for
4523
- * @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)
4567
+ * @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)
4524
4568
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
4525
4569
  */
4526
4570
  await this.loadMarkets();
4527
4571
  let paginate = false;
4528
- [paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
4572
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchCanceledAndClosedOrders', 'paginate');
4529
4573
  if (paginate) {
4530
- return await this.fetchPaginatedCallCursor('fetchOrders', symbol, since, limit, params, 'nextPageCursor', 'nextPageCursor', undefined, 50);
4574
+ return await this.fetchPaginatedCallCursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, 'nextPageCursor', 'nextPageCursor', undefined, 50);
4531
4575
  }
4532
4576
  const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
4533
4577
  const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
@@ -4540,7 +4584,7 @@ class bybit extends bybit$1 {
4540
4584
  request['symbol'] = market['id'];
4541
4585
  }
4542
4586
  let type = undefined;
4543
- [type, params] = this.getBybitType('fetchOrders', market, params);
4587
+ [type, params] = this.getBybitType('fetchCanceledAndClosedOrders', market, params);
4544
4588
  if (((type === 'option') || isUsdcSettled) && !isUnifiedAccount) {
4545
4589
  return await this.fetchUsdcOrders(symbol, since, limit, params);
4546
4590
  }
@@ -4622,17 +4666,23 @@ class bybit extends bybit$1 {
4622
4666
  * @name bybit#fetchClosedOrders
4623
4667
  * @description fetches information on multiple closed orders made by the user
4624
4668
  * @see https://bybit-exchange.github.io/docs/v5/order/order-list
4625
- * @param {string} symbol unified market symbol of the market orders were made in
4669
+ * @param {string} [symbol] unified market symbol of the market orders were made in
4626
4670
  * @param {int} [since] the earliest time in ms to fetch orders for
4627
4671
  * @param {int} [limit] the maximum number of order structures to retrieve
4628
4672
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4673
+ * @param {boolean} [params.stop] set to true for fetching closed stop orders
4674
+ * @param {string} [params.type] market type, ['swap', 'option', 'spot']
4675
+ * @param {string} [params.subType] market subType, ['linear', 'inverse']
4676
+ * @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
4677
+ * @param {int} [params.until] the latest time in ms to fetch entries for
4678
+ * @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)
4629
4679
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
4630
4680
  */
4631
4681
  await this.loadMarkets();
4632
4682
  const request = {
4633
4683
  'orderStatus': 'Filled',
4634
4684
  };
4635
- return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
4685
+ return await this.fetchCanceledAndClosedOrders(symbol, since, limit, this.extend(request, params));
4636
4686
  }
4637
4687
  async fetchCanceledOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
4638
4688
  /**
@@ -4640,20 +4690,23 @@ class bybit extends bybit$1 {
4640
4690
  * @name bybit#fetchCanceledOrders
4641
4691
  * @description fetches information on multiple canceled orders made by the user
4642
4692
  * @see https://bybit-exchange.github.io/docs/v5/order/order-list
4643
- * @param {string} symbol unified market symbol of the market orders were made in
4693
+ * @param {string} [symbol] unified market symbol of the market orders were made in
4644
4694
  * @param {int} [since] timestamp in ms of the earliest order, default is undefined
4645
4695
  * @param {int} [limit] max number of orders to return, default is undefined
4646
4696
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4647
4697
  * @param {boolean} [params.stop] true if stop order
4648
4698
  * @param {string} [params.type] market type, ['swap', 'option', 'spot']
4649
4699
  * @param {string} [params.subType] market subType, ['linear', 'inverse']
4700
+ * @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
4701
+ * @param {int} [params.until] the latest time in ms to fetch entries for
4702
+ * @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)
4650
4703
  * @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
4651
4704
  */
4652
4705
  await this.loadMarkets();
4653
4706
  const request = {
4654
4707
  'orderStatus': 'Cancelled',
4655
4708
  };
4656
- return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
4709
+ return await this.fetchCanceledAndClosedOrders(symbol, since, limit, this.extend(request, params));
4657
4710
  }
4658
4711
  async fetchUsdcOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
4659
4712
  await this.loadMarkets();
@@ -62,6 +62,7 @@ class coinbase extends coinbase$1 {
62
62
  'fetchCrossBorrowRate': false,
63
63
  'fetchCrossBorrowRates': false,
64
64
  'fetchCurrencies': true,
65
+ 'fetchDepositAddressesByNetwork': true,
65
66
  'fetchDeposits': true,
66
67
  'fetchFundingHistory': false,
67
68
  'fetchFundingRate': false,
@@ -129,6 +130,7 @@ class coinbase extends coinbase$1 {
129
130
  'public': {
130
131
  'get': [
131
132
  'currencies',
133
+ 'currencies/crypto',
132
134
  'time',
133
135
  'exchange-rates',
134
136
  'users/{user_id}',
@@ -323,6 +325,10 @@ class coinbase extends coinbase$1 {
323
325
  'ACCOUNT_TYPE_CRYPTO',
324
326
  'ACCOUNT_TYPE_FIAT',
325
327
  ],
328
+ 'networks': {
329
+ 'ERC20': 'ethereum',
330
+ 'XLM': 'stellar',
331
+ },
326
332
  'createMarketBuyOrderRequiresPrice': true,
327
333
  'advanced': true,
328
334
  'fetchMarkets': 'fetchMarketsV3',
@@ -678,10 +684,10 @@ class coinbase extends coinbase$1 {
678
684
  return this.parseTrades(buys['data'], undefined, since, limit);
679
685
  }
680
686
  async fetchTransactionsWithMethod(method, code = undefined, since = undefined, limit = undefined, params = {}) {
681
- const request = await this.prepareAccountRequestWithCurrencyCode(code, limit, params);
687
+ let request = undefined;
688
+ [request, params] = await this.prepareAccountRequestWithCurrencyCode(code, limit, params);
682
689
  await this.loadMarkets();
683
- const query = this.omit(params, ['account_id', 'accountId']);
684
- const response = await this[method](this.extend(request, query));
690
+ const response = await this[method](this.extend(request, params));
685
691
  return this.parseTransactions(response['data'], undefined, since, limit);
686
692
  }
687
693
  async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
@@ -1233,15 +1239,45 @@ class coinbase extends coinbase$1 {
1233
1239
  const expires = this.safeInteger(options, 'expires', 1000);
1234
1240
  const now = this.milliseconds();
1235
1241
  if ((timestamp === undefined) || ((now - timestamp) > expires)) {
1236
- const currencies = await this.v2PublicGetCurrencies(params);
1242
+ const promises = [
1243
+ this.v2PublicGetCurrencies(params),
1244
+ this.v2PublicGetCurrenciesCrypto(params),
1245
+ ];
1246
+ const promisesResult = await Promise.all(promises);
1247
+ const fiatResponse = this.safeDict(promisesResult, 0, {});
1248
+ //
1249
+ // [
1250
+ // "data": {
1251
+ // id: 'IMP',
1252
+ // name: 'Isle of Man Pound',
1253
+ // min_size: '0.01'
1254
+ // },
1255
+ // ...
1256
+ // ]
1257
+ //
1258
+ const cryptoResponse = this.safeDict(promisesResult, 1, {});
1259
+ //
1260
+ // {
1261
+ // asset_id: '9476e3be-b731-47fa-82be-347fabc573d9',
1262
+ // code: 'AERO',
1263
+ // name: 'Aerodrome Finance',
1264
+ // color: '#0433FF',
1265
+ // sort_index: '340',
1266
+ // exponent: '8',
1267
+ // type: 'crypto',
1268
+ // address_regex: '^(?:0x)?[0-9a-fA-F]{40}$'
1269
+ // }
1270
+ //
1271
+ const fiatData = this.safeList(fiatResponse, 'data', []);
1272
+ const cryptoData = this.safeList(cryptoResponse, 'data', []);
1237
1273
  const exchangeRates = await this.v2PublicGetExchangeRates(params);
1238
1274
  this.options['fetchCurrencies'] = this.extend(options, {
1239
- 'currencies': currencies,
1275
+ 'currencies': this.arrayConcat(fiatData, cryptoData),
1240
1276
  'exchangeRates': exchangeRates,
1241
1277
  'timestamp': now,
1242
1278
  });
1243
1279
  }
1244
- return this.safeValue(this.options, 'fetchCurrencies', {});
1280
+ return this.safeDict(this.options, 'fetchCurrencies', {});
1245
1281
  }
1246
1282
  async fetchCurrencies(params = {}) {
1247
1283
  /**
@@ -1256,18 +1292,27 @@ class coinbase extends coinbase$1 {
1256
1292
  const response = await this.fetchCurrenciesFromCache(params);
1257
1293
  const currencies = this.safeValue(response, 'currencies', {});
1258
1294
  //
1259
- // {
1260
- // "data":[
1261
- // {"id":"AED","name":"United Arab Emirates Dirham","min_size":"0.01000000"},
1262
- // {"id":"AFN","name":"Afghan Afghani","min_size":"0.01000000"},
1263
- // {"id":"ALL","name":"Albanian Lek","min_size":"0.01000000"},
1264
- // {"id":"AMD","name":"Armenian Dram","min_size":"0.01000000"},
1265
- // {"id":"ANG","name":"Netherlands Antillean Gulden","min_size":"0.01000000"},
1266
- // ...
1267
- // ],
1268
- // }
1295
+ // fiat
1296
+ //
1297
+ // {
1298
+ // id: 'IMP',
1299
+ // name: 'Isle of Man Pound',
1300
+ // min_size: '0.01'
1301
+ // },
1302
+ //
1303
+ // crypto
1304
+ //
1305
+ // {
1306
+ // asset_id: '9476e3be-b731-47fa-82be-347fabc573d9',
1307
+ // code: 'AERO',
1308
+ // name: 'Aerodrome Finance',
1309
+ // color: '#0433FF',
1310
+ // sort_index: '340',
1311
+ // exponent: '8',
1312
+ // type: 'crypto',
1313
+ // address_regex: '^(?:0x)?[0-9a-fA-F]{40}$'
1314
+ // }
1269
1315
  //
1270
- const exchangeRates = this.safeValue(response, 'exchangeRates', {});
1271
1316
  //
1272
1317
  // {
1273
1318
  // "data":{
@@ -1283,24 +1328,23 @@ class coinbase extends coinbase$1 {
1283
1328
  // }
1284
1329
  // }
1285
1330
  //
1286
- const data = this.safeValue(currencies, 'data', []);
1287
- const dataById = this.indexBy(data, 'id');
1288
- const rates = this.safeValue(this.safeValue(exchangeRates, 'data', {}), 'rates', {});
1289
- const keys = Object.keys(rates);
1290
1331
  const result = {};
1291
- for (let i = 0; i < keys.length; i++) {
1292
- const key = keys[i];
1293
- const type = (key in dataById) ? 'fiat' : 'crypto';
1294
- const currency = this.safeValue(dataById, key, {});
1295
- const id = this.safeString(currency, 'id', key);
1296
- const name = this.safeString(currency, 'name');
1332
+ const networks = {};
1333
+ const networksById = {};
1334
+ for (let i = 0; i < currencies.length; i++) {
1335
+ const currency = currencies[i];
1336
+ const assetId = this.safeString(currency, 'asset_id');
1337
+ const id = this.safeString2(currency, 'id', 'code');
1297
1338
  const code = this.safeCurrencyCode(id);
1339
+ const name = this.safeString(currency, 'name');
1340
+ this.options['networks'][code] = name.toLowerCase();
1341
+ this.options['networksById'][code] = name.toLowerCase();
1298
1342
  result[code] = {
1343
+ 'info': currency,
1299
1344
  'id': id,
1300
1345
  'code': code,
1301
- 'info': currency,
1302
- 'type': type,
1303
- 'name': name,
1346
+ 'type': (assetId !== undefined) ? 'crypto' : 'fiat',
1347
+ 'name': this.safeString(currency, 'name'),
1304
1348
  'active': true,
1305
1349
  'deposit': undefined,
1306
1350
  'withdraw': undefined,
@@ -1317,7 +1361,14 @@ class coinbase extends coinbase$1 {
1317
1361
  },
1318
1362
  },
1319
1363
  };
1364
+ if (assetId !== undefined) {
1365
+ const lowerCaseName = name.toLowerCase();
1366
+ networks[code] = lowerCaseName;
1367
+ networksById[lowerCaseName] = code;
1368
+ }
1320
1369
  }
1370
+ this.options['networks'] = this.extend(networks, this.options['networks']);
1371
+ this.options['networksById'] = this.extend(networksById, this.options['networksById']);
1321
1372
  return result;
1322
1373
  }
1323
1374
  async fetchTickers(symbols = undefined, params = {}) {
@@ -1795,12 +1846,12 @@ class coinbase extends coinbase$1 {
1795
1846
  if (code !== undefined) {
1796
1847
  currency = this.currency(code);
1797
1848
  }
1798
- const request = await this.prepareAccountRequestWithCurrencyCode(code, limit, params);
1799
- const query = this.omit(params, ['account_id', 'accountId']);
1849
+ let request = undefined;
1850
+ [request, params] = await this.prepareAccountRequestWithCurrencyCode(code, limit, params);
1800
1851
  // for pagination use parameter 'starting_after'
1801
1852
  // the value for the next page can be obtained from the result of the previous call in the 'pagination' field
1802
1853
  // eg: instance.last_json_response.pagination.next_starting_after
1803
- const response = await this.v2PrivateGetAccountsAccountIdTransactions(this.extend(request, query));
1854
+ const response = await this.v2PrivateGetAccountsAccountIdTransactions(this.extend(request, params));
1804
1855
  return this.parseLedger(response['data'], currency, since, limit);
1805
1856
  }
1806
1857
  parseLedgerEntryStatus(status) {
@@ -2158,6 +2209,7 @@ class coinbase extends coinbase$1 {
2158
2209
  }
2159
2210
  async prepareAccountRequestWithCurrencyCode(code = undefined, limit = undefined, params = {}) {
2160
2211
  let accountId = this.safeString2(params, 'account_id', 'accountId');
2212
+ params = this.omit(params, ['account_id', 'accountId']);
2161
2213
  if (accountId === undefined) {
2162
2214
  if (code === undefined) {
2163
2215
  throw new errors.ArgumentsRequired(this.id + ' prepareAccountRequestWithCurrencyCode() method requires an account_id (or accountId) parameter OR a currency code argument');
@@ -2173,7 +2225,7 @@ class coinbase extends coinbase$1 {
2173
2225
  if (limit !== undefined) {
2174
2226
  request['limit'] = limit;
2175
2227
  }
2176
- return request;
2228
+ return [request, params];
2177
2229
  }
2178
2230
  async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
2179
2231
  /**
@@ -3346,6 +3398,140 @@ class coinbase extends coinbase$1 {
3346
3398
  const data = this.safeValue(response, 'data', {});
3347
3399
  return this.parseTransaction(data, currency);
3348
3400
  }
3401
+ async fetchDepositAddressesByNetwork(code, params = {}) {
3402
+ /**
3403
+ * @method
3404
+ * @name ascendex#fetchDepositAddress
3405
+ * @description fetch the deposit address for a currency associated with this account
3406
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postcoinbaseaccountaddresses
3407
+ * @param {string} code unified currency code
3408
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3409
+ * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
3410
+ */
3411
+ await this.loadMarkets();
3412
+ const currency = this.currency(code);
3413
+ let request = undefined;
3414
+ [request, params] = await this.prepareAccountRequestWithCurrencyCode(currency['code']);
3415
+ const response = await this.v2PrivateGetAccountsAccountIdAddresses(this.extend(request, params));
3416
+ //
3417
+ // {
3418
+ // pagination: {
3419
+ // ending_before: null,
3420
+ // starting_after: null,
3421
+ // previous_ending_before: null,
3422
+ // next_starting_after: null,
3423
+ // limit: '25',
3424
+ // order: 'desc',
3425
+ // previous_uri: null,
3426
+ // next_uri: null
3427
+ // },
3428
+ // data: [
3429
+ // {
3430
+ // id: '64ceb5f1-5fa2-5310-a4ff-9fd46271003d',
3431
+ // address: '5xjPKeAXpnhA2kHyinvdVeui6RXVdEa3B2J3SCAwiKnk',
3432
+ // address_info: { address: '5xjPKeAXpnhA2kHyinvdVeui6RXVdEa3B2J3SCAwiKnk' },
3433
+ // name: null,
3434
+ // created_at: '2023-05-29T21:12:12Z',
3435
+ // updated_at: '2023-05-29T21:12:12Z',
3436
+ // network: 'solana',
3437
+ // uri_scheme: 'solana',
3438
+ // resource: 'address',
3439
+ // resource_path: '/v2/accounts/a7b3d387-bfb8-5ce7-b8da-1f507e81cf25/addresses/64ceb5f1-5fa2-5310-a4ff-9fd46271003d',
3440
+ // warnings: [
3441
+ // {
3442
+ // type: 'correct_address_warning',
3443
+ // title: 'This is an ERC20 USDC address.',
3444
+ // details: 'Only send ERC20 USD Coin (USDC) to this address.',
3445
+ // image_url: 'https://www.coinbase.com/assets/addresses/global-receive-warning-a3d91807e61c717e5a38d270965003dcc025ca8a3cea40ec3d7835b7c86087fa.png',
3446
+ // options: [ { text: 'I understand', style: 'primary', id: 'dismiss' } ]
3447
+ // }
3448
+ // ],
3449
+ // qr_code_image_url: 'https://static-assets.coinbase.com/p2p/l2/asset_network_combinations/v5/usdc-solana.png',
3450
+ // address_label: 'USDC address (Solana)',
3451
+ // default_receive: true,
3452
+ // deposit_uri: 'solana:5xjPKeAXpnhA2kHyinvdVeui6RXVdEa3B2J3SCAwiKnk?spl-token=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
3453
+ // callback_url: null,
3454
+ // share_address_copy: {
3455
+ // line1: '5xjPKeAXpnhA2kHyinvdVeui6RXVdEa3B2J3SCAwiKnk',
3456
+ // line2: 'This address can only receive USDC-SPL from Solana network. Don’t send USDC from other networks, other SPL tokens or NFTs, or it may result in a loss of funds.'
3457
+ // },
3458
+ // receive_subtitle: 'ERC-20',
3459
+ // inline_warning: {
3460
+ // text: 'This address can only receive USDC-SPL from Solana network. Don’t send USDC from other networks, other SPL tokens or NFTs, or it may result in a loss of funds.',
3461
+ // tooltip: {
3462
+ // title: 'USDC (Solana)',
3463
+ // subtitle: 'This address can only receive USDC-SPL from Solana network.'
3464
+ // }
3465
+ // }
3466
+ // },
3467
+ // ...
3468
+ // ]
3469
+ // }
3470
+ //
3471
+ const data = this.safeList(response, 'data', []);
3472
+ const addressStructures = this.parseDepositAddresses(data, undefined, false);
3473
+ return this.indexBy(addressStructures, 'network');
3474
+ }
3475
+ parseDepositAddress(depositAddress, currency = undefined) {
3476
+ //
3477
+ // {
3478
+ // id: '64ceb5f1-5fa2-5310-a4ff-9fd46271003d',
3479
+ // address: '5xjPKeAXpnhA2kHyinvdVeui6RXVdEa3B2J3SCAwiKnk',
3480
+ // address_info: {
3481
+ // address: 'GCF74576I7AQ56SLMKBQAP255EGUOWCRVII3S44KEXVNJEOIFVBDMXVL',
3482
+ // destination_tag: '3722061866'
3483
+ // },
3484
+ // name: null,
3485
+ // created_at: '2023-05-29T21:12:12Z',
3486
+ // updated_at: '2023-05-29T21:12:12Z',
3487
+ // network: 'solana',
3488
+ // uri_scheme: 'solana',
3489
+ // resource: 'address',
3490
+ // resource_path: '/v2/accounts/a7b3d387-bfb8-5ce7-b8da-1f507e81cf25/addresses/64ceb5f1-5fa2-5310-a4ff-9fd46271003d',
3491
+ // warnings: [
3492
+ // {
3493
+ // type: 'correct_address_warning',
3494
+ // title: 'This is an ERC20 USDC address.',
3495
+ // details: 'Only send ERC20 USD Coin (USDC) to this address.',
3496
+ // image_url: 'https://www.coinbase.com/assets/addresses/global-receive-warning-a3d91807e61c717e5a38d270965003dcc025ca8a3cea40ec3d7835b7c86087fa.png',
3497
+ // options: [ { text: 'I understand', style: 'primary', id: 'dismiss' } ]
3498
+ // }
3499
+ // ],
3500
+ // qr_code_image_url: 'https://static-assets.coinbase.com/p2p/l2/asset_network_combinations/v5/usdc-solana.png',
3501
+ // address_label: 'USDC address (Solana)',
3502
+ // default_receive: true,
3503
+ // deposit_uri: 'solana:5xjPKeAXpnhA2kHyinvdVeui6RXVdEa3B2J3SCAwiKnk?spl-token=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
3504
+ // callback_url: null,
3505
+ // share_address_copy: {
3506
+ // line1: '5xjPKeAXpnhA2kHyinvdVeui6RXVdEa3B2J3SCAwiKnk',
3507
+ // line2: 'This address can only receive USDC-SPL from Solana network. Don’t send USDC from other networks, other SPL tokens or NFTs, or it may result in a loss of funds.'
3508
+ // },
3509
+ // receive_subtitle: 'ERC-20',
3510
+ // inline_warning: {
3511
+ // text: 'This address can only receive USDC-SPL from Solana network. Don’t send USDC from other networks, other SPL tokens or NFTs, or it may result in a loss of funds.',
3512
+ // tooltip: {
3513
+ // title: 'USDC (Solana)',
3514
+ // subtitle: 'This address can only receive USDC-SPL from Solana network.'
3515
+ // }
3516
+ // }
3517
+ // }
3518
+ //
3519
+ const address = this.safeString(depositAddress, 'address');
3520
+ this.checkAddress(address);
3521
+ const networkId = this.safeString(depositAddress, 'network');
3522
+ const code = this.safeCurrencyCode(undefined, currency);
3523
+ const addressLabel = this.safeString(depositAddress, 'address_label');
3524
+ const splitAddressLabel = addressLabel.split(' ');
3525
+ const marketId = this.safeString(splitAddressLabel, 0);
3526
+ const addressInfo = this.safeDict(depositAddress, 'address_info');
3527
+ return {
3528
+ 'info': depositAddress,
3529
+ 'currency': this.safeCurrencyCode(marketId, currency),
3530
+ 'address': address,
3531
+ 'tag': this.safeString(addressInfo, 'destination_tag'),
3532
+ 'network': this.networkIdToCode(networkId, code),
3533
+ };
3534
+ }
3349
3535
  sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
3350
3536
  const version = api[0];
3351
3537
  const signed = api[1] === 'private';
@@ -1781,7 +1781,7 @@ class deribit extends deribit$1 {
1781
1781
  const amount = this.safeString(order, 'amount');
1782
1782
  let cost = Precise["default"].stringMul(filledString, averageString);
1783
1783
  if (market['inverse']) {
1784
- if (this.parseNumber(averageString) !== 0) {
1784
+ if (averageString !== '0') {
1785
1785
  cost = Precise["default"].stringDiv(amount, averageString);
1786
1786
  }
1787
1787
  }