ccxt 4.4.8 → 4.4.9
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.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bigone.js +35 -86
- package/dist/cjs/src/bingx.js +7 -2
- package/dist/cjs/src/bitget.js +3 -0
- package/dist/cjs/src/bybit.js +5 -1
- package/dist/cjs/src/gate.js +35 -1
- package/dist/cjs/src/htx.js +2 -0
- package/dist/cjs/src/kucoin.js +2 -1
- package/dist/cjs/src/kucoinfutures.js +162 -2
- package/dist/cjs/src/pro/binance.js +4 -4
- package/dist/cjs/src/pro/hitbtc.js +122 -48
- package/dist/cjs/src/pro/hollaex.js +5 -0
- package/dist/cjs/src/pro/okx.js +19 -3
- package/dist/cjs/src/pro/p2b.js +35 -1
- package/dist/cjs/src/pro/whitebit.js +31 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bigone.d.ts +1 -1
- package/js/src/abstract/kucoinfutures.d.ts +5 -0
- package/js/src/bigone.js +35 -86
- package/js/src/bingx.js +7 -2
- package/js/src/bitget.js +3 -0
- package/js/src/bybit.js +5 -1
- package/js/src/gate.js +35 -1
- package/js/src/htx.js +2 -0
- package/js/src/kucoin.js +2 -1
- package/js/src/kucoinfutures.d.ts +7 -1
- package/js/src/kucoinfutures.js +162 -2
- package/js/src/pro/binance.js +4 -4
- package/js/src/pro/hitbtc.d.ts +4 -1
- package/js/src/pro/hitbtc.js +122 -48
- package/js/src/pro/hollaex.js +5 -0
- package/js/src/pro/okx.js +19 -3
- package/js/src/pro/p2b.d.ts +2 -1
- package/js/src/pro/p2b.js +35 -1
- package/js/src/pro/whitebit.d.ts +2 -1
- package/js/src/pro/whitebit.js +31 -0
- package/package.json +1 -1
package/js/src/bigone.js
CHANGED
|
@@ -161,7 +161,7 @@ export default class bigone extends Exchange {
|
|
|
161
161
|
},
|
|
162
162
|
'webExchange': {
|
|
163
163
|
'get': [
|
|
164
|
-
'
|
|
164
|
+
'v3/assets',
|
|
165
165
|
],
|
|
166
166
|
},
|
|
167
167
|
},
|
|
@@ -341,7 +341,7 @@ export default class bigone extends Exchange {
|
|
|
341
341
|
* @returns {dict} an associative dictionary of currencies
|
|
342
342
|
*/
|
|
343
343
|
// we use undocumented link (possible, less informative alternative is : https://big.one/api/uc/v3/assets/accounts)
|
|
344
|
-
const data = await this.fetchWebEndpoint('fetchCurrencies', '
|
|
344
|
+
const data = await this.fetchWebEndpoint('fetchCurrencies', 'webExchangeGetV3Assets', true);
|
|
345
345
|
if (data === undefined) {
|
|
346
346
|
return undefined;
|
|
347
347
|
}
|
|
@@ -351,91 +351,40 @@ export default class bigone extends Exchange {
|
|
|
351
351
|
// "message": "",
|
|
352
352
|
// "data": [
|
|
353
353
|
// {
|
|
354
|
-
//
|
|
355
|
-
//
|
|
356
|
-
//
|
|
357
|
-
//
|
|
358
|
-
//
|
|
359
|
-
//
|
|
360
|
-
//
|
|
361
|
-
//
|
|
362
|
-
//
|
|
363
|
-
//
|
|
364
|
-
//
|
|
365
|
-
//
|
|
354
|
+
// "uuid": "17082d1c-0195-4fb6-8779-2cdbcb9eeb3c",
|
|
355
|
+
// "symbol": "USDT",
|
|
356
|
+
// "name": "TetherUS",
|
|
357
|
+
// "scale": 12,
|
|
358
|
+
// "is_fiat": false,
|
|
359
|
+
// "is_transfer_enabled": true,
|
|
360
|
+
// "transfer_scale": 12,
|
|
361
|
+
// "binding_gateways": [
|
|
362
|
+
// {
|
|
363
|
+
// "guid": "07efc37f-d1ec-4bc9-8339-a745256ea2ba",
|
|
364
|
+
// "is_deposit_enabled": true,
|
|
365
|
+
// "gateway_name": "Ethereum",
|
|
366
|
+
// "min_withdrawal_amount": "0.000001",
|
|
367
|
+
// "withdrawal_fee": "5.71",
|
|
368
|
+
// "is_withdrawal_enabled": true,
|
|
369
|
+
// "min_deposit_amount": "0.000001",
|
|
370
|
+
// "is_memo_required": false,
|
|
371
|
+
// "withdrawal_scale": 6,
|
|
372
|
+
// "scale": 12
|
|
373
|
+
// },
|
|
374
|
+
// {
|
|
375
|
+
// "guid": "4e387a9a-a480-40a3-b4ae-ed1773c2db5a",
|
|
376
|
+
// "is_deposit_enabled": true,
|
|
377
|
+
// "gateway_name": "BinanceSmartChain",
|
|
378
|
+
// "min_withdrawal_amount": "10",
|
|
379
|
+
// "withdrawal_fee": "5",
|
|
380
|
+
// "is_withdrawal_enabled": false,
|
|
381
|
+
// "min_deposit_amount": "1",
|
|
382
|
+
// "is_memo_required": false,
|
|
383
|
+
// "withdrawal_scale": 8,
|
|
384
|
+
// "scale": 12
|
|
385
|
+
// }
|
|
386
|
+
// ]
|
|
366
387
|
// },
|
|
367
|
-
// "info_link": null,
|
|
368
|
-
// "scale": "12",
|
|
369
|
-
// "default_gateway": ..., // one object from "gateways"
|
|
370
|
-
// "gateways": [
|
|
371
|
-
// {
|
|
372
|
-
// "uuid": "f0fa5a85-7f65-428a-b7b7-13aad55c2837",
|
|
373
|
-
// "name": "Mixin",
|
|
374
|
-
// "kind": "CHAIN",
|
|
375
|
-
// "required_confirmations": "0",
|
|
376
|
-
// },
|
|
377
|
-
// {
|
|
378
|
-
// "uuid": "b75446c6-1446-4c8d-b3d1-39f385b0a926",
|
|
379
|
-
// "name": "Ethereum",
|
|
380
|
-
// "kind": "CHAIN",
|
|
381
|
-
// "required_confirmations": "18",
|
|
382
|
-
// },
|
|
383
|
-
// {
|
|
384
|
-
// "uuid": "fe9b1b0b-e55c-4017-b5ce-16f524df5fc0",
|
|
385
|
-
// "name": "Tron",
|
|
386
|
-
// "kind": "CHAIN",
|
|
387
|
-
// "required_confirmations": "1",
|
|
388
|
-
// },
|
|
389
|
-
// ...
|
|
390
|
-
// ],
|
|
391
|
-
// "payments": [],
|
|
392
|
-
// "uuid": "17082d1c-0195-4fb6-8779-2cdbcb9eeb3c",
|
|
393
|
-
// "binding_gateways": [
|
|
394
|
-
// {
|
|
395
|
-
// "guid": "07efc37f-d1ec-4bc9-8339-a745256ea2ba",
|
|
396
|
-
// "contract_address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
|
|
397
|
-
// "is_deposit_enabled": true,
|
|
398
|
-
// "display_name": "Ethereum(ERC20)",
|
|
399
|
-
// "gateway_name": "Ethereum",
|
|
400
|
-
// "min_withdrawal_amount": "0.000001",
|
|
401
|
-
// "min_internal_withdrawal_amount": "0.00000001",
|
|
402
|
-
// "withdrawal_fee": "14",
|
|
403
|
-
// "is_withdrawal_enabled": true,
|
|
404
|
-
// "min_deposit_amount": "0.000001",
|
|
405
|
-
// "is_memo_required": false,
|
|
406
|
-
// "withdrawal_scale": "2",
|
|
407
|
-
// "gateway": {
|
|
408
|
-
// "uuid": "b75446c6-1446-4c8d-b3d1-39f385b0a926",
|
|
409
|
-
// "name": "Ethereum",
|
|
410
|
-
// "kind": "CHAIN",
|
|
411
|
-
// "required_confirmations": "18",
|
|
412
|
-
// },
|
|
413
|
-
// "scale": "12",
|
|
414
|
-
// },
|
|
415
|
-
// {
|
|
416
|
-
// "guid": "b80a4d13-cac7-4319-842d-b33c3bfab8ec",
|
|
417
|
-
// "contract_address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
|
|
418
|
-
// "is_deposit_enabled": true,
|
|
419
|
-
// "display_name": "Tron(TRC20)",
|
|
420
|
-
// "gateway_name": "Tron",
|
|
421
|
-
// "min_withdrawal_amount": "0.000001",
|
|
422
|
-
// "min_internal_withdrawal_amount": "0.00000001",
|
|
423
|
-
// "withdrawal_fee": "1",
|
|
424
|
-
// "is_withdrawal_enabled": true,
|
|
425
|
-
// "min_deposit_amount": "0.000001",
|
|
426
|
-
// "is_memo_required": false,
|
|
427
|
-
// "withdrawal_scale": "6",
|
|
428
|
-
// "gateway": {
|
|
429
|
-
// "uuid": "fe9b1b0b-e55c-4017-b5ce-16f524df5fc0",
|
|
430
|
-
// "name": "Tron",
|
|
431
|
-
// "kind": "CHAIN",
|
|
432
|
-
// "required_confirmations": "1",
|
|
433
|
-
// },
|
|
434
|
-
// "scale": "12",
|
|
435
|
-
// },
|
|
436
|
-
// ...
|
|
437
|
-
// ],
|
|
438
|
-
// },
|
|
439
388
|
// ...
|
|
440
389
|
// ],
|
|
441
390
|
// }
|
package/js/src/bingx.js
CHANGED
|
@@ -651,7 +651,12 @@ export default class bingx extends Exchange {
|
|
|
651
651
|
// "maxNotional": 20000,
|
|
652
652
|
// "status": 1,
|
|
653
653
|
// "tickSize": 0.000001,
|
|
654
|
-
// "stepSize": 1
|
|
654
|
+
// "stepSize": 1,
|
|
655
|
+
// "apiStateSell": true,
|
|
656
|
+
// "apiStateBuy": true,
|
|
657
|
+
// "timeOnline": 0,
|
|
658
|
+
// "offTime": 0,
|
|
659
|
+
// "maintainTime": 0
|
|
655
660
|
// },
|
|
656
661
|
// ...
|
|
657
662
|
// ]
|
|
@@ -760,7 +765,7 @@ export default class bingx extends Exchange {
|
|
|
760
765
|
if ((this.safeString(market, 'apiStateOpen') === 'true') && (this.safeString(market, 'apiStateClose') === 'true')) {
|
|
761
766
|
isActive = true; // swap active
|
|
762
767
|
}
|
|
763
|
-
else if (this.safeBool(market, 'apiStateSell') && this.safeBool(market, 'apiStateBuy')) {
|
|
768
|
+
else if (this.safeBool(market, 'apiStateSell') && this.safeBool(market, 'apiStateBuy') && (this.safeNumber(market, 'status') === 1)) {
|
|
764
769
|
isActive = true; // spot active
|
|
765
770
|
}
|
|
766
771
|
const isInverse = (spot) ? undefined : checkIsInverse;
|
package/js/src/bitget.js
CHANGED
|
@@ -1423,6 +1423,9 @@ export default class bitget extends Exchange {
|
|
|
1423
1423
|
'STARKNET': 'Starknet',
|
|
1424
1424
|
'OPTIMISM': 'Optimism',
|
|
1425
1425
|
'ARBITRUM': 'Arbitrum',
|
|
1426
|
+
'APT': 'APTOS',
|
|
1427
|
+
'MATIC': 'POLYGON',
|
|
1428
|
+
'VIC': 'VICTION',
|
|
1426
1429
|
},
|
|
1427
1430
|
'networksById': {},
|
|
1428
1431
|
'fetchPositions': {
|
package/js/src/bybit.js
CHANGED
|
@@ -3712,6 +3712,7 @@ export default class bybit extends Exchange {
|
|
|
3712
3712
|
// Valid for option only.
|
|
3713
3713
|
// 'orderIv': '0', // Implied volatility; parameters are passed according to the real value; for example, for 10%, 0.1 is passed
|
|
3714
3714
|
};
|
|
3715
|
+
const hedged = this.safeBool(params, 'hedged', false);
|
|
3715
3716
|
let triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
|
|
3716
3717
|
const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice');
|
|
3717
3718
|
const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
|
|
@@ -3910,7 +3911,10 @@ export default class bybit extends Exchange {
|
|
|
3910
3911
|
}
|
|
3911
3912
|
}
|
|
3912
3913
|
}
|
|
3913
|
-
|
|
3914
|
+
if (!market['spot'] && hedged) {
|
|
3915
|
+
request['positionIdx'] = (side === 'buy') ? 1 : 2;
|
|
3916
|
+
}
|
|
3917
|
+
params = this.omit(params, ['stopPrice', 'timeInForce', 'stopLossPrice', 'takeProfitPrice', 'postOnly', 'clientOrderId', 'triggerPrice', 'stopLoss', 'takeProfit', 'trailingAmount', 'trailingTriggerPrice', 'hedged']);
|
|
3914
3918
|
return this.extend(request, params);
|
|
3915
3919
|
}
|
|
3916
3920
|
async createOrders(orders, params = {}) {
|
package/js/src/gate.js
CHANGED
|
@@ -596,6 +596,8 @@ export default class gate extends Exchange {
|
|
|
596
596
|
},
|
|
597
597
|
// copied from gatev2
|
|
598
598
|
'commonCurrencies': {
|
|
599
|
+
'ORT': 'XREATORS',
|
|
600
|
+
'ASS': 'ASSF',
|
|
599
601
|
'88MPH': 'MPH',
|
|
600
602
|
'AXIS': 'AXISDEFI',
|
|
601
603
|
'BIFI': 'BITCOINFILE',
|
|
@@ -630,6 +632,8 @@ export default class gate extends Exchange {
|
|
|
630
632
|
},
|
|
631
633
|
'createMarketBuyOrderRequiresPrice': true,
|
|
632
634
|
'networks': {
|
|
635
|
+
'LINEA': 'LINEAETH',
|
|
636
|
+
'KON': 'KONET',
|
|
633
637
|
'AVAXC': 'AVAX_C',
|
|
634
638
|
'BEP20': 'BSC',
|
|
635
639
|
'EOS': 'EOS',
|
|
@@ -4712,6 +4716,7 @@ export default class gate extends Exchange {
|
|
|
4712
4716
|
* @see https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders-2
|
|
4713
4717
|
* @see https://www.gate.io/docs/developers/apiv4/en/#list-all-auto-orders-2
|
|
4714
4718
|
* @see https://www.gate.io/docs/developers/apiv4/en/#list-options-orders
|
|
4719
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders-by-time-range
|
|
4715
4720
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
4716
4721
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
4717
4722
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -4719,9 +4724,38 @@ export default class gate extends Exchange {
|
|
|
4719
4724
|
* @param {bool} [params.stop] true for fetching stop orders
|
|
4720
4725
|
* @param {string} [params.type] spot, swap or future, if not provided this.options['defaultType'] is used
|
|
4721
4726
|
* @param {string} [params.marginMode] 'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used
|
|
4727
|
+
* @param {boolean} [params.historical] *swap only* true for using historical endpoint
|
|
4722
4728
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4723
4729
|
*/
|
|
4724
|
-
|
|
4730
|
+
await this.loadMarkets();
|
|
4731
|
+
const until = this.safeInteger(params, 'until');
|
|
4732
|
+
params = this.omit(params, 'until');
|
|
4733
|
+
let market = undefined;
|
|
4734
|
+
if (symbol !== undefined) {
|
|
4735
|
+
market = this.market(symbol);
|
|
4736
|
+
symbol = market['symbol'];
|
|
4737
|
+
}
|
|
4738
|
+
const res = this.handleMarketTypeAndParams('fetchClosedOrders', market, params);
|
|
4739
|
+
const type = this.safeString(res, 0);
|
|
4740
|
+
let useHistorical = false;
|
|
4741
|
+
[useHistorical, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'historical', false);
|
|
4742
|
+
if (!useHistorical && ((since === undefined && until === undefined) || (type !== 'swap'))) {
|
|
4743
|
+
return await this.fetchOrdersByStatus('finished', symbol, since, limit, params);
|
|
4744
|
+
}
|
|
4745
|
+
params = this.omit(params, 'type');
|
|
4746
|
+
let request = {};
|
|
4747
|
+
[request, params] = this.prepareRequest(market, type, params);
|
|
4748
|
+
if (since !== undefined) {
|
|
4749
|
+
request['from'] = this.parseToInt(since / 1000);
|
|
4750
|
+
}
|
|
4751
|
+
if (until !== undefined) {
|
|
4752
|
+
request['to'] = this.parseToInt(until / 1000);
|
|
4753
|
+
}
|
|
4754
|
+
if (limit !== undefined) {
|
|
4755
|
+
request['limit'] = limit;
|
|
4756
|
+
}
|
|
4757
|
+
const response = await this.privateFuturesGetSettleOrdersTimerange(this.extend(request, params));
|
|
4758
|
+
return this.parseOrders(response, market, since, limit);
|
|
4725
4759
|
}
|
|
4726
4760
|
fetchOrdersByStatusRequest(status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4727
4761
|
let market = undefined;
|
package/js/src/htx.js
CHANGED
|
@@ -3127,6 +3127,7 @@ export default class htx extends Exchange {
|
|
|
3127
3127
|
* @method
|
|
3128
3128
|
* @name htx#fetchAccounts
|
|
3129
3129
|
* @description fetch all the accounts associated with a profile
|
|
3130
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-all-accounts-of-the-current-user
|
|
3130
3131
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3131
3132
|
* @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
|
|
3132
3133
|
*/
|
|
@@ -3200,6 +3201,7 @@ export default class htx extends Exchange {
|
|
|
3200
3201
|
* @method
|
|
3201
3202
|
* @name htx#fetchCurrencies
|
|
3202
3203
|
* @description fetches all available currencies on an exchange
|
|
3204
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#apiv2-currency-amp-chains
|
|
3203
3205
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3204
3206
|
* @returns {object} an associative dictionary of currencies
|
|
3205
3207
|
*/
|
package/js/src/kucoin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import kucoin from './abstract/kucoinfutures.js';
|
|
2
|
-
import type { TransferEntry, Int, OrderSide, OrderType, OHLCV, Order, Trade, OrderRequest, FundingHistory, Balances, Str, Ticker, Tickers, OrderBook, Transaction, Strings, Market, Currency, Num, MarginModification, TradingFeeInterface, Dict, LeverageTier } from './base/types.js';
|
|
2
|
+
import type { TransferEntry, Int, OrderSide, OrderType, OHLCV, Order, Trade, OrderRequest, FundingHistory, Balances, Str, Ticker, Tickers, OrderBook, Transaction, Strings, Market, Currency, Num, MarginModification, TradingFeeInterface, Dict, LeverageTier, MarginMode, Leverage } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class kucoinfutures
|
|
5
5
|
* @augments Exchange
|
|
@@ -87,4 +87,10 @@ export default class kucoinfutures extends kucoin {
|
|
|
87
87
|
};
|
|
88
88
|
closePosition(symbol: string, side?: OrderSide, params?: {}): Promise<Order>;
|
|
89
89
|
fetchTradingFee(symbol: string, params?: {}): Promise<TradingFeeInterface>;
|
|
90
|
+
fetchMarginMode(symbol: string, params?: {}): Promise<MarginMode>;
|
|
91
|
+
parseMarginMode(marginMode: Dict, market?: any): MarginMode;
|
|
92
|
+
setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<MarginMode>;
|
|
93
|
+
fetchLeverage(symbol: string, params?: {}): Promise<Leverage>;
|
|
94
|
+
setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<Leverage>;
|
|
95
|
+
parseLeverage(leverage: Dict, market?: Market): Leverage;
|
|
90
96
|
}
|
package/js/src/kucoinfutures.js
CHANGED
|
@@ -70,9 +70,10 @@ export default class kucoinfutures extends kucoin {
|
|
|
70
70
|
'fetchIsolatedBorrowRates': false,
|
|
71
71
|
'fetchL3OrderBook': true,
|
|
72
72
|
'fetchLedger': true,
|
|
73
|
+
'fetchLeverage': true,
|
|
73
74
|
'fetchLeverageTiers': false,
|
|
74
75
|
'fetchMarginAdjustmentHistory': false,
|
|
75
|
-
'fetchMarginMode':
|
|
76
|
+
'fetchMarginMode': true,
|
|
76
77
|
'fetchMarketLeverageTiers': true,
|
|
77
78
|
'fetchMarkets': true,
|
|
78
79
|
'fetchMarkOHLCV': false,
|
|
@@ -96,7 +97,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
96
97
|
'fetchTransactionFee': false,
|
|
97
98
|
'fetchWithdrawals': true,
|
|
98
99
|
'setLeverage': false,
|
|
99
|
-
'setMarginMode':
|
|
100
|
+
'setMarginMode': true,
|
|
100
101
|
'transfer': true,
|
|
101
102
|
'withdraw': undefined,
|
|
102
103
|
},
|
|
@@ -173,12 +174,15 @@ export default class kucoinfutures extends kucoin {
|
|
|
173
174
|
'trade-fees': 1,
|
|
174
175
|
'history-positions': 1,
|
|
175
176
|
'getMaxOpenSize': 1,
|
|
177
|
+
'getCrossUserLeverage': 1,
|
|
178
|
+
'position/getMarginMode': 1,
|
|
176
179
|
},
|
|
177
180
|
'post': {
|
|
178
181
|
'withdrawals': 1,
|
|
179
182
|
'transfer-out': 1,
|
|
180
183
|
'transfer-in': 1,
|
|
181
184
|
'orders': 1.33,
|
|
185
|
+
'st-orders': 1.33,
|
|
182
186
|
'orders/test': 1.33,
|
|
183
187
|
'position/margin/auto-deposit-status': 1,
|
|
184
188
|
'position/margin/deposit-margin': 1,
|
|
@@ -186,6 +190,8 @@ export default class kucoinfutures extends kucoin {
|
|
|
186
190
|
'bullet-private': 1,
|
|
187
191
|
'sub/api-key': 1,
|
|
188
192
|
'sub/api-key/update': 1,
|
|
193
|
+
'changeCrossUserLeverage': 1,
|
|
194
|
+
'position/changeMarginMode': 1,
|
|
189
195
|
},
|
|
190
196
|
'delete': {
|
|
191
197
|
'withdrawals/{withdrawalId}': 1,
|
|
@@ -320,9 +326,13 @@ export default class kucoinfutures extends kucoin {
|
|
|
320
326
|
'futuresPrivate': {
|
|
321
327
|
'GET': {
|
|
322
328
|
'getMaxOpenSize': 'v2',
|
|
329
|
+
'getCrossUserLeverage': 'v2',
|
|
330
|
+
'position/getMarginMode': 'v2',
|
|
323
331
|
},
|
|
324
332
|
'POST': {
|
|
325
333
|
'transfer-out': 'v2',
|
|
334
|
+
'changeCrossUserLeverage': 'v2',
|
|
335
|
+
'position/changeMarginMode': 'v2',
|
|
326
336
|
},
|
|
327
337
|
},
|
|
328
338
|
'futuresPublic': {
|
|
@@ -2881,4 +2891,154 @@ export default class kucoinfutures extends kucoin {
|
|
|
2881
2891
|
'tierBased': true,
|
|
2882
2892
|
};
|
|
2883
2893
|
}
|
|
2894
|
+
async fetchMarginMode(symbol, params = {}) {
|
|
2895
|
+
/**
|
|
2896
|
+
* @method
|
|
2897
|
+
* @name kucoinfutures#fetchMarginMode
|
|
2898
|
+
* @description fetches the margin mode of a trading pair
|
|
2899
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/positions/get-margin-mode
|
|
2900
|
+
* @param {string} symbol unified symbol of the market to fetch the margin mode for
|
|
2901
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2902
|
+
* @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
|
|
2903
|
+
*/
|
|
2904
|
+
await this.loadMarkets();
|
|
2905
|
+
const market = this.market(symbol);
|
|
2906
|
+
const request = {
|
|
2907
|
+
'symbol': market['id'],
|
|
2908
|
+
};
|
|
2909
|
+
const response = await this.futuresPrivateGetPositionGetMarginMode(this.extend(request, params));
|
|
2910
|
+
//
|
|
2911
|
+
// {
|
|
2912
|
+
// "code": "200000",
|
|
2913
|
+
// "data": {
|
|
2914
|
+
// "symbol": "XBTUSDTM",
|
|
2915
|
+
// "marginMode": "ISOLATED"
|
|
2916
|
+
// }
|
|
2917
|
+
// }
|
|
2918
|
+
//
|
|
2919
|
+
const data = this.safeDict(response, 'data', {});
|
|
2920
|
+
return this.parseMarginMode(data, market);
|
|
2921
|
+
}
|
|
2922
|
+
parseMarginMode(marginMode, market = undefined) {
|
|
2923
|
+
let marginType = this.safeString(marginMode, 'marginMode');
|
|
2924
|
+
marginType = (marginType === 'ISOLATED') ? 'isolated' : 'cross';
|
|
2925
|
+
return {
|
|
2926
|
+
'info': marginMode,
|
|
2927
|
+
'symbol': market['symbol'],
|
|
2928
|
+
'marginMode': marginType,
|
|
2929
|
+
};
|
|
2930
|
+
}
|
|
2931
|
+
async setMarginMode(marginMode, symbol = undefined, params = {}) {
|
|
2932
|
+
/**
|
|
2933
|
+
* @method
|
|
2934
|
+
* @name kucoinfutures#setMarginMode
|
|
2935
|
+
* @description set margin mode to 'cross' or 'isolated'
|
|
2936
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/positions/modify-margin-mode
|
|
2937
|
+
* @param {string} marginMode 'cross' or 'isolated'
|
|
2938
|
+
* @param {string} symbol unified market symbol
|
|
2939
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2940
|
+
* @returns {object} response from the exchange
|
|
2941
|
+
*/
|
|
2942
|
+
if (symbol === undefined) {
|
|
2943
|
+
throw new ArgumentsRequired(this.id + ' setMarginMode() requires a symbol argument');
|
|
2944
|
+
}
|
|
2945
|
+
this.checkRequiredArgument('setMarginMode', marginMode, 'marginMode', ['cross', 'isolated']);
|
|
2946
|
+
await this.loadMarkets();
|
|
2947
|
+
const market = this.market(symbol);
|
|
2948
|
+
const request = {
|
|
2949
|
+
'symbol': market['id'],
|
|
2950
|
+
'marginMode': marginMode.toUpperCase(),
|
|
2951
|
+
};
|
|
2952
|
+
const response = await this.futuresPrivatePostPositionChangeMarginMode(this.extend(request, params));
|
|
2953
|
+
//
|
|
2954
|
+
// {
|
|
2955
|
+
// "code": "200000",
|
|
2956
|
+
// "data": {
|
|
2957
|
+
// "symbol": "XBTUSDTM",
|
|
2958
|
+
// "marginMode": "ISOLATED"
|
|
2959
|
+
// }
|
|
2960
|
+
// }
|
|
2961
|
+
//
|
|
2962
|
+
const data = this.safeDict(response, 'data', {});
|
|
2963
|
+
return this.parseMarginMode(data, market);
|
|
2964
|
+
}
|
|
2965
|
+
async fetchLeverage(symbol, params = {}) {
|
|
2966
|
+
/**
|
|
2967
|
+
* @method
|
|
2968
|
+
* @name kucoin#fetchLeverage
|
|
2969
|
+
* @description fetch the set leverage for a market
|
|
2970
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/positions/get-cross-margin-leverage
|
|
2971
|
+
* @param {string} symbol unified market symbol
|
|
2972
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2973
|
+
* @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
2974
|
+
*/
|
|
2975
|
+
let marginMode = undefined;
|
|
2976
|
+
[marginMode, params] = this.handleMarginModeAndParams(symbol, params);
|
|
2977
|
+
if (marginMode !== 'cross') {
|
|
2978
|
+
throw new NotSupported(this.id + ' fetchLeverage() currently supports only params["marginMode"] = "cross"');
|
|
2979
|
+
}
|
|
2980
|
+
await this.loadMarkets();
|
|
2981
|
+
const market = this.market(symbol);
|
|
2982
|
+
const request = {
|
|
2983
|
+
'symbol': market['id'],
|
|
2984
|
+
};
|
|
2985
|
+
const response = await this.futuresPrivateGetGetCrossUserLeverage(this.extend(request, params));
|
|
2986
|
+
//
|
|
2987
|
+
// {
|
|
2988
|
+
// "code": "200000",
|
|
2989
|
+
// "data": {
|
|
2990
|
+
// "symbol": "XBTUSDTM",
|
|
2991
|
+
// "leverage": "3"
|
|
2992
|
+
// }
|
|
2993
|
+
// }
|
|
2994
|
+
//
|
|
2995
|
+
const data = this.safeDict(response, 'data', {});
|
|
2996
|
+
const parsed = this.parseLeverage(data, market);
|
|
2997
|
+
return this.extend(parsed, {
|
|
2998
|
+
'marginMode': marginMode,
|
|
2999
|
+
});
|
|
3000
|
+
}
|
|
3001
|
+
async setLeverage(leverage, symbol = undefined, params = {}) {
|
|
3002
|
+
/**
|
|
3003
|
+
* @method
|
|
3004
|
+
* @name kucoinfutures#setLeverage
|
|
3005
|
+
* @description set the level of leverage for a market
|
|
3006
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/positions/modify-cross-margin-leverage
|
|
3007
|
+
* @param {float} leverage the rate of leverage
|
|
3008
|
+
* @param {string} symbol unified market symbol
|
|
3009
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3010
|
+
* @returns {object} response from the exchange
|
|
3011
|
+
*/
|
|
3012
|
+
let marginMode = undefined;
|
|
3013
|
+
[marginMode, params] = this.handleMarginModeAndParams(symbol, params);
|
|
3014
|
+
if (marginMode !== 'cross') {
|
|
3015
|
+
throw new NotSupported(this.id + ' setLeverage() currently supports only params["marginMode"] = "cross"');
|
|
3016
|
+
}
|
|
3017
|
+
await this.loadMarkets();
|
|
3018
|
+
const market = this.market(symbol);
|
|
3019
|
+
const request = {
|
|
3020
|
+
'symbol': market['id'],
|
|
3021
|
+
'leverage': leverage.toString(),
|
|
3022
|
+
};
|
|
3023
|
+
const response = await this.futuresPrivatePostChangeCrossUserLeverage(this.extend(request, params));
|
|
3024
|
+
//
|
|
3025
|
+
// {
|
|
3026
|
+
// "code": "200000",
|
|
3027
|
+
// "data": true
|
|
3028
|
+
// }
|
|
3029
|
+
//
|
|
3030
|
+
return this.parseLeverage(response, market);
|
|
3031
|
+
}
|
|
3032
|
+
parseLeverage(leverage, market = undefined) {
|
|
3033
|
+
const marketId = this.safeString(leverage, 'symbol');
|
|
3034
|
+
market = this.safeMarket(marketId, market);
|
|
3035
|
+
const leverageNum = this.safeInteger(leverage, 'leverage');
|
|
3036
|
+
return {
|
|
3037
|
+
'info': leverage,
|
|
3038
|
+
'symbol': market['symbol'],
|
|
3039
|
+
'marginMode': undefined,
|
|
3040
|
+
'longLeverage': leverageNum,
|
|
3041
|
+
'shortLeverage': leverageNum,
|
|
3042
|
+
};
|
|
3043
|
+
}
|
|
2884
3044
|
}
|
package/js/src/pro/binance.js
CHANGED
|
@@ -2649,16 +2649,16 @@ export default class binance extends binanceRest {
|
|
|
2649
2649
|
[subType, params] = this.handleSubTypeAndParams('watchBalance', undefined, params);
|
|
2650
2650
|
let isPortfolioMargin = undefined;
|
|
2651
2651
|
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'watchBalance', 'papi', 'portfolioMargin', false);
|
|
2652
|
-
let urlType = type;
|
|
2653
|
-
if (isPortfolioMargin) {
|
|
2654
|
-
urlType = 'papi';
|
|
2655
|
-
}
|
|
2656
2652
|
if (this.isLinear(type, subType)) {
|
|
2657
2653
|
type = 'future';
|
|
2658
2654
|
}
|
|
2659
2655
|
else if (this.isInverse(type, subType)) {
|
|
2660
2656
|
type = 'delivery';
|
|
2661
2657
|
}
|
|
2658
|
+
let urlType = type;
|
|
2659
|
+
if (isPortfolioMargin) {
|
|
2660
|
+
urlType = 'papi';
|
|
2661
|
+
}
|
|
2662
2662
|
const url = this.urls['api']['ws'][urlType] + '/' + this.options[type]['listenKey'];
|
|
2663
2663
|
const client = this.client(url);
|
|
2664
2664
|
this.setBalanceCache(client, type, isPortfolioMargin);
|
package/js/src/pro/hitbtc.d.ts
CHANGED
|
@@ -14,8 +14,11 @@ export default class hitbtc extends hitbtcRest {
|
|
|
14
14
|
handleDeltas(bookside: any, deltas: any): void;
|
|
15
15
|
watchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
16
16
|
watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
17
|
-
handleTicker(client: Client, message: any):
|
|
17
|
+
handleTicker(client: Client, message: any): void;
|
|
18
18
|
parseWsTicker(ticker: any, market?: any): Ticker;
|
|
19
|
+
watchBidsAsks(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
20
|
+
handleBidAsk(client: Client, message: any): void;
|
|
21
|
+
parseWsBidAsk(ticker: any, market?: any): Ticker;
|
|
19
22
|
watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
20
23
|
handleTrades(client: Client, message: any): any;
|
|
21
24
|
parseWsTrades(trades: any, market?: object, since?: Int, limit?: Int, params?: {}): Trade[];
|