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/js/src/bitmart.js CHANGED
@@ -113,7 +113,8 @@ export default class bitmart extends Exchange {
113
113
  'urls': {
114
114
  'logo': 'https://user-images.githubusercontent.com/1294454/129991357-8f47464b-d0f4-41d6-8a82-34122f0d1398.jpg',
115
115
  'api': {
116
- 'rest': 'https://api-cloud.{hostname}', // bitmart.info for Hong Kong users
116
+ 'spot': 'https://api-cloud.{hostname}',
117
+ 'swap': 'https://api-cloud-v2.{hostname}', // bitmart.info for Hong Kong users
117
118
  },
118
119
  'www': 'https://www.bitmart.com/',
119
120
  'doc': 'https://developer-pro.bitmart.com/',
@@ -204,6 +205,8 @@ export default class bitmart extends Exchange {
204
205
  'contract/private/current-plan-order': 1.2,
205
206
  'contract/private/trades': 10,
206
207
  'contract/private/position-risk': 10,
208
+ 'contract/private/affilate/rebate-list': 10,
209
+ 'contract/private/affilate/trade-list': 10,
207
210
  },
208
211
  'post': {
209
212
  // sub-account endpoints
@@ -497,8 +500,8 @@ export default class bitmart extends Exchange {
497
500
  '40045': InvalidOrder,
498
501
  '40046': PermissionDenied,
499
502
  '40047': PermissionDenied,
500
- '40048': BadRequest,
501
- '40049': BadRequest,
503
+ '40048': InvalidOrder,
504
+ '40049': InvalidOrder,
502
505
  '40050': InvalidOrder, // 403, Client OrderId duplicated with existing orders
503
506
  },
504
507
  'broad': {},
@@ -870,36 +873,43 @@ export default class bitmart extends Exchange {
870
873
  async fetchContractMarkets(params = {}) {
871
874
  const response = await this.publicGetContractPublicDetails(params);
872
875
  //
873
- // {
874
- // "code": 1000,
875
- // "message": "Ok",
876
- // "trace": "9b92a999-9463-4c96-91a4-93ad1cad0d72",
877
- // "data": {
878
- // "symbols": [{
879
- // "symbol": "BTCUSDT",
880
- // "product_type": 1,
881
- // "open_timestamp": 1594080000,
882
- // "expire_timestamp": 0,
883
- // "settle_timestamp": 0,
884
- // "base_currency": "BTC",
885
- // "quote_currency": "USDT",
886
- // "last_price": "23920",
887
- // "volume_24h": "18969368",
888
- // "turnover_24h": "458933659.7858",
889
- // "index_price": "23945.25191635",
890
- // "index_name": "BTCUSDT",
891
- // "contract_size": "0.001",
892
- // "min_leverage": "1",
893
- // "max_leverage": "100",
894
- // "price_precision": "0.1",
895
- // "vol_precision": "1",
896
- // "max_volume": "500000",
897
- // "min_volume": "1"
898
- // },
899
- // ...
900
- // ]
901
- // }
876
+ // {
877
+ // "code": 1000,
878
+ // "message": "Ok",
879
+ // "trace": "9b92a999-9463-4c96-91a4-93ad1cad0d72",
880
+ // "data": {
881
+ // "symbols": [
882
+ // {
883
+ // "symbol": "BTCUSDT",
884
+ // "product_type": 1,
885
+ // "open_timestamp": 1594080000,
886
+ // "expire_timestamp": 0,
887
+ // "settle_timestamp": 0,
888
+ // "base_currency": "BTC",
889
+ // "quote_currency": "USDT",
890
+ // "last_price": "23920",
891
+ // "volume_24h": "18969368",
892
+ // "turnover_24h": "458933659.7858",
893
+ // "index_price": "23945.25191635",
894
+ // "index_name": "BTCUSDT",
895
+ // "contract_size": "0.001",
896
+ // "min_leverage": "1",
897
+ // "max_leverage": "100",
898
+ // "price_precision": "0.1",
899
+ // "vol_precision": "1",
900
+ // "max_volume": "500000",
901
+ // "min_volume": "1",
902
+ // "funding_rate": "0.0001",
903
+ // "expected_funding_rate": "0.00011",
904
+ // "open_interest": "4134180870",
905
+ // "open_interest_value": "94100888927.0433258",
906
+ // "high_24h": "23900",
907
+ // "low_24h": "23100",
908
+ // "change_24h": "0.004"
909
+ // },
910
+ // ]
902
911
  // }
912
+ // }
903
913
  //
904
914
  const data = this.safeValue(response, 'data', {});
905
915
  const symbols = this.safeValue(data, 'symbols', []);
@@ -978,6 +988,7 @@ export default class bitmart extends Exchange {
978
988
  /**
979
989
  * @method
980
990
  * @name bitmart#fetchMarkets
991
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
981
992
  * @description retrieves data on all markets for bitmart
982
993
  * @param {object} [params] extra parameters specific to the exchange API endpoint
983
994
  * @returns {object[]} an array of objects representing market data
@@ -1183,25 +1194,41 @@ export default class bitmart extends Exchange {
1183
1194
  //
1184
1195
  // swap
1185
1196
  //
1186
- // {
1187
- // "contract_symbol":"DOGEUSDT",
1188
- // "last_price":"0.130340",
1189
- // "index_price":"0.13048245",
1190
- // "last_funding_rate":"0.00002287",
1191
- // "price_change_percent_24h":"-2.074",
1192
- // "volume_24h":"113705028.59482228",
1193
- // "url":"https://futures.bitmart.com/en?symbol=DOGEUSDT",
1194
- // "high_price":"0.134520",
1195
- // "low_price":"0.128570",
1196
- // "legal_coin_price":"0.1302699"
1197
- // }
1197
+ // {
1198
+ // "symbol": "BTCUSDT",
1199
+ // "product_type": 1,
1200
+ // "open_timestamp": 1594080000,
1201
+ // "expire_timestamp": 0,
1202
+ // "settle_timestamp": 0,
1203
+ // "base_currency": "BTC",
1204
+ // "quote_currency": "USDT",
1205
+ // "last_price": "23920",
1206
+ // "volume_24h": "18969368",
1207
+ // "turnover_24h": "458933659.7858",
1208
+ // "index_price": "23945.25191635",
1209
+ // "index_name": "BTCUSDT",
1210
+ // "contract_size": "0.001",
1211
+ // "min_leverage": "1",
1212
+ // "max_leverage": "100",
1213
+ // "price_precision": "0.1",
1214
+ // "vol_precision": "1",
1215
+ // "max_volume": "500000",
1216
+ // "min_volume": "1",
1217
+ // "funding_rate": "0.0001",
1218
+ // "expected_funding_rate": "0.00011",
1219
+ // "open_interest": "4134180870",
1220
+ // "open_interest_value": "94100888927.0433258",
1221
+ // "high_24h": "23900",
1222
+ // "low_24h": "23100",
1223
+ // "change_24h": "0.004"
1224
+ // }
1198
1225
  //
1199
1226
  const result = this.safeList(ticker, 'result', []);
1200
1227
  const average = this.safeString2(ticker, 'avg_price', 'index_price');
1201
1228
  let marketId = this.safeString2(ticker, 'symbol', 'contract_symbol');
1202
1229
  let timestamp = this.safeInteger2(ticker, 'timestamp', 'ts');
1203
1230
  let last = this.safeString2(ticker, 'last_price', 'last');
1204
- let percentage = this.safeString(ticker, 'price_change_percent_24h');
1231
+ let percentage = this.safeString2(ticker, 'price_change_percent_24h', 'change_24h');
1205
1232
  let change = this.safeString(ticker, 'fluctuation');
1206
1233
  let high = this.safeString2(ticker, 'high_24h', 'high_price');
1207
1234
  let low = this.safeString2(ticker, 'low_24h', 'low_price');
@@ -1210,8 +1237,8 @@ export default class bitmart extends Exchange {
1210
1237
  let ask = this.safeString2(ticker, 'best_ask', 'ask_px');
1211
1238
  let askVolume = this.safeString2(ticker, 'best_ask_size', 'ask_sz');
1212
1239
  let open = this.safeString(ticker, 'open_24h');
1213
- let baseVolume = this.safeString2(ticker, 'base_volume_24h', 'v_24h');
1214
- let quoteVolume = this.safeStringLower2(ticker, 'quote_volume_24h', 'qv_24h');
1240
+ let baseVolume = this.safeStringN(ticker, ['base_volume_24h', 'v_24h', 'volume_24h']);
1241
+ let quoteVolume = this.safeStringLowerN(ticker, ['quote_volume_24h', 'qv_24h', 'turnover_24h']);
1215
1242
  const listMarketId = this.safeString(result, 0);
1216
1243
  if (listMarketId !== undefined) {
1217
1244
  marketId = listMarketId;
@@ -1278,6 +1305,7 @@ export default class bitmart extends Exchange {
1278
1305
  * @name bitmart#fetchTicker
1279
1306
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
1280
1307
  * @see https://developer-pro.bitmart.com/en/spot/#get-ticker-of-a-trading-pair-v3
1308
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
1281
1309
  * @param {string} symbol unified symbol of the market to fetch the ticker for
1282
1310
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1283
1311
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -1287,8 +1315,8 @@ export default class bitmart extends Exchange {
1287
1315
  const request = {};
1288
1316
  let response = undefined;
1289
1317
  if (market['swap']) {
1290
- request['contract_symbol'] = market['id'];
1291
- response = await this.publicGetContractV1Tickers(this.extend(request, params));
1318
+ request['symbol'] = market['id'];
1319
+ response = await this.publicGetContractPublicDetails(this.extend(request, params));
1292
1320
  //
1293
1321
  // {
1294
1322
  // "message":"OK",
@@ -1343,7 +1371,6 @@ export default class bitmart extends Exchange {
1343
1371
  throw new NotSupported(this.id + ' fetchTicker() does not support ' + market['type'] + ' markets, only spot and swap markets are accepted');
1344
1372
  }
1345
1373
  // fails in naming for contract tickers 'contract_symbol'
1346
- let tickersById = undefined;
1347
1374
  let tickers = [];
1348
1375
  let ticker = {};
1349
1376
  if (market['spot']) {
@@ -1351,9 +1378,8 @@ export default class bitmart extends Exchange {
1351
1378
  }
1352
1379
  else {
1353
1380
  const data = this.safeDict(response, 'data', {});
1354
- tickers = this.safeList(data, 'tickers', []);
1355
- tickersById = this.indexBy(tickers, 'contract_symbol');
1356
- ticker = this.safeDict(tickersById, market['id']);
1381
+ tickers = this.safeList(data, 'symbols', []);
1382
+ ticker = this.safeValue(tickers, 0, {});
1357
1383
  }
1358
1384
  return this.parseTicker(ticker, market);
1359
1385
  }
@@ -1363,6 +1389,7 @@ export default class bitmart extends Exchange {
1363
1389
  * @name bitmart#fetchTickers
1364
1390
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
1365
1391
  * @see https://developer-pro.bitmart.com/en/spot/#get-ticker-of-all-pairs-v3
1392
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
1366
1393
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1367
1394
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1368
1395
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -1405,29 +1432,45 @@ export default class bitmart extends Exchange {
1405
1432
  //
1406
1433
  }
1407
1434
  else if (type === 'swap') {
1408
- response = await this.publicGetContractV1Tickers(params);
1435
+ response = await this.publicGetContractPublicDetails(params);
1409
1436
  //
1410
- // {
1411
- // "message": "OK",
1412
- // "code": 1000,
1413
- // "trace": "c1dec681c24ea5d.105.171712565",
1414
- // "data": {
1415
- // "tickers": [
1416
- // {
1417
- // "contract_symbol": "SNTUSDT",
1418
- // "last_price": "0.0366600",
1419
- // "index_price": "0.03587373",
1420
- // "last_funding_rate": "0.00005000",
1421
- // "price_change_percent_24h": "-2.629",
1422
- // "volume_24h": "10102540.19909109848",
1423
- // "url": "https://futures.bitmart.com/en?symbol=SNTUSDT",
1424
- // "high_price": "0.0405600",
1425
- // "low_price": "0.0355000",
1426
- // "legal_coin_price": "0.03666697"
1427
- // },
1428
- // ]
1429
- // }
1430
- // }
1437
+ // {
1438
+ // "code": 1000,
1439
+ // "message": "Ok",
1440
+ // "trace": "9b92a999-9463-4c96-91a4-93ad1cad0d72",
1441
+ // "data": {
1442
+ // "symbols": [
1443
+ // {
1444
+ // "symbol": "BTCUSDT",
1445
+ // "product_type": 1,
1446
+ // "open_timestamp": 1594080000,
1447
+ // "expire_timestamp": 0,
1448
+ // "settle_timestamp": 0,
1449
+ // "base_currency": "BTC",
1450
+ // "quote_currency": "USDT",
1451
+ // "last_price": "23920",
1452
+ // "volume_24h": "18969368",
1453
+ // "turnover_24h": "458933659.7858",
1454
+ // "index_price": "23945.25191635",
1455
+ // "index_name": "BTCUSDT",
1456
+ // "contract_size": "0.001",
1457
+ // "min_leverage": "1",
1458
+ // "max_leverage": "100",
1459
+ // "price_precision": "0.1",
1460
+ // "vol_precision": "1",
1461
+ // "max_volume": "500000",
1462
+ // "min_volume": "1",
1463
+ // "funding_rate": "0.0001",
1464
+ // "expected_funding_rate": "0.00011",
1465
+ // "open_interest": "4134180870",
1466
+ // "open_interest_value": "94100888927.0433258",
1467
+ // "high_24h": "23900",
1468
+ // "low_24h": "23100",
1469
+ // "change_24h": "0.004"
1470
+ // },
1471
+ // ]
1472
+ // }
1473
+ // }
1431
1474
  //
1432
1475
  }
1433
1476
  else {
@@ -1439,7 +1482,7 @@ export default class bitmart extends Exchange {
1439
1482
  }
1440
1483
  else {
1441
1484
  const data = this.safeDict(response, 'data', {});
1442
- tickers = this.safeList(data, 'tickers', []);
1485
+ tickers = this.safeList(data, 'symbols', []);
1443
1486
  }
1444
1487
  const result = {};
1445
1488
  for (let i = 0; i < tickers.length; i++) {
@@ -1462,6 +1505,7 @@ export default class bitmart extends Exchange {
1462
1505
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
1463
1506
  * @see https://developer-pro.bitmart.com/en/spot/#get-depth-v3
1464
1507
  * @see https://developer-pro.bitmart.com/en/futures/#get-market-depth
1508
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-market-depth
1465
1509
  * @param {string} symbol unified symbol of the market to fetch the order book for
1466
1510
  * @param {int} [limit] the maximum amount of order book entries to return
1467
1511
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1753,7 +1797,7 @@ export default class bitmart extends Exchange {
1753
1797
  * @name bitmart#fetchOHLCV
1754
1798
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1755
1799
  * @see https://developer-pro.bitmart.com/en/spot/#get-history-k-line-v3
1756
- * @see https://developer-pro.bitmart.com/en/futures/#get-k-line
1800
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-k-line
1757
1801
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1758
1802
  * @param {string} timeframe the length of time each candle represents
1759
1803
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -2050,6 +2094,7 @@ export default class bitmart extends Exchange {
2050
2094
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
2051
2095
  * @see https://developer-pro.bitmart.com/en/spot/#get-spot-wallet-balance
2052
2096
  * @see https://developer-pro.bitmart.com/en/futures/#get-contract-assets-detail
2097
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-contract-assets-keyed
2053
2098
  * @see https://developer-pro.bitmart.com/en/spot/#get-account-balance
2054
2099
  * @see https://developer-pro.bitmart.com/en/spot/#get-margin-account-details-isolated
2055
2100
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2419,6 +2464,8 @@ export default class bitmart extends Exchange {
2419
2464
  * @see https://developer-pro.bitmart.com/en/spot/#place-margin-order
2420
2465
  * @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
2421
2466
  * @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
2467
+ * @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
2468
+ * @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
2422
2469
  * @param {string} symbol unified symbol of the market to create an order in
2423
2470
  * @param {string} type 'market', 'limit' or 'trailing' for swap markets only
2424
2471
  * @param {string} side 'buy' or 'sell'
@@ -2667,9 +2714,11 @@ export default class bitmart extends Exchange {
2667
2714
  params = this.omit(params, 'clientOrderId');
2668
2715
  request['client_order_id'] = clientOrderId;
2669
2716
  }
2670
- const leverage = this.safeInteger(params, 'leverage', 1);
2717
+ const leverage = this.safeInteger(params, 'leverage');
2671
2718
  params = this.omit(params, ['timeInForce', 'postOnly', 'reduceOnly', 'leverage', 'trailingTriggerPrice', 'trailingPercent', 'triggerPrice', 'stopPrice']);
2672
- request['leverage'] = this.numberToString(leverage);
2719
+ if (leverage !== undefined) {
2720
+ request['leverage'] = this.numberToString(leverage);
2721
+ }
2673
2722
  return this.extend(request, params);
2674
2723
  }
2675
2724
  createSpotOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
@@ -2760,6 +2809,8 @@ export default class bitmart extends Exchange {
2760
2809
  * @see https://developer-pro.bitmart.com/en/spot/#cancel-order-v3-signed
2761
2810
  * @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
2762
2811
  * @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
2812
+ * @see https://developer-pro.bitmart.com/en/futures/#cancel-order-signed
2813
+ * @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
2763
2814
  * @param {string} id order id
2764
2815
  * @param {string} symbol unified symbol of the market the order was made in
2765
2816
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2912,6 +2963,7 @@ export default class bitmart extends Exchange {
2912
2963
  * @description cancel all open orders in a market
2913
2964
  * @see https://developer-pro.bitmart.com/en/spot/#cancel-all-orders
2914
2965
  * @see https://developer-pro.bitmart.com/en/futures/#cancel-all-orders-signed
2966
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#cancel-all-orders-signed
2915
2967
  * @param {string} symbol unified market symbol of the market to cancel orders in
2916
2968
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2917
2969
  * @param {string} [params.side] *spot only* 'buy' or 'sell'
@@ -3150,6 +3202,7 @@ export default class bitmart extends Exchange {
3150
3202
  * @name bitmart#fetchClosedOrders
3151
3203
  * @see https://developer-pro.bitmart.com/en/spot/#account-orders-v4-signed
3152
3204
  * @see https://developer-pro.bitmart.com/en/futures/#get-order-history-keyed
3205
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-order-history-keyed
3153
3206
  * @description fetches information on multiple closed orders made by the user
3154
3207
  * @param {string} symbol unified market symbol of the market orders were made in
3155
3208
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -3219,6 +3272,7 @@ export default class bitmart extends Exchange {
3219
3272
  * @see https://developer-pro.bitmart.com/en/spot/#query-order-by-id-v4-signed
3220
3273
  * @see https://developer-pro.bitmart.com/en/spot/#query-order-by-clientorderid-v4-signed
3221
3274
  * @see https://developer-pro.bitmart.com/en/futures/#get-order-detail-keyed
3275
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-order-detail-keyed
3222
3276
  * @param {string} id the id of the order
3223
3277
  * @param {string} symbol unified symbol of the market the order was made in
3224
3278
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -3952,6 +4006,7 @@ export default class bitmart extends Exchange {
3952
4006
  * @description transfer currency internally between wallets on the same account, currently only supports transfer between spot and margin
3953
4007
  * @see https://developer-pro.bitmart.com/en/spot/#margin-asset-transfer-signed
3954
4008
  * @see https://developer-pro.bitmart.com/en/futures/#transfer-signed
4009
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#transfer-signed
3955
4010
  * @param {string} code unified currency code
3956
4011
  * @param {float} amount amount to transfer
3957
4012
  * @param {string} fromAccount account to transfer from
@@ -4236,7 +4291,7 @@ export default class bitmart extends Exchange {
4236
4291
  * @method
4237
4292
  * @name bitmart#fetchOpenInterest
4238
4293
  * @description Retrieves the open interest of a currency
4239
- * @see https://developer-pro.bitmart.com/en/futures/#get-futures-openinterest
4294
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-futures-openinterest
4240
4295
  * @param {string} symbol Unified CCXT market symbol
4241
4296
  * @param {object} [params] exchange specific parameters
4242
4297
  * @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
@@ -4292,6 +4347,7 @@ export default class bitmart extends Exchange {
4292
4347
  * @name bitmart#setLeverage
4293
4348
  * @description set the level of leverage for a market
4294
4349
  * @see https://developer-pro.bitmart.com/en/futures/#submit-leverage-signed
4350
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#submit-leverage-signed
4295
4351
  * @param {float} leverage the rate of leverage
4296
4352
  * @param {string} symbol unified market symbol
4297
4353
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -4321,7 +4377,7 @@ export default class bitmart extends Exchange {
4321
4377
  * @method
4322
4378
  * @name bitmart#fetchFundingRate
4323
4379
  * @description fetch the current funding rate
4324
- * @see https://developer-pro.bitmart.com/en/futures/#get-current-funding-rate
4380
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-funding-rate
4325
4381
  * @param {string} symbol unified market symbol
4326
4382
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4327
4383
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
@@ -4388,6 +4444,7 @@ export default class bitmart extends Exchange {
4388
4444
  * @name bitmart#fetchPosition
4389
4445
  * @description fetch data on a single open contract trade position
4390
4446
  * @see https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
4447
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-risk-details-keyed
4391
4448
  * @param {string} symbol unified market symbol of the market the position is held in
4392
4449
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4393
4450
  * @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
@@ -4437,6 +4494,7 @@ export default class bitmart extends Exchange {
4437
4494
  * @name bitmart#fetchPositions
4438
4495
  * @description fetch all open contract positions
4439
4496
  * @see https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
4497
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-risk-details-keyed
4440
4498
  * @param {string[]|undefined} symbols list of unified market symbols
4441
4499
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4442
4500
  * @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
@@ -4663,7 +4721,11 @@ export default class bitmart extends Exchange {
4663
4721
  return this.milliseconds();
4664
4722
  }
4665
4723
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
4666
- const baseUrl = this.implodeHostname(this.urls['api']['rest']);
4724
+ const parts = path.split('/');
4725
+ // to do: refactor api endpoints with spot/swap sections
4726
+ const category = this.safeString(parts, 0, 'spot');
4727
+ const market = (category === 'spot' || category === 'account') ? 'spot' : 'swap';
4728
+ const baseUrl = this.implodeHostname(this.urls['api'][market]);
4667
4729
  let url = baseUrl + '/' + this.implodeParams(path, params);
4668
4730
  const query = this.omit(params, this.extractParams(path));
4669
4731
  let queryString = '';
package/js/src/bybit.js CHANGED
@@ -243,6 +243,7 @@ export default class bybit extends Exchange {
243
243
  },
244
244
  'private': {
245
245
  'get': {
246
+ 'v5/market/instruments-info': 5,
246
247
  // Legacy inverse swap
247
248
  'v2/private/wallet/fund/records': 25,
248
249
  // spot
@@ -988,6 +989,7 @@ export default class bybit extends Exchange {
988
989
  },
989
990
  'precisionMode': TICK_SIZE,
990
991
  'options': {
992
+ 'usePrivateInstrumentsInfo': false,
991
993
  'sandboxMode': false,
992
994
  'enableDemoTrading': false,
993
995
  'fetchMarkets': ['spot', 'linear', 'inverse', 'option'],
@@ -1482,7 +1484,14 @@ export default class bybit extends Exchange {
1482
1484
  const request = {
1483
1485
  'category': 'spot',
1484
1486
  };
1485
- const response = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1487
+ const usePrivateInstrumentsInfo = this.safeBool(this.options, 'usePrivateInstrumentsInfo', false);
1488
+ let response = undefined;
1489
+ if (usePrivateInstrumentsInfo) {
1490
+ response = await this.privateGetV5MarketInstrumentsInfo(this.extend(request, params));
1491
+ }
1492
+ else {
1493
+ response = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1494
+ }
1486
1495
  //
1487
1496
  // {
1488
1497
  // "retCode": 0,
@@ -1592,14 +1601,27 @@ export default class bybit extends Exchange {
1592
1601
  async fetchFutureMarkets(params) {
1593
1602
  params = this.extend(params);
1594
1603
  params['limit'] = 1000; // minimize number of requests
1595
- const response = await this.publicGetV5MarketInstrumentsInfo(params);
1604
+ const usePrivateInstrumentsInfo = this.safeBool(this.options, 'usePrivateInstrumentsInfo', false);
1605
+ let response = undefined;
1606
+ if (usePrivateInstrumentsInfo) {
1607
+ response = await this.privateGetV5MarketInstrumentsInfo(params);
1608
+ }
1609
+ else {
1610
+ response = await this.publicGetV5MarketInstrumentsInfo(params);
1611
+ }
1596
1612
  const data = this.safeDict(response, 'result', {});
1597
1613
  let markets = this.safeList(data, 'list', []);
1598
1614
  let paginationCursor = this.safeString(data, 'nextPageCursor');
1599
1615
  if (paginationCursor !== undefined) {
1600
1616
  while (paginationCursor !== undefined) {
1601
1617
  params['cursor'] = paginationCursor;
1602
- const responseInner = await this.publicGetV5MarketInstrumentsInfo(params);
1618
+ let responseInner = undefined;
1619
+ if (usePrivateInstrumentsInfo) {
1620
+ responseInner = await this.privateGetV5MarketInstrumentsInfo(params);
1621
+ }
1622
+ else {
1623
+ responseInner = await this.publicGetV5MarketInstrumentsInfo(params);
1624
+ }
1603
1625
  const dataNew = this.safeDict(responseInner, 'result', {});
1604
1626
  const rawMarkets = this.safeList(dataNew, 'list', []);
1605
1627
  const rawMarketsLength = rawMarkets.length;
@@ -1768,7 +1790,14 @@ export default class bybit extends Exchange {
1768
1790
  const request = {
1769
1791
  'category': 'option',
1770
1792
  };
1771
- const response = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1793
+ const usePrivateInstrumentsInfo = this.safeBool(this.options, 'usePrivateInstrumentsInfo', false);
1794
+ let response = undefined;
1795
+ if (usePrivateInstrumentsInfo) {
1796
+ response = await this.privateGetV5MarketInstrumentsInfo(this.extend(request, params));
1797
+ }
1798
+ else {
1799
+ response = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1800
+ }
1772
1801
  const data = this.safeDict(response, 'result', {});
1773
1802
  let markets = this.safeList(data, 'list', []);
1774
1803
  if (this.options['loadAllOptions']) {
@@ -1777,7 +1806,13 @@ export default class bybit extends Exchange {
1777
1806
  if (paginationCursor !== undefined) {
1778
1807
  while (paginationCursor !== undefined) {
1779
1808
  request['cursor'] = paginationCursor;
1780
- const responseInner = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1809
+ let responseInner = undefined;
1810
+ if (usePrivateInstrumentsInfo) {
1811
+ responseInner = await this.privateGetV5MarketInstrumentsInfo(this.extend(request, params));
1812
+ }
1813
+ else {
1814
+ responseInner = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1815
+ }
1781
1816
  const dataNew = this.safeDict(responseInner, 'result', {});
1782
1817
  const rawMarkets = this.safeList(dataNew, 'list', []);
1783
1818
  const rawMarketsLength = rawMarkets.length;
@@ -270,8 +270,8 @@ export default class coinbase extends Exchange {
270
270
  },
271
271
  'fees': {
272
272
  'trading': {
273
- 'taker': this.parseNumber('0.006'),
274
- 'maker': this.parseNumber('0.004'),
273
+ 'taker': this.parseNumber('0.012'),
274
+ 'maker': this.parseNumber('0.006'),
275
275
  'tierBased': true,
276
276
  'percentage': true,
277
277
  'tiers': {
@@ -1376,6 +1376,10 @@ export default class coinbase extends Exchange {
1376
1376
  const marketType = this.safeStringLower(market, 'product_type');
1377
1377
  const tradingDisabled = this.safeBool(market, 'trading_disabled');
1378
1378
  const stablePairs = this.safeList(this.options, 'stablePairs', []);
1379
+ const defaultTakerFee = this.safeNumber(this.fees['trading'], 'taker');
1380
+ const defaultMakerFee = this.safeNumber(this.fees['trading'], 'maker');
1381
+ const takerFee = this.inArray(id, stablePairs) ? 0.00001 : this.safeNumber(feeTier, 'taker_fee_rate', defaultTakerFee);
1382
+ const makerFee = this.inArray(id, stablePairs) ? 0.0 : this.safeNumber(feeTier, 'maker_fee_rate', defaultMakerFee);
1379
1383
  return this.safeMarketStructure({
1380
1384
  'id': id,
1381
1385
  'symbol': base + '/' + quote,
@@ -1395,8 +1399,8 @@ export default class coinbase extends Exchange {
1395
1399
  'contract': false,
1396
1400
  'linear': undefined,
1397
1401
  'inverse': undefined,
1398
- 'taker': this.inArray(id, stablePairs) ? 0.00001 : this.safeNumber(feeTier, 'taker_fee_rate'),
1399
- 'maker': this.inArray(id, stablePairs) ? 0.0 : this.safeNumber(feeTier, 'maker_fee_rate'),
1402
+ 'taker': takerFee,
1403
+ 'maker': makerFee,
1400
1404
  'contractSize': undefined,
1401
1405
  'expiry': undefined,
1402
1406
  'expiryDatetime': undefined,
package/js/src/gemini.js CHANGED
@@ -188,6 +188,7 @@ export default class gemini extends Exchange {
188
188
  'v1/account/create': 1,
189
189
  'v1/account/list': 1,
190
190
  'v1/heartbeat': 1,
191
+ 'v1/roles': 1,
191
192
  },
192
193
  },
193
194
  },
package/js/src/htx.js CHANGED
@@ -6296,6 +6296,7 @@ export default class htx extends Exchange {
6296
6296
  async fetchDepositAddressesByNetwork(code, params = {}) {
6297
6297
  /**
6298
6298
  * @method
6299
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=7ec50029-7773-11ed-9966-0242ac110003
6299
6300
  * @name huobi#fetchDepositAddressesByNetwork
6300
6301
  * @description fetch a dictionary of addresses for a currency, indexed by network
6301
6302
  * @param {string} code unified currency code of the currency for the deposit address
@@ -6329,6 +6330,7 @@ export default class htx extends Exchange {
6329
6330
  /**
6330
6331
  * @method
6331
6332
  * @name huobi#fetchDepositAddress
6333
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=7ec50029-7773-11ed-9966-0242ac110003
6332
6334
  * @description fetch the deposit address for a currency associated with this account
6333
6335
  * @param {string} code unified currency code
6334
6336
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -6379,6 +6381,7 @@ export default class htx extends Exchange {
6379
6381
  /**
6380
6382
  * @method
6381
6383
  * @name huobi#fetchDeposits
6384
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=7ec4f050-7773-11ed-9966-0242ac110003
6382
6385
  * @description fetch all deposits made to an account
6383
6386
  * @param {string} code unified currency code
6384
6387
  * @param {int} [since] the earliest time in ms to fetch deposits for
@@ -6613,6 +6616,7 @@ export default class htx extends Exchange {
6613
6616
  /**
6614
6617
  * @method
6615
6618
  * @name huobi#withdraw
6619
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=7ec4cc41-7773-11ed-9966-0242ac110003
6616
6620
  * @description make a withdrawal
6617
6621
  * @param {string} code unified currency code
6618
6622
  * @param {float} amount the amount to withdraw
package/js/src/mexc.js CHANGED
@@ -5239,7 +5239,7 @@ export default class mexc extends Exchange {
5239
5239
  const networks = this.safeDict(this.options, 'networks', {});
5240
5240
  let network = this.safeString2(params, 'network', 'netWork'); // this line allows the user to specify either ERC20 or ETH
5241
5241
  network = this.safeString(networks, network, network); // handle ETH > ERC-20 alias
5242
- network = this.networkCodeToId(network);
5242
+ network = this.networkIdToCode(network);
5243
5243
  this.checkAddress(address);
5244
5244
  await this.loadMarkets();
5245
5245
  const currency = this.currency(code);