ccxt 4.2.75 → 4.2.77
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 +5 -5
- package/build.sh +2 -2
- package/dist/ccxt.browser.js +1004 -616
- package/dist/ccxt.browser.min.js +7 -7
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +6 -0
- package/dist/cjs/src/binance.js +504 -443
- package/dist/cjs/src/bingx.js +13 -15
- package/dist/cjs/src/blofin.js +14 -2
- package/dist/cjs/src/bybit.js +102 -59
- package/dist/cjs/src/coinbase.js +19 -3
- package/dist/cjs/src/coinbaseinternational.js +1 -1
- package/dist/cjs/src/delta.js +66 -49
- package/dist/cjs/src/gate.js +1 -0
- package/dist/cjs/src/htx.js +1 -0
- package/dist/cjs/src/hyperliquid.js +1 -1
- package/dist/cjs/src/kraken.js +8 -8
- package/dist/cjs/src/kucoin.js +152 -5
- package/dist/cjs/src/pro/ascendex.js +1 -1
- package/dist/cjs/src/pro/bitvavo.js +1 -1
- package/dist/cjs/src/pro/coinbaseinternational.js +1 -1
- package/dist/cjs/src/pro/coinex.js +20 -14
- package/dist/cjs/src/pro/deribit.js +1 -1
- package/dist/cjs/src/pro/exmo.js +1 -1
- package/dist/cjs/src/pro/krakenfutures.js +1 -1
- package/dist/cjs/src/pro/phemex.js +1 -1
- package/dist/cjs/src/pro/poloniex.js +1 -1
- package/dist/cjs/src/pro/probit.js +1 -1
- package/dist/cjs/src/pro/woo.js +61 -6
- package/dist/cjs/src/woo.js +25 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +1 -0
- package/js/src/abstract/binancecoinm.d.ts +1 -0
- package/js/src/abstract/binanceus.d.ts +1 -0
- package/js/src/abstract/binanceusdm.d.ts +1 -0
- package/js/src/abstract/bingx.d.ts +2 -0
- package/js/src/abstract/kucoin.d.ts +1 -0
- package/js/src/abstract/kucoinfutures.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +3 -3
- package/js/src/base/Exchange.js +6 -0
- package/js/src/base/types.d.ts +1 -1
- package/js/src/binance.d.ts +2 -2
- package/js/src/binance.js +504 -443
- package/js/src/bingx.js +13 -15
- package/js/src/bitflyer.d.ts +2 -2
- package/js/src/bithumb.d.ts +2 -2
- package/js/src/blofin.js +14 -2
- package/js/src/bybit.d.ts +1 -1
- package/js/src/bybit.js +102 -59
- package/js/src/coinbase.js +19 -3
- package/js/src/coinbaseinternational.js +1 -1
- package/js/src/delta.d.ts +2 -1
- package/js/src/delta.js +66 -49
- package/js/src/deribit.d.ts +1 -1
- package/js/src/gate.d.ts +1 -1
- package/js/src/gate.js +1 -0
- package/js/src/htx.js +1 -0
- package/js/src/hyperliquid.js +1 -1
- package/js/src/kraken.js +8 -8
- package/js/src/kucoin.d.ts +4 -1
- package/js/src/kucoin.js +152 -5
- package/js/src/okx.d.ts +1 -1
- package/js/src/pro/ascendex.js +1 -1
- package/js/src/pro/bitvavo.js +1 -1
- package/js/src/pro/coinbaseinternational.js +1 -1
- package/js/src/pro/coinex.js +20 -14
- package/js/src/pro/deribit.js +1 -1
- package/js/src/pro/exmo.js +1 -1
- package/js/src/pro/krakenfutures.js +1 -1
- package/js/src/pro/phemex.js +1 -1
- package/js/src/pro/poloniex.js +1 -1
- package/js/src/pro/probit.js +1 -1
- package/js/src/pro/woo.d.ts +1 -0
- package/js/src/pro/woo.js +61 -6
- package/js/src/woo.js +25 -0
- package/package.json +1 -1
- package/skip-tests.json +1 -2
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -124,6 +124,7 @@ class bingx extends bingx$1 {
|
|
|
124
124
|
'v1': {
|
|
125
125
|
'public': {
|
|
126
126
|
'get': {
|
|
127
|
+
'server/time': 3,
|
|
127
128
|
'common/symbols': 3,
|
|
128
129
|
'market/trades': 3,
|
|
129
130
|
'market/depth': 3,
|
|
@@ -147,6 +148,7 @@ class bingx extends bingx$1 {
|
|
|
147
148
|
'trade/order/cancelReplace': 3,
|
|
148
149
|
'trade/cancelOrders': 3,
|
|
149
150
|
'trade/cancelOpenOrders': 3,
|
|
151
|
+
'trade/cancelAllAfter': 1,
|
|
150
152
|
},
|
|
151
153
|
},
|
|
152
154
|
},
|
|
@@ -1809,15 +1811,18 @@ class bingx extends bingx$1 {
|
|
|
1809
1811
|
request[exchangeClientOrderId] = clientOrderId;
|
|
1810
1812
|
}
|
|
1811
1813
|
const timeInForce = this.safeStringUpper(params, 'timeInForce');
|
|
1812
|
-
|
|
1814
|
+
[postOnly, params] = this.handlePostOnly(isMarketOrder, timeInForce === 'PostOnly', params);
|
|
1815
|
+
if (postOnly || (timeInForce === 'PostOnly')) {
|
|
1816
|
+
request['timeInForce'] = 'PostOnly';
|
|
1817
|
+
}
|
|
1818
|
+
else if (timeInForce === 'IOC') {
|
|
1813
1819
|
request['timeInForce'] = 'IOC';
|
|
1814
1820
|
}
|
|
1821
|
+
else if (timeInForce === 'GTC') {
|
|
1822
|
+
request['timeInForce'] = 'GTC';
|
|
1823
|
+
}
|
|
1815
1824
|
const triggerPrice = this.safeString2(params, 'stopPrice', 'triggerPrice');
|
|
1816
1825
|
if (isSpot) {
|
|
1817
|
-
[postOnly, params] = this.handlePostOnly(isMarketOrder, timeInForce === 'POC', params);
|
|
1818
|
-
if (postOnly || (timeInForce === 'POC')) {
|
|
1819
|
-
request['timeInForce'] = 'POC';
|
|
1820
|
-
}
|
|
1821
1826
|
const cost = this.safeNumber2(params, 'cost', 'quoteOrderQty');
|
|
1822
1827
|
params = this.omit(params, 'cost');
|
|
1823
1828
|
if (cost !== undefined) {
|
|
@@ -1850,14 +1855,7 @@ class bingx extends bingx$1 {
|
|
|
1850
1855
|
}
|
|
1851
1856
|
}
|
|
1852
1857
|
else {
|
|
1853
|
-
|
|
1854
|
-
if (postOnly || (timeInForce === 'PostOnly')) {
|
|
1855
|
-
request['timeInForce'] = 'PostOnly';
|
|
1856
|
-
}
|
|
1857
|
-
else if (timeInForce === 'GTC') {
|
|
1858
|
-
request['timeInForce'] = 'GTC';
|
|
1859
|
-
}
|
|
1860
|
-
else if (timeInForce === 'FOK') {
|
|
1858
|
+
if (timeInForce === 'FOK') {
|
|
1861
1859
|
request['timeInForce'] = 'FOK';
|
|
1862
1860
|
}
|
|
1863
1861
|
const stopLossPrice = this.safeString(params, 'stopLossPrice');
|
|
@@ -1985,7 +1983,7 @@ class bingx extends bingx$1 {
|
|
|
1985
1983
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1986
1984
|
* @param {string} [params.clientOrderId] a unique id for the order
|
|
1987
1985
|
* @param {bool} [params.postOnly] true to place a post only order
|
|
1988
|
-
* @param {string} [params.timeInForce] spot supports 'PO' and 'IOC', swap supports 'PO', 'GTC', 'IOC' and 'FOK'
|
|
1986
|
+
* @param {string} [params.timeInForce] spot supports 'PO', 'GTC' and 'IOC', swap supports 'PO', 'GTC', 'IOC' and 'FOK'
|
|
1989
1987
|
* @param {bool} [params.reduceOnly] *swap only* true or false whether the order is reduce only
|
|
1990
1988
|
* @param {float} [params.triggerPrice] *swap only* triggerPrice at which the attached take profit / stop loss order will be triggered
|
|
1991
1989
|
* @param {float} [params.stopLossPrice] *swap only* stop loss trigger price
|
|
@@ -2470,7 +2468,7 @@ class bingx extends bingx$1 {
|
|
|
2470
2468
|
'FILLED': 'closed',
|
|
2471
2469
|
'CANCELED': 'canceled',
|
|
2472
2470
|
'CANCELLED': 'canceled',
|
|
2473
|
-
'FAILED': '
|
|
2471
|
+
'FAILED': 'canceled',
|
|
2474
2472
|
};
|
|
2475
2473
|
return this.safeString(statuses, status, status);
|
|
2476
2474
|
}
|
package/dist/cjs/src/blofin.js
CHANGED
|
@@ -1251,6 +1251,7 @@ class blofin extends blofin$1 {
|
|
|
1251
1251
|
* @param {string} id order id
|
|
1252
1252
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
1253
1253
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1254
|
+
* @param {boolean} [params.trigger] True if cancelling a trigger/conditional order/tp sl orders
|
|
1254
1255
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1255
1256
|
*/
|
|
1256
1257
|
if (symbol === undefined) {
|
|
@@ -1261,14 +1262,25 @@ class blofin extends blofin$1 {
|
|
|
1261
1262
|
const request = {
|
|
1262
1263
|
'instId': market['id'],
|
|
1263
1264
|
};
|
|
1265
|
+
const isTrigger = this.safeBoolN(params, ['stop', 'trigger', 'tpsl'], false);
|
|
1264
1266
|
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
1265
1267
|
if (clientOrderId !== undefined) {
|
|
1266
1268
|
request['clientOrderId'] = clientOrderId;
|
|
1267
1269
|
}
|
|
1268
1270
|
else {
|
|
1269
|
-
|
|
1271
|
+
if (!isTrigger) {
|
|
1272
|
+
request['orderId'] = id.toString();
|
|
1273
|
+
}
|
|
1274
|
+
else {
|
|
1275
|
+
request['tpslId'] = id.toString();
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
const query = this.omit(params, ['orderId', 'clientOrderId', 'stop', 'trigger', 'tpsl']);
|
|
1279
|
+
if (isTrigger) {
|
|
1280
|
+
const tpslResponse = await this.cancelOrders([id], symbol, params);
|
|
1281
|
+
const first = this.safeDict(tpslResponse, 0);
|
|
1282
|
+
return first;
|
|
1270
1283
|
}
|
|
1271
|
-
const query = this.omit(params, ['orderId', 'clientOrderId']);
|
|
1272
1284
|
const response = await this.privatePostTradeCancelOrder(this.extend(request, query));
|
|
1273
1285
|
const data = this.safeList(response, 'data', []);
|
|
1274
1286
|
const order = this.safeDict(data, 0);
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -963,6 +963,9 @@ class bybit extends bybit$1 {
|
|
|
963
963
|
'precisionMode': number.TICK_SIZE,
|
|
964
964
|
'options': {
|
|
965
965
|
'fetchMarkets': ['spot', 'linear', 'inverse', 'option'],
|
|
966
|
+
'createOrder': {
|
|
967
|
+
'method': 'privatePostV5OrderCreate', // 'privatePostV5PositionTradingStop'
|
|
968
|
+
},
|
|
966
969
|
'enableUnifiedMargin': undefined,
|
|
967
970
|
'enableUnifiedAccount': undefined,
|
|
968
971
|
'createMarketBuyOrderRequiresPrice': true,
|
|
@@ -2650,7 +2653,7 @@ class bybit extends bybit$1 {
|
|
|
2650
2653
|
//
|
|
2651
2654
|
const id = this.safeStringN(trade, ['execId', 'id', 'tradeId']);
|
|
2652
2655
|
const marketId = this.safeString(trade, 'symbol');
|
|
2653
|
-
let marketType = 'contract';
|
|
2656
|
+
let marketType = ('createType' in trade) ? 'contract' : 'spot';
|
|
2654
2657
|
if (market !== undefined) {
|
|
2655
2658
|
marketType = market['type'];
|
|
2656
2659
|
}
|
|
@@ -3531,8 +3534,10 @@ class bybit extends bybit$1 {
|
|
|
3531
3534
|
const trailingAmount = this.safeString2(params, 'trailingAmount', 'trailingStop');
|
|
3532
3535
|
const isTrailingAmountOrder = trailingAmount !== undefined;
|
|
3533
3536
|
const orderRequest = this.createOrderRequest(symbol, type, side, amount, price, params, enableUnifiedAccount);
|
|
3537
|
+
const options = this.safeValue(this.options, 'createOrder', {});
|
|
3538
|
+
const defaultMethod = this.safeString(options, 'method', 'privatePostV5OrderCreate');
|
|
3534
3539
|
let response = undefined;
|
|
3535
|
-
if (isTrailingAmountOrder) {
|
|
3540
|
+
if (isTrailingAmountOrder || (defaultMethod === 'privatePostV5PositionTradingStop')) {
|
|
3536
3541
|
response = await this.privatePostV5PositionTradingStop(orderRequest);
|
|
3537
3542
|
}
|
|
3538
3543
|
else {
|
|
@@ -3560,10 +3565,12 @@ class bybit extends bybit$1 {
|
|
|
3560
3565
|
if ((price === undefined) && (lowerCaseType === 'limit')) {
|
|
3561
3566
|
throw new errors.ArgumentsRequired(this.id + ' createOrder requires a price argument for limit orders');
|
|
3562
3567
|
}
|
|
3568
|
+
let defaultMethod = undefined;
|
|
3569
|
+
[defaultMethod, params] = this.handleOptionAndParams(params, 'createOrder', 'method', 'privatePostV5OrderCreate');
|
|
3563
3570
|
const request = {
|
|
3564
3571
|
'symbol': market['id'],
|
|
3565
|
-
'side': this.capitalize(side),
|
|
3566
|
-
'orderType': this.capitalize(lowerCaseType), // limit or market
|
|
3572
|
+
// 'side': this.capitalize (side),
|
|
3573
|
+
// 'orderType': this.capitalize (lowerCaseType), // limit or market
|
|
3567
3574
|
// 'timeInForce': 'GTC', // IOC, FOK, PostOnly
|
|
3568
3575
|
// 'takeProfit': 123.45, // take profit price, only take effect upon opening the position
|
|
3569
3576
|
// 'stopLoss': 123.45, // stop loss price, only take effect upon opening the position
|
|
@@ -3585,6 +3592,87 @@ class bybit extends bybit$1 {
|
|
|
3585
3592
|
// Valid for option only.
|
|
3586
3593
|
// 'orderIv': '0', // Implied volatility; parameters are passed according to the real value; for example, for 10%, 0.1 is passed
|
|
3587
3594
|
};
|
|
3595
|
+
let triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
|
|
3596
|
+
const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice');
|
|
3597
|
+
const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
|
|
3598
|
+
const stopLoss = this.safeValue(params, 'stopLoss');
|
|
3599
|
+
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
3600
|
+
const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activePrice', this.numberToString(price));
|
|
3601
|
+
const trailingAmount = this.safeString2(params, 'trailingAmount', 'trailingStop');
|
|
3602
|
+
const isTrailingAmountOrder = trailingAmount !== undefined;
|
|
3603
|
+
const isTriggerOrder = triggerPrice !== undefined;
|
|
3604
|
+
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
3605
|
+
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
3606
|
+
const isStopLoss = stopLoss !== undefined;
|
|
3607
|
+
const isTakeProfit = takeProfit !== undefined;
|
|
3608
|
+
const isMarket = lowerCaseType === 'market';
|
|
3609
|
+
const isLimit = lowerCaseType === 'limit';
|
|
3610
|
+
const isBuy = side === 'buy';
|
|
3611
|
+
const isAlternativeEndpoint = defaultMethod === 'privatePostV5PositionTradingStop';
|
|
3612
|
+
if (isTrailingAmountOrder || isAlternativeEndpoint) {
|
|
3613
|
+
if (isStopLoss || isTakeProfit || isTriggerOrder || market['spot']) {
|
|
3614
|
+
throw new errors.InvalidOrder(this.id + ' the API endpoint used only supports contract trailingAmount, stopLossPrice and takeProfitPrice orders');
|
|
3615
|
+
}
|
|
3616
|
+
if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
|
|
3617
|
+
if (isStopLossTriggerOrder) {
|
|
3618
|
+
request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
3619
|
+
if (isLimit) {
|
|
3620
|
+
request['tpslMode'] = 'Partial';
|
|
3621
|
+
request['slOrderType'] = 'Limit';
|
|
3622
|
+
request['slLimitPrice'] = this.priceToPrecision(symbol, price);
|
|
3623
|
+
request['slSize'] = this.amountToPrecision(symbol, amount);
|
|
3624
|
+
}
|
|
3625
|
+
}
|
|
3626
|
+
else if (isTakeProfitTriggerOrder) {
|
|
3627
|
+
request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
3628
|
+
if (isLimit) {
|
|
3629
|
+
request['tpslMode'] = 'Partial';
|
|
3630
|
+
request['tpOrderType'] = 'Limit';
|
|
3631
|
+
request['tpLimitPrice'] = this.priceToPrecision(symbol, price);
|
|
3632
|
+
request['tpSize'] = this.amountToPrecision(symbol, amount);
|
|
3633
|
+
}
|
|
3634
|
+
}
|
|
3635
|
+
}
|
|
3636
|
+
}
|
|
3637
|
+
else {
|
|
3638
|
+
request['side'] = this.capitalize(side);
|
|
3639
|
+
request['orderType'] = this.capitalize(lowerCaseType);
|
|
3640
|
+
const timeInForce = this.safeStringLower(params, 'timeInForce'); // this is same as exchange specific param
|
|
3641
|
+
let postOnly = undefined;
|
|
3642
|
+
[postOnly, params] = this.handlePostOnly(isMarket, timeInForce === 'postonly', params);
|
|
3643
|
+
if (postOnly) {
|
|
3644
|
+
request['timeInForce'] = 'PostOnly';
|
|
3645
|
+
}
|
|
3646
|
+
else if (timeInForce === 'gtc') {
|
|
3647
|
+
request['timeInForce'] = 'GTC';
|
|
3648
|
+
}
|
|
3649
|
+
else if (timeInForce === 'fok') {
|
|
3650
|
+
request['timeInForce'] = 'FOK';
|
|
3651
|
+
}
|
|
3652
|
+
else if (timeInForce === 'ioc') {
|
|
3653
|
+
request['timeInForce'] = 'IOC';
|
|
3654
|
+
}
|
|
3655
|
+
if (market['spot']) {
|
|
3656
|
+
// only works for spot market
|
|
3657
|
+
if (triggerPrice !== undefined) {
|
|
3658
|
+
request['orderFilter'] = 'StopOrder';
|
|
3659
|
+
}
|
|
3660
|
+
else if (stopLossTriggerPrice !== undefined || takeProfitTriggerPrice !== undefined || isStopLoss || isTakeProfit) {
|
|
3661
|
+
request['orderFilter'] = 'tpslOrder';
|
|
3662
|
+
}
|
|
3663
|
+
}
|
|
3664
|
+
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
3665
|
+
if (clientOrderId !== undefined) {
|
|
3666
|
+
request['orderLinkId'] = clientOrderId;
|
|
3667
|
+
}
|
|
3668
|
+
else if (market['option']) {
|
|
3669
|
+
// mandatory field for options
|
|
3670
|
+
request['orderLinkId'] = this.uuid16();
|
|
3671
|
+
}
|
|
3672
|
+
if (isLimit) {
|
|
3673
|
+
request['price'] = this.priceToPrecision(symbol, price);
|
|
3674
|
+
}
|
|
3675
|
+
}
|
|
3588
3676
|
if (market['spot']) {
|
|
3589
3677
|
request['category'] = 'spot';
|
|
3590
3678
|
}
|
|
@@ -3644,48 +3732,17 @@ class bybit extends bybit$1 {
|
|
|
3644
3732
|
}
|
|
3645
3733
|
}
|
|
3646
3734
|
else {
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
const isLimit = lowerCaseType === 'limit';
|
|
3651
|
-
if (isLimit) {
|
|
3652
|
-
request['price'] = this.priceToPrecision(symbol, price);
|
|
3653
|
-
}
|
|
3654
|
-
const timeInForce = this.safeStringLower(params, 'timeInForce'); // this is same as exchange specific param
|
|
3655
|
-
let postOnly = undefined;
|
|
3656
|
-
[postOnly, params] = this.handlePostOnly(isMarket, timeInForce === 'postonly', params);
|
|
3657
|
-
if (postOnly) {
|
|
3658
|
-
request['timeInForce'] = 'PostOnly';
|
|
3659
|
-
}
|
|
3660
|
-
else if (timeInForce === 'gtc') {
|
|
3661
|
-
request['timeInForce'] = 'GTC';
|
|
3662
|
-
}
|
|
3663
|
-
else if (timeInForce === 'fok') {
|
|
3664
|
-
request['timeInForce'] = 'FOK';
|
|
3665
|
-
}
|
|
3666
|
-
else if (timeInForce === 'ioc') {
|
|
3667
|
-
request['timeInForce'] = 'IOC';
|
|
3735
|
+
if (!isTrailingAmountOrder && !isAlternativeEndpoint) {
|
|
3736
|
+
request['qty'] = this.amountToPrecision(symbol, amount);
|
|
3737
|
+
}
|
|
3668
3738
|
}
|
|
3669
|
-
let triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
|
|
3670
|
-
const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice');
|
|
3671
|
-
const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
|
|
3672
|
-
const stopLoss = this.safeValue(params, 'stopLoss');
|
|
3673
|
-
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
3674
|
-
const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activePrice', this.numberToString(price));
|
|
3675
|
-
const trailingAmount = this.safeString2(params, 'trailingAmount', 'trailingStop');
|
|
3676
|
-
const isTrailingAmountOrder = trailingAmount !== undefined;
|
|
3677
|
-
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
3678
|
-
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
3679
|
-
const isStopLoss = stopLoss !== undefined;
|
|
3680
|
-
const isTakeProfit = takeProfit !== undefined;
|
|
3681
|
-
const isBuy = side === 'buy';
|
|
3682
3739
|
if (isTrailingAmountOrder) {
|
|
3683
3740
|
if (trailingTriggerPrice !== undefined) {
|
|
3684
3741
|
request['activePrice'] = this.priceToPrecision(symbol, trailingTriggerPrice);
|
|
3685
3742
|
}
|
|
3686
3743
|
request['trailingStop'] = trailingAmount;
|
|
3687
3744
|
}
|
|
3688
|
-
else if (
|
|
3745
|
+
else if (isTriggerOrder && !isAlternativeEndpoint) {
|
|
3689
3746
|
const triggerDirection = this.safeString(params, 'triggerDirection');
|
|
3690
3747
|
params = this.omit(params, ['triggerPrice', 'stopPrice', 'triggerDirection']);
|
|
3691
3748
|
if (market['spot']) {
|
|
@@ -3702,7 +3759,7 @@ class bybit extends bybit$1 {
|
|
|
3702
3759
|
}
|
|
3703
3760
|
request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
|
|
3704
3761
|
}
|
|
3705
|
-
else if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
|
|
3762
|
+
else if ((isStopLossTriggerOrder || isTakeProfitTriggerOrder) && !isAlternativeEndpoint) {
|
|
3706
3763
|
if (isBuy) {
|
|
3707
3764
|
request['triggerDirection'] = isStopLossTriggerOrder ? 1 : 2;
|
|
3708
3765
|
}
|
|
@@ -3713,7 +3770,7 @@ class bybit extends bybit$1 {
|
|
|
3713
3770
|
request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
|
|
3714
3771
|
request['reduceOnly'] = true;
|
|
3715
3772
|
}
|
|
3716
|
-
if (isStopLoss || isTakeProfit) {
|
|
3773
|
+
if ((isStopLoss || isTakeProfit) && !isAlternativeEndpoint) {
|
|
3717
3774
|
if (isStopLoss) {
|
|
3718
3775
|
const slTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
|
|
3719
3776
|
request['stopLoss'] = this.priceToPrecision(symbol, slTriggerPrice);
|
|
@@ -3735,23 +3792,6 @@ class bybit extends bybit$1 {
|
|
|
3735
3792
|
}
|
|
3736
3793
|
}
|
|
3737
3794
|
}
|
|
3738
|
-
if (market['spot']) {
|
|
3739
|
-
// only works for spot market
|
|
3740
|
-
if (triggerPrice !== undefined) {
|
|
3741
|
-
request['orderFilter'] = 'StopOrder';
|
|
3742
|
-
}
|
|
3743
|
-
else if (stopLossTriggerPrice !== undefined || takeProfitTriggerPrice !== undefined || isStopLoss || isTakeProfit) {
|
|
3744
|
-
request['orderFilter'] = 'tpslOrder';
|
|
3745
|
-
}
|
|
3746
|
-
}
|
|
3747
|
-
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
3748
|
-
if (clientOrderId !== undefined) {
|
|
3749
|
-
request['orderLinkId'] = clientOrderId;
|
|
3750
|
-
}
|
|
3751
|
-
else if (market['option']) {
|
|
3752
|
-
// mandatory field for options
|
|
3753
|
-
request['orderLinkId'] = this.uuid16();
|
|
3754
|
-
}
|
|
3755
3795
|
params = this.omit(params, ['stopPrice', 'timeInForce', 'stopLossPrice', 'takeProfitPrice', 'postOnly', 'clientOrderId', 'triggerPrice', 'stopLoss', 'takeProfit', 'trailingAmount', 'trailingTriggerPrice']);
|
|
3756
3796
|
return this.extend(request, params);
|
|
3757
3797
|
}
|
|
@@ -5214,7 +5254,9 @@ class bybit extends bybit$1 {
|
|
|
5214
5254
|
}
|
|
5215
5255
|
const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
|
|
5216
5256
|
const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
|
|
5217
|
-
let request = {
|
|
5257
|
+
let request = {
|
|
5258
|
+
'execType': 'Trade',
|
|
5259
|
+
};
|
|
5218
5260
|
let market = undefined;
|
|
5219
5261
|
let isUsdcSettled = false;
|
|
5220
5262
|
if (symbol !== undefined) {
|
|
@@ -6789,6 +6831,7 @@ class bybit extends bybit$1 {
|
|
|
6789
6831
|
* @param {int} [since] Not used by Bybit
|
|
6790
6832
|
* @param {int} [limit] The number of open interest structures to return. Max 200, default 50
|
|
6791
6833
|
* @param {object} [params] Exchange specific parameters
|
|
6834
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
6792
6835
|
* @returns An array of open interest structures
|
|
6793
6836
|
*/
|
|
6794
6837
|
if (timeframe === '1m') {
|
package/dist/cjs/src/coinbase.js
CHANGED
|
@@ -1323,7 +1323,7 @@ class coinbase extends coinbase$1 {
|
|
|
1323
1323
|
* @returns {object} an associative dictionary of currencies
|
|
1324
1324
|
*/
|
|
1325
1325
|
const response = await this.fetchCurrenciesFromCache(params);
|
|
1326
|
-
const currencies = this.
|
|
1326
|
+
const currencies = this.safeList(response, 'currencies', []);
|
|
1327
1327
|
//
|
|
1328
1328
|
// fiat
|
|
1329
1329
|
//
|
|
@@ -1875,9 +1875,15 @@ class coinbase extends coinbase$1 {
|
|
|
1875
1875
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
1876
1876
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
1877
1877
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1878
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
1878
1879
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
1879
1880
|
*/
|
|
1880
1881
|
await this.loadMarkets();
|
|
1882
|
+
let paginate = false;
|
|
1883
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
1884
|
+
if (paginate) {
|
|
1885
|
+
return await this.fetchPaginatedCallCursor('fetchLedger', code, since, limit, params, 'next_starting_after', 'starting_after', undefined, 100);
|
|
1886
|
+
}
|
|
1881
1887
|
let currency = undefined;
|
|
1882
1888
|
if (code !== undefined) {
|
|
1883
1889
|
currency = this.currency(code);
|
|
@@ -1888,7 +1894,17 @@ class coinbase extends coinbase$1 {
|
|
|
1888
1894
|
// the value for the next page can be obtained from the result of the previous call in the 'pagination' field
|
|
1889
1895
|
// eg: instance.last_json_response.pagination.next_starting_after
|
|
1890
1896
|
const response = await this.v2PrivateGetAccountsAccountIdTransactions(this.extend(request, params));
|
|
1891
|
-
|
|
1897
|
+
const ledger = this.parseLedger(response['data'], currency, since, limit);
|
|
1898
|
+
const length = ledger.length;
|
|
1899
|
+
const lastIndex = length - 1;
|
|
1900
|
+
const last = this.safeDict(ledger, lastIndex);
|
|
1901
|
+
const pagination = this.safeDict(response, 'pagination', {});
|
|
1902
|
+
const cursor = this.safeString(pagination, 'next_starting_after');
|
|
1903
|
+
if ((cursor !== undefined) && (cursor !== '')) {
|
|
1904
|
+
last['next_starting_after'] = cursor;
|
|
1905
|
+
ledger[lastIndex] = last;
|
|
1906
|
+
}
|
|
1907
|
+
return ledger;
|
|
1892
1908
|
}
|
|
1893
1909
|
parseLedgerEntryStatus(status) {
|
|
1894
1910
|
const types = {
|
|
@@ -2867,7 +2883,7 @@ class coinbase extends coinbase$1 {
|
|
|
2867
2883
|
let paginate = false;
|
|
2868
2884
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
|
|
2869
2885
|
if (paginate) {
|
|
2870
|
-
return await this.fetchPaginatedCallCursor('fetchOrders', symbol, since, limit, params, 'cursor', 'cursor', undefined,
|
|
2886
|
+
return await this.fetchPaginatedCallCursor('fetchOrders', symbol, since, limit, params, 'cursor', 'cursor', undefined, 1000);
|
|
2871
2887
|
}
|
|
2872
2888
|
let market = undefined;
|
|
2873
2889
|
if (symbol !== undefined) {
|
|
@@ -16,7 +16,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
16
16
|
describe() {
|
|
17
17
|
return this.deepExtend(super.describe(), {
|
|
18
18
|
'id': 'coinbaseinternational',
|
|
19
|
-
'name': '
|
|
19
|
+
'name': 'Coinbase International',
|
|
20
20
|
'countries': ['US'],
|
|
21
21
|
'certified': true,
|
|
22
22
|
'pro': true,
|