ccxt 4.1.63 → 4.1.64

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.
@@ -403,7 +403,7 @@ class krakenfutures extends krakenfutures$1 {
403
403
  * @param {int} [limit] not used by krakenfutures watchBalance
404
404
  * @param {object} [params] extra parameters specific to the krakenfutures api endpoint
405
405
  * @param {string} [params.account] can be either 'futures' or 'flex_futures'
406
- * @returns {object[]} a list of [balance structures]{@link https://docs.ccxt.com/#/?id=balance-structure}
406
+ * @returns {object} a object of wallet types each with a balance structure {@link https://docs.ccxt.com/#/?id=balance-structure}
407
407
  */
408
408
  await this.loadMarkets();
409
409
  const name = 'balances';
@@ -1268,6 +1268,7 @@ class krakenfutures extends krakenfutures$1 {
1268
1268
  holdingResult[code] = newAccount;
1269
1269
  }
1270
1270
  this.balance['cash'] = holdingResult;
1271
+ this.balance['cash'] = this.safeBalance(this.balance['cash']);
1271
1272
  client.resolve(holdingResult, messageHash);
1272
1273
  }
1273
1274
  if (futures !== undefined) {
@@ -1291,6 +1292,7 @@ class krakenfutures extends krakenfutures$1 {
1291
1292
  futuresResult[symbol][code] = newAccount;
1292
1293
  }
1293
1294
  this.balance['margin'] = futuresResult;
1295
+ this.balance['margin'] = this.safeBalance(this.balance['margin']);
1294
1296
  client.resolve(this.balance['margin'], messageHash + 'futures');
1295
1297
  }
1296
1298
  if (flexFutures !== undefined) {
@@ -1312,6 +1314,7 @@ class krakenfutures extends krakenfutures$1 {
1312
1314
  flexFuturesResult[code] = newAccount;
1313
1315
  }
1314
1316
  this.balance['flex'] = flexFuturesResult;
1317
+ this.balance['flex'] = this.safeBalance(this.balance['flex']);
1315
1318
  client.resolve(this.balance['flex'], messageHash + 'flex_futures');
1316
1319
  }
1317
1320
  client.resolve(this.balance, messageHash);
@@ -1163,9 +1163,7 @@ class tokocrypto extends tokocrypto$1 {
1163
1163
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1164
1164
  */
1165
1165
  await this.loadMarkets();
1166
- const defaultMethod = 'binanceGetTicker24hr';
1167
- const method = this.safeString(this.options, 'fetchTickersMethod', defaultMethod);
1168
- const response = await this[method](params);
1166
+ const response = await this.binanceGetTicker24hr(params);
1169
1167
  return this.parseTickers(response, symbols);
1170
1168
  }
1171
1169
  getMarketIdByType(market) {
@@ -469,7 +469,13 @@ class wazirx extends wazirx$1 {
469
469
  request['limit'] = Math.min(limit, 1000); // Default 500; max 1000.
470
470
  }
471
471
  const method = this.safeString(this.options, 'fetchTradesMethod', 'publicGetTrades');
472
- const response = await this[method](this.extend(request, params));
472
+ let response = undefined;
473
+ if (method === 'privateGetHistoricalTrades') {
474
+ response = await this.privateGetHistoricalTrades(this.extend(request, params));
475
+ }
476
+ else {
477
+ response = await this.publicGetTrades(this.extend(request, params));
478
+ }
473
479
  // [
474
480
  // {
475
481
  // "id":322307791,
package/doc/manual.rst CHANGED
@@ -5594,7 +5594,7 @@ Some exchanges allow you to specify optional parameters for your order. You can
5594
5594
 
5595
5595
  # Python
5596
5596
  # add a custom order flag
5597
- kraken.create_market_buy_order('BTC/USD', 1, {'trading_agreement': 'agree'})
5597
+ kraken.create_market_buy_order('BTC/USD', 1, {'validate': true})
5598
5598
 
5599
5599
  .. code-block:: PHP
5600
5600
 
package/doc/readme.rst CHANGED
@@ -2067,7 +2067,7 @@ Python
2067
2067
  print(exmo.id, exmo.create_limit_buy_order('BTC/EUR', 1, 2500.00))
2068
2068
 
2069
2069
  # pass/redefine custom exchange-specific order params: type, amount, price, flags, etc...
2070
- kraken.create_market_buy_order('BTC/USD', 1, {'trading_agreement': 'agree'})
2070
+ kraken.create_market_buy_order('BTC/USD', 1, {'validate': true})
2071
2071
 
2072
2072
  PHP
2073
2073
  ^^^
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 { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
7
- declare const version = "4.1.62";
7
+ declare const version = "4.1.63";
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, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.1.63';
41
+ const version = '4.1.64';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -45,10 +45,39 @@ export default class binanceus extends binance {
45
45
  'has': {
46
46
  'CORS': undefined,
47
47
  'spot': true,
48
- 'margin': undefined,
49
- 'swap': undefined,
50
- 'future': undefined,
51
- 'option': undefined,
48
+ 'margin': false,
49
+ 'swap': false,
50
+ 'option': false,
51
+ 'addMargin': false,
52
+ 'borrowMargin': false,
53
+ 'createReduceOnlyOrder': false,
54
+ 'fetchBorrowInterest': false,
55
+ 'fetchBorrowRate': false,
56
+ 'fetchBorrowRateHistories': false,
57
+ 'fetchBorrowRateHistory': false,
58
+ 'fetchBorrowRates': false,
59
+ 'fetchBorrowRatesPerSymbol': false,
60
+ 'fetchFundingHistory': false,
61
+ 'fetchFundingRate': false,
62
+ 'fetchFundingRateHistory': false,
63
+ 'fetchFundingRates': false,
64
+ 'fetchIndexOHLCV': false,
65
+ 'fetchIsolatedPositions': false,
66
+ 'fetchLeverage': false,
67
+ 'fetchLeverageTiers': false,
68
+ 'fetchMarketLeverageTiers': false,
69
+ 'fetchMarkOHLCV': false,
70
+ 'fetchOpenInterestHistory': false,
71
+ 'fetchPosition': false,
72
+ 'fetchPositions': false,
73
+ 'fetchPositionsRisk': false,
74
+ 'fetchPremiumIndexOHLCV': false,
75
+ 'reduceMargin': false,
76
+ 'repayMargin': false,
77
+ 'setLeverage': false,
78
+ 'setMargin': false,
79
+ 'setMarginMode': false,
80
+ 'setPositionMode': false,
52
81
  },
53
82
  });
54
83
  }
package/js/src/kraken.js CHANGED
@@ -1529,8 +1529,8 @@ export default class kraken extends Exchange {
1529
1529
  //
1530
1530
  // market
1531
1531
  // limit (price = limit price)
1532
- // stop-loss (price = stop loss price)
1533
- // take-profit (price = take profit price)
1532
+ // stop-loss (price = stop loss trigger price)
1533
+ // take-profit (price = take profit trigger price)
1534
1534
  // stop-loss-limit (price = stop loss trigger price, price2 = triggered limit price)
1535
1535
  // take-profit-limit (price = take profit trigger price, price2 = triggered limit price)
1536
1536
  // settle-position
@@ -1801,6 +1801,15 @@ export default class kraken extends Exchange {
1801
1801
  return result;
1802
1802
  }
1803
1803
  async fetchOrdersByIds(ids, symbol = undefined, params = {}) {
1804
+ /**
1805
+ * @method
1806
+ * @name kraken#fetchOrdersByIds
1807
+ * @description fetch orders by the list of order id
1808
+ * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders
1809
+ * @param {string[]|undefined} ids list of order id
1810
+ * @param {object} [params] extra parameters specific to the kraken api endpoint
1811
+ * @returns {object[]} a list of [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1812
+ */
1804
1813
  await this.loadMarkets();
1805
1814
  const response = await this.privatePostQueryOrders(this.extend({
1806
1815
  'trades': true,
@@ -2296,6 +2305,15 @@ export default class kraken extends Exchange {
2296
2305
  return await this.fetchDepositAddress(code, this.extend(request, params));
2297
2306
  }
2298
2307
  async fetchDepositMethods(code, params = {}) {
2308
+ /**
2309
+ * @method
2310
+ * @name kraken#fetchDepositMethods
2311
+ * @description fetch deposit methods for a currency associated with this account
2312
+ * @see https://docs.kraken.com/rest/#tag/Funding/operation/getDepositMethods
2313
+ * @param {string} code unified currency code
2314
+ * @param {object} [params] extra parameters specific to the kraken api endpoint
2315
+ * @returns {object} of deposit methods
2316
+ */
2299
2317
  await this.loadMarkets();
2300
2318
  const currency = this.currency(code);
2301
2319
  const request = {
@@ -89,7 +89,7 @@ export default class krakenfutures extends Exchange {
89
89
  },
90
90
  'www': 'https://futures.kraken.com/',
91
91
  'doc': [
92
- 'https://support.kraken.com/hc/en-us/categories/360001806372-Futures-API',
92
+ 'https://docs.futures.kraken.com/#introduction',
93
93
  ],
94
94
  'fees': 'https://support.kraken.com/hc/en-us/articles/360022835771-Transaction-fees-and-rebates-for-Kraken-Futures',
95
95
  'referral': undefined,
@@ -2232,26 +2232,26 @@ export default class krakenfutures extends Exchange {
2232
2232
  */
2233
2233
  await this.loadMarkets();
2234
2234
  const currency = this.currency(code);
2235
- let method = 'privatePostTransfer';
2236
- const request = {
2237
- 'amount': amount,
2238
- };
2239
2235
  if (fromAccount === 'spot') {
2240
2236
  throw new BadRequest(this.id + ' transfer does not yet support transfers from spot');
2241
2237
  }
2238
+ const request = {
2239
+ 'amount': amount,
2240
+ };
2241
+ let response = undefined;
2242
2242
  if (toAccount === 'spot') {
2243
2243
  if (this.parseAccount(fromAccount) !== 'cash') {
2244
2244
  throw new BadRequest(this.id + ' transfer cannot transfer from ' + fromAccount + ' to ' + toAccount);
2245
2245
  }
2246
- method = 'privatePostWithdrawal';
2247
2246
  request['currency'] = currency['id'];
2247
+ response = await this.privatePostWithdrawal(this.extend(request, params));
2248
2248
  }
2249
2249
  else {
2250
2250
  request['fromAccount'] = this.parseAccount(fromAccount);
2251
2251
  request['toAccount'] = this.parseAccount(toAccount);
2252
2252
  request['unit'] = currency['id'];
2253
+ response = await this.privatePostTransfer(this.extend(request, params));
2253
2254
  }
2254
- const response = await this[method](this.extend(request, params));
2255
2255
  //
2256
2256
  // {
2257
2257
  // "result": "success",
package/js/src/luno.js CHANGED
@@ -337,17 +337,17 @@ export default class luno extends Exchange {
337
337
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
338
338
  */
339
339
  await this.loadMarkets();
340
- let method = 'publicGetOrderbook';
341
- if (limit !== undefined) {
342
- if (limit <= 100) {
343
- method += 'Top'; // get just the top of the orderbook when limit is low
344
- }
345
- }
346
340
  const market = this.market(symbol);
347
341
  const request = {
348
342
  'pair': market['id'],
349
343
  };
350
- const response = await this[method](this.extend(request, params));
344
+ let response = undefined;
345
+ if (limit !== undefined && limit <= 100) {
346
+ response = await this.publicGetOrderbookTop(this.extend(request, params));
347
+ }
348
+ else {
349
+ response = await this.publicGetOrderbook(this.extend(request, params));
350
+ }
351
351
  const timestamp = this.safeInteger(response, 'timestamp');
352
352
  return this.parseOrderBook(response, market['symbol'], timestamp, 'bids', 'asks', 'price', 'volume');
353
353
  }
@@ -815,13 +815,12 @@ export default class luno extends Exchange {
815
815
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
816
816
  */
817
817
  await this.loadMarkets();
818
- let method = 'privatePost';
819
818
  const market = this.market(symbol);
820
819
  const request = {
821
820
  'pair': market['id'],
822
821
  };
822
+ let response = undefined;
823
823
  if (type === 'market') {
824
- method += 'Marketorder';
825
824
  request['type'] = side.toUpperCase();
826
825
  // todo add createMarketBuyOrderRequires price logic as it is implemented in the other exchanges
827
826
  if (side === 'buy') {
@@ -830,14 +829,14 @@ export default class luno extends Exchange {
830
829
  else {
831
830
  request['base_volume'] = this.amountToPrecision(market['symbol'], amount);
832
831
  }
832
+ response = await this.privatePostMarketorder(this.extend(request, params));
833
833
  }
834
834
  else {
835
- method += 'Postorder';
836
835
  request['volume'] = this.amountToPrecision(market['symbol'], amount);
837
836
  request['price'] = this.priceToPrecision(market['symbol'], price);
838
837
  request['type'] = (side === 'buy') ? 'BID' : 'ASK';
838
+ response = await this.privatePostPostorder(this.extend(request, params));
839
839
  }
840
- const response = await this[method](this.extend(request, params));
841
840
  return this.safeOrder({
842
841
  'info': response,
843
842
  'id': response['order_id'],