ccxt 4.2.29 → 4.2.30
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/README.md +4 -4
- package/dist/ccxt.browser.js +1709 -533
- package/dist/ccxt.browser.min.js +7 -7
- package/dist/cjs/ccxt.js +3 -1
- package/dist/cjs/src/ascendex.js +5 -5
- package/dist/cjs/src/base/Exchange.js +21 -21
- package/dist/cjs/src/base/errors.js +3 -3
- package/dist/cjs/src/base/functions/type.js +12 -0
- package/dist/cjs/src/bigone.js +2 -2
- package/dist/cjs/src/binance.js +896 -217
- package/dist/cjs/src/bingx.js +1 -1
- package/dist/cjs/src/bitfinex.js +1 -1
- package/dist/cjs/src/bitfinex2.js +52 -62
- package/dist/cjs/src/bitget.js +8 -4
- package/dist/cjs/src/bitmart.js +3 -3
- package/dist/cjs/src/bitmex.js +4 -4
- package/dist/cjs/src/bitrue.js +1 -1
- package/dist/cjs/src/bitso.js +1 -1
- package/dist/cjs/src/bitteam.js +2 -2
- package/dist/cjs/src/btcalpha.js +1 -1
- package/dist/cjs/src/bybit.js +3 -3
- package/dist/cjs/src/coinbase.js +12 -5
- package/dist/cjs/src/coincheck.js +1 -1
- package/dist/cjs/src/coinex.js +2 -2
- package/dist/cjs/src/coinlist.js +1 -1
- package/dist/cjs/src/coinmate.js +1 -1
- package/dist/cjs/src/coinmetro.js +2 -2
- package/dist/cjs/src/coinsph.js +1 -1
- package/dist/cjs/src/cryptocom.js +3 -3
- package/dist/cjs/src/digifinex.js +6 -4
- package/dist/cjs/src/exmo.js +2 -2
- package/dist/cjs/src/gate.js +5 -5
- package/dist/cjs/src/gemini.js +3 -3
- package/dist/cjs/src/hitbtc.js +14 -20
- package/dist/cjs/src/hollaex.js +2 -2
- package/dist/cjs/src/htx.js +5 -5
- package/dist/cjs/src/huobijp.js +1 -1
- package/dist/cjs/src/krakenfutures.js +1 -1
- package/dist/cjs/src/kucoin.js +17 -17
- package/dist/cjs/src/kucoinfutures.js +3 -3
- package/dist/cjs/src/lbank.js +1 -1
- package/dist/cjs/src/mexc.js +7 -7
- package/dist/cjs/src/novadax.js +1 -1
- package/dist/cjs/src/okcoin.js +2 -2
- package/dist/cjs/src/okx.js +7 -6
- package/dist/cjs/src/p2b.js +1 -0
- package/dist/cjs/src/phemex.js +3 -3
- package/dist/cjs/src/poloniexfutures.js +3 -3
- package/dist/cjs/src/pro/alpaca.js +1 -1
- package/dist/cjs/src/pro/binance.js +4 -4
- package/dist/cjs/src/pro/bitget.js +1 -1
- package/dist/cjs/src/pro/bitmart.js +1 -1
- package/dist/cjs/src/pro/bitmex.js +49 -6
- package/dist/cjs/src/pro/bitvavo.js +1 -1
- package/dist/cjs/src/pro/bybit.js +2 -2
- package/dist/cjs/src/pro/cex.js +2 -2
- package/dist/cjs/src/pro/independentreserve.js +1 -1
- package/dist/cjs/src/pro/okx.js +1 -1
- package/dist/cjs/src/pro/onetrading.js +2 -2
- package/dist/cjs/src/pro/p2b.js +432 -0
- package/dist/cjs/src/pro/probit.js +5 -5
- package/dist/cjs/src/pro/whitebit.js +1 -1
- package/dist/cjs/src/probit.js +1 -1
- package/dist/cjs/src/timex.js +1 -1
- package/dist/cjs/src/tokocrypto.js +3 -3
- package/dist/cjs/src/wavesexchange.js +2 -2
- package/dist/cjs/src/whitebit.js +2 -2
- package/dist/cjs/src/woo.js +3 -3
- package/dist/cjs/src/yobit.js +1 -1
- package/dist/cjs/src/zaif.js +1 -1
- package/dist/cjs/src/zonda.js +3 -3
- package/js/ccxt.d.ts +4 -1
- package/js/ccxt.js +3 -1
- package/js/src/abstract/bybit.d.ts +2 -2
- package/js/src/ascendex.js +5 -5
- package/js/src/base/Exchange.d.ts +1 -1
- package/js/src/base/Exchange.js +21 -21
- package/js/src/base/errorHierarchy.d.ts +7 -6
- package/js/src/base/errorHierarchy.js +7 -6
- package/js/src/base/errors.d.ts +3 -3
- package/js/src/base/errors.js +3 -3
- package/js/src/base/functions/type.js +12 -0
- package/js/src/bigone.js +2 -2
- package/js/src/binance.d.ts +1 -0
- package/js/src/binance.js +897 -218
- package/js/src/bingx.js +1 -1
- package/js/src/bitfinex.js +1 -1
- package/js/src/bitfinex2.js +52 -62
- package/js/src/bitget.js +8 -4
- package/js/src/bitmart.js +3 -3
- package/js/src/bitmex.js +4 -4
- package/js/src/bitrue.js +1 -1
- package/js/src/bitso.d.ts +1 -1
- package/js/src/bitso.js +1 -1
- package/js/src/bitteam.js +2 -2
- package/js/src/btcalpha.js +1 -1
- package/js/src/bybit.js +3 -3
- package/js/src/coinbase.js +12 -5
- package/js/src/coincheck.js +1 -1
- package/js/src/coinex.js +2 -2
- package/js/src/coinlist.js +1 -1
- package/js/src/coinmate.js +1 -1
- package/js/src/coinmetro.d.ts +1 -1
- package/js/src/coinmetro.js +2 -2
- package/js/src/coinsph.js +1 -1
- package/js/src/cryptocom.js +3 -3
- package/js/src/digifinex.js +6 -4
- package/js/src/exmo.js +2 -2
- package/js/src/gate.js +5 -5
- package/js/src/gemini.d.ts +1 -1
- package/js/src/gemini.js +3 -3
- package/js/src/hitbtc.js +14 -20
- package/js/src/hollaex.js +2 -2
- package/js/src/htx.js +5 -5
- package/js/src/huobijp.js +1 -1
- package/js/src/krakenfutures.js +1 -1
- package/js/src/kucoin.js +17 -17
- package/js/src/kucoinfutures.js +3 -3
- package/js/src/lbank.js +1 -1
- package/js/src/mexc.js +7 -7
- package/js/src/novadax.js +1 -1
- package/js/src/okcoin.js +2 -2
- package/js/src/okx.js +7 -6
- package/js/src/p2b.js +1 -0
- package/js/src/phemex.js +3 -3
- package/js/src/poloniexfutures.js +3 -3
- package/js/src/pro/alpaca.js +1 -1
- package/js/src/pro/binance.js +4 -4
- package/js/src/pro/bitget.js +1 -1
- package/js/src/pro/bitmart.js +1 -1
- package/js/src/pro/bitmex.d.ts +2 -1
- package/js/src/pro/bitmex.js +49 -6
- package/js/src/pro/bitvavo.js +1 -1
- package/js/src/pro/bybit.js +2 -2
- package/js/src/pro/cex.js +2 -2
- package/js/src/pro/independentreserve.js +1 -1
- package/js/src/pro/okx.js +1 -1
- package/js/src/pro/onetrading.js +2 -2
- package/js/src/pro/p2b.d.ts +23 -0
- package/js/src/pro/p2b.js +433 -0
- package/js/src/pro/probit.js +5 -5
- package/js/src/pro/whitebit.js +1 -1
- package/js/src/probit.js +1 -1
- package/js/src/timex.js +1 -1
- package/js/src/tokocrypto.js +3 -3
- package/js/src/wavesexchange.js +2 -2
- package/js/src/whitebit.js +2 -2
- package/js/src/woo.js +3 -3
- package/js/src/yobit.js +1 -1
- package/js/src/zaif.js +1 -1
- package/js/src/zonda.d.ts +1 -1
- package/js/src/zonda.js +3 -3
- package/package.json +1 -1
- package/skip-tests.json +3 -10
package/dist/cjs/src/probit.js
CHANGED
|
@@ -284,7 +284,7 @@ class probit extends probit$1 {
|
|
|
284
284
|
const quoteId = this.safeString(market, 'quote_currency_id');
|
|
285
285
|
const base = this.safeCurrencyCode(baseId);
|
|
286
286
|
const quote = this.safeCurrencyCode(quoteId);
|
|
287
|
-
const closed = this.
|
|
287
|
+
const closed = this.safeBool(market, 'closed', false);
|
|
288
288
|
const takerFeeRate = this.safeString(market, 'taker_fee_rate');
|
|
289
289
|
const taker = Precise["default"].stringDiv(takerFeeRate, '100');
|
|
290
290
|
const makerFeeRate = this.safeString(market, 'maker_fee_rate');
|
package/dist/cjs/src/timex.js
CHANGED
|
@@ -721,7 +721,7 @@ class timex extends timex$1 {
|
|
|
721
721
|
const market = this.market(symbol);
|
|
722
722
|
const uppercaseSide = side.toUpperCase();
|
|
723
723
|
let uppercaseType = type.toUpperCase();
|
|
724
|
-
const postOnly = this.
|
|
724
|
+
const postOnly = this.safeBool(params, 'postOnly', false);
|
|
725
725
|
if (postOnly) {
|
|
726
726
|
uppercaseType = 'POST_ONLY';
|
|
727
727
|
params = this.omit(params, ['postOnly']);
|
|
@@ -689,7 +689,7 @@ class tokocrypto extends tokocrypto$1 {
|
|
|
689
689
|
break;
|
|
690
690
|
}
|
|
691
691
|
}
|
|
692
|
-
const isMarginTradingAllowed = this.
|
|
692
|
+
const isMarginTradingAllowed = this.safeBool(market, 'isMarginTradingAllowed', false);
|
|
693
693
|
const entry = {
|
|
694
694
|
'id': id,
|
|
695
695
|
'lowercaseId': lowercaseId,
|
|
@@ -1588,7 +1588,7 @@ class tokocrypto extends tokocrypto$1 {
|
|
|
1588
1588
|
await this.loadMarkets();
|
|
1589
1589
|
const market = this.market(symbol);
|
|
1590
1590
|
const clientOrderId = this.safeString2(params, 'clientOrderId', 'clientId');
|
|
1591
|
-
const postOnly = this.
|
|
1591
|
+
const postOnly = this.safeBool(params, 'postOnly', false);
|
|
1592
1592
|
// only supported for spot/margin api
|
|
1593
1593
|
if (postOnly) {
|
|
1594
1594
|
type = 'LIMIT_MAKER';
|
|
@@ -2462,7 +2462,7 @@ class tokocrypto extends tokocrypto$1 {
|
|
|
2462
2462
|
}
|
|
2463
2463
|
// check success value for wapi endpoints
|
|
2464
2464
|
// response in format {'msg': 'The coin does not exist.', 'success': true/false}
|
|
2465
|
-
const success = this.
|
|
2465
|
+
const success = this.safeBool(response, 'success', true);
|
|
2466
2466
|
if (!success) {
|
|
2467
2467
|
const messageInner = this.safeString(response, 'msg');
|
|
2468
2468
|
let parsedMessage = undefined;
|
|
@@ -395,7 +395,7 @@ class wavesexchange extends wavesexchange$1 {
|
|
|
395
395
|
// "matcherFee":"4077612"
|
|
396
396
|
// }
|
|
397
397
|
// }
|
|
398
|
-
const isDiscountFee = this.
|
|
398
|
+
const isDiscountFee = this.safeBool(params, 'isDiscountFee', false);
|
|
399
399
|
let mode = undefined;
|
|
400
400
|
if (isDiscountFee) {
|
|
401
401
|
mode = this.safeValue(response, 'discount');
|
|
@@ -2412,7 +2412,7 @@ class wavesexchange extends wavesexchange$1 {
|
|
|
2412
2412
|
}
|
|
2413
2413
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
2414
2414
|
const errorCode = this.safeString(response, 'error');
|
|
2415
|
-
const success = this.
|
|
2415
|
+
const success = this.safeBool(response, 'success', true);
|
|
2416
2416
|
const Exception = this.safeValue(this.exceptions, errorCode);
|
|
2417
2417
|
if (Exception !== undefined) {
|
|
2418
2418
|
const messageInner = this.safeString(response, 'message');
|
package/dist/cjs/src/whitebit.js
CHANGED
|
@@ -422,8 +422,8 @@ class whitebit extends whitebit$1 {
|
|
|
422
422
|
const currency = response[id];
|
|
423
423
|
// breaks down in Python due to utf8 encoding issues on the exchange side
|
|
424
424
|
// const name = this.safeString (currency, 'name');
|
|
425
|
-
const canDeposit = this.
|
|
426
|
-
const canWithdraw = this.
|
|
425
|
+
const canDeposit = this.safeBool(currency, 'can_deposit', true);
|
|
426
|
+
const canWithdraw = this.safeBool(currency, 'can_withdraw', true);
|
|
427
427
|
const active = canDeposit && canWithdraw;
|
|
428
428
|
const code = this.safeCurrencyCode(id);
|
|
429
429
|
result[code] = {
|
package/dist/cjs/src/woo.js
CHANGED
|
@@ -1133,7 +1133,7 @@ class woo extends woo$1 {
|
|
|
1133
1133
|
* @param {boolean} [params.stop] whether the order is a stop/algo order
|
|
1134
1134
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1135
1135
|
*/
|
|
1136
|
-
const stop = this.
|
|
1136
|
+
const stop = this.safeBool(params, 'stop', false);
|
|
1137
1137
|
params = this.omit(params, 'stop');
|
|
1138
1138
|
if (!stop && (symbol === undefined)) {
|
|
1139
1139
|
throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
@@ -1301,7 +1301,7 @@ class woo extends woo$1 {
|
|
|
1301
1301
|
const request = {};
|
|
1302
1302
|
let market = undefined;
|
|
1303
1303
|
const stop = this.safeValue(params, 'stop');
|
|
1304
|
-
const trailing = this.
|
|
1304
|
+
const trailing = this.safeBool(params, 'trailing', false);
|
|
1305
1305
|
params = this.omit(params, ['stop', 'trailing']);
|
|
1306
1306
|
if (symbol !== undefined) {
|
|
1307
1307
|
market = this.market(symbol);
|
|
@@ -2083,7 +2083,7 @@ class woo extends woo$1 {
|
|
|
2083
2083
|
//
|
|
2084
2084
|
const transfer = this.parseTransfer(response, currency);
|
|
2085
2085
|
const transferOptions = this.safeValue(this.options, 'transfer', {});
|
|
2086
|
-
const fillResponseFromRequest = this.
|
|
2086
|
+
const fillResponseFromRequest = this.safeBool(transferOptions, 'fillResponseFromRequest', true);
|
|
2087
2087
|
if (fillResponseFromRequest) {
|
|
2088
2088
|
transfer['amount'] = amount;
|
|
2089
2089
|
transfer['fromAccount'] = fromAccount;
|
package/dist/cjs/src/yobit.js
CHANGED
|
@@ -1288,7 +1288,7 @@ class yobit extends yobit$1 {
|
|
|
1288
1288
|
//
|
|
1289
1289
|
// To cover points 1, 2, 3 and 4 combined this handler should work like this:
|
|
1290
1290
|
//
|
|
1291
|
-
let success = this.
|
|
1291
|
+
let success = this.safeBool(response, 'success', false);
|
|
1292
1292
|
if (typeof success === 'string') {
|
|
1293
1293
|
if ((success === 'true') || (success === '1')) {
|
|
1294
1294
|
success = true;
|
package/dist/cjs/src/zaif.js
CHANGED
|
@@ -725,7 +725,7 @@ class zaif extends zaif$1 {
|
|
|
725
725
|
this.throwBroadlyMatchedException(this.exceptions['broad'], error, feedback);
|
|
726
726
|
throw new errors.ExchangeError(feedback); // unknown message
|
|
727
727
|
}
|
|
728
|
-
const success = this.
|
|
728
|
+
const success = this.safeBool(response, 'success', true);
|
|
729
729
|
if (!success) {
|
|
730
730
|
throw new errors.ExchangeError(feedback);
|
|
731
731
|
}
|
package/dist/cjs/src/zonda.js
CHANGED
|
@@ -1436,7 +1436,7 @@ class zonda extends zonda$1 {
|
|
|
1436
1436
|
// }
|
|
1437
1437
|
//
|
|
1438
1438
|
const id = this.safeString2(response, 'offerId', 'stopOfferId');
|
|
1439
|
-
const completed = this.
|
|
1439
|
+
const completed = this.safeBool(response, 'completed', false);
|
|
1440
1440
|
const status = completed ? 'closed' : 'open';
|
|
1441
1441
|
const transactions = this.safeValue(response, 'transactions');
|
|
1442
1442
|
return this.safeOrder({
|
|
@@ -1498,7 +1498,7 @@ class zonda extends zonda$1 {
|
|
|
1498
1498
|
'EUR': true,
|
|
1499
1499
|
'PLN': true,
|
|
1500
1500
|
};
|
|
1501
|
-
return this.
|
|
1501
|
+
return this.safeBool(fiatCurrencies, currency, false);
|
|
1502
1502
|
}
|
|
1503
1503
|
parseDepositAddress(depositAddress, currency = undefined) {
|
|
1504
1504
|
//
|
|
@@ -1635,7 +1635,7 @@ class zonda extends zonda$1 {
|
|
|
1635
1635
|
//
|
|
1636
1636
|
const transfer = this.parseTransfer(response, currency);
|
|
1637
1637
|
const transferOptions = this.safeValue(this.options, 'transfer', {});
|
|
1638
|
-
const fillResponseFromRequest = this.
|
|
1638
|
+
const fillResponseFromRequest = this.safeBool(transferOptions, 'fillResponseFromRequest', true);
|
|
1639
1639
|
if (fillResponseFromRequest) {
|
|
1640
1640
|
transfer['amount'] = amount;
|
|
1641
1641
|
}
|
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 { 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.2.
|
|
7
|
+
declare const version = "4.2.29";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
|
@@ -157,6 +157,7 @@ import ndaxPro from './src/pro/ndax.js';
|
|
|
157
157
|
import okcoinPro from './src/pro/okcoin.js';
|
|
158
158
|
import okxPro from './src/pro/okx.js';
|
|
159
159
|
import onetradingPro from './src/pro/onetrading.js';
|
|
160
|
+
import p2bPro from './src/pro/p2b.js';
|
|
160
161
|
import phemexPro from './src/pro/phemex.js';
|
|
161
162
|
import poloniexPro from './src/pro/poloniex.js';
|
|
162
163
|
import poloniexfuturesPro from './src/pro/poloniexfutures.js';
|
|
@@ -320,6 +321,7 @@ declare const pro: {
|
|
|
320
321
|
okcoin: typeof okcoinPro;
|
|
321
322
|
okx: typeof okxPro;
|
|
322
323
|
onetrading: typeof onetradingPro;
|
|
324
|
+
p2b: typeof p2bPro;
|
|
323
325
|
phemex: typeof phemexPro;
|
|
324
326
|
poloniex: typeof poloniexPro;
|
|
325
327
|
poloniexfutures: typeof poloniexfuturesPro;
|
|
@@ -387,6 +389,7 @@ declare const ccxt: {
|
|
|
387
389
|
okcoin: typeof okcoinPro;
|
|
388
390
|
okx: typeof okxPro;
|
|
389
391
|
onetrading: typeof onetradingPro;
|
|
392
|
+
p2b: typeof p2bPro;
|
|
390
393
|
phemex: typeof phemexPro;
|
|
391
394
|
poloniex: typeof poloniexPro;
|
|
392
395
|
poloniexfutures: typeof poloniexfuturesPro;
|
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.2.
|
|
41
|
+
const version = '4.2.30';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -194,6 +194,7 @@ import ndaxPro from './src/pro/ndax.js';
|
|
|
194
194
|
import okcoinPro from './src/pro/okcoin.js';
|
|
195
195
|
import okxPro from './src/pro/okx.js';
|
|
196
196
|
import onetradingPro from './src/pro/onetrading.js';
|
|
197
|
+
import p2bPro from './src/pro/p2b.js';
|
|
197
198
|
import phemexPro from './src/pro/phemex.js';
|
|
198
199
|
import poloniexPro from './src/pro/poloniex.js';
|
|
199
200
|
import poloniexfuturesPro from './src/pro/poloniexfutures.js';
|
|
@@ -357,6 +358,7 @@ const pro = {
|
|
|
357
358
|
'okcoin': okcoinPro,
|
|
358
359
|
'okx': okxPro,
|
|
359
360
|
'onetrading': onetradingPro,
|
|
361
|
+
'p2b': p2bPro,
|
|
360
362
|
'phemex': phemexPro,
|
|
361
363
|
'poloniex': poloniexPro,
|
|
362
364
|
'poloniexfutures': poloniexfuturesPro,
|
|
@@ -122,8 +122,6 @@ interface Exchange {
|
|
|
122
122
|
privateGetV5PreUpgradeAssetSettlementRecord(params?: {}): Promise<implicitReturnType>;
|
|
123
123
|
privateGetV5AccountWalletBalance(params?: {}): Promise<implicitReturnType>;
|
|
124
124
|
privateGetV5AccountBorrowHistory(params?: {}): Promise<implicitReturnType>;
|
|
125
|
-
privateGetV5AccountSetCollateralSwitch(params?: {}): Promise<implicitReturnType>;
|
|
126
|
-
privateGetV5AccountSetCollateralSwitchBatch(params?: {}): Promise<implicitReturnType>;
|
|
127
125
|
privateGetV5AccountCollateralInfo(params?: {}): Promise<implicitReturnType>;
|
|
128
126
|
privateGetV5AssetCoinGreeks(params?: {}): Promise<implicitReturnType>;
|
|
129
127
|
privateGetV5AccountFeeRate(params?: {}): Promise<implicitReturnType>;
|
|
@@ -290,6 +288,8 @@ interface Exchange {
|
|
|
290
288
|
privatePostV5LendingPurchase(params?: {}): Promise<implicitReturnType>;
|
|
291
289
|
privatePostV5LendingRedeem(params?: {}): Promise<implicitReturnType>;
|
|
292
290
|
privatePostV5LendingRedeemCancel(params?: {}): Promise<implicitReturnType>;
|
|
291
|
+
privatePostV5AccountSetCollateralSwitch(params?: {}): Promise<implicitReturnType>;
|
|
292
|
+
privatePostV5AccountSetCollateralSwitchBatch(params?: {}): Promise<implicitReturnType>;
|
|
293
293
|
}
|
|
294
294
|
declare abstract class Exchange extends _Exchange {
|
|
295
295
|
}
|
package/js/src/ascendex.js
CHANGED
|
@@ -622,7 +622,7 @@ export default class ascendex extends Exchange {
|
|
|
622
622
|
symbol = base + '/' + quote + ':' + settle;
|
|
623
623
|
}
|
|
624
624
|
const fee = this.safeNumber(market, 'commissionReserveRate');
|
|
625
|
-
const marginTradable = this.
|
|
625
|
+
const marginTradable = this.safeBool(market, 'marginTradable', false);
|
|
626
626
|
result.push({
|
|
627
627
|
'id': id,
|
|
628
628
|
'symbol': symbol,
|
|
@@ -817,7 +817,7 @@ export default class ascendex extends Exchange {
|
|
|
817
817
|
let marginMode = undefined;
|
|
818
818
|
[marketType, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
|
|
819
819
|
[marginMode, params] = this.handleMarginModeAndParams('fetchBalance', params);
|
|
820
|
-
const isMargin = this.
|
|
820
|
+
const isMargin = this.safeBool(params, 'margin', false);
|
|
821
821
|
const isCross = marginMode === 'cross';
|
|
822
822
|
marketType = (isMargin || isCross) ? 'margin' : marketType;
|
|
823
823
|
params = this.omit(params, 'margin');
|
|
@@ -1177,7 +1177,7 @@ export default class ascendex extends Exchange {
|
|
|
1177
1177
|
const timestamp = this.safeInteger(trade, 'ts');
|
|
1178
1178
|
const priceString = this.safeString2(trade, 'price', 'p');
|
|
1179
1179
|
const amountString = this.safeString(trade, 'q');
|
|
1180
|
-
const buyerIsMaker = this.
|
|
1180
|
+
const buyerIsMaker = this.safeBool(trade, 'bm', false);
|
|
1181
1181
|
const side = buyerIsMaker ? 'sell' : 'buy';
|
|
1182
1182
|
market = this.safeMarket(undefined, market);
|
|
1183
1183
|
return this.safeTrade({
|
|
@@ -1521,7 +1521,7 @@ export default class ascendex extends Exchange {
|
|
|
1521
1521
|
const isLimitOrder = ((type === 'limit') || (type === 'stop_limit'));
|
|
1522
1522
|
const timeInForce = this.safeString(params, 'timeInForce');
|
|
1523
1523
|
const postOnly = this.isPostOnly(isMarketOrder, false, params);
|
|
1524
|
-
const reduceOnly = this.
|
|
1524
|
+
const reduceOnly = this.safeBool(params, 'reduceOnly', false);
|
|
1525
1525
|
const stopPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
|
|
1526
1526
|
if (isLimitOrder) {
|
|
1527
1527
|
request['orderPrice'] = this.priceToPrecision(symbol, price);
|
|
@@ -3164,7 +3164,7 @@ export default class ascendex extends Exchange {
|
|
|
3164
3164
|
// { "code": "0" }
|
|
3165
3165
|
//
|
|
3166
3166
|
const transferOptions = this.safeValue(this.options, 'transfer', {});
|
|
3167
|
-
const fillResponseFromRequest = this.
|
|
3167
|
+
const fillResponseFromRequest = this.safeBool(transferOptions, 'fillResponseFromRequest', true);
|
|
3168
3168
|
const transfer = this.parseTransfer(response, currency);
|
|
3169
3169
|
if (fillResponseFromRequest) {
|
|
3170
3170
|
transfer['fromAccount'] = fromAccount;
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -1980,7 +1980,7 @@ export default class Exchange {
|
|
|
1980
1980
|
fee['cost'] = this.safeNumber(fee, 'cost');
|
|
1981
1981
|
}
|
|
1982
1982
|
const timestamp = this.safeInteger(entry, 'timestamp');
|
|
1983
|
-
const info = this.
|
|
1983
|
+
const info = this.safeDict(entry, 'info', {});
|
|
1984
1984
|
return {
|
|
1985
1985
|
'id': this.safeString(entry, 'id'),
|
|
1986
1986
|
'timestamp': timestamp,
|
|
@@ -2152,7 +2152,7 @@ export default class Exchange {
|
|
|
2152
2152
|
for (let i = 0; i < values.length; i++) {
|
|
2153
2153
|
const market = values[i];
|
|
2154
2154
|
const defaultCurrencyPrecision = (this.precisionMode === DECIMAL_PLACES) ? 8 : this.parseNumber('1e-8');
|
|
2155
|
-
const marketPrecision = this.
|
|
2155
|
+
const marketPrecision = this.safeDict(market, 'precision', {});
|
|
2156
2156
|
if ('base' in market) {
|
|
2157
2157
|
const currency = this.safeCurrencyStructure({
|
|
2158
2158
|
'id': this.safeString2(market, 'baseId', 'base'),
|
|
@@ -2182,7 +2182,7 @@ export default class Exchange {
|
|
|
2182
2182
|
const resultingCurrencies = [];
|
|
2183
2183
|
for (let i = 0; i < codes.length; i++) {
|
|
2184
2184
|
const code = codes[i];
|
|
2185
|
-
const groupedCurrenciesCode = this.
|
|
2185
|
+
const groupedCurrenciesCode = this.safeList(groupedCurrencies, code, []);
|
|
2186
2186
|
let highestPrecisionCurrency = this.safeValue(groupedCurrenciesCode, 0);
|
|
2187
2187
|
for (let j = 1; j < groupedCurrenciesCode.length; j++) {
|
|
2188
2188
|
const currentCurrency = groupedCurrenciesCode[j];
|
|
@@ -2265,7 +2265,7 @@ export default class Exchange {
|
|
|
2265
2265
|
const parseSymbol = symbol === undefined;
|
|
2266
2266
|
const parseSide = side === undefined;
|
|
2267
2267
|
const shouldParseFees = parseFee || parseFees;
|
|
2268
|
-
const fees = this.
|
|
2268
|
+
const fees = this.safeList(order, 'fees', []);
|
|
2269
2269
|
let trades = [];
|
|
2270
2270
|
if (parseFilled || parseCost || shouldParseFees) {
|
|
2271
2271
|
const rawTrades = this.safeValue(order, 'trades', trades);
|
|
@@ -2399,7 +2399,7 @@ export default class Exchange {
|
|
|
2399
2399
|
}
|
|
2400
2400
|
}
|
|
2401
2401
|
// ensure that the average field is calculated correctly
|
|
2402
|
-
const inverse = this.
|
|
2402
|
+
const inverse = this.safeBool(market, 'inverse', false);
|
|
2403
2403
|
const contractSize = this.numberToString(this.safeValue(market, 'contractSize', 1));
|
|
2404
2404
|
// inverse
|
|
2405
2405
|
// price = filled * contract size / cost
|
|
@@ -2453,12 +2453,12 @@ export default class Exchange {
|
|
|
2453
2453
|
entry['amount'] = this.safeNumber(entry, 'amount');
|
|
2454
2454
|
entry['price'] = this.safeNumber(entry, 'price');
|
|
2455
2455
|
entry['cost'] = this.safeNumber(entry, 'cost');
|
|
2456
|
-
const tradeFee = this.
|
|
2456
|
+
const tradeFee = this.safeDict(entry, 'fee', {});
|
|
2457
2457
|
tradeFee['cost'] = this.safeNumber(tradeFee, 'cost');
|
|
2458
2458
|
if ('rate' in tradeFee) {
|
|
2459
2459
|
tradeFee['rate'] = this.safeNumber(tradeFee, 'rate');
|
|
2460
2460
|
}
|
|
2461
|
-
const entryFees = this.
|
|
2461
|
+
const entryFees = this.safeList(entry, 'fees', []);
|
|
2462
2462
|
for (let j = 0; j < entryFees.length; j++) {
|
|
2463
2463
|
entryFees[j]['cost'] = this.safeNumber(entryFees[j], 'cost');
|
|
2464
2464
|
}
|
|
@@ -2633,7 +2633,7 @@ export default class Exchange {
|
|
|
2633
2633
|
const contractSize = this.safeString(market, 'contractSize');
|
|
2634
2634
|
let multiplyPrice = price;
|
|
2635
2635
|
if (contractSize !== undefined) {
|
|
2636
|
-
const inverse = this.
|
|
2636
|
+
const inverse = this.safeBool(market, 'inverse', false);
|
|
2637
2637
|
if (inverse) {
|
|
2638
2638
|
multiplyPrice = Precise.stringDiv('1', price);
|
|
2639
2639
|
}
|
|
@@ -2876,12 +2876,12 @@ export default class Exchange {
|
|
|
2876
2876
|
}
|
|
2877
2877
|
convertTradingViewToOHLCV(ohlcvs, timestamp = 't', open = 'o', high = 'h', low = 'l', close = 'c', volume = 'v', ms = false) {
|
|
2878
2878
|
const result = [];
|
|
2879
|
-
const timestamps = this.
|
|
2880
|
-
const opens = this.
|
|
2881
|
-
const highs = this.
|
|
2882
|
-
const lows = this.
|
|
2883
|
-
const closes = this.
|
|
2884
|
-
const volumes = this.
|
|
2879
|
+
const timestamps = this.safeList(ohlcvs, timestamp, []);
|
|
2880
|
+
const opens = this.safeList(ohlcvs, open, []);
|
|
2881
|
+
const highs = this.safeList(ohlcvs, high, []);
|
|
2882
|
+
const lows = this.safeList(ohlcvs, low, []);
|
|
2883
|
+
const closes = this.safeList(ohlcvs, close, []);
|
|
2884
|
+
const volumes = this.safeList(ohlcvs, volume, []);
|
|
2885
2885
|
for (let i = 0; i < timestamps.length; i++) {
|
|
2886
2886
|
result.push([
|
|
2887
2887
|
ms ? this.safeInteger(timestamps, i) : this.safeTimestamp(timestamps, i),
|
|
@@ -2916,10 +2916,10 @@ export default class Exchange {
|
|
|
2916
2916
|
async fetchWebEndpoint(method, endpointMethod, returnAsJson, startRegex = undefined, endRegex = undefined) {
|
|
2917
2917
|
let errorMessage = '';
|
|
2918
2918
|
const options = this.safeValue(this.options, method, {});
|
|
2919
|
-
const muteOnFailure = this.
|
|
2919
|
+
const muteOnFailure = this.safeBool(options, 'webApiMuteFailure', true);
|
|
2920
2920
|
try {
|
|
2921
2921
|
// if it was not explicitly disabled, then don't fetch
|
|
2922
|
-
if (this.
|
|
2922
|
+
if (this.safeBool(options, 'webApiEnable', true) !== true) {
|
|
2923
2923
|
return undefined;
|
|
2924
2924
|
}
|
|
2925
2925
|
const maxRetries = this.safeValue(options, 'webApiRetries', 10);
|
|
@@ -3130,7 +3130,7 @@ export default class Exchange {
|
|
|
3130
3130
|
if (currencyCode !== undefined) {
|
|
3131
3131
|
const defaultNetworkCodeReplacements = this.safeValue(this.options, 'defaultNetworkCodeReplacements', {});
|
|
3132
3132
|
if (currencyCode in defaultNetworkCodeReplacements) {
|
|
3133
|
-
const replacementObject = this.
|
|
3133
|
+
const replacementObject = this.safeDict(defaultNetworkCodeReplacements, currencyCode, {});
|
|
3134
3134
|
networkCode = this.safeString(replacementObject, networkCode, networkCode);
|
|
3135
3135
|
}
|
|
3136
3136
|
}
|
|
@@ -3232,7 +3232,7 @@ export default class Exchange {
|
|
|
3232
3232
|
const id = this.safeString(item, marketIdKey);
|
|
3233
3233
|
const market = this.safeMarket(id, undefined, undefined, 'swap');
|
|
3234
3234
|
const symbol = market['symbol'];
|
|
3235
|
-
const contract = this.
|
|
3235
|
+
const contract = this.safeBool(market, 'contract', false);
|
|
3236
3236
|
if (contract && ((symbols === undefined) || this.inArray(symbol, symbols))) {
|
|
3237
3237
|
tiers[symbol] = this.parseMarketLeverageTiers(item, market);
|
|
3238
3238
|
}
|
|
@@ -4403,8 +4403,8 @@ export default class Exchange {
|
|
|
4403
4403
|
const currency = this.currencies[code];
|
|
4404
4404
|
let precision = this.safeValue(currency, 'precision');
|
|
4405
4405
|
if (networkCode !== undefined) {
|
|
4406
|
-
const networks = this.
|
|
4407
|
-
const networkItem = this.
|
|
4406
|
+
const networks = this.safeDict(currency, 'networks', {});
|
|
4407
|
+
const networkItem = this.safeDict(networks, networkCode, {});
|
|
4408
4408
|
precision = this.safeValue(networkItem, 'precision', precision);
|
|
4409
4409
|
}
|
|
4410
4410
|
if (precision === undefined) {
|
|
@@ -4706,7 +4706,7 @@ export default class Exchange {
|
|
|
4706
4706
|
* @returns {Array}
|
|
4707
4707
|
*/
|
|
4708
4708
|
const timeInForce = this.safeStringUpper(params, 'timeInForce');
|
|
4709
|
-
let postOnly = this.
|
|
4709
|
+
let postOnly = this.safeBool(params, 'postOnly', false);
|
|
4710
4710
|
const ioc = timeInForce === 'IOC';
|
|
4711
4711
|
const fok = timeInForce === 'FOK';
|
|
4712
4712
|
const po = timeInForce === 'PO';
|
|
@@ -10,9 +10,11 @@ declare const errorHierarchy: {
|
|
|
10
10
|
ArgumentsRequired: {};
|
|
11
11
|
BadRequest: {
|
|
12
12
|
BadSymbol: {};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
};
|
|
14
|
+
OperationRejected: {
|
|
15
|
+
NoChange: {
|
|
16
|
+
MarginModeAlreadySet: {};
|
|
17
|
+
};
|
|
16
18
|
};
|
|
17
19
|
BadResponse: {
|
|
18
20
|
NullResponse: {};
|
|
@@ -35,9 +37,8 @@ declare const errorHierarchy: {
|
|
|
35
37
|
};
|
|
36
38
|
OperationFailed: {
|
|
37
39
|
NetworkError: {
|
|
38
|
-
DDoSProtection: {
|
|
39
|
-
|
|
40
|
-
};
|
|
40
|
+
DDoSProtection: {};
|
|
41
|
+
RateLimitExceeded: {};
|
|
41
42
|
ExchangeNotAvailable: {
|
|
42
43
|
OnMaintenance: {};
|
|
43
44
|
};
|
|
@@ -16,9 +16,11 @@ const errorHierarchy = {
|
|
|
16
16
|
'ArgumentsRequired': {},
|
|
17
17
|
'BadRequest': {
|
|
18
18
|
'BadSymbol': {},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
'
|
|
19
|
+
},
|
|
20
|
+
'OperationRejected': {
|
|
21
|
+
'NoChange': {
|
|
22
|
+
'MarginModeAlreadySet': {},
|
|
23
|
+
},
|
|
22
24
|
},
|
|
23
25
|
'BadResponse': {
|
|
24
26
|
'NullResponse': {},
|
|
@@ -41,9 +43,8 @@ const errorHierarchy = {
|
|
|
41
43
|
},
|
|
42
44
|
'OperationFailed': {
|
|
43
45
|
'NetworkError': {
|
|
44
|
-
'DDoSProtection': {
|
|
45
|
-
|
|
46
|
-
},
|
|
46
|
+
'DDoSProtection': {},
|
|
47
|
+
'RateLimitExceeded': {},
|
|
47
48
|
'ExchangeNotAvailable': {
|
|
48
49
|
'OnMaintenance': {},
|
|
49
50
|
},
|
package/js/src/base/errors.d.ts
CHANGED
|
@@ -25,13 +25,13 @@ declare class ArgumentsRequired extends ExchangeError {
|
|
|
25
25
|
declare class BadRequest extends ExchangeError {
|
|
26
26
|
constructor(message: any);
|
|
27
27
|
}
|
|
28
|
-
declare class OperationRejected extends
|
|
28
|
+
declare class OperationRejected extends ExchangeError {
|
|
29
29
|
constructor(message: any);
|
|
30
30
|
}
|
|
31
31
|
declare class BadSymbol extends BadRequest {
|
|
32
32
|
constructor(message: any);
|
|
33
33
|
}
|
|
34
|
-
declare class NoChange extends
|
|
34
|
+
declare class NoChange extends OperationRejected {
|
|
35
35
|
constructor(message: any);
|
|
36
36
|
}
|
|
37
37
|
declare class MarginModeAlreadySet extends NoChange {
|
|
@@ -91,7 +91,7 @@ declare class NetworkError extends OperationFailed {
|
|
|
91
91
|
declare class DDoSProtection extends NetworkError {
|
|
92
92
|
constructor(message: any);
|
|
93
93
|
}
|
|
94
|
-
declare class RateLimitExceeded extends
|
|
94
|
+
declare class RateLimitExceeded extends NetworkError {
|
|
95
95
|
constructor(message: any);
|
|
96
96
|
}
|
|
97
97
|
declare class ExchangeNotAvailable extends NetworkError {
|
package/js/src/base/errors.js
CHANGED
|
@@ -90,7 +90,7 @@ class BadRequest extends ExchangeError {
|
|
|
90
90
|
this.name = 'BadRequest';
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
class OperationRejected extends
|
|
93
|
+
class OperationRejected extends ExchangeError {
|
|
94
94
|
constructor(message) {
|
|
95
95
|
super(message);
|
|
96
96
|
this.name = 'OperationRejected';
|
|
@@ -102,7 +102,7 @@ class BadSymbol extends BadRequest {
|
|
|
102
102
|
this.name = 'BadSymbol';
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
class NoChange extends
|
|
105
|
+
class NoChange extends OperationRejected {
|
|
106
106
|
constructor(message) {
|
|
107
107
|
super(message);
|
|
108
108
|
this.name = 'NoChange';
|
|
@@ -223,7 +223,7 @@ class DDoSProtection extends NetworkError {
|
|
|
223
223
|
this.name = 'DDoSProtection';
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
class RateLimitExceeded extends
|
|
226
|
+
class RateLimitExceeded extends NetworkError {
|
|
227
227
|
constructor(message) {
|
|
228
228
|
super(message);
|
|
229
229
|
this.name = 'RateLimitExceeded';
|
|
@@ -98,6 +98,9 @@ const safeFloatN = (o, k, $default) => {
|
|
|
98
98
|
return isNumber(n) ? n : $default;
|
|
99
99
|
};
|
|
100
100
|
const safeIntegerN = (o, k, $default) => {
|
|
101
|
+
if (o === undefined) {
|
|
102
|
+
return $default;
|
|
103
|
+
}
|
|
101
104
|
const n = asInteger(getValueFromKeysInArray(o, k));
|
|
102
105
|
return isNumber(n) ? n : $default;
|
|
103
106
|
};
|
|
@@ -110,14 +113,23 @@ const safeTimestampN = (o, k, $default) => {
|
|
|
110
113
|
return isNumber(n) ? parseInt(n * 1000) : $default;
|
|
111
114
|
};
|
|
112
115
|
const safeValueN = (o, k, $default) => {
|
|
116
|
+
if (o === undefined) {
|
|
117
|
+
return $default;
|
|
118
|
+
}
|
|
113
119
|
const x = getValueFromKeysInArray(o, k);
|
|
114
120
|
return hasProps(x) ? x : $default;
|
|
115
121
|
};
|
|
116
122
|
const safeStringN = (o, k, $default) => {
|
|
123
|
+
if (o === undefined) {
|
|
124
|
+
return $default;
|
|
125
|
+
}
|
|
117
126
|
const x = getValueFromKeysInArray(o, k);
|
|
118
127
|
return isStringCoercible(x) ? String(x) : $default;
|
|
119
128
|
};
|
|
120
129
|
const safeStringLowerN = (o, k, $default) => {
|
|
130
|
+
if (o === undefined) {
|
|
131
|
+
return $default;
|
|
132
|
+
}
|
|
121
133
|
const x = getValueFromKeysInArray(o, k);
|
|
122
134
|
return isStringCoercible(x) ? String(x).toLowerCase() : $default;
|
|
123
135
|
};
|
package/js/src/bigone.js
CHANGED
|
@@ -1472,7 +1472,7 @@ export default class bigone extends Exchange {
|
|
|
1472
1472
|
const requestSide = isBuy ? 'BID' : 'ASK';
|
|
1473
1473
|
let uppercaseType = type.toUpperCase();
|
|
1474
1474
|
const isLimit = uppercaseType === 'LIMIT';
|
|
1475
|
-
const exchangeSpecificParam = this.
|
|
1475
|
+
const exchangeSpecificParam = this.safeBool(params, 'post_only', false);
|
|
1476
1476
|
let postOnly = undefined;
|
|
1477
1477
|
[postOnly, params] = this.handlePostOnly((uppercaseType === 'MARKET'), exchangeSpecificParam, params);
|
|
1478
1478
|
const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'stop_price']);
|
|
@@ -2104,7 +2104,7 @@ export default class bigone extends Exchange {
|
|
|
2104
2104
|
//
|
|
2105
2105
|
const transfer = this.parseTransfer(response, currency);
|
|
2106
2106
|
const transferOptions = this.safeValue(this.options, 'transfer', {});
|
|
2107
|
-
const fillResponseFromRequest = this.
|
|
2107
|
+
const fillResponseFromRequest = this.safeBool(transferOptions, 'fillResponseFromRequest', true);
|
|
2108
2108
|
if (fillResponseFromRequest) {
|
|
2109
2109
|
transfer['fromAccount'] = fromAccount;
|
|
2110
2110
|
transfer['toAccount'] = toAccount;
|
package/js/src/binance.d.ts
CHANGED
|
@@ -307,6 +307,7 @@ export default class binance extends Exchange {
|
|
|
307
307
|
body: any;
|
|
308
308
|
headers: any;
|
|
309
309
|
};
|
|
310
|
+
getExceptionsByUrl(url: any, exactOrBroad: any): any;
|
|
310
311
|
handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
|
|
311
312
|
calculateRateLimiterCost(api: any, method: any, path: any, params: any, config?: {}): any;
|
|
312
313
|
request(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any, config?: {}, context?: {}): Promise<any>;
|