ccxt 4.4.17 → 4.4.18

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.4.17';
197
+ const version = '4.4.18';
198
198
  Exchange["default"].ccxtVersion = version;
199
199
  const exchanges = {
200
200
  'ace': ace,
@@ -606,10 +606,11 @@ class bingx extends bingx$1 {
606
606
  'max': this.safeNumber(rawNetwork, 'withdrawMax'),
607
607
  },
608
608
  };
609
+ fee = this.safeNumber(rawNetwork, 'withdrawFee');
609
610
  if (isDefault) {
610
- fee = this.safeNumber(rawNetwork, 'withdrawFee');
611
611
  defaultLimits = limits;
612
612
  }
613
+ const precision = this.safeNumber(rawNetwork, 'withdrawPrecision');
613
614
  const networkActive = networkDepositEnabled || networkWithdrawEnabled;
614
615
  networks[networkCode] = {
615
616
  'info': rawNetwork,
@@ -619,7 +620,7 @@ class bingx extends bingx$1 {
619
620
  'active': networkActive,
620
621
  'deposit': networkDepositEnabled,
621
622
  'withdraw': networkWithdrawEnabled,
622
- 'precision': undefined,
623
+ 'precision': precision,
623
624
  'limits': limits,
624
625
  };
625
626
  }
@@ -1294,7 +1294,7 @@ class bitmart extends bitmart$1 {
1294
1294
  'close': last,
1295
1295
  'last': last,
1296
1296
  'previousClose': undefined,
1297
- 'change': change,
1297
+ 'change': undefined,
1298
1298
  'percentage': percentage,
1299
1299
  'average': average,
1300
1300
  'baseVolume': baseVolume,
@@ -116,6 +116,12 @@ class bitso extends bitso$1 {
116
116
  'TUSD': 0.01,
117
117
  },
118
118
  'defaultPrecision': 0.00000001,
119
+ 'networks': {
120
+ 'TRC20': 'trx',
121
+ 'ERC20': 'erc20',
122
+ 'BEP20': 'bsc',
123
+ 'BEP2': 'bep2',
124
+ },
119
125
  },
120
126
  'timeframes': {
121
127
  '1m': '60',
@@ -1633,19 +1639,6 @@ class bitso extends bitso$1 {
1633
1639
  const first = this.safeDict(payload, 0);
1634
1640
  return this.parseTransaction(first, currency);
1635
1641
  }
1636
- safeNetwork(networkId) {
1637
- if (networkId === undefined) {
1638
- return undefined;
1639
- }
1640
- networkId = networkId.toUpperCase();
1641
- const networksById = {
1642
- 'trx': 'TRC20',
1643
- 'erc20': 'ERC20',
1644
- 'bsc': 'BEP20',
1645
- 'bep2': 'BEP2',
1646
- };
1647
- return this.safeString(networksById, networkId, networkId);
1648
- }
1649
1642
  parseTransaction(transaction, currency = undefined) {
1650
1643
  //
1651
1644
  // deposit
@@ -1692,12 +1685,14 @@ class bitso extends bitso$1 {
1692
1685
  const networkId = this.safeString2(transaction, 'network', 'method');
1693
1686
  const status = this.safeString(transaction, 'status');
1694
1687
  const withdrawId = this.safeString(transaction, 'wid');
1688
+ const networkCode = this.networkIdToCode(networkId);
1689
+ const networkCodeUpper = (networkCode !== undefined) ? networkCode.toUpperCase() : undefined;
1695
1690
  return {
1696
1691
  'id': this.safeString2(transaction, 'wid', 'fid'),
1697
1692
  'txid': this.safeString(details, 'tx_hash'),
1698
1693
  'timestamp': this.parse8601(datetime),
1699
1694
  'datetime': datetime,
1700
- 'network': this.safeNetwork(networkId),
1695
+ 'network': networkCodeUpper,
1701
1696
  'addressFrom': receivingAddress,
1702
1697
  'address': (withdrawalAddress !== undefined) ? withdrawalAddress : receivingAddress,
1703
1698
  'addressTo': withdrawalAddress,
@@ -3685,32 +3685,61 @@ class gate extends gate$1 {
3685
3685
  }
3686
3686
  parseTransaction(transaction, currency = undefined) {
3687
3687
  //
3688
- // deposits
3688
+ // fetchDeposits
3689
3689
  //
3690
- // {
3691
- // "id": "d33361395",
3692
- // "currency": "USDT_TRX",
3693
- // "address": "TErdnxenuLtXfnMafLbfappYdHtnXQ5U4z",
3694
- // "amount": "100",
3695
- // "txid": "ae9374de34e558562fe18cbb1bf9ab4d9eb8aa7669d65541c9fa2a532c1474a0",
3696
- // "timestamp": "1626345819",
3697
- // "status": "DONE",
3698
- // "memo": ""
3699
- // }
3690
+ // {
3691
+ // "id": "d33361395",
3692
+ // "currency": "USDT_TRX",
3693
+ // "address": "TErdnxenuLtXfnMafLbfappYdHtnXQ5U4z",
3694
+ // "amount": "100",
3695
+ // "txid": "ae9374de34e558562fe18cbb1bf9ab4d9eb8aa7669d65541c9fa2a532c1474a0",
3696
+ // "timestamp": "1626345819",
3697
+ // "status": "DONE",
3698
+ // "memo": ""
3699
+ // }
3700
3700
  //
3701
3701
  // withdraw
3702
3702
  //
3703
- // {
3704
- // "id": "w13389675",
3705
- // "currency": "USDT",
3706
- // "amount": "50",
3707
- // "address": "TUu2rLFrmzUodiWfYki7QCNtv1akL682p1",
3708
- // "memo": null
3709
- // }
3703
+ // {
3704
+ // "id":"w64413318",
3705
+ // "currency":"usdt",
3706
+ // "amount":"10150",
3707
+ // "address":"0x0ab891497116f7f5532a4c2f4f7b1784488628e1",
3708
+ // "memo":null,
3709
+ // "status":"REQUEST",
3710
+ // "chain":"eth",
3711
+ // "withdraw_order_id":"",
3712
+ // "fee_amount":"4.15000000"
3713
+ // }
3714
+ //
3715
+ // fetchWithdrawals
3716
+ //
3717
+ // {
3718
+ // "id": "210496",
3719
+ // "timestamp": "1542000000",
3720
+ // "withdraw_order_id": "order_123456",
3721
+ // "currency": "USDT",
3722
+ // "address": "1HkxtBAMrA3tP5ENnYY2CZortjZvFDH5Cs",
3723
+ // "txid": "128988928203223323290",
3724
+ // "block_number": "41575382",
3725
+ // "amount": "222.61",
3726
+ // "fee": "0.01",
3727
+ // "memo": "",
3728
+ // "status": "DONE",
3729
+ // "chain": "TRX"
3730
+ // }
3731
+ //
3732
+ // {
3733
+ // "id": "w13389675",
3734
+ // "currency": "USDT",
3735
+ // "amount": "50",
3736
+ // "address": "TUu2rLFrmzUodiWfYki7QCNtv1akL682p1",
3737
+ // "memo": null
3738
+ // }
3710
3739
  //
3711
3740
  // {
3712
3741
  // "currency":"usdt",
3713
- // "address":"0x01b0A9b7b4CdE774AF0f3E47CB4f1c2CCdBa0806",
3742
+ // "address":"0x01c0A9b7b4CdE774AF0f3E47CB4f1c2CCdBa0806",
3714
3743
  // "amount":"1880",
3715
3744
  // "chain":"eth"
3716
3745
  // }
@@ -3728,7 +3757,7 @@ class gate extends gate$1 {
3728
3757
  type = this.parseTransactionType(id[0]);
3729
3758
  }
3730
3759
  }
3731
- const feeCostString = this.safeString(transaction, 'fee');
3760
+ const feeCostString = this.safeString2(transaction, 'fee', 'fee_amount');
3732
3761
  if (type === 'withdrawal') {
3733
3762
  amountString = Precise["default"].stringSub(amountString, feeCostString);
3734
3763
  }
@@ -6471,6 +6471,7 @@ class htx extends htx$1 {
6471
6471
  * @method
6472
6472
  * @name htx#fetchWithdrawals
6473
6473
  * @description fetch all withdrawals made from an account
6474
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#search-for-existed-withdraws-and-deposits
6474
6475
  * @param {string} code unified currency code
6475
6476
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
6476
6477
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -6826,6 +6827,7 @@ class htx extends htx$1 {
6826
6827
  * @method
6827
6828
  * @name htx#fetchIsolatedBorrowRates
6828
6829
  * @description fetch the borrow interest rates of all currencies
6830
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-loan-interest-rate-and-quota-isolated
6829
6831
  * @param {object} [params] extra parameters specific to the exchange API endpoint
6830
6832
  * @returns {object} a list of [isolated borrow rate structures]{@link https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure}
6831
6833
  */
@@ -7046,6 +7048,8 @@ class htx extends htx$1 {
7046
7048
  * @method
7047
7049
  * @name htx#fetchFundingRate
7048
7050
  * @description fetch the current funding rate
7051
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-funding-rate
7052
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-funding-rate
7049
7053
  * @param {string} symbol unified market symbol
7050
7054
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7051
7055
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
@@ -7088,6 +7092,8 @@ class htx extends htx$1 {
7088
7092
  * @method
7089
7093
  * @name htx#fetchFundingRates
7090
7094
  * @description fetch the funding rate for multiple markets
7095
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-a-batch-of-funding-rate
7096
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-a-batch-of-funding-rate
7091
7097
  * @param {string[]|undefined} symbols list of unified market symbols
7092
7098
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7093
7099
  * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols
@@ -39,6 +39,7 @@ class kucoinfutures extends kucoinfutures$1 {
39
39
  'createDepositAddress': true,
40
40
  'createOrder': true,
41
41
  'createOrders': true,
42
+ 'createOrderWithTakeProfitAndStopLoss': true,
42
43
  'createReduceOnlyOrder': true,
43
44
  'createStopLimitOrder': true,
44
45
  'createStopLossOrder': true,
@@ -241,7 +242,8 @@ class kucoinfutures extends kucoinfutures$1 {
241
242
  '404000': errors.NotSupported,
242
243
  '400100': errors.BadRequest,
243
244
  '411100': errors.AccountSuspended,
244
- '500000': errors.ExchangeNotAvailable, // Internal Server Error -- We had a problem with our server. Try again later.
245
+ '500000': errors.ExchangeNotAvailable,
246
+ '300009': errors.InvalidOrder, // {"msg":"No open positions to close.","code":"300009"}
245
247
  },
246
248
  'broad': {
247
249
  'Position does not exist': errors.OrderNotFound, // { "code":"200000", "msg":"Position does not exist" }
@@ -1422,12 +1424,15 @@ class kucoinfutures extends kucoinfutures$1 {
1422
1424
  * @name kucoinfutures#createOrder
1423
1425
  * @description Create an order on the exchange
1424
1426
  * @see https://docs.kucoin.com/futures/#place-an-order
1427
+ * @see https://www.kucoin.com/docs/rest/futures-trading/orders/place-take-profit-and-stop-loss-order#http-request
1425
1428
  * @param {string} symbol Unified CCXT market symbol
1426
1429
  * @param {string} type 'limit' or 'market'
1427
1430
  * @param {string} side 'buy' or 'sell'
1428
1431
  * @param {float} amount the amount of currency to trade
1429
1432
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1430
1433
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1434
+ * @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered
1435
+ * @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
1431
1436
  * @param {float} [params.triggerPrice] The price a trigger order is triggered at
1432
1437
  * @param {float} [params.stopLossPrice] price to trigger stop-loss orders
1433
1438
  * @param {float} [params.takeProfitPrice] price to trigger take-profit orders
@@ -1449,13 +1454,19 @@ class kucoinfutures extends kucoinfutures$1 {
1449
1454
  const market = this.market(symbol);
1450
1455
  const testOrder = this.safeBool(params, 'test', false);
1451
1456
  params = this.omit(params, 'test');
1457
+ const isTpAndSlOrder = (this.safeValue(params, 'stopLoss') !== undefined) || (this.safeValue(params, 'takeProfit') !== undefined);
1452
1458
  const orderRequest = this.createContractOrderRequest(symbol, type, side, amount, price, params);
1453
1459
  let response = undefined;
1454
1460
  if (testOrder) {
1455
1461
  response = await this.futuresPrivatePostOrdersTest(orderRequest);
1456
1462
  }
1457
1463
  else {
1458
- response = await this.futuresPrivatePostOrders(orderRequest);
1464
+ if (isTpAndSlOrder) {
1465
+ response = await this.futuresPrivatePostStOrders(orderRequest);
1466
+ }
1467
+ else {
1468
+ response = await this.futuresPrivatePostOrders(orderRequest);
1469
+ }
1459
1470
  }
1460
1471
  //
1461
1472
  // {
@@ -1535,6 +1546,9 @@ class kucoinfutures extends kucoinfutures$1 {
1535
1546
  'leverage': 1,
1536
1547
  };
1537
1548
  const [triggerPrice, stopLossPrice, takeProfitPrice] = this.handleTriggerPrices(params);
1549
+ const stopLoss = this.safeDict(params, 'stopLoss');
1550
+ const takeProfit = this.safeDict(params, 'takeProfit');
1551
+ // const isTpAndSl = stopLossPrice && takeProfitPrice;
1538
1552
  const triggerPriceTypes = {
1539
1553
  'mark': 'MP',
1540
1554
  'last': 'TP',
@@ -1542,12 +1556,26 @@ class kucoinfutures extends kucoinfutures$1 {
1542
1556
  };
1543
1557
  const triggerPriceType = this.safeString(params, 'triggerPriceType', 'mark');
1544
1558
  const triggerPriceTypeValue = this.safeString(triggerPriceTypes, triggerPriceType, triggerPriceType);
1545
- params = this.omit(params, ['stopLossPrice', 'takeProfitPrice', 'triggerPrice', 'stopPrice']);
1559
+ params = this.omit(params, ['stopLossPrice', 'takeProfitPrice', 'triggerPrice', 'stopPrice', 'takeProfit', 'stopLoss']);
1546
1560
  if (triggerPrice) {
1547
1561
  request['stop'] = (side === 'buy') ? 'up' : 'down';
1548
1562
  request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
1549
1563
  request['stopPriceType'] = triggerPriceTypeValue;
1550
1564
  }
1565
+ else if (stopLoss !== undefined || takeProfit !== undefined) {
1566
+ let priceType = triggerPriceTypeValue;
1567
+ if (stopLoss !== undefined) {
1568
+ const slPrice = this.safeString2(stopLoss, 'triggerPrice', 'stopPrice');
1569
+ request['triggerStopDownPrice'] = this.priceToPrecision(symbol, slPrice);
1570
+ priceType = this.safeString(stopLoss, 'triggerPriceType', triggerPriceTypeValue);
1571
+ }
1572
+ if (takeProfit !== undefined) {
1573
+ const tpPrice = this.safeString2(takeProfit, 'triggerPrice', 'takeProfitPrice');
1574
+ request['triggerStopUpPrice'] = this.priceToPrecision(symbol, tpPrice);
1575
+ priceType = this.safeString(stopLoss, 'triggerPriceType', triggerPriceTypeValue);
1576
+ }
1577
+ request['stopPriceType'] = priceType;
1578
+ }
1551
1579
  else if (stopLossPrice || takeProfitPrice) {
1552
1580
  if (stopLossPrice) {
1553
1581
  request['stop'] = (side === 'buy') ? 'up' : 'down';
@@ -2272,8 +2272,12 @@ class mexc extends mexc$1 {
2272
2272
  const order = this.parseOrder(response, market);
2273
2273
  order['side'] = side;
2274
2274
  order['type'] = type;
2275
- order['price'] = price;
2276
- order['amount'] = amount;
2275
+ if (this.safeString(order, 'price') === undefined) {
2276
+ order['price'] = price;
2277
+ }
2278
+ if (this.safeString(order, 'amount') === undefined) {
2279
+ order['amount'] = amount;
2280
+ }
2277
2281
  return order;
2278
2282
  }
2279
2283
  async createSwapOrder(market, type, side, amount, price = undefined, marginMode = undefined, params = {}) {
@@ -7318,6 +7318,7 @@ class okx extends okx$1 {
7318
7318
  // "instType": "OPTION",
7319
7319
  // "oi": "300",
7320
7320
  // "oiCcy": "3",
7321
+ // "oiUsd": "3",
7321
7322
  // "ts": "1684551166251"
7322
7323
  // }
7323
7324
  //
@@ -7343,7 +7344,7 @@ class okx extends okx$1 {
7343
7344
  else {
7344
7345
  baseVolume = this.safeNumber(interest, 'oiCcy');
7345
7346
  openInterestAmount = this.safeNumber(interest, 'oi');
7346
- openInterestValue = this.safeNumber(interest, 'oiCcy');
7347
+ openInterestValue = this.safeNumber(interest, 'oiUsd');
7347
7348
  }
7348
7349
  return this.safeOpenInterest({
7349
7350
  'symbol': this.safeSymbol(id),
@@ -1140,7 +1140,7 @@ class bitget extends bitget$1 {
1140
1140
  let subType = undefined;
1141
1141
  [subType, params] = this.handleSubTypeAndParams('watchOrders', market, params, 'linear');
1142
1142
  if ((type === 'spot' || type === 'margin') && (symbol === undefined)) {
1143
- throw new errors.ArgumentsRequired(this.id + ' watchOrders requires a symbol argument for ' + type + ' markets.');
1143
+ marketId = 'default';
1144
1144
  }
1145
1145
  if ((productType === undefined) && (type !== 'spot') && (symbol === undefined)) {
1146
1146
  messageHash = messageHash + ':' + subType;
@@ -1155,7 +1155,12 @@ class bitget extends bitget$1 {
1155
1155
  messageHash = messageHash + ':usdcfutures'; // non unified channel
1156
1156
  }
1157
1157
  let instType = undefined;
1158
- [instType, params] = this.getInstType(market, params);
1158
+ if (market === undefined && type === 'spot') {
1159
+ instType = 'SPOT';
1160
+ }
1161
+ else {
1162
+ [instType, params] = this.getInstType(market, params);
1163
+ }
1159
1164
  if (type === 'spot') {
1160
1165
  subscriptionHash = subscriptionHash + ':' + symbol;
1161
1166
  }
@@ -1531,8 +1536,15 @@ class bitget extends bitget$1 {
1531
1536
  symbol = market['symbol'];
1532
1537
  messageHash = messageHash + ':' + symbol;
1533
1538
  }
1539
+ let type = undefined;
1540
+ [type, params] = this.handleMarketTypeAndParams('watchMyTrades', market, params);
1534
1541
  let instType = undefined;
1535
- [instType, params] = this.getInstType(market, params);
1542
+ if (market === undefined && type === 'spot') {
1543
+ instType = 'SPOT';
1544
+ }
1545
+ else {
1546
+ [instType, params] = this.getInstType(market, params);
1547
+ }
1536
1548
  const subscriptionHash = 'fill:' + instType;
1537
1549
  const args = {
1538
1550
  'instType': instType,
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarketMarginModes, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
7
- declare const version = "4.4.16";
7
+ declare const version = "4.4.17";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.4.17';
41
+ const version = '4.4.18';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
package/js/src/bingx.js CHANGED
@@ -609,10 +609,11 @@ export default class bingx extends Exchange {
609
609
  'max': this.safeNumber(rawNetwork, 'withdrawMax'),
610
610
  },
611
611
  };
612
+ fee = this.safeNumber(rawNetwork, 'withdrawFee');
612
613
  if (isDefault) {
613
- fee = this.safeNumber(rawNetwork, 'withdrawFee');
614
614
  defaultLimits = limits;
615
615
  }
616
+ const precision = this.safeNumber(rawNetwork, 'withdrawPrecision');
616
617
  const networkActive = networkDepositEnabled || networkWithdrawEnabled;
617
618
  networks[networkCode] = {
618
619
  'info': rawNetwork,
@@ -622,7 +623,7 @@ export default class bingx extends Exchange {
622
623
  'active': networkActive,
623
624
  'deposit': networkDepositEnabled,
624
625
  'withdraw': networkWithdrawEnabled,
625
- 'precision': undefined,
626
+ 'precision': precision,
626
627
  'limits': limits,
627
628
  };
628
629
  }
package/js/src/bitmart.js CHANGED
@@ -1297,7 +1297,7 @@ export default class bitmart extends Exchange {
1297
1297
  'close': last,
1298
1298
  'last': last,
1299
1299
  'previousClose': undefined,
1300
- 'change': change,
1300
+ 'change': undefined,
1301
1301
  'percentage': percentage,
1302
1302
  'average': average,
1303
1303
  'baseVolume': baseVolume,
package/js/src/bitso.d.ts CHANGED
@@ -37,7 +37,6 @@ export default class bitso extends Exchange {
37
37
  fetchDepositWithdrawFees(codes?: Strings, params?: {}): Promise<Dict>;
38
38
  parseDepositWithdrawFees(response: any, codes?: any, currencyIdKey?: any): Dict;
39
39
  withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
40
- safeNetwork(networkId: any): string;
41
40
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
42
41
  parseTransactionStatus(status: Str): string;
43
42
  nonce(): number;
package/js/src/bitso.js CHANGED
@@ -119,6 +119,12 @@ export default class bitso extends Exchange {
119
119
  'TUSD': 0.01,
120
120
  },
121
121
  'defaultPrecision': 0.00000001,
122
+ 'networks': {
123
+ 'TRC20': 'trx',
124
+ 'ERC20': 'erc20',
125
+ 'BEP20': 'bsc',
126
+ 'BEP2': 'bep2',
127
+ },
122
128
  },
123
129
  'timeframes': {
124
130
  '1m': '60',
@@ -1636,19 +1642,6 @@ export default class bitso extends Exchange {
1636
1642
  const first = this.safeDict(payload, 0);
1637
1643
  return this.parseTransaction(first, currency);
1638
1644
  }
1639
- safeNetwork(networkId) {
1640
- if (networkId === undefined) {
1641
- return undefined;
1642
- }
1643
- networkId = networkId.toUpperCase();
1644
- const networksById = {
1645
- 'trx': 'TRC20',
1646
- 'erc20': 'ERC20',
1647
- 'bsc': 'BEP20',
1648
- 'bep2': 'BEP2',
1649
- };
1650
- return this.safeString(networksById, networkId, networkId);
1651
- }
1652
1645
  parseTransaction(transaction, currency = undefined) {
1653
1646
  //
1654
1647
  // deposit
@@ -1695,12 +1688,14 @@ export default class bitso extends Exchange {
1695
1688
  const networkId = this.safeString2(transaction, 'network', 'method');
1696
1689
  const status = this.safeString(transaction, 'status');
1697
1690
  const withdrawId = this.safeString(transaction, 'wid');
1691
+ const networkCode = this.networkIdToCode(networkId);
1692
+ const networkCodeUpper = (networkCode !== undefined) ? networkCode.toUpperCase() : undefined;
1698
1693
  return {
1699
1694
  'id': this.safeString2(transaction, 'wid', 'fid'),
1700
1695
  'txid': this.safeString(details, 'tx_hash'),
1701
1696
  'timestamp': this.parse8601(datetime),
1702
1697
  'datetime': datetime,
1703
- 'network': this.safeNetwork(networkId),
1698
+ 'network': networkCodeUpper,
1704
1699
  'addressFrom': receivingAddress,
1705
1700
  'address': (withdrawalAddress !== undefined) ? withdrawalAddress : receivingAddress,
1706
1701
  'addressTo': withdrawalAddress,
package/js/src/gate.js CHANGED
@@ -3688,32 +3688,61 @@ export default class gate extends Exchange {
3688
3688
  }
3689
3689
  parseTransaction(transaction, currency = undefined) {
3690
3690
  //
3691
- // deposits
3691
+ // fetchDeposits
3692
3692
  //
3693
- // {
3694
- // "id": "d33361395",
3695
- // "currency": "USDT_TRX",
3696
- // "address": "TErdnxenuLtXfnMafLbfappYdHtnXQ5U4z",
3697
- // "amount": "100",
3698
- // "txid": "ae9374de34e558562fe18cbb1bf9ab4d9eb8aa7669d65541c9fa2a532c1474a0",
3699
- // "timestamp": "1626345819",
3700
- // "status": "DONE",
3701
- // "memo": ""
3702
- // }
3693
+ // {
3694
+ // "id": "d33361395",
3695
+ // "currency": "USDT_TRX",
3696
+ // "address": "TErdnxenuLtXfnMafLbfappYdHtnXQ5U4z",
3697
+ // "amount": "100",
3698
+ // "txid": "ae9374de34e558562fe18cbb1bf9ab4d9eb8aa7669d65541c9fa2a532c1474a0",
3699
+ // "timestamp": "1626345819",
3700
+ // "status": "DONE",
3701
+ // "memo": ""
3702
+ // }
3703
3703
  //
3704
3704
  // withdraw
3705
3705
  //
3706
- // {
3707
- // "id": "w13389675",
3708
- // "currency": "USDT",
3709
- // "amount": "50",
3710
- // "address": "TUu2rLFrmzUodiWfYki7QCNtv1akL682p1",
3711
- // "memo": null
3712
- // }
3706
+ // {
3707
+ // "id":"w64413318",
3708
+ // "currency":"usdt",
3709
+ // "amount":"10150",
3710
+ // "address":"0x0ab891497116f7f5532a4c2f4f7b1784488628e1",
3711
+ // "memo":null,
3712
+ // "status":"REQUEST",
3713
+ // "chain":"eth",
3714
+ // "withdraw_order_id":"",
3715
+ // "fee_amount":"4.15000000"
3716
+ // }
3717
+ //
3718
+ // fetchWithdrawals
3719
+ //
3720
+ // {
3721
+ // "id": "210496",
3722
+ // "timestamp": "1542000000",
3723
+ // "withdraw_order_id": "order_123456",
3724
+ // "currency": "USDT",
3725
+ // "address": "1HkxtBAMrA3tP5ENnYY2CZortjZvFDH5Cs",
3726
+ // "txid": "128988928203223323290",
3727
+ // "block_number": "41575382",
3728
+ // "amount": "222.61",
3729
+ // "fee": "0.01",
3730
+ // "memo": "",
3731
+ // "status": "DONE",
3732
+ // "chain": "TRX"
3733
+ // }
3734
+ //
3735
+ // {
3736
+ // "id": "w13389675",
3737
+ // "currency": "USDT",
3738
+ // "amount": "50",
3739
+ // "address": "TUu2rLFrmzUodiWfYki7QCNtv1akL682p1",
3740
+ // "memo": null
3741
+ // }
3713
3742
  //
3714
3743
  // {
3715
3744
  // "currency":"usdt",
3716
- // "address":"0x01b0A9b7b4CdE774AF0f3E47CB4f1c2CCdBa0806",
3745
+ // "address":"0x01c0A9b7b4CdE774AF0f3E47CB4f1c2CCdBa0806",
3717
3746
  // "amount":"1880",
3718
3747
  // "chain":"eth"
3719
3748
  // }
@@ -3731,7 +3760,7 @@ export default class gate extends Exchange {
3731
3760
  type = this.parseTransactionType(id[0]);
3732
3761
  }
3733
3762
  }
3734
- const feeCostString = this.safeString(transaction, 'fee');
3763
+ const feeCostString = this.safeString2(transaction, 'fee', 'fee_amount');
3735
3764
  if (type === 'withdrawal') {
3736
3765
  amountString = Precise.stringSub(amountString, feeCostString);
3737
3766
  }
package/js/src/htx.js CHANGED
@@ -6474,6 +6474,7 @@ export default class htx extends Exchange {
6474
6474
  * @method
6475
6475
  * @name htx#fetchWithdrawals
6476
6476
  * @description fetch all withdrawals made from an account
6477
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#search-for-existed-withdraws-and-deposits
6477
6478
  * @param {string} code unified currency code
6478
6479
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
6479
6480
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -6829,6 +6830,7 @@ export default class htx extends Exchange {
6829
6830
  * @method
6830
6831
  * @name htx#fetchIsolatedBorrowRates
6831
6832
  * @description fetch the borrow interest rates of all currencies
6833
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-loan-interest-rate-and-quota-isolated
6832
6834
  * @param {object} [params] extra parameters specific to the exchange API endpoint
6833
6835
  * @returns {object} a list of [isolated borrow rate structures]{@link https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure}
6834
6836
  */
@@ -7049,6 +7051,8 @@ export default class htx extends Exchange {
7049
7051
  * @method
7050
7052
  * @name htx#fetchFundingRate
7051
7053
  * @description fetch the current funding rate
7054
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-funding-rate
7055
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-funding-rate
7052
7056
  * @param {string} symbol unified market symbol
7053
7057
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7054
7058
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
@@ -7091,6 +7095,8 @@ export default class htx extends Exchange {
7091
7095
  * @method
7092
7096
  * @name htx#fetchFundingRates
7093
7097
  * @description fetch the funding rate for multiple markets
7098
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-a-batch-of-funding-rate
7099
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-a-batch-of-funding-rate
7094
7100
  * @param {string[]|undefined} symbols list of unified market symbols
7095
7101
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7096
7102
  * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols