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/js/src/bingx.js
CHANGED
|
@@ -1845,7 +1845,7 @@ export default class bingx extends Exchange {
|
|
|
1845
1845
|
if (((type === 'LIMIT') || (type === 'TRIGGER_LIMIT') || (type === 'STOP') || (type === 'TAKE_PROFIT')) && !isTrailing) {
|
|
1846
1846
|
request['price'] = this.parseToNumeric(this.priceToPrecision(symbol, price));
|
|
1847
1847
|
}
|
|
1848
|
-
let reduceOnly = this.
|
|
1848
|
+
let reduceOnly = this.safeBool(params, 'reduceOnly', false);
|
|
1849
1849
|
if (isTriggerOrder) {
|
|
1850
1850
|
request['stopPrice'] = this.parseToNumeric(this.priceToPrecision(symbol, triggerPrice));
|
|
1851
1851
|
if (isMarketOrder || (type === 'TRIGGER_MARKET')) {
|
package/js/src/bitfinex.js
CHANGED
|
@@ -1057,7 +1057,7 @@ export default class bitfinex extends Exchange {
|
|
|
1057
1057
|
*/
|
|
1058
1058
|
await this.loadMarkets();
|
|
1059
1059
|
const market = this.market(symbol);
|
|
1060
|
-
const postOnly = this.
|
|
1060
|
+
const postOnly = this.safeBool(params, 'postOnly', false);
|
|
1061
1061
|
type = type.toLowerCase();
|
|
1062
1062
|
params = this.omit(params, ['postOnly']);
|
|
1063
1063
|
if (market['spot']) {
|
package/js/src/bitfinex2.js
CHANGED
|
@@ -38,9 +38,13 @@ export default class bitfinex2 extends Exchange {
|
|
|
38
38
|
'createLimitOrder': true,
|
|
39
39
|
'createMarketOrder': true,
|
|
40
40
|
'createOrder': true,
|
|
41
|
+
'createReduceOnlyOrder': true,
|
|
41
42
|
'createStopLimitOrder': true,
|
|
42
43
|
'createStopMarketOrder': true,
|
|
43
44
|
'createStopOrder': true,
|
|
45
|
+
'createTriggerOrder': true,
|
|
46
|
+
'createTrailingAmountOrder': true,
|
|
47
|
+
'createTrailingPercentOrder': false,
|
|
44
48
|
'editOrder': false,
|
|
45
49
|
'fetchBalance': true,
|
|
46
50
|
'fetchClosedOrder': true,
|
|
@@ -1495,94 +1499,81 @@ export default class bitfinex2 extends Exchange {
|
|
|
1495
1499
|
/**
|
|
1496
1500
|
* @method
|
|
1497
1501
|
* @name bitfinex2#createOrder
|
|
1498
|
-
* @description
|
|
1502
|
+
* @description create an order on the exchange
|
|
1499
1503
|
* @see https://docs.bitfinex.com/reference/rest-auth-submit-order
|
|
1500
|
-
* @param {string} symbol
|
|
1504
|
+
* @param {string} symbol unified CCXT market symbol
|
|
1501
1505
|
* @param {string} type 'limit' or 'market'
|
|
1502
1506
|
* @param {string} side 'buy' or 'sell'
|
|
1503
1507
|
* @param {float} amount the amount of currency to trade
|
|
1504
|
-
* @param {float} [price] price of order
|
|
1505
|
-
* @param {object} [params]
|
|
1506
|
-
* @param {float} [params.stopPrice]
|
|
1508
|
+
* @param {float} [price] price of the order
|
|
1509
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1510
|
+
* @param {float} [params.stopPrice] the price that triggers a trigger order
|
|
1507
1511
|
* @param {string} [params.timeInForce] "GTC", "IOC", "FOK", or "PO"
|
|
1508
|
-
* @param {
|
|
1509
|
-
* @param {
|
|
1512
|
+
* @param {boolean} [params.postOnly] set to true if you want to make a post only order
|
|
1513
|
+
* @param {boolean} [params.reduceOnly] indicates that the order is to reduce the size of a position
|
|
1510
1514
|
* @param {int} [params.flags] additional order parameters: 4096 (Post Only), 1024 (Reduce Only), 16384 (OCO), 64 (Hidden), 512 (Close), 524288 (No Var Rates)
|
|
1511
1515
|
* @param {int} [params.lev] leverage for a derivative order, supported by derivative symbol orders only. The value should be between 1 and 100 inclusive.
|
|
1512
|
-
* @param {string} [params.
|
|
1513
|
-
* @param {string} [params.price_aux_limit] Order price for stop limit orders
|
|
1516
|
+
* @param {string} [params.price_aux_limit] order price for stop limit orders
|
|
1514
1517
|
* @param {string} [params.price_oco_stop] OCO stop price
|
|
1518
|
+
* @param {string} [params.trailingAmount] *swap only* the quote amount to trail away from the current market price
|
|
1515
1519
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1516
1520
|
*/
|
|
1517
1521
|
await this.loadMarkets();
|
|
1518
1522
|
const market = this.market(symbol);
|
|
1519
|
-
// order types "limit" and "market" immediatley parsed "EXCHANGE LIMIT" and "EXCHANGE MARKET"
|
|
1520
|
-
// note: same order types exist for margin orders without the EXCHANGE prefix
|
|
1521
|
-
const orderTypes = this.safeValue(this.options, 'orderTypes', {});
|
|
1522
|
-
let orderType = type.toUpperCase();
|
|
1523
|
-
if (market['spot']) {
|
|
1524
|
-
// although they claim that type needs to be 'exchange limit' or 'exchange market'
|
|
1525
|
-
// in fact that's not the case for swap markets
|
|
1526
|
-
orderType = this.safeStringUpper(orderTypes, type, type);
|
|
1527
|
-
}
|
|
1528
|
-
const stopPrice = this.safeString2(params, 'stopPrice', 'triggerPrice');
|
|
1529
|
-
const timeInForce = this.safeString(params, 'timeInForce');
|
|
1530
|
-
const postOnlyParam = this.safeValue(params, 'postOnly', false);
|
|
1531
|
-
const reduceOnly = this.safeValue(params, 'reduceOnly', false);
|
|
1532
|
-
const clientOrderId = this.safeValue2(params, 'cid', 'clientOrderId');
|
|
1533
|
-
params = this.omit(params, ['triggerPrice', 'stopPrice', 'timeInForce', 'postOnly', 'reduceOnly', 'price_aux_limit']);
|
|
1534
1523
|
let amountString = this.amountToPrecision(symbol, amount);
|
|
1535
1524
|
amountString = (side === 'buy') ? amountString : Precise.stringNeg(amountString);
|
|
1536
1525
|
const request = {
|
|
1537
|
-
// 'gid': 0123456789, // int32, optional group id for the order
|
|
1538
|
-
// 'cid': 0123456789, // int32 client order id
|
|
1539
|
-
'type': orderType,
|
|
1540
1526
|
'symbol': market['id'],
|
|
1541
|
-
// 'price': this.numberToString (price),
|
|
1542
1527
|
'amount': amountString,
|
|
1543
|
-
// 'flags': 0, // int32, https://docs.bitfinex.com/v2/docs/flag-values
|
|
1544
|
-
// 'lev': 10, // leverage for a derivative orders, the value should be between 1 and 100 inclusive, optional, 10 by default
|
|
1545
|
-
// 'price_trailing': this.numberToString (priceTrailing),
|
|
1546
|
-
// 'price_aux_limit': this.numberToString (stopPrice),
|
|
1547
|
-
// 'price_oco_stop': this.numberToString (ocoStopPrice),
|
|
1548
|
-
// 'tif': '2020-01-01 10:45:23', // datetime for automatic order cancellation
|
|
1549
|
-
// 'meta': {
|
|
1550
|
-
// 'aff_code': 'AFF_CODE_HERE'
|
|
1551
|
-
// },
|
|
1552
1528
|
};
|
|
1553
|
-
const
|
|
1554
|
-
const
|
|
1555
|
-
const
|
|
1556
|
-
const
|
|
1557
|
-
const
|
|
1558
|
-
const
|
|
1529
|
+
const stopPrice = this.safeString2(params, 'stopPrice', 'triggerPrice');
|
|
1530
|
+
const trailingAmount = this.safeString(params, 'trailingAmount');
|
|
1531
|
+
const timeInForce = this.safeString(params, 'timeInForce');
|
|
1532
|
+
const postOnlyParam = this.safeBool(params, 'postOnly', false);
|
|
1533
|
+
const reduceOnly = this.safeBool(params, 'reduceOnly', false);
|
|
1534
|
+
const clientOrderId = this.safeValue2(params, 'cid', 'clientOrderId');
|
|
1535
|
+
params = this.omit(params, ['triggerPrice', 'stopPrice', 'timeInForce', 'postOnly', 'reduceOnly', 'trailingAmount', 'clientOrderId']);
|
|
1536
|
+
let orderType = type.toUpperCase();
|
|
1537
|
+
if (trailingAmount !== undefined) {
|
|
1538
|
+
orderType = 'TRAILING STOP';
|
|
1539
|
+
request['price_trailing'] = trailingAmount;
|
|
1540
|
+
}
|
|
1541
|
+
else if (stopPrice !== undefined) {
|
|
1542
|
+
// request['price'] is taken as stopPrice for stop orders
|
|
1543
|
+
request['price'] = this.priceToPrecision(symbol, stopPrice);
|
|
1544
|
+
if (type === 'limit') {
|
|
1545
|
+
orderType = 'STOP LIMIT';
|
|
1546
|
+
request['price_aux_limit'] = this.priceToPrecision(symbol, price);
|
|
1547
|
+
}
|
|
1548
|
+
else {
|
|
1549
|
+
orderType = 'STOP';
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
const ioc = (timeInForce === 'IOC');
|
|
1553
|
+
const fok = (timeInForce === 'FOK');
|
|
1559
1554
|
const postOnly = (postOnlyParam || (timeInForce === 'PO'));
|
|
1560
1555
|
if ((ioc || fok) && (price === undefined)) {
|
|
1561
1556
|
throw new InvalidOrder(this.id + ' createOrder() requires a price argument with IOC and FOK orders');
|
|
1562
1557
|
}
|
|
1563
|
-
if ((ioc || fok) &&
|
|
1558
|
+
if ((ioc || fok) && (type === 'market')) {
|
|
1564
1559
|
throw new InvalidOrder(this.id + ' createOrder() does not allow market IOC and FOK orders');
|
|
1565
1560
|
}
|
|
1566
|
-
if ((
|
|
1561
|
+
if ((type !== 'market') && (stopPrice === undefined)) {
|
|
1567
1562
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
1568
1563
|
}
|
|
1569
|
-
if (stopLimit || stopMarket) {
|
|
1570
|
-
// request['price'] is taken as stopPrice for stop orders
|
|
1571
|
-
request['price'] = this.priceToPrecision(symbol, stopPrice);
|
|
1572
|
-
if (stopMarket) {
|
|
1573
|
-
request['type'] = 'EXCHANGE STOP';
|
|
1574
|
-
}
|
|
1575
|
-
else if (stopLimit) {
|
|
1576
|
-
request['type'] = 'EXCHANGE STOP LIMIT';
|
|
1577
|
-
request['price_aux_limit'] = this.priceToPrecision(symbol, price);
|
|
1578
|
-
}
|
|
1579
|
-
}
|
|
1580
1564
|
if (ioc) {
|
|
1581
|
-
|
|
1565
|
+
orderType = 'IOC';
|
|
1582
1566
|
}
|
|
1583
1567
|
else if (fok) {
|
|
1584
|
-
|
|
1568
|
+
orderType = 'FOK';
|
|
1569
|
+
}
|
|
1570
|
+
let marginMode = undefined;
|
|
1571
|
+
[marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
|
|
1572
|
+
if (market['spot'] && (marginMode === undefined)) {
|
|
1573
|
+
// The EXCHANGE prefix is only required for non margin spot markets
|
|
1574
|
+
orderType = 'EXCHANGE ' + orderType;
|
|
1585
1575
|
}
|
|
1576
|
+
request['type'] = orderType;
|
|
1586
1577
|
// flag values may be summed to combine flags
|
|
1587
1578
|
let flags = 0;
|
|
1588
1579
|
if (postOnly) {
|
|
@@ -1596,7 +1587,6 @@ export default class bitfinex2 extends Exchange {
|
|
|
1596
1587
|
}
|
|
1597
1588
|
if (clientOrderId !== undefined) {
|
|
1598
1589
|
request['cid'] = clientOrderId;
|
|
1599
|
-
params = this.omit(params, ['cid', 'clientOrderId']);
|
|
1600
1590
|
}
|
|
1601
1591
|
const response = await this.privatePostAuthWOrderSubmit(this.extend(request, params));
|
|
1602
1592
|
//
|
|
@@ -1652,8 +1642,8 @@ export default class bitfinex2 extends Exchange {
|
|
|
1652
1642
|
const errorText = response[7];
|
|
1653
1643
|
throw new ExchangeError(this.id + ' ' + response[6] + ': ' + errorText + ' (#' + errorCode + ')');
|
|
1654
1644
|
}
|
|
1655
|
-
const orders = this.
|
|
1656
|
-
const order = this.
|
|
1645
|
+
const orders = this.safeList(response, 4, []);
|
|
1646
|
+
const order = this.safeList(orders, 0);
|
|
1657
1647
|
return this.parseOrder(order, market);
|
|
1658
1648
|
}
|
|
1659
1649
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
@@ -2401,7 +2391,7 @@ export default class bitfinex2 extends Exchange {
|
|
|
2401
2391
|
request['payment_id'] = tag;
|
|
2402
2392
|
}
|
|
2403
2393
|
const withdrawOptions = this.safeValue(this.options, 'withdraw', {});
|
|
2404
|
-
const includeFee = this.
|
|
2394
|
+
const includeFee = this.safeBool(withdrawOptions, 'includeFee', false);
|
|
2405
2395
|
if (includeFee) {
|
|
2406
2396
|
request['fee_deduct'] = 1;
|
|
2407
2397
|
}
|
package/js/src/bitget.js
CHANGED
|
@@ -69,6 +69,7 @@ export default class bitget extends Exchange {
|
|
|
69
69
|
'fetchCrossBorrowRate': true,
|
|
70
70
|
'fetchCrossBorrowRates': false,
|
|
71
71
|
'fetchCurrencies': true,
|
|
72
|
+
'fetchDeposit': false,
|
|
72
73
|
'fetchDepositAddress': true,
|
|
73
74
|
'fetchDepositAddresses': false,
|
|
74
75
|
'fetchDeposits': true,
|
|
@@ -98,6 +99,7 @@ export default class bitget extends Exchange {
|
|
|
98
99
|
'fetchOpenOrders': true,
|
|
99
100
|
'fetchOrder': true,
|
|
100
101
|
'fetchOrderBook': true,
|
|
102
|
+
'fetchOrderBooks': false,
|
|
101
103
|
'fetchOrders': false,
|
|
102
104
|
'fetchOrderTrades': false,
|
|
103
105
|
'fetchPosition': true,
|
|
@@ -105,6 +107,7 @@ export default class bitget extends Exchange {
|
|
|
105
107
|
'fetchPositions': true,
|
|
106
108
|
'fetchPositionsRisk': false,
|
|
107
109
|
'fetchPremiumIndexOHLCV': false,
|
|
110
|
+
'fetchStatus': false,
|
|
108
111
|
'fetchTicker': true,
|
|
109
112
|
'fetchTickers': true,
|
|
110
113
|
'fetchTime': true,
|
|
@@ -121,6 +124,7 @@ export default class bitget extends Exchange {
|
|
|
121
124
|
'repayCrossMargin': true,
|
|
122
125
|
'repayIsolatedMargin': true,
|
|
123
126
|
'setLeverage': true,
|
|
127
|
+
'setMargin': false,
|
|
124
128
|
'setMarginMode': true,
|
|
125
129
|
'setPositionMode': true,
|
|
126
130
|
'signIn': false,
|
|
@@ -2238,7 +2242,7 @@ export default class bitget extends Exchange {
|
|
|
2238
2242
|
'fee': undefined,
|
|
2239
2243
|
};
|
|
2240
2244
|
const withdrawOptions = this.safeValue(this.options, 'withdraw', {});
|
|
2241
|
-
const fillResponseFromRequest = this.
|
|
2245
|
+
const fillResponseFromRequest = this.safeBool(withdrawOptions, 'fillResponseFromRequest', true);
|
|
2242
2246
|
if (fillResponseFromRequest) {
|
|
2243
2247
|
result['currency'] = code;
|
|
2244
2248
|
result['timestamp'] = this.milliseconds();
|
|
@@ -3123,7 +3127,7 @@ export default class bitget extends Exchange {
|
|
|
3123
3127
|
[marginMode, params] = this.handleMarginModeAndParams('fetchTradingFees', params);
|
|
3124
3128
|
[marketType, params] = this.handleMarketTypeAndParams('fetchTradingFees', undefined, params);
|
|
3125
3129
|
if (marketType === 'spot') {
|
|
3126
|
-
const margin = this.
|
|
3130
|
+
const margin = this.safeBool(params, 'margin', false);
|
|
3127
3131
|
params = this.omit(params, 'margin');
|
|
3128
3132
|
if ((marginMode !== undefined) || margin) {
|
|
3129
3133
|
response = await this.publicMarginGetV2MarginCurrencies(params);
|
|
@@ -4144,7 +4148,7 @@ export default class bitget extends Exchange {
|
|
|
4144
4148
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
4145
4149
|
}
|
|
4146
4150
|
const triggerType = this.safeString(params, 'triggerType', 'mark_price');
|
|
4147
|
-
const reduceOnly = this.
|
|
4151
|
+
const reduceOnly = this.safeBool(params, 'reduceOnly', false);
|
|
4148
4152
|
const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
|
|
4149
4153
|
const exchangeSpecificTifParam = this.safeString2(params, 'force', 'timeInForce');
|
|
4150
4154
|
let postOnly = undefined;
|
|
@@ -4240,7 +4244,7 @@ export default class bitget extends Exchange {
|
|
|
4240
4244
|
}
|
|
4241
4245
|
const marginModeRequest = (marginMode === 'cross') ? 'crossed' : 'isolated';
|
|
4242
4246
|
request['marginMode'] = marginModeRequest;
|
|
4243
|
-
const oneWayMode = this.
|
|
4247
|
+
const oneWayMode = this.safeBool(params, 'oneWayMode', false);
|
|
4244
4248
|
params = this.omit(params, 'oneWayMode');
|
|
4245
4249
|
let requestSide = side;
|
|
4246
4250
|
if (reduceOnly) {
|
package/js/src/bitmart.js
CHANGED
|
@@ -1939,7 +1939,7 @@ export default class bitmart extends Exchange {
|
|
|
1939
1939
|
let marketType = undefined;
|
|
1940
1940
|
[marketType, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
|
|
1941
1941
|
const marginMode = this.safeString(params, 'marginMode');
|
|
1942
|
-
const isMargin = this.
|
|
1942
|
+
const isMargin = this.safeBool(params, 'margin', false);
|
|
1943
1943
|
params = this.omit(params, ['margin', 'marginMode']);
|
|
1944
1944
|
if (marginMode !== undefined || isMargin) {
|
|
1945
1945
|
marketType = 'margin';
|
|
@@ -2813,7 +2813,7 @@ export default class bitmart extends Exchange {
|
|
|
2813
2813
|
response = await this.privateGetContractPrivateCurrentPlanOrder(this.extend(request, params));
|
|
2814
2814
|
}
|
|
2815
2815
|
else {
|
|
2816
|
-
const trailing = this.
|
|
2816
|
+
const trailing = this.safeBool(params, 'trailing', false);
|
|
2817
2817
|
let orderType = this.safeString(params, 'orderType');
|
|
2818
2818
|
params = this.omit(params, ['orderType', 'trailing']);
|
|
2819
2819
|
if (trailing) {
|
|
@@ -2993,7 +2993,7 @@ export default class bitmart extends Exchange {
|
|
|
2993
2993
|
if (symbol === undefined) {
|
|
2994
2994
|
throw new ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
2995
2995
|
}
|
|
2996
|
-
const trailing = this.
|
|
2996
|
+
const trailing = this.safeBool(params, 'trailing', false);
|
|
2997
2997
|
let orderType = this.safeString(params, 'orderType');
|
|
2998
2998
|
params = this.omit(params, ['orderType', 'trailing']);
|
|
2999
2999
|
if (trailing) {
|
package/js/src/bitmex.js
CHANGED
|
@@ -104,7 +104,7 @@ export default class bitmex extends Exchange {
|
|
|
104
104
|
'public': 'https://testnet.bitmex.com',
|
|
105
105
|
'private': 'https://testnet.bitmex.com',
|
|
106
106
|
},
|
|
107
|
-
'logo': 'https://
|
|
107
|
+
'logo': 'https://github.com/ccxt/ccxt/assets/43336371/cea9cfe5-c57e-4b84-b2ac-77b960b04445',
|
|
108
108
|
'api': {
|
|
109
109
|
'public': 'https://www.bitmex.com',
|
|
110
110
|
'private': 'https://www.bitmex.com',
|
|
@@ -115,7 +115,10 @@ export default class bitmex extends Exchange {
|
|
|
115
115
|
'https://github.com/BitMEX/api-connectors/tree/master/official-http',
|
|
116
116
|
],
|
|
117
117
|
'fees': 'https://www.bitmex.com/app/fees',
|
|
118
|
-
'referral':
|
|
118
|
+
'referral': {
|
|
119
|
+
'url': 'https://www.bitmex.com/app/register/NZTR1q',
|
|
120
|
+
'discount': 0.1,
|
|
121
|
+
},
|
|
119
122
|
},
|
|
120
123
|
'api': {
|
|
121
124
|
'public': {
|
|
@@ -339,8 +342,8 @@ export default class bitmex extends Exchange {
|
|
|
339
342
|
const network = this.networkIdToCode(networkId);
|
|
340
343
|
const withdrawalFeeRaw = this.safeString(chain, 'withdrawalFee');
|
|
341
344
|
const withdrawalFee = this.parseNumber(Precise.stringMul(withdrawalFeeRaw, precisionString));
|
|
342
|
-
const isDepositEnabled = this.
|
|
343
|
-
const isWithdrawEnabled = this.
|
|
345
|
+
const isDepositEnabled = this.safeBool(chain, 'depositEnabled', false);
|
|
346
|
+
const isWithdrawEnabled = this.safeBool(chain, 'withdrawalEnabled', false);
|
|
344
347
|
const active = (isDepositEnabled && isWithdrawEnabled);
|
|
345
348
|
if (isDepositEnabled) {
|
|
346
349
|
depositEnabled = true;
|
|
@@ -1716,7 +1719,7 @@ export default class bitmex extends Exchange {
|
|
|
1716
1719
|
isInverse = (defaultSubType === 'inverse');
|
|
1717
1720
|
}
|
|
1718
1721
|
else {
|
|
1719
|
-
isInverse = this.
|
|
1722
|
+
isInverse = this.safeBool(market, 'inverse', false);
|
|
1720
1723
|
}
|
|
1721
1724
|
if (isInverse) {
|
|
1722
1725
|
cost = this.convertFromRawQuantity(symbol, qty);
|
|
@@ -2423,7 +2426,7 @@ export default class bitmex extends Exchange {
|
|
|
2423
2426
|
const item = response[i];
|
|
2424
2427
|
const marketId = this.safeString(item, 'symbol');
|
|
2425
2428
|
const market = this.safeMarket(marketId);
|
|
2426
|
-
const swap = this.
|
|
2429
|
+
const swap = this.safeBool(market, 'swap', false);
|
|
2427
2430
|
if (swap) {
|
|
2428
2431
|
filteredResponse.push(item);
|
|
2429
2432
|
}
|
package/js/src/bitrue.js
CHANGED
|
@@ -3191,7 +3191,7 @@ export default class bitrue extends Exchange {
|
|
|
3191
3191
|
}
|
|
3192
3192
|
// check success value for wapi endpoints
|
|
3193
3193
|
// response in format {'msg': 'The coin does not exist.', 'success': true/false}
|
|
3194
|
-
const success = this.
|
|
3194
|
+
const success = this.safeBool(response, 'success', true);
|
|
3195
3195
|
if (!success) {
|
|
3196
3196
|
const messageInner = this.safeString(response, 'msg');
|
|
3197
3197
|
let parsedMessage = undefined;
|
package/js/src/bitso.d.ts
CHANGED
package/js/src/bitso.js
CHANGED
|
@@ -1729,7 +1729,7 @@ export default class bitso extends Exchange {
|
|
|
1729
1729
|
//
|
|
1730
1730
|
// {"success":false,"error":{"code":104,"message":"Cannot perform request - nonce must be higher than 1520307203724237"}}
|
|
1731
1731
|
//
|
|
1732
|
-
let success = this.
|
|
1732
|
+
let success = this.safeBool(response, 'success', false);
|
|
1733
1733
|
if (typeof success === 'string') {
|
|
1734
1734
|
if ((success === 'true') || (success === '1')) {
|
|
1735
1735
|
success = true;
|
package/js/src/bitteam.js
CHANGED
|
@@ -356,7 +356,7 @@ export default class bitteam extends Exchange {
|
|
|
356
356
|
const created = this.parse8601(timeStart);
|
|
357
357
|
let minCost = undefined;
|
|
358
358
|
const currenciesValuedInUsd = this.safeValue(this.options, 'currenciesValuedInUsd', {});
|
|
359
|
-
const quoteInUsd = this.
|
|
359
|
+
const quoteInUsd = this.safeBool(currenciesValuedInUsd, quote, false);
|
|
360
360
|
if (quoteInUsd) {
|
|
361
361
|
const settings = this.safeValue(market, 'settings', {});
|
|
362
362
|
minCost = this.safeNumber(settings, 'limit_usd');
|
|
@@ -543,7 +543,7 @@ export default class bitteam extends Exchange {
|
|
|
543
543
|
const id = this.safeString(currency, 'symbol');
|
|
544
544
|
const numericId = this.safeInteger(currency, 'id');
|
|
545
545
|
const code = this.safeCurrencyCode(id);
|
|
546
|
-
const active = this.
|
|
546
|
+
const active = this.safeBool(currency, 'active', false);
|
|
547
547
|
const precision = this.safeInteger(currency, 'precision');
|
|
548
548
|
const txLimits = this.safeValue(currency, 'txLimits', {});
|
|
549
549
|
const minWithdraw = this.safeString(txLimits, 'minWithdraw');
|
package/js/src/btcalpha.js
CHANGED
|
@@ -680,7 +680,7 @@ export default class btcalpha extends Exchange {
|
|
|
680
680
|
const marketId = this.safeString(order, 'pair');
|
|
681
681
|
market = this.safeMarket(marketId, market, '_');
|
|
682
682
|
const symbol = market['symbol'];
|
|
683
|
-
const success = this.
|
|
683
|
+
const success = this.safeBool(order, 'success', false);
|
|
684
684
|
let timestamp = undefined;
|
|
685
685
|
if (success) {
|
|
686
686
|
timestamp = this.safeTimestamp(order, 'date');
|
package/js/src/bybit.js
CHANGED
|
@@ -299,8 +299,6 @@ export default class bybit extends Exchange {
|
|
|
299
299
|
// account
|
|
300
300
|
'v5/account/wallet-balance': 1,
|
|
301
301
|
'v5/account/borrow-history': 1,
|
|
302
|
-
'v5/account/set-collateral-switch': 5,
|
|
303
|
-
'v5/account/set-collateral-switch-batch': 5,
|
|
304
302
|
'v5/account/collateral-info': 1,
|
|
305
303
|
'v5/asset/coin-greeks': 1,
|
|
306
304
|
'v5/account/fee-rate': 10,
|
|
@@ -493,6 +491,8 @@ export default class bybit extends Exchange {
|
|
|
493
491
|
'v5/lending/purchase': 5,
|
|
494
492
|
'v5/lending/redeem': 5,
|
|
495
493
|
'v5/lending/redeem-cancel': 5,
|
|
494
|
+
'v5/account/set-collateral-switch': 5,
|
|
495
|
+
'v5/account/set-collateral-switch-batch': 5,
|
|
496
496
|
},
|
|
497
497
|
},
|
|
498
498
|
},
|
|
@@ -857,6 +857,7 @@ export default class bybit extends Exchange {
|
|
|
857
857
|
'181003': InvalidOrder,
|
|
858
858
|
'181004': InvalidOrder,
|
|
859
859
|
'182000': InvalidOrder,
|
|
860
|
+
'181017': BadRequest,
|
|
860
861
|
'20001': OrderNotFound,
|
|
861
862
|
'20003': InvalidOrder,
|
|
862
863
|
'20004': InvalidOrder,
|
|
@@ -3349,16 +3350,31 @@ export default class bybit extends Exchange {
|
|
|
3349
3350
|
let fee = undefined;
|
|
3350
3351
|
const feeCostString = this.safeString(order, 'cumExecFee');
|
|
3351
3352
|
if (feeCostString !== undefined) {
|
|
3352
|
-
let
|
|
3353
|
+
let feeCurrencyCode = undefined;
|
|
3353
3354
|
if (market['spot']) {
|
|
3354
|
-
|
|
3355
|
+
if (Precise.stringGt(feeCostString, '0')) {
|
|
3356
|
+
if (side === 'buy') {
|
|
3357
|
+
feeCurrencyCode = market['base'];
|
|
3358
|
+
}
|
|
3359
|
+
else {
|
|
3360
|
+
feeCurrencyCode = market['quote'];
|
|
3361
|
+
}
|
|
3362
|
+
}
|
|
3363
|
+
else {
|
|
3364
|
+
if (side === 'buy') {
|
|
3365
|
+
feeCurrencyCode = market['quote'];
|
|
3366
|
+
}
|
|
3367
|
+
else {
|
|
3368
|
+
feeCurrencyCode = market['base'];
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3355
3371
|
}
|
|
3356
3372
|
else {
|
|
3357
|
-
|
|
3373
|
+
feeCurrencyCode = market['inverse'] ? market['base'] : market['settle'];
|
|
3358
3374
|
}
|
|
3359
3375
|
fee = {
|
|
3360
3376
|
'cost': feeCostString,
|
|
3361
|
-
'currency':
|
|
3377
|
+
'currency': feeCurrencyCode,
|
|
3362
3378
|
};
|
|
3363
3379
|
}
|
|
3364
3380
|
let clientOrderId = this.safeString(order, 'orderLinkId');
|
|
@@ -3446,7 +3462,7 @@ export default class bybit extends Exchange {
|
|
|
3446
3462
|
const result = await this.fetchOrders(symbol, undefined, undefined, this.extend(request, params));
|
|
3447
3463
|
const length = result.length;
|
|
3448
3464
|
if (length === 0) {
|
|
3449
|
-
const isTrigger = this.
|
|
3465
|
+
const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
|
|
3450
3466
|
const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
|
|
3451
3467
|
throw new OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
|
|
3452
3468
|
}
|
|
@@ -4518,7 +4534,7 @@ export default class bybit extends Exchange {
|
|
|
4518
4534
|
return await this.fetchUsdcOrders(symbol, since, limit, params);
|
|
4519
4535
|
}
|
|
4520
4536
|
request['category'] = type;
|
|
4521
|
-
const isStop = this.
|
|
4537
|
+
const isStop = this.safeBoolN(params, ['trigger', 'stop'], false);
|
|
4522
4538
|
params = this.omit(params, ['trigger', 'stop']);
|
|
4523
4539
|
if (isStop) {
|
|
4524
4540
|
request['orderFilter'] = 'StopOrder';
|
|
@@ -5676,10 +5692,10 @@ export default class bybit extends Exchange {
|
|
|
5676
5692
|
// "time": 1672280219169
|
|
5677
5693
|
// }
|
|
5678
5694
|
//
|
|
5679
|
-
const result = this.
|
|
5680
|
-
const positions = this.
|
|
5695
|
+
const result = this.safeDict(response, 'result', {});
|
|
5696
|
+
const positions = this.safeList2(result, 'list', 'dataList', []);
|
|
5681
5697
|
const timestamp = this.safeInteger(response, 'time');
|
|
5682
|
-
const first = this.
|
|
5698
|
+
const first = this.safeDict(positions, 0, {});
|
|
5683
5699
|
const position = this.parsePosition(first, market);
|
|
5684
5700
|
position['timestamp'] = timestamp;
|
|
5685
5701
|
position['datetime'] = this.iso8601(timestamp);
|
|
@@ -6425,7 +6441,7 @@ export default class bybit extends Exchange {
|
|
|
6425
6441
|
throw new BadRequest(this.id + 'fetchOpenInterestHistory cannot use the 1m timeframe');
|
|
6426
6442
|
}
|
|
6427
6443
|
await this.loadMarkets();
|
|
6428
|
-
const paginate = this.
|
|
6444
|
+
const paginate = this.safeBool(params, 'paginate');
|
|
6429
6445
|
if (paginate) {
|
|
6430
6446
|
params = this.omit(params, 'paginate');
|
|
6431
6447
|
return await this.fetchPaginatedCallDeterministic('fetchOpenInterestHistory', symbol, since, limit, timeframe, params, 500);
|
package/js/src/coinbase.js
CHANGED
|
@@ -1364,7 +1364,11 @@ export default class coinbase extends Exchange {
|
|
|
1364
1364
|
async fetchTickersV3(symbols = undefined, params = {}) {
|
|
1365
1365
|
await this.loadMarkets();
|
|
1366
1366
|
symbols = this.marketSymbols(symbols);
|
|
1367
|
-
const
|
|
1367
|
+
const request = {};
|
|
1368
|
+
if (symbols !== undefined) {
|
|
1369
|
+
request['product_ids'] = this.marketIds(symbols);
|
|
1370
|
+
}
|
|
1371
|
+
const response = await this.v3PrivateGetBrokerageProducts(this.extend(request, params));
|
|
1368
1372
|
//
|
|
1369
1373
|
// {
|
|
1370
1374
|
// "products": [
|
|
@@ -1682,7 +1686,7 @@ export default class coinbase extends Exchange {
|
|
|
1682
1686
|
'limit': 250,
|
|
1683
1687
|
};
|
|
1684
1688
|
let response = undefined;
|
|
1685
|
-
const isV3 = this.
|
|
1689
|
+
const isV3 = this.safeBool(params, 'v3', false);
|
|
1686
1690
|
params = this.omit(params, 'v3');
|
|
1687
1691
|
const method = this.safeString(this.options, 'fetchBalance', 'v3PrivateGetBrokerageAccounts');
|
|
1688
1692
|
if ((isV3) || (method === 'v3PrivateGetBrokerageAccounts')) {
|
|
@@ -3198,8 +3202,11 @@ export default class coinbase extends Exchange {
|
|
|
3198
3202
|
*/
|
|
3199
3203
|
await this.loadMarkets();
|
|
3200
3204
|
symbols = this.marketSymbols(symbols);
|
|
3201
|
-
|
|
3202
|
-
|
|
3205
|
+
const request = {};
|
|
3206
|
+
if (symbols !== undefined) {
|
|
3207
|
+
request['product_ids'] = this.marketIds(symbols);
|
|
3208
|
+
}
|
|
3209
|
+
const response = await this.v3PrivateGetBrokerageBestBidAsk(this.extend(request, params));
|
|
3203
3210
|
//
|
|
3204
3211
|
// {
|
|
3205
3212
|
// "pricebooks": [
|
|
@@ -3328,7 +3335,7 @@ export default class coinbase extends Exchange {
|
|
|
3328
3335
|
const savedPath = fullPath;
|
|
3329
3336
|
if (method === 'GET') {
|
|
3330
3337
|
if (Object.keys(query).length) {
|
|
3331
|
-
fullPath += '?' + this.
|
|
3338
|
+
fullPath += '?' + this.urlencodeWithArrayRepeat(query);
|
|
3332
3339
|
}
|
|
3333
3340
|
}
|
|
3334
3341
|
const url = this.urls['api']['rest'] + fullPath;
|
package/js/src/coincheck.js
CHANGED
|
@@ -832,7 +832,7 @@ export default class coincheck extends Exchange {
|
|
|
832
832
|
// {"success":false,"error":"disabled API Key"}'
|
|
833
833
|
// {"success":false,"error":"invalid authentication"}
|
|
834
834
|
//
|
|
835
|
-
const success = this.
|
|
835
|
+
const success = this.safeBool(response, 'success', true);
|
|
836
836
|
if (!success) {
|
|
837
837
|
const error = this.safeString(response, 'error');
|
|
838
838
|
const feedback = this.id + ' ' + this.json(response);
|
package/js/src/coinex.js
CHANGED
|
@@ -3327,7 +3327,7 @@ export default class coinex extends Exchange {
|
|
|
3327
3327
|
const data = this.safeValue(response, 'data', {});
|
|
3328
3328
|
const depositAddress = this.parseDepositAddress(data, currency);
|
|
3329
3329
|
const options = this.safeValue(this.options, 'fetchDepositAddress', {});
|
|
3330
|
-
const fillResponseFromRequest = this.
|
|
3330
|
+
const fillResponseFromRequest = this.safeBool(options, 'fillResponseFromRequest', true);
|
|
3331
3331
|
if (fillResponseFromRequest) {
|
|
3332
3332
|
depositAddress['network'] = this.safeNetworkCode(network, currency);
|
|
3333
3333
|
}
|
|
@@ -5354,7 +5354,7 @@ export default class coinex extends Exchange {
|
|
|
5354
5354
|
* @returns {Array} the marginMode in lowercase
|
|
5355
5355
|
*/
|
|
5356
5356
|
const defaultType = this.safeString(this.options, 'defaultType');
|
|
5357
|
-
const isMargin = this.
|
|
5357
|
+
const isMargin = this.safeBool(params, 'margin', false);
|
|
5358
5358
|
let marginMode = undefined;
|
|
5359
5359
|
[marginMode, params] = super.handleMarginModeAndParams(methodName, params, defaultValue);
|
|
5360
5360
|
if (marginMode === undefined) {
|
package/js/src/coinlist.js
CHANGED
|
@@ -364,7 +364,7 @@ export default class coinlist extends Exchange {
|
|
|
364
364
|
const currency = currencies[i];
|
|
365
365
|
const id = this.safeString(currency, 'asset');
|
|
366
366
|
const code = this.safeCurrencyCode(id);
|
|
367
|
-
const isTransferable = this.
|
|
367
|
+
const isTransferable = this.safeBool(currency, 'is_transferable', false);
|
|
368
368
|
const withdrawEnabled = isTransferable;
|
|
369
369
|
const depositEnabled = isTransferable;
|
|
370
370
|
const active = isTransferable;
|
package/js/src/coinmate.js
CHANGED
|
@@ -544,7 +544,7 @@ export default class coinmate extends Exchange {
|
|
|
544
544
|
//
|
|
545
545
|
const data = this.safeValue(response, 'data');
|
|
546
546
|
const transaction = this.parseTransaction(data, currency);
|
|
547
|
-
const fillResponseFromRequest = this.
|
|
547
|
+
const fillResponseFromRequest = this.safeBool(withdrawOptions, 'fillResponseFromRequest', true);
|
|
548
548
|
if (fillResponseFromRequest) {
|
|
549
549
|
transaction['amount'] = amount;
|
|
550
550
|
transaction['currency'] = code;
|
package/js/src/coinmetro.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export default class coinmetro extends Exchange {
|
|
|
45
45
|
after: number;
|
|
46
46
|
status: string;
|
|
47
47
|
fee: any;
|
|
48
|
-
info: any
|
|
48
|
+
info: import("./base/types.js").Dictionary<any>;
|
|
49
49
|
};
|
|
50
50
|
parseLedgerEntryDescription(description: any): any[];
|
|
51
51
|
parseLedgerEntryType(type: any): string;
|