ccxt 4.2.76 → 4.2.78
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 +3 -3
- package/dist/ccxt.browser.js +1181 -643
- 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 +502 -443
- package/dist/cjs/src/bingx.js +1 -1
- package/dist/cjs/src/blofin.js +14 -2
- package/dist/cjs/src/bybit.js +106 -60
- package/dist/cjs/src/coinbase.js +23 -10
- package/dist/cjs/src/delta.js +66 -49
- package/dist/cjs/src/gate.js +1 -0
- package/dist/cjs/src/htx.js +36 -27
- package/dist/cjs/src/hyperliquid.js +7 -5
- package/dist/cjs/src/kraken.js +8 -8
- package/dist/cjs/src/kucoin.js +204 -5
- package/dist/cjs/src/okcoin.js +27 -1
- package/dist/cjs/src/okx.js +18 -0
- package/dist/cjs/src/pro/ascendex.js +1 -1
- package/dist/cjs/src/pro/bitvavo.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 +72 -3
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- 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 +3 -3
- package/js/src/binance.d.ts +2 -2
- package/js/src/binance.js +502 -443
- package/js/src/bingx.js +1 -1
- 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 +106 -60
- package/js/src/coinbase.d.ts +2 -2
- package/js/src/coinbase.js +23 -10
- 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 +36 -27
- package/js/src/hyperliquid.js +7 -5
- package/js/src/kraken.js +8 -8
- package/js/src/kucoin.d.ts +4 -1
- package/js/src/kucoin.js +204 -5
- package/js/src/okcoin.js +27 -1
- package/js/src/okx.d.ts +1 -1
- package/js/src/okx.js +18 -0
- package/js/src/pro/ascendex.js +1 -1
- package/js/src/pro/bitvavo.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.d.ts +2 -0
- package/js/src/woo.js +72 -3
- package/package.json +1 -1
- package/skip-tests.json +6 -3
package/dist/cjs/src/bingx.js
CHANGED
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,
|
|
@@ -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) {
|
|
@@ -8048,11 +8090,15 @@ class bybit extends bybit$1 {
|
|
|
8048
8090
|
const tier = info[i];
|
|
8049
8091
|
const marketId = this.safeString(info, 'symbol');
|
|
8050
8092
|
market = this.safeMarket(marketId);
|
|
8093
|
+
let minNotional = this.parseNumber('0');
|
|
8094
|
+
if (i !== 0) {
|
|
8095
|
+
minNotional = this.safeNumber(info[i - 1], 'riskLimitValue');
|
|
8096
|
+
}
|
|
8051
8097
|
tiers.push({
|
|
8052
8098
|
'tier': this.safeInteger(tier, 'id'),
|
|
8053
8099
|
'currency': market['settle'],
|
|
8054
|
-
'minNotional':
|
|
8055
|
-
'maxNotional':
|
|
8100
|
+
'minNotional': minNotional,
|
|
8101
|
+
'maxNotional': this.safeNumber(tier, 'riskLimitValue'),
|
|
8056
8102
|
'maintenanceMarginRate': this.safeNumber(tier, 'maintenanceMargin'),
|
|
8057
8103
|
'maxLeverage': this.safeNumber(tier, 'maxLeverage'),
|
|
8058
8104
|
'info': tier,
|
package/dist/cjs/src/coinbase.js
CHANGED
|
@@ -1069,7 +1069,10 @@ class coinbase extends coinbase$1 {
|
|
|
1069
1069
|
* @returns {object[]} an array of objects representing market data
|
|
1070
1070
|
*/
|
|
1071
1071
|
const method = this.safeString(this.options, 'fetchMarkets', 'fetchMarketsV3');
|
|
1072
|
-
|
|
1072
|
+
if (method === 'fetchMarketsV3') {
|
|
1073
|
+
return await this.fetchMarketsV3(params);
|
|
1074
|
+
}
|
|
1075
|
+
return await this.fetchMarketsV2(params);
|
|
1073
1076
|
}
|
|
1074
1077
|
async fetchMarketsV2(params = {}) {
|
|
1075
1078
|
const response = await this.fetchCurrenciesFromCache(params);
|
|
@@ -1144,7 +1147,13 @@ class coinbase extends coinbase$1 {
|
|
|
1144
1147
|
return result;
|
|
1145
1148
|
}
|
|
1146
1149
|
async fetchMarketsV3(params = {}) {
|
|
1147
|
-
const
|
|
1150
|
+
const promisesUnresolved = [
|
|
1151
|
+
this.v3PrivateGetBrokerageProducts(params),
|
|
1152
|
+
this.v3PrivateGetBrokerageTransactionSummary(params),
|
|
1153
|
+
];
|
|
1154
|
+
// const response = await this.v3PrivateGetBrokerageProducts (params);
|
|
1155
|
+
const promises = await Promise.all(promisesUnresolved);
|
|
1156
|
+
const response = this.safeDict(promises, 0, {});
|
|
1148
1157
|
//
|
|
1149
1158
|
// [
|
|
1150
1159
|
// {
|
|
@@ -1179,7 +1188,8 @@ class coinbase extends coinbase$1 {
|
|
|
1179
1188
|
// ...
|
|
1180
1189
|
// ]
|
|
1181
1190
|
//
|
|
1182
|
-
const fees = await this.v3PrivateGetBrokerageTransactionSummary(params);
|
|
1191
|
+
// const fees = await this.v3PrivateGetBrokerageTransactionSummary (params);
|
|
1192
|
+
const fees = this.safeDict(promises, 1, {});
|
|
1183
1193
|
//
|
|
1184
1194
|
// {
|
|
1185
1195
|
// "total_volume": 0,
|
|
@@ -1896,6 +1906,9 @@ class coinbase extends coinbase$1 {
|
|
|
1896
1906
|
const response = await this.v2PrivateGetAccountsAccountIdTransactions(this.extend(request, params));
|
|
1897
1907
|
const ledger = this.parseLedger(response['data'], currency, since, limit);
|
|
1898
1908
|
const length = ledger.length;
|
|
1909
|
+
if (length === 0) {
|
|
1910
|
+
return ledger;
|
|
1911
|
+
}
|
|
1899
1912
|
const lastIndex = length - 1;
|
|
1900
1913
|
const last = this.safeDict(ledger, lastIndex);
|
|
1901
1914
|
const pagination = this.safeDict(response, 'pagination', {});
|
|
@@ -2235,9 +2248,9 @@ class coinbase extends coinbase$1 {
|
|
|
2235
2248
|
'fee': fee,
|
|
2236
2249
|
};
|
|
2237
2250
|
}
|
|
2238
|
-
async findAccountId(code) {
|
|
2251
|
+
async findAccountId(code, params = {}) {
|
|
2239
2252
|
await this.loadMarkets();
|
|
2240
|
-
await this.loadAccounts();
|
|
2253
|
+
await this.loadAccounts(false, params);
|
|
2241
2254
|
for (let i = 0; i < this.accounts.length; i++) {
|
|
2242
2255
|
const account = this.accounts[i];
|
|
2243
2256
|
if (account['code'] === code) {
|
|
@@ -2266,7 +2279,7 @@ class coinbase extends coinbase$1 {
|
|
|
2266
2279
|
if (code === undefined) {
|
|
2267
2280
|
throw new errors.ArgumentsRequired(this.id + ' prepareAccountRequestWithCurrencyCode() method requires an account_id (or accountId) parameter OR a currency code argument');
|
|
2268
2281
|
}
|
|
2269
|
-
accountId = await this.findAccountId(code);
|
|
2282
|
+
accountId = await this.findAccountId(code, params);
|
|
2270
2283
|
if (accountId === undefined) {
|
|
2271
2284
|
throw new errors.ExchangeError(this.id + ' prepareAccountRequestWithCurrencyCode() could not find account id for ' + code);
|
|
2272
2285
|
}
|
|
@@ -2883,7 +2896,7 @@ class coinbase extends coinbase$1 {
|
|
|
2883
2896
|
let paginate = false;
|
|
2884
2897
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
|
|
2885
2898
|
if (paginate) {
|
|
2886
|
-
return await this.fetchPaginatedCallCursor('fetchOrders', symbol, since, limit, params, 'cursor', 'cursor', undefined,
|
|
2899
|
+
return await this.fetchPaginatedCallCursor('fetchOrders', symbol, since, limit, params, 'cursor', 'cursor', undefined, 1000);
|
|
2887
2900
|
}
|
|
2888
2901
|
let market = undefined;
|
|
2889
2902
|
if (symbol !== undefined) {
|
|
@@ -3410,7 +3423,7 @@ class coinbase extends coinbase$1 {
|
|
|
3410
3423
|
if (code === undefined) {
|
|
3411
3424
|
throw new errors.ArgumentsRequired(this.id + ' withdraw() requires an account_id (or accountId) parameter OR a currency code argument');
|
|
3412
3425
|
}
|
|
3413
|
-
accountId = await this.findAccountId(code);
|
|
3426
|
+
accountId = await this.findAccountId(code, params);
|
|
3414
3427
|
if (accountId === undefined) {
|
|
3415
3428
|
throw new errors.ExchangeError(this.id + ' withdraw() could not find account id for ' + code);
|
|
3416
3429
|
}
|
|
@@ -3635,7 +3648,7 @@ class coinbase extends coinbase$1 {
|
|
|
3635
3648
|
if (code === undefined) {
|
|
3636
3649
|
throw new errors.ArgumentsRequired(this.id + ' deposit() requires an account_id (or accountId) parameter OR a currency code argument');
|
|
3637
3650
|
}
|
|
3638
|
-
accountId = await this.findAccountId(code);
|
|
3651
|
+
accountId = await this.findAccountId(code, params);
|
|
3639
3652
|
if (accountId === undefined) {
|
|
3640
3653
|
throw new errors.ExchangeError(this.id + ' deposit() could not find account id for ' + code);
|
|
3641
3654
|
}
|
|
@@ -3705,7 +3718,7 @@ class coinbase extends coinbase$1 {
|
|
|
3705
3718
|
if (code === undefined) {
|
|
3706
3719
|
throw new errors.ArgumentsRequired(this.id + ' fetchDeposit() requires an account_id (or accountId) parameter OR a currency code argument');
|
|
3707
3720
|
}
|
|
3708
|
-
accountId = await this.findAccountId(code);
|
|
3721
|
+
accountId = await this.findAccountId(code, params);
|
|
3709
3722
|
if (accountId === undefined) {
|
|
3710
3723
|
throw new errors.ExchangeError(this.id + ' fetchDeposit() could not find account id for ' + code);
|
|
3711
3724
|
}
|