ccxt 4.3.75 → 4.3.77

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,9 @@ 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
2469
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
2422
2470
  * @param {string} symbol unified symbol of the market to create an order in
2423
2471
  * @param {string} type 'market', 'limit' or 'trailing' for swap markets only
2424
2472
  * @param {string} side 'buy' or 'sell'
@@ -2667,9 +2715,14 @@ export default class bitmart extends Exchange {
2667
2715
  params = this.omit(params, 'clientOrderId');
2668
2716
  request['client_order_id'] = clientOrderId;
2669
2717
  }
2670
- const leverage = this.safeInteger(params, 'leverage', 1);
2718
+ const leverage = this.safeInteger(params, 'leverage');
2671
2719
  params = this.omit(params, ['timeInForce', 'postOnly', 'reduceOnly', 'leverage', 'trailingTriggerPrice', 'trailingPercent', 'triggerPrice', 'stopPrice']);
2672
- request['leverage'] = this.numberToString(leverage);
2720
+ if (leverage !== undefined) {
2721
+ request['leverage'] = this.numberToString(leverage);
2722
+ }
2723
+ else if (isTriggerOrder) {
2724
+ request['leverage'] = '1'; // for plan orders leverage is required, if not available default to 1
2725
+ }
2673
2726
  return this.extend(request, params);
2674
2727
  }
2675
2728
  createSpotOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
@@ -2760,6 +2813,8 @@ export default class bitmart extends Exchange {
2760
2813
  * @see https://developer-pro.bitmart.com/en/spot/#cancel-order-v3-signed
2761
2814
  * @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
2762
2815
  * @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
2816
+ * @see https://developer-pro.bitmart.com/en/futures/#cancel-order-signed
2817
+ * @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
2763
2818
  * @param {string} id order id
2764
2819
  * @param {string} symbol unified symbol of the market the order was made in
2765
2820
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2912,6 +2967,7 @@ export default class bitmart extends Exchange {
2912
2967
  * @description cancel all open orders in a market
2913
2968
  * @see https://developer-pro.bitmart.com/en/spot/#cancel-all-orders
2914
2969
  * @see https://developer-pro.bitmart.com/en/futures/#cancel-all-orders-signed
2970
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#cancel-all-orders-signed
2915
2971
  * @param {string} symbol unified market symbol of the market to cancel orders in
2916
2972
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2917
2973
  * @param {string} [params.side] *spot only* 'buy' or 'sell'
@@ -3150,6 +3206,7 @@ export default class bitmart extends Exchange {
3150
3206
  * @name bitmart#fetchClosedOrders
3151
3207
  * @see https://developer-pro.bitmart.com/en/spot/#account-orders-v4-signed
3152
3208
  * @see https://developer-pro.bitmart.com/en/futures/#get-order-history-keyed
3209
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-order-history-keyed
3153
3210
  * @description fetches information on multiple closed orders made by the user
3154
3211
  * @param {string} symbol unified market symbol of the market orders were made in
3155
3212
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -3219,6 +3276,7 @@ export default class bitmart extends Exchange {
3219
3276
  * @see https://developer-pro.bitmart.com/en/spot/#query-order-by-id-v4-signed
3220
3277
  * @see https://developer-pro.bitmart.com/en/spot/#query-order-by-clientorderid-v4-signed
3221
3278
  * @see https://developer-pro.bitmart.com/en/futures/#get-order-detail-keyed
3279
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-order-detail-keyed
3222
3280
  * @param {string} id the id of the order
3223
3281
  * @param {string} symbol unified symbol of the market the order was made in
3224
3282
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -3952,6 +4010,7 @@ export default class bitmart extends Exchange {
3952
4010
  * @description transfer currency internally between wallets on the same account, currently only supports transfer between spot and margin
3953
4011
  * @see https://developer-pro.bitmart.com/en/spot/#margin-asset-transfer-signed
3954
4012
  * @see https://developer-pro.bitmart.com/en/futures/#transfer-signed
4013
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#transfer-signed
3955
4014
  * @param {string} code unified currency code
3956
4015
  * @param {float} amount amount to transfer
3957
4016
  * @param {string} fromAccount account to transfer from
@@ -4236,7 +4295,7 @@ export default class bitmart extends Exchange {
4236
4295
  * @method
4237
4296
  * @name bitmart#fetchOpenInterest
4238
4297
  * @description Retrieves the open interest of a currency
4239
- * @see https://developer-pro.bitmart.com/en/futures/#get-futures-openinterest
4298
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-futures-openinterest
4240
4299
  * @param {string} symbol Unified CCXT market symbol
4241
4300
  * @param {object} [params] exchange specific parameters
4242
4301
  * @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
@@ -4292,6 +4351,7 @@ export default class bitmart extends Exchange {
4292
4351
  * @name bitmart#setLeverage
4293
4352
  * @description set the level of leverage for a market
4294
4353
  * @see https://developer-pro.bitmart.com/en/futures/#submit-leverage-signed
4354
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#submit-leverage-signed
4295
4355
  * @param {float} leverage the rate of leverage
4296
4356
  * @param {string} symbol unified market symbol
4297
4357
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -4321,7 +4381,7 @@ export default class bitmart extends Exchange {
4321
4381
  * @method
4322
4382
  * @name bitmart#fetchFundingRate
4323
4383
  * @description fetch the current funding rate
4324
- * @see https://developer-pro.bitmart.com/en/futures/#get-current-funding-rate
4384
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-funding-rate
4325
4385
  * @param {string} symbol unified market symbol
4326
4386
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4327
4387
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
@@ -4388,6 +4448,7 @@ export default class bitmart extends Exchange {
4388
4448
  * @name bitmart#fetchPosition
4389
4449
  * @description fetch data on a single open contract trade position
4390
4450
  * @see https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
4451
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-risk-details-keyed
4391
4452
  * @param {string} symbol unified market symbol of the market the position is held in
4392
4453
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4393
4454
  * @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
@@ -4437,6 +4498,7 @@ export default class bitmart extends Exchange {
4437
4498
  * @name bitmart#fetchPositions
4438
4499
  * @description fetch all open contract positions
4439
4500
  * @see https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
4501
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-risk-details-keyed
4440
4502
  * @param {string[]|undefined} symbols list of unified market symbols
4441
4503
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4442
4504
  * @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
@@ -4663,7 +4725,11 @@ export default class bitmart extends Exchange {
4663
4725
  return this.milliseconds();
4664
4726
  }
4665
4727
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
4666
- const baseUrl = this.implodeHostname(this.urls['api']['rest']);
4728
+ const parts = path.split('/');
4729
+ // to do: refactor api endpoints with spot/swap sections
4730
+ const category = this.safeString(parts, 0, 'spot');
4731
+ const market = (category === 'spot' || category === 'account') ? 'spot' : 'swap';
4732
+ const baseUrl = this.implodeHostname(this.urls['api'][market]);
4667
4733
  let url = baseUrl + '/' + this.implodeParams(path, params);
4668
4734
  const query = this.omit(params, this.extractParams(path));
4669
4735
  let queryString = '';
package/js/src/bybit.js CHANGED
@@ -3789,7 +3789,12 @@ export default class bybit extends Exchange {
3789
3789
  }
3790
3790
  else {
3791
3791
  if (!isTrailingAmountOrder && !isAlternativeEndpoint) {
3792
- request['qty'] = this.amountToPrecision(symbol, amount);
3792
+ if (market['option']) {
3793
+ request['qty'] = this.numberToString(amount);
3794
+ }
3795
+ else {
3796
+ request['qty'] = this.amountToPrecision(symbol, amount);
3797
+ }
3793
3798
  }
3794
3799
  }
3795
3800
  if (isTrailingAmountOrder) {
@@ -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/kraken.js CHANGED
@@ -1853,6 +1853,9 @@ export default class kraken extends Exchange {
1853
1853
  const extendedPostFlags = (flags !== undefined) ? flags + ',post' : 'post';
1854
1854
  request['oflags'] = extendedPostFlags;
1855
1855
  }
1856
+ if ((flags !== undefined) && (request['oflags'] === undefined)) {
1857
+ request['oflags'] = flags;
1858
+ }
1856
1859
  params = this.omit(params, ['timeInForce', 'reduceOnly', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingLimitAmount', 'offset']);
1857
1860
  return [request, params];
1858
1861
  }
@@ -538,6 +538,12 @@ export default class binance extends binanceRest {
538
538
  /**
539
539
  * @method
540
540
  * @name binance#watchOrderBook
541
+ * @see https://binance-docs.github.io/apidocs/spot/en/#partial-book-depth-streams
542
+ * @see https://binance-docs.github.io/apidocs/spot/en/#diff-depth-stream
543
+ * @see https://binance-docs.github.io/apidocs/futures/en/#partial-book-depth-streams
544
+ * @see https://binance-docs.github.io/apidocs/futures/en/#diff-book-depth-streams
545
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#partial-book-depth-streams
546
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#diff-book-depth-streams
541
547
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
542
548
  * @param {string} symbol unified symbol of the market to fetch the order book for
543
549
  * @param {int} [limit] the maximum amount of order book entries to return
@@ -587,6 +593,12 @@ export default class binance extends binanceRest {
587
593
  /**
588
594
  * @method
589
595
  * @name binance#watchOrderBookForSymbols
596
+ * @see https://binance-docs.github.io/apidocs/spot/en/#partial-book-depth-streams
597
+ * @see https://binance-docs.github.io/apidocs/spot/en/#diff-depth-stream
598
+ * @see https://binance-docs.github.io/apidocs/futures/en/#partial-book-depth-streams
599
+ * @see https://binance-docs.github.io/apidocs/futures/en/#diff-book-depth-streams
600
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#partial-book-depth-streams
601
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#diff-book-depth-streams
590
602
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
591
603
  * @param {string[]} symbols unified array of symbols
592
604
  * @param {int} [limit] the maximum amount of order book entries to return
@@ -1479,6 +1491,12 @@ export default class binance extends binanceRest {
1479
1491
  /**
1480
1492
  * @method
1481
1493
  * @name binance#watchTicker
1494
+ * @see https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-mini-ticker-stream
1495
+ * @see https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-ticker-streams
1496
+ * @see https://binance-docs.github.io/apidocs/futures/en/#all-market-mini-tickers-stream
1497
+ * @see https://binance-docs.github.io/apidocs/futures/en/#individual-symbol-ticker-streams
1498
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#all-market-mini-tickers-stream
1499
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#individual-symbol-ticker-streams
1482
1500
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
1483
1501
  * @param {string} symbol unified symbol of the market to fetch the ticker for
1484
1502
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1494,6 +1512,12 @@ export default class binance extends binanceRest {
1494
1512
  /**
1495
1513
  * @method
1496
1514
  * @name binance#watchTickers
1515
+ * @see https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-mini-ticker-stream
1516
+ * @see https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-ticker-streams
1517
+ * @see https://binance-docs.github.io/apidocs/futures/en/#all-market-mini-tickers-stream
1518
+ * @see https://binance-docs.github.io/apidocs/futures/en/#individual-symbol-ticker-streams
1519
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#all-market-mini-tickers-stream
1520
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#individual-symbol-ticker-streams
1497
1521
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
1498
1522
  * @param {string[]} symbols unified symbol of the market to fetch the ticker for
1499
1523
  * @param {object} [params] extra parameters specific to the exchange API endpoint