ccxt 4.2.52 → 4.2.54
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/build.sh +1 -1
- package/dist/ccxt.browser.js +511 -102
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binance.js +136 -9
- package/dist/cjs/src/bingx.js +32 -1
- package/dist/cjs/src/bitget.js +1 -0
- package/dist/cjs/src/bitvavo.js +1 -1
- package/dist/cjs/src/bybit.js +19 -0
- package/dist/cjs/src/coinbase.js +186 -12
- package/dist/cjs/src/htx.js +10 -4
- package/dist/cjs/src/pro/binance.js +92 -38
- package/dist/cjs/src/pro/bitvavo.js +1 -1
- package/dist/cjs/src/pro/blockchaincom.js +7 -25
- package/dist/cjs/src/pro/deribit.js +2 -2
- package/dist/cjs/src/pro/gemini.js +1 -1
- package/dist/cjs/src/pro/okx.js +18 -4
- package/dist/cjs/src/whitebit.js +4 -3
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +9 -3
- package/js/src/abstract/binancecoinm.d.ts +9 -3
- package/js/src/abstract/binanceus.d.ts +9 -3
- package/js/src/abstract/binanceusdm.d.ts +9 -3
- package/js/src/abstract/coinbase.d.ts +1 -1
- package/js/src/binance.d.ts +4 -0
- package/js/src/binance.js +136 -9
- package/js/src/bingx.d.ts +4 -0
- package/js/src/bingx.js +32 -1
- package/js/src/bitget.js +1 -0
- package/js/src/bitvavo.js +1 -1
- package/js/src/bybit.d.ts +5 -0
- package/js/src/bybit.js +19 -0
- package/js/src/coinbase.d.ts +2 -0
- package/js/src/coinbase.js +186 -12
- package/js/src/htx.js +10 -4
- package/js/src/pro/binance.d.ts +4 -4
- package/js/src/pro/binance.js +92 -38
- package/js/src/pro/bitvavo.js +1 -1
- package/js/src/pro/blockchaincom.d.ts +0 -1
- package/js/src/pro/blockchaincom.js +7 -25
- package/js/src/pro/deribit.js +2 -2
- package/js/src/pro/gemini.js +1 -1
- package/js/src/pro/okx.js +18 -4
- package/js/src/whitebit.js +4 -3
- package/jsdoc2md.js +3 -2
- package/package.json +2 -1
- package/skip-tests.json +26 -9
|
@@ -46,6 +46,7 @@ interface Exchange {
|
|
|
46
46
|
v2PrivatePutUser(params?: {}): Promise<implicitReturnType>;
|
|
47
47
|
v2PrivateDeleteAccountsId(params?: {}): Promise<implicitReturnType>;
|
|
48
48
|
v2PrivateDeleteAccountsAccountIdTransactionsTransactionId(params?: {}): Promise<implicitReturnType>;
|
|
49
|
+
v3PublicGetBrokerageTime(params?: {}): Promise<implicitReturnType>;
|
|
49
50
|
v3PrivateGetBrokerageAccounts(params?: {}): Promise<implicitReturnType>;
|
|
50
51
|
v3PrivateGetBrokerageAccountsAccountUuid(params?: {}): Promise<implicitReturnType>;
|
|
51
52
|
v3PrivateGetBrokerageOrdersHistoricalBatch(params?: {}): Promise<implicitReturnType>;
|
|
@@ -61,7 +62,6 @@ interface Exchange {
|
|
|
61
62
|
v3PrivateGetBrokerageProductBook(params?: {}): Promise<implicitReturnType>;
|
|
62
63
|
v3PrivateGetBrokerageBestBidAsk(params?: {}): Promise<implicitReturnType>;
|
|
63
64
|
v3PrivateGetBrokerageConvertTradeTradeId(params?: {}): Promise<implicitReturnType>;
|
|
64
|
-
v3PrivateGetBrokerageTime(params?: {}): Promise<implicitReturnType>;
|
|
65
65
|
v3PrivateGetBrokerageCfmBalanceSummary(params?: {}): Promise<implicitReturnType>;
|
|
66
66
|
v3PrivateGetBrokerageCfmPositions(params?: {}): Promise<implicitReturnType>;
|
|
67
67
|
v3PrivateGetBrokerageCfmPositionsProductId(params?: {}): Promise<implicitReturnType>;
|
package/js/src/binance.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ export default class binance extends Exchange {
|
|
|
66
66
|
fetchOpenOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
67
67
|
fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
68
68
|
fetchCanceledOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
69
|
+
fetchCanceledAndClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
69
70
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
70
71
|
cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
|
|
71
72
|
cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
|
|
@@ -263,6 +264,7 @@ export default class binance extends Exchange {
|
|
|
263
264
|
setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
|
|
264
265
|
setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<any>;
|
|
265
266
|
setPositionMode(hedged: boolean, symbol?: Str, params?: {}): Promise<any>;
|
|
267
|
+
fetchLeverage(symbol: string, params?: {}): Promise<any>;
|
|
266
268
|
fetchSettlementHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
267
269
|
fetchMySettlementHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
268
270
|
parseSettlement(settlement: any, market: any): {
|
|
@@ -273,6 +275,7 @@ export default class binance extends Exchange {
|
|
|
273
275
|
datetime: string;
|
|
274
276
|
};
|
|
275
277
|
parseSettlements(settlements: any, market: any): any[];
|
|
278
|
+
fetchLedgerEntry(id: string, code?: Str, params?: {}): Promise<any>;
|
|
276
279
|
fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
277
280
|
parseLedgerEntry(item: any, currency?: Currency): {
|
|
278
281
|
id: string;
|
|
@@ -425,6 +428,7 @@ export default class binance extends Exchange {
|
|
|
425
428
|
underlyingPrice: any;
|
|
426
429
|
info: any;
|
|
427
430
|
};
|
|
431
|
+
fetchTradingLimits(symbols?: Strings, params?: {}): Promise<{}>;
|
|
428
432
|
fetchPositionMode(symbol?: Str, params?: {}): Promise<{
|
|
429
433
|
info: any;
|
|
430
434
|
hedged: boolean;
|
package/js/src/binance.js
CHANGED
|
@@ -44,13 +44,13 @@ export default class binance extends Exchange {
|
|
|
44
44
|
'closeAllPositions': false,
|
|
45
45
|
'closePosition': false,
|
|
46
46
|
'createDepositAddress': false,
|
|
47
|
-
'createMarketBuyOrderWithCost': true,
|
|
48
|
-
'createMarketOrderWithCost': true,
|
|
49
|
-
'createMarketSellOrderWithCost': true,
|
|
50
47
|
'createLimitBuyOrder': true,
|
|
51
48
|
'createLimitSellOrder': true,
|
|
52
49
|
'createMarketBuyOrder': true,
|
|
50
|
+
'createMarketBuyOrderWithCost': true,
|
|
51
|
+
'createMarketOrderWithCost': true,
|
|
53
52
|
'createMarketSellOrder': true,
|
|
53
|
+
'createMarketSellOrderWithCost': true,
|
|
54
54
|
'createOrder': true,
|
|
55
55
|
'createOrders': true,
|
|
56
56
|
'createOrderWithTakeProfitAndStopLoss': true,
|
|
@@ -70,6 +70,7 @@ export default class binance extends Exchange {
|
|
|
70
70
|
'fetchBorrowInterest': true,
|
|
71
71
|
'fetchBorrowRateHistories': false,
|
|
72
72
|
'fetchBorrowRateHistory': true,
|
|
73
|
+
'fetchCanceledAndClosedOrders': 'emulated',
|
|
73
74
|
'fetchCanceledOrders': 'emulated',
|
|
74
75
|
'fetchClosedOrder': false,
|
|
75
76
|
'fetchClosedOrders': 'emulated',
|
|
@@ -95,7 +96,8 @@ export default class binance extends Exchange {
|
|
|
95
96
|
'fetchL3OrderBook': false,
|
|
96
97
|
'fetchLastPrices': true,
|
|
97
98
|
'fetchLedger': true,
|
|
98
|
-
'
|
|
99
|
+
'fetchLedgerEntry': true,
|
|
100
|
+
'fetchLeverage': true,
|
|
99
101
|
'fetchLeverageTiers': true,
|
|
100
102
|
'fetchLiquidations': false,
|
|
101
103
|
'fetchMarketLeverageTiers': 'emulated',
|
|
@@ -127,7 +129,7 @@ export default class binance extends Exchange {
|
|
|
127
129
|
'fetchTrades': true,
|
|
128
130
|
'fetchTradingFee': true,
|
|
129
131
|
'fetchTradingFees': true,
|
|
130
|
-
'fetchTradingLimits':
|
|
132
|
+
'fetchTradingLimits': 'emulated',
|
|
131
133
|
'fetchTransactionFee': 'emulated',
|
|
132
134
|
'fetchTransactionFees': true,
|
|
133
135
|
'fetchTransactions': false,
|
|
@@ -295,8 +297,6 @@ export default class binance extends Exchange {
|
|
|
295
297
|
'loan/flexible/borrow/history': 40,
|
|
296
298
|
'loan/flexible/repay/history': 40,
|
|
297
299
|
'loan/flexible/ltv/adjustment/history': 40,
|
|
298
|
-
'loan/flexible/loanable/data': 40,
|
|
299
|
-
'loan/flexible/collateral/data': 40,
|
|
300
300
|
'loan/vip/ongoing/orders': 40,
|
|
301
301
|
'loan/vip/repay/history': 40,
|
|
302
302
|
'loan/vip/collateral/account': 600,
|
|
@@ -588,7 +588,6 @@ export default class binance extends Exchange {
|
|
|
588
588
|
'loan/repay': 40.002,
|
|
589
589
|
'loan/adjust/ltv': 40.002,
|
|
590
590
|
'loan/customize/margin_call': 40.002,
|
|
591
|
-
'loan/flexible/borrow': 40.002,
|
|
592
591
|
'loan/flexible/repay': 40.002,
|
|
593
592
|
'loan/flexible/adjust/ltv': 40.002,
|
|
594
593
|
'loan/vip/repay': 40.002,
|
|
@@ -643,10 +642,19 @@ export default class binance extends Exchange {
|
|
|
643
642
|
'sub-account/futures/account': 0.1,
|
|
644
643
|
'sub-account/futures/accountSummary': 1,
|
|
645
644
|
'sub-account/futures/positionRisk': 0.1,
|
|
645
|
+
'loan/flexible/ongoing/orders': 30,
|
|
646
|
+
'loan/flexible/borrow/history': 40,
|
|
647
|
+
'loan/flexible/repay/history': 40,
|
|
648
|
+
'loan/flexible/ltv/adjustment/history': 40,
|
|
649
|
+
'loan/flexible/loanable/data': 40,
|
|
650
|
+
'loan/flexible/collateral/data': 40, // Weight(IP): 400 => cost = 0.1 * 400 = 40
|
|
646
651
|
},
|
|
647
652
|
'post': {
|
|
648
653
|
'eth-staking/eth/stake': 15,
|
|
649
|
-
'sub-account/subAccountApi/ipRestriction': 20.001,
|
|
654
|
+
'sub-account/subAccountApi/ipRestriction': 20.001,
|
|
655
|
+
'loan/flexible/borrow': 40.002,
|
|
656
|
+
'loan/flexible/repay': 40.002,
|
|
657
|
+
'loan/flexible/adjust/ltv': 40.002, // Weight(UID): 6000 => cost = 0.006667 * 6000 = 40.002
|
|
650
658
|
},
|
|
651
659
|
},
|
|
652
660
|
'sapiV3': {
|
|
@@ -6826,6 +6834,38 @@ export default class binance extends Exchange {
|
|
|
6826
6834
|
const filteredOrders = this.filterBy(orders, 'status', 'canceled');
|
|
6827
6835
|
return this.filterBySinceLimit(filteredOrders, since, limit);
|
|
6828
6836
|
}
|
|
6837
|
+
async fetchCanceledAndClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
6838
|
+
/**
|
|
6839
|
+
* @method
|
|
6840
|
+
* @name binance#fetchCanceledAndClosedOrders
|
|
6841
|
+
* @description fetches information on multiple canceled orders made by the user
|
|
6842
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#all-orders-user_data
|
|
6843
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-orders-user_data
|
|
6844
|
+
* @see https://binance-docs.github.io/apidocs/voptions/en/#query-option-order-history-trade
|
|
6845
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-orders-user_data
|
|
6846
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-orders-user_data
|
|
6847
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-conditional-orders-user_data
|
|
6848
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-conditional-orders-user_data
|
|
6849
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-margin-account-orders-user_data
|
|
6850
|
+
* @param {string} symbol unified market symbol of the market the orders were made in
|
|
6851
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
6852
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
6853
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6854
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
6855
|
+
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch orders in a portfolio margin account
|
|
6856
|
+
* @param {boolean} [params.stop] set to true if you would like to fetch portfolio margin account stop or conditional orders
|
|
6857
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
6858
|
+
*/
|
|
6859
|
+
if (symbol === undefined) {
|
|
6860
|
+
throw new ArgumentsRequired(this.id + ' fetchCanceledAndClosedOrders() requires a symbol argument');
|
|
6861
|
+
}
|
|
6862
|
+
const orders = await this.fetchOrders(symbol, since, undefined, params);
|
|
6863
|
+
const canceledOrders = this.filterBy(orders, 'status', 'canceled');
|
|
6864
|
+
const closedOrders = this.filterBy(orders, 'status', 'closed');
|
|
6865
|
+
const filteredOrders = this.arrayConcat(canceledOrders, closedOrders);
|
|
6866
|
+
const sortedOrders = this.sortBy(filteredOrders, 'timestamp');
|
|
6867
|
+
return this.filterBySinceLimit(sortedOrders, since, limit);
|
|
6868
|
+
}
|
|
6829
6869
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
6830
6870
|
/**
|
|
6831
6871
|
* @method
|
|
@@ -10349,6 +10389,67 @@ export default class binance extends Exchange {
|
|
|
10349
10389
|
//
|
|
10350
10390
|
return response;
|
|
10351
10391
|
}
|
|
10392
|
+
async fetchLeverage(symbol, params = {}) {
|
|
10393
|
+
/**
|
|
10394
|
+
* @method
|
|
10395
|
+
* @name binance#fetchLeverage
|
|
10396
|
+
* @description fetch the set leverage for a market
|
|
10397
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
|
|
10398
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
|
|
10399
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#get-um-account-detail-user_data
|
|
10400
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#get-cm-account-detail-user_data
|
|
10401
|
+
* @param {string} symbol unified market symbol
|
|
10402
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
10403
|
+
* @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
10404
|
+
*/
|
|
10405
|
+
await this.loadMarkets();
|
|
10406
|
+
await this.loadLeverageBrackets(false, params);
|
|
10407
|
+
const market = this.market(symbol);
|
|
10408
|
+
if (!market['contract']) {
|
|
10409
|
+
throw new NotSupported(this.id + ' fetchLeverage() supports linear and inverse contracts only');
|
|
10410
|
+
}
|
|
10411
|
+
let type = undefined;
|
|
10412
|
+
[type, params] = this.handleMarketTypeAndParams('fetchLeverage', market, params);
|
|
10413
|
+
let subType = undefined;
|
|
10414
|
+
[subType, params] = this.handleSubTypeAndParams('fetchLeverage', market, params, 'linear');
|
|
10415
|
+
let isPortfolioMargin = undefined;
|
|
10416
|
+
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchLeverage', 'papi', 'portfolioMargin', false);
|
|
10417
|
+
let response = undefined;
|
|
10418
|
+
if (this.isLinear(type, subType)) {
|
|
10419
|
+
if (isPortfolioMargin) {
|
|
10420
|
+
response = await this.papiGetUmAccount(params);
|
|
10421
|
+
}
|
|
10422
|
+
else {
|
|
10423
|
+
response = await this.fapiPrivateV2GetAccount(params);
|
|
10424
|
+
}
|
|
10425
|
+
}
|
|
10426
|
+
else if (this.isInverse(type, subType)) {
|
|
10427
|
+
if (isPortfolioMargin) {
|
|
10428
|
+
response = await this.papiGetCmAccount(params);
|
|
10429
|
+
}
|
|
10430
|
+
else {
|
|
10431
|
+
response = await this.dapiPrivateGetAccount(params);
|
|
10432
|
+
}
|
|
10433
|
+
}
|
|
10434
|
+
else {
|
|
10435
|
+
throw new NotSupported(this.id + ' fetchPositions() supports linear and inverse contracts only');
|
|
10436
|
+
}
|
|
10437
|
+
const positions = this.safeList(response, 'positions', []);
|
|
10438
|
+
for (let i = 0; i < positions.length; i++) {
|
|
10439
|
+
const position = positions[i];
|
|
10440
|
+
const innerSymbol = this.safeString(position, 'symbol');
|
|
10441
|
+
if (innerSymbol === market['id']) {
|
|
10442
|
+
const isolated = this.safeBool(position, 'isolated');
|
|
10443
|
+
const marginMode = isolated ? 'isolated' : 'cross';
|
|
10444
|
+
return {
|
|
10445
|
+
'info': position,
|
|
10446
|
+
'marginMode': marginMode,
|
|
10447
|
+
'leverage': this.safeInteger(position, 'leverage'),
|
|
10448
|
+
};
|
|
10449
|
+
}
|
|
10450
|
+
}
|
|
10451
|
+
return response;
|
|
10452
|
+
}
|
|
10352
10453
|
async fetchSettlementHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
10353
10454
|
/**
|
|
10354
10455
|
* @method
|
|
@@ -10531,6 +10632,19 @@ export default class binance extends Exchange {
|
|
|
10531
10632
|
}
|
|
10532
10633
|
return result;
|
|
10533
10634
|
}
|
|
10635
|
+
async fetchLedgerEntry(id, code = undefined, params = {}) {
|
|
10636
|
+
await this.loadMarkets();
|
|
10637
|
+
let type = undefined;
|
|
10638
|
+
[type, params] = this.handleMarketTypeAndParams('fetchLedgerEntry', undefined, params);
|
|
10639
|
+
const query = {
|
|
10640
|
+
'recordId': id,
|
|
10641
|
+
'type': type,
|
|
10642
|
+
};
|
|
10643
|
+
if (type !== 'option') {
|
|
10644
|
+
throw new BadRequest(this.id + ' fetchLedgerEntry () can only be used for type option');
|
|
10645
|
+
}
|
|
10646
|
+
return await this.fetchLedger(code, undefined, undefined, this.extend(query, params));
|
|
10647
|
+
}
|
|
10534
10648
|
async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
10535
10649
|
/**
|
|
10536
10650
|
* @method
|
|
@@ -11997,6 +12111,19 @@ export default class binance extends Exchange {
|
|
|
11997
12111
|
'info': greeks,
|
|
11998
12112
|
};
|
|
11999
12113
|
}
|
|
12114
|
+
async fetchTradingLimits(symbols = undefined, params = {}) {
|
|
12115
|
+
// this method should not be called directly, use loadTradingLimits () instead
|
|
12116
|
+
const markets = await this.fetchMarkets();
|
|
12117
|
+
const tradingLimits = {};
|
|
12118
|
+
for (let i = 0; i < markets.length; i++) {
|
|
12119
|
+
const market = markets[i];
|
|
12120
|
+
const symbol = market['symbol'];
|
|
12121
|
+
if ((symbols === undefined) || (this.inArray(symbol, symbols))) {
|
|
12122
|
+
tradingLimits[symbol] = market['limits']['amount'];
|
|
12123
|
+
}
|
|
12124
|
+
}
|
|
12125
|
+
return tradingLimits;
|
|
12126
|
+
}
|
|
12000
12127
|
async fetchPositionMode(symbol = undefined, params = {}) {
|
|
12001
12128
|
/**
|
|
12002
12129
|
* @method
|
package/js/src/bingx.d.ts
CHANGED
|
@@ -132,6 +132,10 @@ export default class bingx extends Exchange {
|
|
|
132
132
|
parseLiquidation(liquidation: any, market?: Market): import("./base/types.js").Liquidation;
|
|
133
133
|
closePosition(symbol: string, side?: OrderSide, params?: {}): Promise<Order>;
|
|
134
134
|
closeAllPositions(params?: {}): Promise<Position[]>;
|
|
135
|
+
fetchPositionMode(symbol?: Str, params?: {}): Promise<{
|
|
136
|
+
info: any;
|
|
137
|
+
hedged: boolean;
|
|
138
|
+
}>;
|
|
135
139
|
setPositionMode(hedged: boolean, symbol?: Str, params?: {}): Promise<any>;
|
|
136
140
|
editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: number, price?: number, params?: {}): Promise<Order>;
|
|
137
141
|
sign(path: any, section?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
package/js/src/bingx.js
CHANGED
|
@@ -70,6 +70,7 @@ export default class bingx extends Exchange {
|
|
|
70
70
|
'fetchOpenOrders': true,
|
|
71
71
|
'fetchOrder': true,
|
|
72
72
|
'fetchOrderBook': true,
|
|
73
|
+
'fetchPositionMode': true,
|
|
73
74
|
'fetchPositions': true,
|
|
74
75
|
'fetchTicker': true,
|
|
75
76
|
'fetchTickers': true,
|
|
@@ -80,6 +81,7 @@ export default class bingx extends Exchange {
|
|
|
80
81
|
'setLeverage': true,
|
|
81
82
|
'setMargin': true,
|
|
82
83
|
'setMarginMode': true,
|
|
84
|
+
'setPositionMode': true,
|
|
83
85
|
'transfer': true,
|
|
84
86
|
},
|
|
85
87
|
'hostname': 'bingx.com',
|
|
@@ -3506,13 +3508,14 @@ export default class bingx extends Exchange {
|
|
|
3506
3508
|
* @param {float} leverage the rate of leverage
|
|
3507
3509
|
* @param {string} symbol unified market symbol
|
|
3508
3510
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3511
|
+
* @param {string} [params.side] hedged: ['long' or 'short']. one way: ['both']
|
|
3509
3512
|
* @returns {object} response from the exchange
|
|
3510
3513
|
*/
|
|
3511
3514
|
if (symbol === undefined) {
|
|
3512
3515
|
throw new ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
|
|
3513
3516
|
}
|
|
3514
3517
|
const side = this.safeStringUpper(params, 'side');
|
|
3515
|
-
this.checkRequiredArgument('setLeverage', side, 'side', ['LONG', 'SHORT']);
|
|
3518
|
+
this.checkRequiredArgument('setLeverage', side, 'side', ['LONG', 'SHORT', 'BOTH']);
|
|
3516
3519
|
await this.loadMarkets();
|
|
3517
3520
|
const market = this.market(symbol);
|
|
3518
3521
|
const request = {
|
|
@@ -3956,6 +3959,34 @@ export default class bingx extends Exchange {
|
|
|
3956
3959
|
}
|
|
3957
3960
|
return positions;
|
|
3958
3961
|
}
|
|
3962
|
+
async fetchPositionMode(symbol = undefined, params = {}) {
|
|
3963
|
+
/**
|
|
3964
|
+
* @method
|
|
3965
|
+
* @name bingx#fetchPositionMode
|
|
3966
|
+
* @description fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets
|
|
3967
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Get%20Position%20Mode
|
|
3968
|
+
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
3969
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3970
|
+
* @returns {object} an object detailing whether the market is in hedged or one-way mode
|
|
3971
|
+
*/
|
|
3972
|
+
const response = await this.swapV1PrivateGetPositionSideDual(params);
|
|
3973
|
+
//
|
|
3974
|
+
// {
|
|
3975
|
+
// "code": "0",
|
|
3976
|
+
// "msg": "",
|
|
3977
|
+
// "timeStamp": "1709002057516",
|
|
3978
|
+
// "data": {
|
|
3979
|
+
// "dualSidePosition": "false"
|
|
3980
|
+
// }
|
|
3981
|
+
// }
|
|
3982
|
+
//
|
|
3983
|
+
const data = this.safeDict(response, 'data', {});
|
|
3984
|
+
const dualSidePosition = this.safeString(data, 'dualSidePosition');
|
|
3985
|
+
return {
|
|
3986
|
+
'info': response,
|
|
3987
|
+
'hedged': (dualSidePosition === 'true'),
|
|
3988
|
+
};
|
|
3989
|
+
}
|
|
3959
3990
|
async setPositionMode(hedged, symbol = undefined, params = {}) {
|
|
3960
3991
|
/**
|
|
3961
3992
|
* @method
|
package/js/src/bitget.js
CHANGED
|
@@ -3595,6 +3595,7 @@ export default class bitget extends Exchange {
|
|
|
3595
3595
|
'not_trigger': 'open',
|
|
3596
3596
|
'partial_fill': 'open',
|
|
3597
3597
|
'partially_fill': 'open',
|
|
3598
|
+
'partially_filled': 'open',
|
|
3598
3599
|
'triggered': 'closed',
|
|
3599
3600
|
'full_fill': 'closed',
|
|
3600
3601
|
'filled': 'closed',
|
package/js/src/bitvavo.js
CHANGED
|
@@ -571,7 +571,7 @@ export default class bitvavo extends Exchange {
|
|
|
571
571
|
// "market":"ETH-BTC",
|
|
572
572
|
// "open":"0.022578",
|
|
573
573
|
// "high":"0.023019",
|
|
574
|
-
// "low":"0.
|
|
574
|
+
// "low":"0.022572",
|
|
575
575
|
// "last":"0.023019",
|
|
576
576
|
// "volume":"25.16366324",
|
|
577
577
|
// "volumeQuote":"0.57333305",
|
package/js/src/bybit.d.ts
CHANGED
|
@@ -126,6 +126,11 @@ export default class bybit extends Exchange {
|
|
|
126
126
|
fetchUsdcPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
|
|
127
127
|
fetchPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
|
|
128
128
|
parsePosition(position: any, market?: Market): import("./base/types.js").Position;
|
|
129
|
+
fetchLeverage(symbol: string, params?: {}): Promise<{
|
|
130
|
+
info: import("./base/types.js").Position;
|
|
131
|
+
leverage: number;
|
|
132
|
+
marginMode: number;
|
|
133
|
+
}>;
|
|
129
134
|
setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<any>;
|
|
130
135
|
setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
|
|
131
136
|
setPositionMode(hedged: boolean, symbol?: Str, params?: {}): Promise<any>;
|
package/js/src/bybit.js
CHANGED
|
@@ -111,6 +111,7 @@ export default class bybit extends Exchange {
|
|
|
111
111
|
'fetchUnderlyingAssets': false,
|
|
112
112
|
'fetchVolatilityHistory': true,
|
|
113
113
|
'fetchWithdrawals': true,
|
|
114
|
+
'fetchLeverage': true,
|
|
114
115
|
'repayCrossMargin': true,
|
|
115
116
|
'setLeverage': true,
|
|
116
117
|
'setMarginMode': true,
|
|
@@ -6347,6 +6348,24 @@ export default class bybit extends Exchange {
|
|
|
6347
6348
|
'takeProfitPrice': this.safeNumber2(position, 'take_profit', 'takeProfit'),
|
|
6348
6349
|
});
|
|
6349
6350
|
}
|
|
6351
|
+
async fetchLeverage(symbol, params = {}) {
|
|
6352
|
+
/**
|
|
6353
|
+
* @method
|
|
6354
|
+
* @name bybit#fetchLeverage
|
|
6355
|
+
* @description fetch the set leverage for a market
|
|
6356
|
+
* @see https://bybit-exchange.github.io/docs/v5/position
|
|
6357
|
+
* @param {string} symbol unified market symbol
|
|
6358
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6359
|
+
* @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
6360
|
+
*/
|
|
6361
|
+
await this.loadMarkets();
|
|
6362
|
+
const position = await this.fetchPosition(symbol, params);
|
|
6363
|
+
return {
|
|
6364
|
+
'info': position,
|
|
6365
|
+
'leverage': this.safeInteger(position, 'leverage'),
|
|
6366
|
+
'marginMode': this.safeNumber(position, 'marginMode'),
|
|
6367
|
+
};
|
|
6368
|
+
}
|
|
6350
6369
|
async setMarginMode(marginMode, symbol = undefined, params = {}) {
|
|
6351
6370
|
/**
|
|
6352
6371
|
* @method
|
package/js/src/coinbase.d.ts
CHANGED
|
@@ -99,6 +99,8 @@ export default class coinbase extends Exchange {
|
|
|
99
99
|
tag: string;
|
|
100
100
|
network: string;
|
|
101
101
|
};
|
|
102
|
+
deposit(code: string, amount: number, id: string, params?: {}): Promise<Transaction>;
|
|
103
|
+
fetchDeposit(id: string, code?: Str, params?: {}): Promise<Transaction>;
|
|
102
104
|
sign(path: any, api?: any[], method?: string, params?: {}, headers?: any, body?: any): {
|
|
103
105
|
url: string;
|
|
104
106
|
method: string;
|