ccxt 4.3.74 → 4.3.76

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
@@ -194,7 +194,7 @@ var xt$1 = require('./src/pro/xt.js');
194
194
 
195
195
  //-----------------------------------------------------------------------------
196
196
  // this is updated by vss.js when building
197
- const version = '4.3.74';
197
+ const version = '4.3.76';
198
198
  Exchange["default"].ccxtVersion = version;
199
199
  const exchanges = {
200
200
  'ace': ace,
@@ -2002,7 +2002,7 @@ class Exchange {
2002
2002
  }
2003
2003
  async watchLiquidations(symbol, since = undefined, limit = undefined, params = {}) {
2004
2004
  if (this.has['watchLiquidationsForSymbols']) {
2005
- return this.watchLiquidationsForSymbols([symbol], since, limit, params);
2005
+ return await this.watchLiquidationsForSymbols([symbol], since, limit, params);
2006
2006
  }
2007
2007
  throw new errors.NotSupported(this.id + ' watchLiquidations() is not supported yet');
2008
2008
  }
@@ -9803,7 +9803,7 @@ class binance extends binance$1 {
9803
9803
  const liquidationPrice = this.parseNumber(liquidationPriceString);
9804
9804
  let collateralString = undefined;
9805
9805
  let marginMode = this.safeString(position, 'marginType');
9806
- if (marginMode === undefined && isolatedMarginString) {
9806
+ if (marginMode === undefined && isolatedMarginString !== undefined) {
9807
9807
  marginMode = Precise["default"].stringEq(isolatedMarginString, '0') ? 'cross' : 'isolated';
9808
9808
  }
9809
9809
  let side = undefined;
@@ -110,7 +110,8 @@ class bitmart extends bitmart$1 {
110
110
  'urls': {
111
111
  'logo': 'https://user-images.githubusercontent.com/1294454/129991357-8f47464b-d0f4-41d6-8a82-34122f0d1398.jpg',
112
112
  'api': {
113
- 'rest': 'https://api-cloud.{hostname}', // bitmart.info for Hong Kong users
113
+ 'spot': 'https://api-cloud.{hostname}',
114
+ 'swap': 'https://api-cloud-v2.{hostname}', // bitmart.info for Hong Kong users
114
115
  },
115
116
  'www': 'https://www.bitmart.com/',
116
117
  'doc': 'https://developer-pro.bitmart.com/',
@@ -201,6 +202,8 @@ class bitmart extends bitmart$1 {
201
202
  'contract/private/current-plan-order': 1.2,
202
203
  'contract/private/trades': 10,
203
204
  'contract/private/position-risk': 10,
205
+ 'contract/private/affilate/rebate-list': 10,
206
+ 'contract/private/affilate/trade-list': 10,
204
207
  },
205
208
  'post': {
206
209
  // sub-account endpoints
@@ -494,8 +497,8 @@ class bitmart extends bitmart$1 {
494
497
  '40045': errors.InvalidOrder,
495
498
  '40046': errors.PermissionDenied,
496
499
  '40047': errors.PermissionDenied,
497
- '40048': errors.BadRequest,
498
- '40049': errors.BadRequest,
500
+ '40048': errors.InvalidOrder,
501
+ '40049': errors.InvalidOrder,
499
502
  '40050': errors.InvalidOrder, // 403, Client OrderId duplicated with existing orders
500
503
  },
501
504
  'broad': {},
@@ -867,36 +870,43 @@ class bitmart extends bitmart$1 {
867
870
  async fetchContractMarkets(params = {}) {
868
871
  const response = await this.publicGetContractPublicDetails(params);
869
872
  //
870
- // {
871
- // "code": 1000,
872
- // "message": "Ok",
873
- // "trace": "9b92a999-9463-4c96-91a4-93ad1cad0d72",
874
- // "data": {
875
- // "symbols": [{
876
- // "symbol": "BTCUSDT",
877
- // "product_type": 1,
878
- // "open_timestamp": 1594080000,
879
- // "expire_timestamp": 0,
880
- // "settle_timestamp": 0,
881
- // "base_currency": "BTC",
882
- // "quote_currency": "USDT",
883
- // "last_price": "23920",
884
- // "volume_24h": "18969368",
885
- // "turnover_24h": "458933659.7858",
886
- // "index_price": "23945.25191635",
887
- // "index_name": "BTCUSDT",
888
- // "contract_size": "0.001",
889
- // "min_leverage": "1",
890
- // "max_leverage": "100",
891
- // "price_precision": "0.1",
892
- // "vol_precision": "1",
893
- // "max_volume": "500000",
894
- // "min_volume": "1"
895
- // },
896
- // ...
897
- // ]
898
- // }
873
+ // {
874
+ // "code": 1000,
875
+ // "message": "Ok",
876
+ // "trace": "9b92a999-9463-4c96-91a4-93ad1cad0d72",
877
+ // "data": {
878
+ // "symbols": [
879
+ // {
880
+ // "symbol": "BTCUSDT",
881
+ // "product_type": 1,
882
+ // "open_timestamp": 1594080000,
883
+ // "expire_timestamp": 0,
884
+ // "settle_timestamp": 0,
885
+ // "base_currency": "BTC",
886
+ // "quote_currency": "USDT",
887
+ // "last_price": "23920",
888
+ // "volume_24h": "18969368",
889
+ // "turnover_24h": "458933659.7858",
890
+ // "index_price": "23945.25191635",
891
+ // "index_name": "BTCUSDT",
892
+ // "contract_size": "0.001",
893
+ // "min_leverage": "1",
894
+ // "max_leverage": "100",
895
+ // "price_precision": "0.1",
896
+ // "vol_precision": "1",
897
+ // "max_volume": "500000",
898
+ // "min_volume": "1",
899
+ // "funding_rate": "0.0001",
900
+ // "expected_funding_rate": "0.00011",
901
+ // "open_interest": "4134180870",
902
+ // "open_interest_value": "94100888927.0433258",
903
+ // "high_24h": "23900",
904
+ // "low_24h": "23100",
905
+ // "change_24h": "0.004"
906
+ // },
907
+ // ]
899
908
  // }
909
+ // }
900
910
  //
901
911
  const data = this.safeValue(response, 'data', {});
902
912
  const symbols = this.safeValue(data, 'symbols', []);
@@ -975,6 +985,7 @@ class bitmart extends bitmart$1 {
975
985
  /**
976
986
  * @method
977
987
  * @name bitmart#fetchMarkets
988
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
978
989
  * @description retrieves data on all markets for bitmart
979
990
  * @param {object} [params] extra parameters specific to the exchange API endpoint
980
991
  * @returns {object[]} an array of objects representing market data
@@ -1180,25 +1191,41 @@ class bitmart extends bitmart$1 {
1180
1191
  //
1181
1192
  // swap
1182
1193
  //
1183
- // {
1184
- // "contract_symbol":"DOGEUSDT",
1185
- // "last_price":"0.130340",
1186
- // "index_price":"0.13048245",
1187
- // "last_funding_rate":"0.00002287",
1188
- // "price_change_percent_24h":"-2.074",
1189
- // "volume_24h":"113705028.59482228",
1190
- // "url":"https://futures.bitmart.com/en?symbol=DOGEUSDT",
1191
- // "high_price":"0.134520",
1192
- // "low_price":"0.128570",
1193
- // "legal_coin_price":"0.1302699"
1194
- // }
1194
+ // {
1195
+ // "symbol": "BTCUSDT",
1196
+ // "product_type": 1,
1197
+ // "open_timestamp": 1594080000,
1198
+ // "expire_timestamp": 0,
1199
+ // "settle_timestamp": 0,
1200
+ // "base_currency": "BTC",
1201
+ // "quote_currency": "USDT",
1202
+ // "last_price": "23920",
1203
+ // "volume_24h": "18969368",
1204
+ // "turnover_24h": "458933659.7858",
1205
+ // "index_price": "23945.25191635",
1206
+ // "index_name": "BTCUSDT",
1207
+ // "contract_size": "0.001",
1208
+ // "min_leverage": "1",
1209
+ // "max_leverage": "100",
1210
+ // "price_precision": "0.1",
1211
+ // "vol_precision": "1",
1212
+ // "max_volume": "500000",
1213
+ // "min_volume": "1",
1214
+ // "funding_rate": "0.0001",
1215
+ // "expected_funding_rate": "0.00011",
1216
+ // "open_interest": "4134180870",
1217
+ // "open_interest_value": "94100888927.0433258",
1218
+ // "high_24h": "23900",
1219
+ // "low_24h": "23100",
1220
+ // "change_24h": "0.004"
1221
+ // }
1195
1222
  //
1196
1223
  const result = this.safeList(ticker, 'result', []);
1197
1224
  const average = this.safeString2(ticker, 'avg_price', 'index_price');
1198
1225
  let marketId = this.safeString2(ticker, 'symbol', 'contract_symbol');
1199
1226
  let timestamp = this.safeInteger2(ticker, 'timestamp', 'ts');
1200
1227
  let last = this.safeString2(ticker, 'last_price', 'last');
1201
- let percentage = this.safeString(ticker, 'price_change_percent_24h');
1228
+ let percentage = this.safeString2(ticker, 'price_change_percent_24h', 'change_24h');
1202
1229
  let change = this.safeString(ticker, 'fluctuation');
1203
1230
  let high = this.safeString2(ticker, 'high_24h', 'high_price');
1204
1231
  let low = this.safeString2(ticker, 'low_24h', 'low_price');
@@ -1207,8 +1234,8 @@ class bitmart extends bitmart$1 {
1207
1234
  let ask = this.safeString2(ticker, 'best_ask', 'ask_px');
1208
1235
  let askVolume = this.safeString2(ticker, 'best_ask_size', 'ask_sz');
1209
1236
  let open = this.safeString(ticker, 'open_24h');
1210
- let baseVolume = this.safeString2(ticker, 'base_volume_24h', 'v_24h');
1211
- let quoteVolume = this.safeStringLower2(ticker, 'quote_volume_24h', 'qv_24h');
1237
+ let baseVolume = this.safeStringN(ticker, ['base_volume_24h', 'v_24h', 'volume_24h']);
1238
+ let quoteVolume = this.safeStringLowerN(ticker, ['quote_volume_24h', 'qv_24h', 'turnover_24h']);
1212
1239
  const listMarketId = this.safeString(result, 0);
1213
1240
  if (listMarketId !== undefined) {
1214
1241
  marketId = listMarketId;
@@ -1275,6 +1302,7 @@ class bitmart extends bitmart$1 {
1275
1302
  * @name bitmart#fetchTicker
1276
1303
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
1277
1304
  * @see https://developer-pro.bitmart.com/en/spot/#get-ticker-of-a-trading-pair-v3
1305
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
1278
1306
  * @param {string} symbol unified symbol of the market to fetch the ticker for
1279
1307
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1280
1308
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -1284,8 +1312,8 @@ class bitmart extends bitmart$1 {
1284
1312
  const request = {};
1285
1313
  let response = undefined;
1286
1314
  if (market['swap']) {
1287
- request['contract_symbol'] = market['id'];
1288
- response = await this.publicGetContractV1Tickers(this.extend(request, params));
1315
+ request['symbol'] = market['id'];
1316
+ response = await this.publicGetContractPublicDetails(this.extend(request, params));
1289
1317
  //
1290
1318
  // {
1291
1319
  // "message":"OK",
@@ -1340,7 +1368,6 @@ class bitmart extends bitmart$1 {
1340
1368
  throw new errors.NotSupported(this.id + ' fetchTicker() does not support ' + market['type'] + ' markets, only spot and swap markets are accepted');
1341
1369
  }
1342
1370
  // fails in naming for contract tickers 'contract_symbol'
1343
- let tickersById = undefined;
1344
1371
  let tickers = [];
1345
1372
  let ticker = {};
1346
1373
  if (market['spot']) {
@@ -1348,9 +1375,8 @@ class bitmart extends bitmart$1 {
1348
1375
  }
1349
1376
  else {
1350
1377
  const data = this.safeDict(response, 'data', {});
1351
- tickers = this.safeList(data, 'tickers', []);
1352
- tickersById = this.indexBy(tickers, 'contract_symbol');
1353
- ticker = this.safeDict(tickersById, market['id']);
1378
+ tickers = this.safeList(data, 'symbols', []);
1379
+ ticker = this.safeValue(tickers, 0, {});
1354
1380
  }
1355
1381
  return this.parseTicker(ticker, market);
1356
1382
  }
@@ -1360,6 +1386,7 @@ class bitmart extends bitmart$1 {
1360
1386
  * @name bitmart#fetchTickers
1361
1387
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
1362
1388
  * @see https://developer-pro.bitmart.com/en/spot/#get-ticker-of-all-pairs-v3
1389
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
1363
1390
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1364
1391
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1365
1392
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -1402,29 +1429,45 @@ class bitmart extends bitmart$1 {
1402
1429
  //
1403
1430
  }
1404
1431
  else if (type === 'swap') {
1405
- response = await this.publicGetContractV1Tickers(params);
1432
+ response = await this.publicGetContractPublicDetails(params);
1406
1433
  //
1407
- // {
1408
- // "message": "OK",
1409
- // "code": 1000,
1410
- // "trace": "c1dec681c24ea5d.105.171712565",
1411
- // "data": {
1412
- // "tickers": [
1413
- // {
1414
- // "contract_symbol": "SNTUSDT",
1415
- // "last_price": "0.0366600",
1416
- // "index_price": "0.03587373",
1417
- // "last_funding_rate": "0.00005000",
1418
- // "price_change_percent_24h": "-2.629",
1419
- // "volume_24h": "10102540.19909109848",
1420
- // "url": "https://futures.bitmart.com/en?symbol=SNTUSDT",
1421
- // "high_price": "0.0405600",
1422
- // "low_price": "0.0355000",
1423
- // "legal_coin_price": "0.03666697"
1424
- // },
1425
- // ]
1426
- // }
1427
- // }
1434
+ // {
1435
+ // "code": 1000,
1436
+ // "message": "Ok",
1437
+ // "trace": "9b92a999-9463-4c96-91a4-93ad1cad0d72",
1438
+ // "data": {
1439
+ // "symbols": [
1440
+ // {
1441
+ // "symbol": "BTCUSDT",
1442
+ // "product_type": 1,
1443
+ // "open_timestamp": 1594080000,
1444
+ // "expire_timestamp": 0,
1445
+ // "settle_timestamp": 0,
1446
+ // "base_currency": "BTC",
1447
+ // "quote_currency": "USDT",
1448
+ // "last_price": "23920",
1449
+ // "volume_24h": "18969368",
1450
+ // "turnover_24h": "458933659.7858",
1451
+ // "index_price": "23945.25191635",
1452
+ // "index_name": "BTCUSDT",
1453
+ // "contract_size": "0.001",
1454
+ // "min_leverage": "1",
1455
+ // "max_leverage": "100",
1456
+ // "price_precision": "0.1",
1457
+ // "vol_precision": "1",
1458
+ // "max_volume": "500000",
1459
+ // "min_volume": "1",
1460
+ // "funding_rate": "0.0001",
1461
+ // "expected_funding_rate": "0.00011",
1462
+ // "open_interest": "4134180870",
1463
+ // "open_interest_value": "94100888927.0433258",
1464
+ // "high_24h": "23900",
1465
+ // "low_24h": "23100",
1466
+ // "change_24h": "0.004"
1467
+ // },
1468
+ // ]
1469
+ // }
1470
+ // }
1428
1471
  //
1429
1472
  }
1430
1473
  else {
@@ -1436,7 +1479,7 @@ class bitmart extends bitmart$1 {
1436
1479
  }
1437
1480
  else {
1438
1481
  const data = this.safeDict(response, 'data', {});
1439
- tickers = this.safeList(data, 'tickers', []);
1482
+ tickers = this.safeList(data, 'symbols', []);
1440
1483
  }
1441
1484
  const result = {};
1442
1485
  for (let i = 0; i < tickers.length; i++) {
@@ -1459,6 +1502,7 @@ class bitmart extends bitmart$1 {
1459
1502
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
1460
1503
  * @see https://developer-pro.bitmart.com/en/spot/#get-depth-v3
1461
1504
  * @see https://developer-pro.bitmart.com/en/futures/#get-market-depth
1505
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-market-depth
1462
1506
  * @param {string} symbol unified symbol of the market to fetch the order book for
1463
1507
  * @param {int} [limit] the maximum amount of order book entries to return
1464
1508
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1750,7 +1794,7 @@ class bitmart extends bitmart$1 {
1750
1794
  * @name bitmart#fetchOHLCV
1751
1795
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1752
1796
  * @see https://developer-pro.bitmart.com/en/spot/#get-history-k-line-v3
1753
- * @see https://developer-pro.bitmart.com/en/futures/#get-k-line
1797
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-k-line
1754
1798
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1755
1799
  * @param {string} timeframe the length of time each candle represents
1756
1800
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -2047,6 +2091,7 @@ class bitmart extends bitmart$1 {
2047
2091
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
2048
2092
  * @see https://developer-pro.bitmart.com/en/spot/#get-spot-wallet-balance
2049
2093
  * @see https://developer-pro.bitmart.com/en/futures/#get-contract-assets-detail
2094
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-contract-assets-keyed
2050
2095
  * @see https://developer-pro.bitmart.com/en/spot/#get-account-balance
2051
2096
  * @see https://developer-pro.bitmart.com/en/spot/#get-margin-account-details-isolated
2052
2097
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2416,6 +2461,8 @@ class bitmart extends bitmart$1 {
2416
2461
  * @see https://developer-pro.bitmart.com/en/spot/#place-margin-order
2417
2462
  * @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
2418
2463
  * @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
2464
+ * @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
2465
+ * @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
2419
2466
  * @param {string} symbol unified symbol of the market to create an order in
2420
2467
  * @param {string} type 'market', 'limit' or 'trailing' for swap markets only
2421
2468
  * @param {string} side 'buy' or 'sell'
@@ -2664,9 +2711,11 @@ class bitmart extends bitmart$1 {
2664
2711
  params = this.omit(params, 'clientOrderId');
2665
2712
  request['client_order_id'] = clientOrderId;
2666
2713
  }
2667
- const leverage = this.safeInteger(params, 'leverage', 1);
2714
+ const leverage = this.safeInteger(params, 'leverage');
2668
2715
  params = this.omit(params, ['timeInForce', 'postOnly', 'reduceOnly', 'leverage', 'trailingTriggerPrice', 'trailingPercent', 'triggerPrice', 'stopPrice']);
2669
- request['leverage'] = this.numberToString(leverage);
2716
+ if (leverage !== undefined) {
2717
+ request['leverage'] = this.numberToString(leverage);
2718
+ }
2670
2719
  return this.extend(request, params);
2671
2720
  }
2672
2721
  createSpotOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
@@ -2757,6 +2806,8 @@ class bitmart extends bitmart$1 {
2757
2806
  * @see https://developer-pro.bitmart.com/en/spot/#cancel-order-v3-signed
2758
2807
  * @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
2759
2808
  * @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
2809
+ * @see https://developer-pro.bitmart.com/en/futures/#cancel-order-signed
2810
+ * @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
2760
2811
  * @param {string} id order id
2761
2812
  * @param {string} symbol unified symbol of the market the order was made in
2762
2813
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2909,6 +2960,7 @@ class bitmart extends bitmart$1 {
2909
2960
  * @description cancel all open orders in a market
2910
2961
  * @see https://developer-pro.bitmart.com/en/spot/#cancel-all-orders
2911
2962
  * @see https://developer-pro.bitmart.com/en/futures/#cancel-all-orders-signed
2963
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#cancel-all-orders-signed
2912
2964
  * @param {string} symbol unified market symbol of the market to cancel orders in
2913
2965
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2914
2966
  * @param {string} [params.side] *spot only* 'buy' or 'sell'
@@ -3147,6 +3199,7 @@ class bitmart extends bitmart$1 {
3147
3199
  * @name bitmart#fetchClosedOrders
3148
3200
  * @see https://developer-pro.bitmart.com/en/spot/#account-orders-v4-signed
3149
3201
  * @see https://developer-pro.bitmart.com/en/futures/#get-order-history-keyed
3202
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-order-history-keyed
3150
3203
  * @description fetches information on multiple closed orders made by the user
3151
3204
  * @param {string} symbol unified market symbol of the market orders were made in
3152
3205
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -3216,6 +3269,7 @@ class bitmart extends bitmart$1 {
3216
3269
  * @see https://developer-pro.bitmart.com/en/spot/#query-order-by-id-v4-signed
3217
3270
  * @see https://developer-pro.bitmart.com/en/spot/#query-order-by-clientorderid-v4-signed
3218
3271
  * @see https://developer-pro.bitmart.com/en/futures/#get-order-detail-keyed
3272
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-order-detail-keyed
3219
3273
  * @param {string} id the id of the order
3220
3274
  * @param {string} symbol unified symbol of the market the order was made in
3221
3275
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -3949,6 +4003,7 @@ class bitmart extends bitmart$1 {
3949
4003
  * @description transfer currency internally between wallets on the same account, currently only supports transfer between spot and margin
3950
4004
  * @see https://developer-pro.bitmart.com/en/spot/#margin-asset-transfer-signed
3951
4005
  * @see https://developer-pro.bitmart.com/en/futures/#transfer-signed
4006
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#transfer-signed
3952
4007
  * @param {string} code unified currency code
3953
4008
  * @param {float} amount amount to transfer
3954
4009
  * @param {string} fromAccount account to transfer from
@@ -4233,7 +4288,7 @@ class bitmart extends bitmart$1 {
4233
4288
  * @method
4234
4289
  * @name bitmart#fetchOpenInterest
4235
4290
  * @description Retrieves the open interest of a currency
4236
- * @see https://developer-pro.bitmart.com/en/futures/#get-futures-openinterest
4291
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-futures-openinterest
4237
4292
  * @param {string} symbol Unified CCXT market symbol
4238
4293
  * @param {object} [params] exchange specific parameters
4239
4294
  * @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
@@ -4289,6 +4344,7 @@ class bitmart extends bitmart$1 {
4289
4344
  * @name bitmart#setLeverage
4290
4345
  * @description set the level of leverage for a market
4291
4346
  * @see https://developer-pro.bitmart.com/en/futures/#submit-leverage-signed
4347
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#submit-leverage-signed
4292
4348
  * @param {float} leverage the rate of leverage
4293
4349
  * @param {string} symbol unified market symbol
4294
4350
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -4318,7 +4374,7 @@ class bitmart extends bitmart$1 {
4318
4374
  * @method
4319
4375
  * @name bitmart#fetchFundingRate
4320
4376
  * @description fetch the current funding rate
4321
- * @see https://developer-pro.bitmart.com/en/futures/#get-current-funding-rate
4377
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-funding-rate
4322
4378
  * @param {string} symbol unified market symbol
4323
4379
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4324
4380
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
@@ -4385,6 +4441,7 @@ class bitmart extends bitmart$1 {
4385
4441
  * @name bitmart#fetchPosition
4386
4442
  * @description fetch data on a single open contract trade position
4387
4443
  * @see https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
4444
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-risk-details-keyed
4388
4445
  * @param {string} symbol unified market symbol of the market the position is held in
4389
4446
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4390
4447
  * @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
@@ -4434,6 +4491,7 @@ class bitmart extends bitmart$1 {
4434
4491
  * @name bitmart#fetchPositions
4435
4492
  * @description fetch all open contract positions
4436
4493
  * @see https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
4494
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-risk-details-keyed
4437
4495
  * @param {string[]|undefined} symbols list of unified market symbols
4438
4496
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4439
4497
  * @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
@@ -4660,7 +4718,11 @@ class bitmart extends bitmart$1 {
4660
4718
  return this.milliseconds();
4661
4719
  }
4662
4720
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
4663
- const baseUrl = this.implodeHostname(this.urls['api']['rest']);
4721
+ const parts = path.split('/');
4722
+ // to do: refactor api endpoints with spot/swap sections
4723
+ const category = this.safeString(parts, 0, 'spot');
4724
+ const market = (category === 'spot' || category === 'account') ? 'spot' : 'swap';
4725
+ const baseUrl = this.implodeHostname(this.urls['api'][market]);
4664
4726
  let url = baseUrl + '/' + this.implodeParams(path, params);
4665
4727
  const query = this.omit(params, this.extractParams(path));
4666
4728
  let queryString = '';
@@ -240,6 +240,7 @@ class bybit extends bybit$1 {
240
240
  },
241
241
  'private': {
242
242
  'get': {
243
+ 'v5/market/instruments-info': 5,
243
244
  // Legacy inverse swap
244
245
  'v2/private/wallet/fund/records': 25,
245
246
  // spot
@@ -985,6 +986,7 @@ class bybit extends bybit$1 {
985
986
  },
986
987
  'precisionMode': number.TICK_SIZE,
987
988
  'options': {
989
+ 'usePrivateInstrumentsInfo': false,
988
990
  'sandboxMode': false,
989
991
  'enableDemoTrading': false,
990
992
  'fetchMarkets': ['spot', 'linear', 'inverse', 'option'],
@@ -1479,7 +1481,14 @@ class bybit extends bybit$1 {
1479
1481
  const request = {
1480
1482
  'category': 'spot',
1481
1483
  };
1482
- const response = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1484
+ const usePrivateInstrumentsInfo = this.safeBool(this.options, 'usePrivateInstrumentsInfo', false);
1485
+ let response = undefined;
1486
+ if (usePrivateInstrumentsInfo) {
1487
+ response = await this.privateGetV5MarketInstrumentsInfo(this.extend(request, params));
1488
+ }
1489
+ else {
1490
+ response = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1491
+ }
1483
1492
  //
1484
1493
  // {
1485
1494
  // "retCode": 0,
@@ -1589,14 +1598,27 @@ class bybit extends bybit$1 {
1589
1598
  async fetchFutureMarkets(params) {
1590
1599
  params = this.extend(params);
1591
1600
  params['limit'] = 1000; // minimize number of requests
1592
- const response = await this.publicGetV5MarketInstrumentsInfo(params);
1601
+ const usePrivateInstrumentsInfo = this.safeBool(this.options, 'usePrivateInstrumentsInfo', false);
1602
+ let response = undefined;
1603
+ if (usePrivateInstrumentsInfo) {
1604
+ response = await this.privateGetV5MarketInstrumentsInfo(params);
1605
+ }
1606
+ else {
1607
+ response = await this.publicGetV5MarketInstrumentsInfo(params);
1608
+ }
1593
1609
  const data = this.safeDict(response, 'result', {});
1594
1610
  let markets = this.safeList(data, 'list', []);
1595
1611
  let paginationCursor = this.safeString(data, 'nextPageCursor');
1596
1612
  if (paginationCursor !== undefined) {
1597
1613
  while (paginationCursor !== undefined) {
1598
1614
  params['cursor'] = paginationCursor;
1599
- const responseInner = await this.publicGetV5MarketInstrumentsInfo(params);
1615
+ let responseInner = undefined;
1616
+ if (usePrivateInstrumentsInfo) {
1617
+ responseInner = await this.privateGetV5MarketInstrumentsInfo(params);
1618
+ }
1619
+ else {
1620
+ responseInner = await this.publicGetV5MarketInstrumentsInfo(params);
1621
+ }
1600
1622
  const dataNew = this.safeDict(responseInner, 'result', {});
1601
1623
  const rawMarkets = this.safeList(dataNew, 'list', []);
1602
1624
  const rawMarketsLength = rawMarkets.length;
@@ -1765,7 +1787,14 @@ class bybit extends bybit$1 {
1765
1787
  const request = {
1766
1788
  'category': 'option',
1767
1789
  };
1768
- const response = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1790
+ const usePrivateInstrumentsInfo = this.safeBool(this.options, 'usePrivateInstrumentsInfo', false);
1791
+ let response = undefined;
1792
+ if (usePrivateInstrumentsInfo) {
1793
+ response = await this.privateGetV5MarketInstrumentsInfo(this.extend(request, params));
1794
+ }
1795
+ else {
1796
+ response = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1797
+ }
1769
1798
  const data = this.safeDict(response, 'result', {});
1770
1799
  let markets = this.safeList(data, 'list', []);
1771
1800
  if (this.options['loadAllOptions']) {
@@ -1774,7 +1803,13 @@ class bybit extends bybit$1 {
1774
1803
  if (paginationCursor !== undefined) {
1775
1804
  while (paginationCursor !== undefined) {
1776
1805
  request['cursor'] = paginationCursor;
1777
- const responseInner = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1806
+ let responseInner = undefined;
1807
+ if (usePrivateInstrumentsInfo) {
1808
+ responseInner = await this.privateGetV5MarketInstrumentsInfo(this.extend(request, params));
1809
+ }
1810
+ else {
1811
+ responseInner = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1812
+ }
1778
1813
  const dataNew = this.safeDict(responseInner, 'result', {});
1779
1814
  const rawMarkets = this.safeList(dataNew, 'list', []);
1780
1815
  const rawMarketsLength = rawMarkets.length;
@@ -267,8 +267,8 @@ class coinbase extends coinbase$1 {
267
267
  },
268
268
  'fees': {
269
269
  'trading': {
270
- 'taker': this.parseNumber('0.006'),
271
- 'maker': this.parseNumber('0.004'),
270
+ 'taker': this.parseNumber('0.012'),
271
+ 'maker': this.parseNumber('0.006'),
272
272
  'tierBased': true,
273
273
  'percentage': true,
274
274
  'tiers': {
@@ -1373,6 +1373,10 @@ class coinbase extends coinbase$1 {
1373
1373
  const marketType = this.safeStringLower(market, 'product_type');
1374
1374
  const tradingDisabled = this.safeBool(market, 'trading_disabled');
1375
1375
  const stablePairs = this.safeList(this.options, 'stablePairs', []);
1376
+ const defaultTakerFee = this.safeNumber(this.fees['trading'], 'taker');
1377
+ const defaultMakerFee = this.safeNumber(this.fees['trading'], 'maker');
1378
+ const takerFee = this.inArray(id, stablePairs) ? 0.00001 : this.safeNumber(feeTier, 'taker_fee_rate', defaultTakerFee);
1379
+ const makerFee = this.inArray(id, stablePairs) ? 0.0 : this.safeNumber(feeTier, 'maker_fee_rate', defaultMakerFee);
1376
1380
  return this.safeMarketStructure({
1377
1381
  'id': id,
1378
1382
  'symbol': base + '/' + quote,
@@ -1392,8 +1396,8 @@ class coinbase extends coinbase$1 {
1392
1396
  'contract': false,
1393
1397
  'linear': undefined,
1394
1398
  'inverse': undefined,
1395
- 'taker': this.inArray(id, stablePairs) ? 0.00001 : this.safeNumber(feeTier, 'taker_fee_rate'),
1396
- 'maker': this.inArray(id, stablePairs) ? 0.0 : this.safeNumber(feeTier, 'maker_fee_rate'),
1399
+ 'taker': takerFee,
1400
+ 'maker': makerFee,
1397
1401
  'contractSize': undefined,
1398
1402
  'expiry': undefined,
1399
1403
  'expiryDatetime': undefined,
@@ -185,6 +185,7 @@ class gemini extends gemini$1 {
185
185
  'v1/account/create': 1,
186
186
  'v1/account/list': 1,
187
187
  'v1/heartbeat': 1,
188
+ 'v1/roles': 1,
188
189
  },
189
190
  },
190
191
  },