ccxt 4.2.28 → 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/CONTRIBUTING.md +4 -1
- package/README.md +6 -6
- package/dist/ccxt.browser.js +1865 -558
- 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 +114 -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 +9 -6
- 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 +28 -12
- 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 +12 -6
- 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 +24 -10
- 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/coinbase.js +1 -1
- 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/abstract/okx.d.ts +1 -0
- package/js/src/ascendex.js +5 -5
- package/js/src/base/Exchange.d.ts +10 -1
- package/js/src/base/Exchange.js +114 -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 +9 -6
- 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 +28 -12
- 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 +12 -6
- 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 +24 -10
- 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/coinbase.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/bingx.js
CHANGED
|
@@ -1842,7 +1842,7 @@ class bingx extends bingx$1 {
|
|
|
1842
1842
|
if (((type === 'LIMIT') || (type === 'TRIGGER_LIMIT') || (type === 'STOP') || (type === 'TAKE_PROFIT')) && !isTrailing) {
|
|
1843
1843
|
request['price'] = this.parseToNumeric(this.priceToPrecision(symbol, price));
|
|
1844
1844
|
}
|
|
1845
|
-
let reduceOnly = this.
|
|
1845
|
+
let reduceOnly = this.safeBool(params, 'reduceOnly', false);
|
|
1846
1846
|
if (isTriggerOrder) {
|
|
1847
1847
|
request['stopPrice'] = this.parseToNumeric(this.priceToPrecision(symbol, triggerPrice));
|
|
1848
1848
|
if (isMarketOrder || (type === 'TRIGGER_MARKET')) {
|
package/dist/cjs/src/bitfinex.js
CHANGED
|
@@ -1054,7 +1054,7 @@ class bitfinex extends bitfinex$1 {
|
|
|
1054
1054
|
*/
|
|
1055
1055
|
await this.loadMarkets();
|
|
1056
1056
|
const market = this.market(symbol);
|
|
1057
|
-
const postOnly = this.
|
|
1057
|
+
const postOnly = this.safeBool(params, 'postOnly', false);
|
|
1058
1058
|
type = type.toLowerCase();
|
|
1059
1059
|
params = this.omit(params, ['postOnly']);
|
|
1060
1060
|
if (market['spot']) {
|
|
@@ -35,9 +35,13 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
35
35
|
'createLimitOrder': true,
|
|
36
36
|
'createMarketOrder': true,
|
|
37
37
|
'createOrder': true,
|
|
38
|
+
'createReduceOnlyOrder': true,
|
|
38
39
|
'createStopLimitOrder': true,
|
|
39
40
|
'createStopMarketOrder': true,
|
|
40
41
|
'createStopOrder': true,
|
|
42
|
+
'createTriggerOrder': true,
|
|
43
|
+
'createTrailingAmountOrder': true,
|
|
44
|
+
'createTrailingPercentOrder': false,
|
|
41
45
|
'editOrder': false,
|
|
42
46
|
'fetchBalance': true,
|
|
43
47
|
'fetchClosedOrder': true,
|
|
@@ -1492,94 +1496,81 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
1492
1496
|
/**
|
|
1493
1497
|
* @method
|
|
1494
1498
|
* @name bitfinex2#createOrder
|
|
1495
|
-
* @description
|
|
1499
|
+
* @description create an order on the exchange
|
|
1496
1500
|
* @see https://docs.bitfinex.com/reference/rest-auth-submit-order
|
|
1497
|
-
* @param {string} symbol
|
|
1501
|
+
* @param {string} symbol unified CCXT market symbol
|
|
1498
1502
|
* @param {string} type 'limit' or 'market'
|
|
1499
1503
|
* @param {string} side 'buy' or 'sell'
|
|
1500
1504
|
* @param {float} amount the amount of currency to trade
|
|
1501
|
-
* @param {float} [price] price of order
|
|
1502
|
-
* @param {object} [params]
|
|
1503
|
-
* @param {float} [params.stopPrice]
|
|
1505
|
+
* @param {float} [price] price of the order
|
|
1506
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1507
|
+
* @param {float} [params.stopPrice] the price that triggers a trigger order
|
|
1504
1508
|
* @param {string} [params.timeInForce] "GTC", "IOC", "FOK", or "PO"
|
|
1505
|
-
* @param {
|
|
1506
|
-
* @param {
|
|
1509
|
+
* @param {boolean} [params.postOnly] set to true if you want to make a post only order
|
|
1510
|
+
* @param {boolean} [params.reduceOnly] indicates that the order is to reduce the size of a position
|
|
1507
1511
|
* @param {int} [params.flags] additional order parameters: 4096 (Post Only), 1024 (Reduce Only), 16384 (OCO), 64 (Hidden), 512 (Close), 524288 (No Var Rates)
|
|
1508
1512
|
* @param {int} [params.lev] leverage for a derivative order, supported by derivative symbol orders only. The value should be between 1 and 100 inclusive.
|
|
1509
|
-
* @param {string} [params.
|
|
1510
|
-
* @param {string} [params.price_aux_limit] Order price for stop limit orders
|
|
1513
|
+
* @param {string} [params.price_aux_limit] order price for stop limit orders
|
|
1511
1514
|
* @param {string} [params.price_oco_stop] OCO stop price
|
|
1515
|
+
* @param {string} [params.trailingAmount] *swap only* the quote amount to trail away from the current market price
|
|
1512
1516
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1513
1517
|
*/
|
|
1514
1518
|
await this.loadMarkets();
|
|
1515
1519
|
const market = this.market(symbol);
|
|
1516
|
-
// order types "limit" and "market" immediatley parsed "EXCHANGE LIMIT" and "EXCHANGE MARKET"
|
|
1517
|
-
// note: same order types exist for margin orders without the EXCHANGE prefix
|
|
1518
|
-
const orderTypes = this.safeValue(this.options, 'orderTypes', {});
|
|
1519
|
-
let orderType = type.toUpperCase();
|
|
1520
|
-
if (market['spot']) {
|
|
1521
|
-
// although they claim that type needs to be 'exchange limit' or 'exchange market'
|
|
1522
|
-
// in fact that's not the case for swap markets
|
|
1523
|
-
orderType = this.safeStringUpper(orderTypes, type, type);
|
|
1524
|
-
}
|
|
1525
|
-
const stopPrice = this.safeString2(params, 'stopPrice', 'triggerPrice');
|
|
1526
|
-
const timeInForce = this.safeString(params, 'timeInForce');
|
|
1527
|
-
const postOnlyParam = this.safeValue(params, 'postOnly', false);
|
|
1528
|
-
const reduceOnly = this.safeValue(params, 'reduceOnly', false);
|
|
1529
|
-
const clientOrderId = this.safeValue2(params, 'cid', 'clientOrderId');
|
|
1530
|
-
params = this.omit(params, ['triggerPrice', 'stopPrice', 'timeInForce', 'postOnly', 'reduceOnly', 'price_aux_limit']);
|
|
1531
1520
|
let amountString = this.amountToPrecision(symbol, amount);
|
|
1532
1521
|
amountString = (side === 'buy') ? amountString : Precise["default"].stringNeg(amountString);
|
|
1533
1522
|
const request = {
|
|
1534
|
-
// 'gid': 0123456789, // int32, optional group id for the order
|
|
1535
|
-
// 'cid': 0123456789, // int32 client order id
|
|
1536
|
-
'type': orderType,
|
|
1537
1523
|
'symbol': market['id'],
|
|
1538
|
-
// 'price': this.numberToString (price),
|
|
1539
1524
|
'amount': amountString,
|
|
1540
|
-
// 'flags': 0, // int32, https://docs.bitfinex.com/v2/docs/flag-values
|
|
1541
|
-
// 'lev': 10, // leverage for a derivative orders, the value should be between 1 and 100 inclusive, optional, 10 by default
|
|
1542
|
-
// 'price_trailing': this.numberToString (priceTrailing),
|
|
1543
|
-
// 'price_aux_limit': this.numberToString (stopPrice),
|
|
1544
|
-
// 'price_oco_stop': this.numberToString (ocoStopPrice),
|
|
1545
|
-
// 'tif': '2020-01-01 10:45:23', // datetime for automatic order cancellation
|
|
1546
|
-
// 'meta': {
|
|
1547
|
-
// 'aff_code': 'AFF_CODE_HERE'
|
|
1548
|
-
// },
|
|
1549
1525
|
};
|
|
1550
|
-
const
|
|
1551
|
-
const
|
|
1552
|
-
const
|
|
1553
|
-
const
|
|
1554
|
-
const
|
|
1555
|
-
const
|
|
1526
|
+
const stopPrice = this.safeString2(params, 'stopPrice', 'triggerPrice');
|
|
1527
|
+
const trailingAmount = this.safeString(params, 'trailingAmount');
|
|
1528
|
+
const timeInForce = this.safeString(params, 'timeInForce');
|
|
1529
|
+
const postOnlyParam = this.safeBool(params, 'postOnly', false);
|
|
1530
|
+
const reduceOnly = this.safeBool(params, 'reduceOnly', false);
|
|
1531
|
+
const clientOrderId = this.safeValue2(params, 'cid', 'clientOrderId');
|
|
1532
|
+
params = this.omit(params, ['triggerPrice', 'stopPrice', 'timeInForce', 'postOnly', 'reduceOnly', 'trailingAmount', 'clientOrderId']);
|
|
1533
|
+
let orderType = type.toUpperCase();
|
|
1534
|
+
if (trailingAmount !== undefined) {
|
|
1535
|
+
orderType = 'TRAILING STOP';
|
|
1536
|
+
request['price_trailing'] = trailingAmount;
|
|
1537
|
+
}
|
|
1538
|
+
else if (stopPrice !== undefined) {
|
|
1539
|
+
// request['price'] is taken as stopPrice for stop orders
|
|
1540
|
+
request['price'] = this.priceToPrecision(symbol, stopPrice);
|
|
1541
|
+
if (type === 'limit') {
|
|
1542
|
+
orderType = 'STOP LIMIT';
|
|
1543
|
+
request['price_aux_limit'] = this.priceToPrecision(symbol, price);
|
|
1544
|
+
}
|
|
1545
|
+
else {
|
|
1546
|
+
orderType = 'STOP';
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
const ioc = (timeInForce === 'IOC');
|
|
1550
|
+
const fok = (timeInForce === 'FOK');
|
|
1556
1551
|
const postOnly = (postOnlyParam || (timeInForce === 'PO'));
|
|
1557
1552
|
if ((ioc || fok) && (price === undefined)) {
|
|
1558
1553
|
throw new errors.InvalidOrder(this.id + ' createOrder() requires a price argument with IOC and FOK orders');
|
|
1559
1554
|
}
|
|
1560
|
-
if ((ioc || fok) &&
|
|
1555
|
+
if ((ioc || fok) && (type === 'market')) {
|
|
1561
1556
|
throw new errors.InvalidOrder(this.id + ' createOrder() does not allow market IOC and FOK orders');
|
|
1562
1557
|
}
|
|
1563
|
-
if ((
|
|
1558
|
+
if ((type !== 'market') && (stopPrice === undefined)) {
|
|
1564
1559
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
1565
1560
|
}
|
|
1566
|
-
if (stopLimit || stopMarket) {
|
|
1567
|
-
// request['price'] is taken as stopPrice for stop orders
|
|
1568
|
-
request['price'] = this.priceToPrecision(symbol, stopPrice);
|
|
1569
|
-
if (stopMarket) {
|
|
1570
|
-
request['type'] = 'EXCHANGE STOP';
|
|
1571
|
-
}
|
|
1572
|
-
else if (stopLimit) {
|
|
1573
|
-
request['type'] = 'EXCHANGE STOP LIMIT';
|
|
1574
|
-
request['price_aux_limit'] = this.priceToPrecision(symbol, price);
|
|
1575
|
-
}
|
|
1576
|
-
}
|
|
1577
1561
|
if (ioc) {
|
|
1578
|
-
|
|
1562
|
+
orderType = 'IOC';
|
|
1579
1563
|
}
|
|
1580
1564
|
else if (fok) {
|
|
1581
|
-
|
|
1565
|
+
orderType = 'FOK';
|
|
1566
|
+
}
|
|
1567
|
+
let marginMode = undefined;
|
|
1568
|
+
[marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
|
|
1569
|
+
if (market['spot'] && (marginMode === undefined)) {
|
|
1570
|
+
// The EXCHANGE prefix is only required for non margin spot markets
|
|
1571
|
+
orderType = 'EXCHANGE ' + orderType;
|
|
1582
1572
|
}
|
|
1573
|
+
request['type'] = orderType;
|
|
1583
1574
|
// flag values may be summed to combine flags
|
|
1584
1575
|
let flags = 0;
|
|
1585
1576
|
if (postOnly) {
|
|
@@ -1593,7 +1584,6 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
1593
1584
|
}
|
|
1594
1585
|
if (clientOrderId !== undefined) {
|
|
1595
1586
|
request['cid'] = clientOrderId;
|
|
1596
|
-
params = this.omit(params, ['cid', 'clientOrderId']);
|
|
1597
1587
|
}
|
|
1598
1588
|
const response = await this.privatePostAuthWOrderSubmit(this.extend(request, params));
|
|
1599
1589
|
//
|
|
@@ -1649,8 +1639,8 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
1649
1639
|
const errorText = response[7];
|
|
1650
1640
|
throw new errors.ExchangeError(this.id + ' ' + response[6] + ': ' + errorText + ' (#' + errorCode + ')');
|
|
1651
1641
|
}
|
|
1652
|
-
const orders = this.
|
|
1653
|
-
const order = this.
|
|
1642
|
+
const orders = this.safeList(response, 4, []);
|
|
1643
|
+
const order = this.safeList(orders, 0);
|
|
1654
1644
|
return this.parseOrder(order, market);
|
|
1655
1645
|
}
|
|
1656
1646
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
@@ -2398,7 +2388,7 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
2398
2388
|
request['payment_id'] = tag;
|
|
2399
2389
|
}
|
|
2400
2390
|
const withdrawOptions = this.safeValue(this.options, 'withdraw', {});
|
|
2401
|
-
const includeFee = this.
|
|
2391
|
+
const includeFee = this.safeBool(withdrawOptions, 'includeFee', false);
|
|
2402
2392
|
if (includeFee) {
|
|
2403
2393
|
request['fee_deduct'] = 1;
|
|
2404
2394
|
}
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -66,6 +66,7 @@ class bitget extends bitget$1 {
|
|
|
66
66
|
'fetchCrossBorrowRate': true,
|
|
67
67
|
'fetchCrossBorrowRates': false,
|
|
68
68
|
'fetchCurrencies': true,
|
|
69
|
+
'fetchDeposit': false,
|
|
69
70
|
'fetchDepositAddress': true,
|
|
70
71
|
'fetchDepositAddresses': false,
|
|
71
72
|
'fetchDeposits': true,
|
|
@@ -95,6 +96,7 @@ class bitget extends bitget$1 {
|
|
|
95
96
|
'fetchOpenOrders': true,
|
|
96
97
|
'fetchOrder': true,
|
|
97
98
|
'fetchOrderBook': true,
|
|
99
|
+
'fetchOrderBooks': false,
|
|
98
100
|
'fetchOrders': false,
|
|
99
101
|
'fetchOrderTrades': false,
|
|
100
102
|
'fetchPosition': true,
|
|
@@ -102,6 +104,7 @@ class bitget extends bitget$1 {
|
|
|
102
104
|
'fetchPositions': true,
|
|
103
105
|
'fetchPositionsRisk': false,
|
|
104
106
|
'fetchPremiumIndexOHLCV': false,
|
|
107
|
+
'fetchStatus': false,
|
|
105
108
|
'fetchTicker': true,
|
|
106
109
|
'fetchTickers': true,
|
|
107
110
|
'fetchTime': true,
|
|
@@ -118,6 +121,7 @@ class bitget extends bitget$1 {
|
|
|
118
121
|
'repayCrossMargin': true,
|
|
119
122
|
'repayIsolatedMargin': true,
|
|
120
123
|
'setLeverage': true,
|
|
124
|
+
'setMargin': false,
|
|
121
125
|
'setMarginMode': true,
|
|
122
126
|
'setPositionMode': true,
|
|
123
127
|
'signIn': false,
|
|
@@ -2235,7 +2239,7 @@ class bitget extends bitget$1 {
|
|
|
2235
2239
|
'fee': undefined,
|
|
2236
2240
|
};
|
|
2237
2241
|
const withdrawOptions = this.safeValue(this.options, 'withdraw', {});
|
|
2238
|
-
const fillResponseFromRequest = this.
|
|
2242
|
+
const fillResponseFromRequest = this.safeBool(withdrawOptions, 'fillResponseFromRequest', true);
|
|
2239
2243
|
if (fillResponseFromRequest) {
|
|
2240
2244
|
result['currency'] = code;
|
|
2241
2245
|
result['timestamp'] = this.milliseconds();
|
|
@@ -3120,7 +3124,7 @@ class bitget extends bitget$1 {
|
|
|
3120
3124
|
[marginMode, params] = this.handleMarginModeAndParams('fetchTradingFees', params);
|
|
3121
3125
|
[marketType, params] = this.handleMarketTypeAndParams('fetchTradingFees', undefined, params);
|
|
3122
3126
|
if (marketType === 'spot') {
|
|
3123
|
-
const margin = this.
|
|
3127
|
+
const margin = this.safeBool(params, 'margin', false);
|
|
3124
3128
|
params = this.omit(params, 'margin');
|
|
3125
3129
|
if ((marginMode !== undefined) || margin) {
|
|
3126
3130
|
response = await this.publicMarginGetV2MarginCurrencies(params);
|
|
@@ -4141,7 +4145,7 @@ class bitget extends bitget$1 {
|
|
|
4141
4145
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
4142
4146
|
}
|
|
4143
4147
|
const triggerType = this.safeString(params, 'triggerType', 'mark_price');
|
|
4144
|
-
const reduceOnly = this.
|
|
4148
|
+
const reduceOnly = this.safeBool(params, 'reduceOnly', false);
|
|
4145
4149
|
const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
|
|
4146
4150
|
const exchangeSpecificTifParam = this.safeString2(params, 'force', 'timeInForce');
|
|
4147
4151
|
let postOnly = undefined;
|
|
@@ -4237,7 +4241,7 @@ class bitget extends bitget$1 {
|
|
|
4237
4241
|
}
|
|
4238
4242
|
const marginModeRequest = (marginMode === 'cross') ? 'crossed' : 'isolated';
|
|
4239
4243
|
request['marginMode'] = marginModeRequest;
|
|
4240
|
-
const oneWayMode = this.
|
|
4244
|
+
const oneWayMode = this.safeBool(params, 'oneWayMode', false);
|
|
4241
4245
|
params = this.omit(params, 'oneWayMode');
|
|
4242
4246
|
let requestSide = side;
|
|
4243
4247
|
if (reduceOnly) {
|
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -1936,7 +1936,7 @@ class bitmart extends bitmart$1 {
|
|
|
1936
1936
|
let marketType = undefined;
|
|
1937
1937
|
[marketType, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
|
|
1938
1938
|
const marginMode = this.safeString(params, 'marginMode');
|
|
1939
|
-
const isMargin = this.
|
|
1939
|
+
const isMargin = this.safeBool(params, 'margin', false);
|
|
1940
1940
|
params = this.omit(params, ['margin', 'marginMode']);
|
|
1941
1941
|
if (marginMode !== undefined || isMargin) {
|
|
1942
1942
|
marketType = 'margin';
|
|
@@ -2810,7 +2810,7 @@ class bitmart extends bitmart$1 {
|
|
|
2810
2810
|
response = await this.privateGetContractPrivateCurrentPlanOrder(this.extend(request, params));
|
|
2811
2811
|
}
|
|
2812
2812
|
else {
|
|
2813
|
-
const trailing = this.
|
|
2813
|
+
const trailing = this.safeBool(params, 'trailing', false);
|
|
2814
2814
|
let orderType = this.safeString(params, 'orderType');
|
|
2815
2815
|
params = this.omit(params, ['orderType', 'trailing']);
|
|
2816
2816
|
if (trailing) {
|
|
@@ -2990,7 +2990,7 @@ class bitmart extends bitmart$1 {
|
|
|
2990
2990
|
if (symbol === undefined) {
|
|
2991
2991
|
throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
2992
2992
|
}
|
|
2993
|
-
const trailing = this.
|
|
2993
|
+
const trailing = this.safeBool(params, 'trailing', false);
|
|
2994
2994
|
let orderType = this.safeString(params, 'orderType');
|
|
2995
2995
|
params = this.omit(params, ['orderType', 'trailing']);
|
|
2996
2996
|
if (trailing) {
|
package/dist/cjs/src/bitmex.js
CHANGED
|
@@ -101,7 +101,7 @@ class bitmex extends bitmex$1 {
|
|
|
101
101
|
'public': 'https://testnet.bitmex.com',
|
|
102
102
|
'private': 'https://testnet.bitmex.com',
|
|
103
103
|
},
|
|
104
|
-
'logo': 'https://
|
|
104
|
+
'logo': 'https://github.com/ccxt/ccxt/assets/43336371/cea9cfe5-c57e-4b84-b2ac-77b960b04445',
|
|
105
105
|
'api': {
|
|
106
106
|
'public': 'https://www.bitmex.com',
|
|
107
107
|
'private': 'https://www.bitmex.com',
|
|
@@ -112,7 +112,10 @@ class bitmex extends bitmex$1 {
|
|
|
112
112
|
'https://github.com/BitMEX/api-connectors/tree/master/official-http',
|
|
113
113
|
],
|
|
114
114
|
'fees': 'https://www.bitmex.com/app/fees',
|
|
115
|
-
'referral':
|
|
115
|
+
'referral': {
|
|
116
|
+
'url': 'https://www.bitmex.com/app/register/NZTR1q',
|
|
117
|
+
'discount': 0.1,
|
|
118
|
+
},
|
|
116
119
|
},
|
|
117
120
|
'api': {
|
|
118
121
|
'public': {
|
|
@@ -336,8 +339,8 @@ class bitmex extends bitmex$1 {
|
|
|
336
339
|
const network = this.networkIdToCode(networkId);
|
|
337
340
|
const withdrawalFeeRaw = this.safeString(chain, 'withdrawalFee');
|
|
338
341
|
const withdrawalFee = this.parseNumber(Precise["default"].stringMul(withdrawalFeeRaw, precisionString));
|
|
339
|
-
const isDepositEnabled = this.
|
|
340
|
-
const isWithdrawEnabled = this.
|
|
342
|
+
const isDepositEnabled = this.safeBool(chain, 'depositEnabled', false);
|
|
343
|
+
const isWithdrawEnabled = this.safeBool(chain, 'withdrawalEnabled', false);
|
|
341
344
|
const active = (isDepositEnabled && isWithdrawEnabled);
|
|
342
345
|
if (isDepositEnabled) {
|
|
343
346
|
depositEnabled = true;
|
|
@@ -1713,7 +1716,7 @@ class bitmex extends bitmex$1 {
|
|
|
1713
1716
|
isInverse = (defaultSubType === 'inverse');
|
|
1714
1717
|
}
|
|
1715
1718
|
else {
|
|
1716
|
-
isInverse = this.
|
|
1719
|
+
isInverse = this.safeBool(market, 'inverse', false);
|
|
1717
1720
|
}
|
|
1718
1721
|
if (isInverse) {
|
|
1719
1722
|
cost = this.convertFromRawQuantity(symbol, qty);
|
|
@@ -2420,7 +2423,7 @@ class bitmex extends bitmex$1 {
|
|
|
2420
2423
|
const item = response[i];
|
|
2421
2424
|
const marketId = this.safeString(item, 'symbol');
|
|
2422
2425
|
const market = this.safeMarket(marketId);
|
|
2423
|
-
const swap = this.
|
|
2426
|
+
const swap = this.safeBool(market, 'swap', false);
|
|
2424
2427
|
if (swap) {
|
|
2425
2428
|
filteredResponse.push(item);
|
|
2426
2429
|
}
|
package/dist/cjs/src/bitrue.js
CHANGED
|
@@ -3188,7 +3188,7 @@ class bitrue extends bitrue$1 {
|
|
|
3188
3188
|
}
|
|
3189
3189
|
// check success value for wapi endpoints
|
|
3190
3190
|
// response in format {'msg': 'The coin does not exist.', 'success': true/false}
|
|
3191
|
-
const success = this.
|
|
3191
|
+
const success = this.safeBool(response, 'success', true);
|
|
3192
3192
|
if (!success) {
|
|
3193
3193
|
const messageInner = this.safeString(response, 'msg');
|
|
3194
3194
|
let parsedMessage = undefined;
|
package/dist/cjs/src/bitso.js
CHANGED
|
@@ -1726,7 +1726,7 @@ class bitso extends bitso$1 {
|
|
|
1726
1726
|
//
|
|
1727
1727
|
// {"success":false,"error":{"code":104,"message":"Cannot perform request - nonce must be higher than 1520307203724237"}}
|
|
1728
1728
|
//
|
|
1729
|
-
let success = this.
|
|
1729
|
+
let success = this.safeBool(response, 'success', false);
|
|
1730
1730
|
if (typeof success === 'string') {
|
|
1731
1731
|
if ((success === 'true') || (success === '1')) {
|
|
1732
1732
|
success = true;
|
package/dist/cjs/src/bitteam.js
CHANGED
|
@@ -353,7 +353,7 @@ class bitteam extends bitteam$1 {
|
|
|
353
353
|
const created = this.parse8601(timeStart);
|
|
354
354
|
let minCost = undefined;
|
|
355
355
|
const currenciesValuedInUsd = this.safeValue(this.options, 'currenciesValuedInUsd', {});
|
|
356
|
-
const quoteInUsd = this.
|
|
356
|
+
const quoteInUsd = this.safeBool(currenciesValuedInUsd, quote, false);
|
|
357
357
|
if (quoteInUsd) {
|
|
358
358
|
const settings = this.safeValue(market, 'settings', {});
|
|
359
359
|
minCost = this.safeNumber(settings, 'limit_usd');
|
|
@@ -540,7 +540,7 @@ class bitteam extends bitteam$1 {
|
|
|
540
540
|
const id = this.safeString(currency, 'symbol');
|
|
541
541
|
const numericId = this.safeInteger(currency, 'id');
|
|
542
542
|
const code = this.safeCurrencyCode(id);
|
|
543
|
-
const active = this.
|
|
543
|
+
const active = this.safeBool(currency, 'active', false);
|
|
544
544
|
const precision = this.safeInteger(currency, 'precision');
|
|
545
545
|
const txLimits = this.safeValue(currency, 'txLimits', {});
|
|
546
546
|
const minWithdraw = this.safeString(txLimits, 'minWithdraw');
|
package/dist/cjs/src/btcalpha.js
CHANGED
|
@@ -677,7 +677,7 @@ class btcalpha extends btcalpha$1 {
|
|
|
677
677
|
const marketId = this.safeString(order, 'pair');
|
|
678
678
|
market = this.safeMarket(marketId, market, '_');
|
|
679
679
|
const symbol = market['symbol'];
|
|
680
|
-
const success = this.
|
|
680
|
+
const success = this.safeBool(order, 'success', false);
|
|
681
681
|
let timestamp = undefined;
|
|
682
682
|
if (success) {
|
|
683
683
|
timestamp = this.safeTimestamp(order, 'date');
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -296,8 +296,6 @@ class bybit extends bybit$1 {
|
|
|
296
296
|
// account
|
|
297
297
|
'v5/account/wallet-balance': 1,
|
|
298
298
|
'v5/account/borrow-history': 1,
|
|
299
|
-
'v5/account/set-collateral-switch': 5,
|
|
300
|
-
'v5/account/set-collateral-switch-batch': 5,
|
|
301
299
|
'v5/account/collateral-info': 1,
|
|
302
300
|
'v5/asset/coin-greeks': 1,
|
|
303
301
|
'v5/account/fee-rate': 10,
|
|
@@ -490,6 +488,8 @@ class bybit extends bybit$1 {
|
|
|
490
488
|
'v5/lending/purchase': 5,
|
|
491
489
|
'v5/lending/redeem': 5,
|
|
492
490
|
'v5/lending/redeem-cancel': 5,
|
|
491
|
+
'v5/account/set-collateral-switch': 5,
|
|
492
|
+
'v5/account/set-collateral-switch-batch': 5,
|
|
493
493
|
},
|
|
494
494
|
},
|
|
495
495
|
},
|
|
@@ -854,6 +854,7 @@ class bybit extends bybit$1 {
|
|
|
854
854
|
'181003': errors.InvalidOrder,
|
|
855
855
|
'181004': errors.InvalidOrder,
|
|
856
856
|
'182000': errors.InvalidOrder,
|
|
857
|
+
'181017': errors.BadRequest,
|
|
857
858
|
'20001': errors.OrderNotFound,
|
|
858
859
|
'20003': errors.InvalidOrder,
|
|
859
860
|
'20004': errors.InvalidOrder,
|
|
@@ -3346,16 +3347,31 @@ class bybit extends bybit$1 {
|
|
|
3346
3347
|
let fee = undefined;
|
|
3347
3348
|
const feeCostString = this.safeString(order, 'cumExecFee');
|
|
3348
3349
|
if (feeCostString !== undefined) {
|
|
3349
|
-
let
|
|
3350
|
+
let feeCurrencyCode = undefined;
|
|
3350
3351
|
if (market['spot']) {
|
|
3351
|
-
|
|
3352
|
+
if (Precise["default"].stringGt(feeCostString, '0')) {
|
|
3353
|
+
if (side === 'buy') {
|
|
3354
|
+
feeCurrencyCode = market['base'];
|
|
3355
|
+
}
|
|
3356
|
+
else {
|
|
3357
|
+
feeCurrencyCode = market['quote'];
|
|
3358
|
+
}
|
|
3359
|
+
}
|
|
3360
|
+
else {
|
|
3361
|
+
if (side === 'buy') {
|
|
3362
|
+
feeCurrencyCode = market['quote'];
|
|
3363
|
+
}
|
|
3364
|
+
else {
|
|
3365
|
+
feeCurrencyCode = market['base'];
|
|
3366
|
+
}
|
|
3367
|
+
}
|
|
3352
3368
|
}
|
|
3353
3369
|
else {
|
|
3354
|
-
|
|
3370
|
+
feeCurrencyCode = market['inverse'] ? market['base'] : market['settle'];
|
|
3355
3371
|
}
|
|
3356
3372
|
fee = {
|
|
3357
3373
|
'cost': feeCostString,
|
|
3358
|
-
'currency':
|
|
3374
|
+
'currency': feeCurrencyCode,
|
|
3359
3375
|
};
|
|
3360
3376
|
}
|
|
3361
3377
|
let clientOrderId = this.safeString(order, 'orderLinkId');
|
|
@@ -3443,7 +3459,7 @@ class bybit extends bybit$1 {
|
|
|
3443
3459
|
const result = await this.fetchOrders(symbol, undefined, undefined, this.extend(request, params));
|
|
3444
3460
|
const length = result.length;
|
|
3445
3461
|
if (length === 0) {
|
|
3446
|
-
const isTrigger = this.
|
|
3462
|
+
const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
|
|
3447
3463
|
const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
|
|
3448
3464
|
throw new errors.OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
|
|
3449
3465
|
}
|
|
@@ -4515,7 +4531,7 @@ class bybit extends bybit$1 {
|
|
|
4515
4531
|
return await this.fetchUsdcOrders(symbol, since, limit, params);
|
|
4516
4532
|
}
|
|
4517
4533
|
request['category'] = type;
|
|
4518
|
-
const isStop = this.
|
|
4534
|
+
const isStop = this.safeBoolN(params, ['trigger', 'stop'], false);
|
|
4519
4535
|
params = this.omit(params, ['trigger', 'stop']);
|
|
4520
4536
|
if (isStop) {
|
|
4521
4537
|
request['orderFilter'] = 'StopOrder';
|
|
@@ -5673,10 +5689,10 @@ class bybit extends bybit$1 {
|
|
|
5673
5689
|
// "time": 1672280219169
|
|
5674
5690
|
// }
|
|
5675
5691
|
//
|
|
5676
|
-
const result = this.
|
|
5677
|
-
const positions = this.
|
|
5692
|
+
const result = this.safeDict(response, 'result', {});
|
|
5693
|
+
const positions = this.safeList2(result, 'list', 'dataList', []);
|
|
5678
5694
|
const timestamp = this.safeInteger(response, 'time');
|
|
5679
|
-
const first = this.
|
|
5695
|
+
const first = this.safeDict(positions, 0, {});
|
|
5680
5696
|
const position = this.parsePosition(first, market);
|
|
5681
5697
|
position['timestamp'] = timestamp;
|
|
5682
5698
|
position['datetime'] = this.iso8601(timestamp);
|
|
@@ -6422,7 +6438,7 @@ class bybit extends bybit$1 {
|
|
|
6422
6438
|
throw new errors.BadRequest(this.id + 'fetchOpenInterestHistory cannot use the 1m timeframe');
|
|
6423
6439
|
}
|
|
6424
6440
|
await this.loadMarkets();
|
|
6425
|
-
const paginate = this.
|
|
6441
|
+
const paginate = this.safeBool(params, 'paginate');
|
|
6426
6442
|
if (paginate) {
|
|
6427
6443
|
params = this.omit(params, 'paginate');
|
|
6428
6444
|
return await this.fetchPaginatedCallDeterministic('fetchOpenInterestHistory', symbol, since, limit, timeframe, params, 500);
|
package/dist/cjs/src/coinbase.js
CHANGED
|
@@ -1361,7 +1361,11 @@ class coinbase extends coinbase$1 {
|
|
|
1361
1361
|
async fetchTickersV3(symbols = undefined, params = {}) {
|
|
1362
1362
|
await this.loadMarkets();
|
|
1363
1363
|
symbols = this.marketSymbols(symbols);
|
|
1364
|
-
const
|
|
1364
|
+
const request = {};
|
|
1365
|
+
if (symbols !== undefined) {
|
|
1366
|
+
request['product_ids'] = this.marketIds(symbols);
|
|
1367
|
+
}
|
|
1368
|
+
const response = await this.v3PrivateGetBrokerageProducts(this.extend(request, params));
|
|
1365
1369
|
//
|
|
1366
1370
|
// {
|
|
1367
1371
|
// "products": [
|
|
@@ -1679,7 +1683,7 @@ class coinbase extends coinbase$1 {
|
|
|
1679
1683
|
'limit': 250,
|
|
1680
1684
|
};
|
|
1681
1685
|
let response = undefined;
|
|
1682
|
-
const isV3 = this.
|
|
1686
|
+
const isV3 = this.safeBool(params, 'v3', false);
|
|
1683
1687
|
params = this.omit(params, 'v3');
|
|
1684
1688
|
const method = this.safeString(this.options, 'fetchBalance', 'v3PrivateGetBrokerageAccounts');
|
|
1685
1689
|
if ((isV3) || (method === 'v3PrivateGetBrokerageAccounts')) {
|
|
@@ -3195,8 +3199,11 @@ class coinbase extends coinbase$1 {
|
|
|
3195
3199
|
*/
|
|
3196
3200
|
await this.loadMarkets();
|
|
3197
3201
|
symbols = this.marketSymbols(symbols);
|
|
3198
|
-
|
|
3199
|
-
|
|
3202
|
+
const request = {};
|
|
3203
|
+
if (symbols !== undefined) {
|
|
3204
|
+
request['product_ids'] = this.marketIds(symbols);
|
|
3205
|
+
}
|
|
3206
|
+
const response = await this.v3PrivateGetBrokerageBestBidAsk(this.extend(request, params));
|
|
3200
3207
|
//
|
|
3201
3208
|
// {
|
|
3202
3209
|
// "pricebooks": [
|
|
@@ -3325,7 +3332,7 @@ class coinbase extends coinbase$1 {
|
|
|
3325
3332
|
const savedPath = fullPath;
|
|
3326
3333
|
if (method === 'GET') {
|
|
3327
3334
|
if (Object.keys(query).length) {
|
|
3328
|
-
fullPath += '?' + this.
|
|
3335
|
+
fullPath += '?' + this.urlencodeWithArrayRepeat(query);
|
|
3329
3336
|
}
|
|
3330
3337
|
}
|
|
3331
3338
|
const url = this.urls['api']['rest'] + fullPath;
|
|
@@ -829,7 +829,7 @@ class coincheck extends coincheck$1 {
|
|
|
829
829
|
// {"success":false,"error":"disabled API Key"}'
|
|
830
830
|
// {"success":false,"error":"invalid authentication"}
|
|
831
831
|
//
|
|
832
|
-
const success = this.
|
|
832
|
+
const success = this.safeBool(response, 'success', true);
|
|
833
833
|
if (!success) {
|
|
834
834
|
const error = this.safeString(response, 'error');
|
|
835
835
|
const feedback = this.id + ' ' + this.json(response);
|
package/dist/cjs/src/coinex.js
CHANGED
|
@@ -3324,7 +3324,7 @@ class coinex extends coinex$1 {
|
|
|
3324
3324
|
const data = this.safeValue(response, 'data', {});
|
|
3325
3325
|
const depositAddress = this.parseDepositAddress(data, currency);
|
|
3326
3326
|
const options = this.safeValue(this.options, 'fetchDepositAddress', {});
|
|
3327
|
-
const fillResponseFromRequest = this.
|
|
3327
|
+
const fillResponseFromRequest = this.safeBool(options, 'fillResponseFromRequest', true);
|
|
3328
3328
|
if (fillResponseFromRequest) {
|
|
3329
3329
|
depositAddress['network'] = this.safeNetworkCode(network, currency);
|
|
3330
3330
|
}
|
|
@@ -5351,7 +5351,7 @@ class coinex extends coinex$1 {
|
|
|
5351
5351
|
* @returns {Array} the marginMode in lowercase
|
|
5352
5352
|
*/
|
|
5353
5353
|
const defaultType = this.safeString(this.options, 'defaultType');
|
|
5354
|
-
const isMargin = this.
|
|
5354
|
+
const isMargin = this.safeBool(params, 'margin', false);
|
|
5355
5355
|
let marginMode = undefined;
|
|
5356
5356
|
[marginMode, params] = super.handleMarginModeAndParams(methodName, params, defaultValue);
|
|
5357
5357
|
if (marginMode === undefined) {
|
package/dist/cjs/src/coinlist.js
CHANGED
|
@@ -361,7 +361,7 @@ class coinlist extends coinlist$1 {
|
|
|
361
361
|
const currency = currencies[i];
|
|
362
362
|
const id = this.safeString(currency, 'asset');
|
|
363
363
|
const code = this.safeCurrencyCode(id);
|
|
364
|
-
const isTransferable = this.
|
|
364
|
+
const isTransferable = this.safeBool(currency, 'is_transferable', false);
|
|
365
365
|
const withdrawEnabled = isTransferable;
|
|
366
366
|
const depositEnabled = isTransferable;
|
|
367
367
|
const active = isTransferable;
|
package/dist/cjs/src/coinmate.js
CHANGED
|
@@ -541,7 +541,7 @@ class coinmate extends coinmate$1 {
|
|
|
541
541
|
//
|
|
542
542
|
const data = this.safeValue(response, 'data');
|
|
543
543
|
const transaction = this.parseTransaction(data, currency);
|
|
544
|
-
const fillResponseFromRequest = this.
|
|
544
|
+
const fillResponseFromRequest = this.safeBool(withdrawOptions, 'fillResponseFromRequest', true);
|
|
545
545
|
if (fillResponseFromRequest) {
|
|
546
546
|
transaction['amount'] = amount;
|
|
547
547
|
transaction['currency'] = code;
|