ccxt 4.3.78 → 4.3.80
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/base/Exchange.js +24 -36
- package/dist/cjs/src/binance.js +41 -71
- package/dist/cjs/src/bitmart.js +4 -3
- package/dist/cjs/src/bybit.js +10 -1
- package/dist/cjs/src/poloniex.js +4 -2
- package/dist/cjs/src/pro/binance.js +16 -5
- package/dist/cjs/src/pro/bybit.js +1 -1
- package/dist/cjs/src/pro/cryptocom.js +1 -1
- package/dist/cjs/src/pro/gate.js +1 -1
- package/dist/cjs/src/pro/kucoinfutures.js +1 -1
- package/dist/cjs/src/pro/vertex.js +1 -1
- package/dist/cjs/src/pro/woo.js +1 -1
- package/dist/cjs/src/pro/woofipro.js +1 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +1 -1
- package/js/src/base/Exchange.js +24 -36
- package/js/src/binance.js +41 -71
- package/js/src/bitmart.js +4 -3
- package/js/src/bybit.js +10 -1
- package/js/src/poloniex.js +4 -2
- package/js/src/pro/binance.js +16 -5
- package/js/src/pro/bybit.js +1 -1
- package/js/src/pro/cryptocom.js +1 -1
- package/js/src/pro/gate.js +1 -1
- package/js/src/pro/kucoinfutures.js +1 -1
- package/js/src/pro/vertex.js +1 -1
- package/js/src/pro/woo.js +1 -1
- package/js/src/pro/woofipro.js +1 -1
- package/package.json +1 -1
package/js/src/binance.js
CHANGED
|
@@ -54,7 +54,7 @@ export default class binance extends Exchange {
|
|
|
54
54
|
'createMarketSellOrderWithCost': true,
|
|
55
55
|
'createOrder': true,
|
|
56
56
|
'createOrders': true,
|
|
57
|
-
'createOrderWithTakeProfitAndStopLoss':
|
|
57
|
+
'createOrderWithTakeProfitAndStopLoss': false,
|
|
58
58
|
'createPostOnlyOrder': true,
|
|
59
59
|
'createReduceOnlyOrder': true,
|
|
60
60
|
'createStopLimitOrder': true,
|
|
@@ -3556,7 +3556,7 @@ export default class binance extends Exchange {
|
|
|
3556
3556
|
//
|
|
3557
3557
|
// futures (fapi)
|
|
3558
3558
|
//
|
|
3559
|
-
//
|
|
3559
|
+
// fapiPrivateV3GetAccount
|
|
3560
3560
|
//
|
|
3561
3561
|
// {
|
|
3562
3562
|
// "feeTier":0,
|
|
@@ -9000,6 +9000,7 @@ export default class binance extends Exchange {
|
|
|
9000
9000
|
* @see https://developers.binance.com/docs/wallet/asset/trade-fee
|
|
9001
9001
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Information-V2
|
|
9002
9002
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/account/Account-Information
|
|
9003
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Config
|
|
9003
9004
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
9004
9005
|
* @param {string} [params.subType] "linear" or "inverse"
|
|
9005
9006
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
@@ -9017,7 +9018,7 @@ export default class binance extends Exchange {
|
|
|
9017
9018
|
response = await this.sapiGetAssetTradeFee(params);
|
|
9018
9019
|
}
|
|
9019
9020
|
else if (isLinear) {
|
|
9020
|
-
response = await this.
|
|
9021
|
+
response = await this.fapiPrivateGetAccountConfig(params);
|
|
9021
9022
|
}
|
|
9022
9023
|
else if (isInverse) {
|
|
9023
9024
|
response = await this.dapiPrivateGetAccount(params);
|
|
@@ -10322,6 +10323,7 @@ export default class binance extends Exchange {
|
|
|
10322
10323
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/account/Account-Information
|
|
10323
10324
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Position-Information-V2
|
|
10324
10325
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/Position-Information
|
|
10326
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Information-V3
|
|
10325
10327
|
* @param {string[]} [symbols] list of unified market symbols
|
|
10326
10328
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
10327
10329
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch positions in a portfolio margin account
|
|
@@ -10453,6 +10455,7 @@ export default class binance extends Exchange {
|
|
|
10453
10455
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/Position-Information
|
|
10454
10456
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/account/Query-UM-Position-Information
|
|
10455
10457
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/account/Query-CM-Position-Information
|
|
10458
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Position-Information-V3
|
|
10456
10459
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
10457
10460
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
10458
10461
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch positions for a portfolio margin account
|
|
@@ -10870,6 +10873,7 @@ export default class binance extends Exchange {
|
|
|
10870
10873
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/account/Account-Information
|
|
10871
10874
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-UM-Account-Detail
|
|
10872
10875
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-CM-Account-Detail
|
|
10876
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Symbol-Config
|
|
10873
10877
|
* @param {string[]} [symbols] a list of unified market symbols
|
|
10874
10878
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
10875
10879
|
* @param {string} [params.subType] "linear" or "inverse"
|
|
@@ -10889,7 +10893,7 @@ export default class binance extends Exchange {
|
|
|
10889
10893
|
response = await this.papiGetUmAccount(params);
|
|
10890
10894
|
}
|
|
10891
10895
|
else {
|
|
10892
|
-
response = await this.
|
|
10896
|
+
response = await this.fapiPrivateGetSymbolConfig(params);
|
|
10893
10897
|
}
|
|
10894
10898
|
}
|
|
10895
10899
|
else if (this.isInverse(type, subType)) {
|
|
@@ -10903,7 +10907,10 @@ export default class binance extends Exchange {
|
|
|
10903
10907
|
else {
|
|
10904
10908
|
throw new NotSupported(this.id + ' fetchLeverages() supports linear and inverse contracts only');
|
|
10905
10909
|
}
|
|
10906
|
-
|
|
10910
|
+
let leverages = this.safeList(response, 'positions', []);
|
|
10911
|
+
if (Array.isArray(response)) {
|
|
10912
|
+
leverages = response;
|
|
10913
|
+
}
|
|
10907
10914
|
return this.parseLeverages(leverages, symbols, 'symbol');
|
|
10908
10915
|
}
|
|
10909
10916
|
parseLeverage(leverage, market = undefined) {
|
|
@@ -10913,6 +10920,10 @@ export default class binance extends Exchange {
|
|
|
10913
10920
|
if (marginModeRaw !== undefined) {
|
|
10914
10921
|
marginMode = marginModeRaw ? 'isolated' : 'cross';
|
|
10915
10922
|
}
|
|
10923
|
+
const marginTypeRaw = this.safeStringLower(leverage, 'marginType');
|
|
10924
|
+
if (marginTypeRaw !== undefined) {
|
|
10925
|
+
marginMode = (marginTypeRaw === 'crossed') ? 'cross' : 'isolated';
|
|
10926
|
+
}
|
|
10916
10927
|
const side = this.safeStringLower(leverage, 'positionSide');
|
|
10917
10928
|
let longLeverage = undefined;
|
|
10918
10929
|
let shortLeverage = undefined;
|
|
@@ -12792,6 +12803,7 @@ export default class binance extends Exchange {
|
|
|
12792
12803
|
* @description fetches margin modes ("isolated" or "cross") that the market for the symbol in in, with symbol=undefined all markets for a subType (linear/inverse) are returned
|
|
12793
12804
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/account/Account-Information
|
|
12794
12805
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Information-V2
|
|
12806
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Symbol-Config
|
|
12795
12807
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
12796
12808
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
12797
12809
|
* @param {string} [params.subType] "linear" or "inverse"
|
|
@@ -12807,70 +12819,17 @@ export default class binance extends Exchange {
|
|
|
12807
12819
|
[subType, params] = this.handleSubTypeAndParams('fetchMarginMode', market, params);
|
|
12808
12820
|
let response = undefined;
|
|
12809
12821
|
if (subType === 'linear') {
|
|
12810
|
-
response = await this.
|
|
12822
|
+
response = await this.fapiPrivateGetSymbolConfig(params);
|
|
12811
12823
|
//
|
|
12812
|
-
//
|
|
12813
|
-
//
|
|
12814
|
-
//
|
|
12815
|
-
//
|
|
12816
|
-
//
|
|
12817
|
-
//
|
|
12818
|
-
//
|
|
12819
|
-
//
|
|
12820
|
-
//
|
|
12821
|
-
// totalMaintMargin: '5.90847101',
|
|
12822
|
-
// totalWalletBalance: '4345.15626338',
|
|
12823
|
-
// totalUnrealizedProfit: '376.45220224',
|
|
12824
|
-
// totalMarginBalance: '4721.60846562',
|
|
12825
|
-
// totalPositionInitialMargin: '425.45252687',
|
|
12826
|
-
// totalOpenOrderInitialMargin: '12.85881664',
|
|
12827
|
-
// totalCrossWalletBalance: '4345.15626338',
|
|
12828
|
-
// totalCrossUnPnl: '376.45220224',
|
|
12829
|
-
// availableBalance: '4281.84764041',
|
|
12830
|
-
// maxWithdrawAmount: '4281.84764041',
|
|
12831
|
-
// assets: [
|
|
12832
|
-
// {
|
|
12833
|
-
// asset: 'ETH',
|
|
12834
|
-
// walletBalance: '0.00000000',
|
|
12835
|
-
// unrealizedProfit: '0.00000000',
|
|
12836
|
-
// marginBalance: '0.00000000',
|
|
12837
|
-
// maintMargin: '0.00000000',
|
|
12838
|
-
// initialMargin: '0.00000000',
|
|
12839
|
-
// positionInitialMargin: '0.00000000',
|
|
12840
|
-
// openOrderInitialMargin: '0.00000000',
|
|
12841
|
-
// maxWithdrawAmount: '0.00000000',
|
|
12842
|
-
// crossWalletBalance: '0.00000000',
|
|
12843
|
-
// crossUnPnl: '0.00000000',
|
|
12844
|
-
// availableBalance: '1.26075574',
|
|
12845
|
-
// marginAvailable: true,
|
|
12846
|
-
// updateTime: '0'
|
|
12847
|
-
// },
|
|
12848
|
-
// ...
|
|
12849
|
-
// ],
|
|
12850
|
-
// positions: [
|
|
12851
|
-
// {
|
|
12852
|
-
// symbol: 'SNTUSDT',
|
|
12853
|
-
// initialMargin: '0',
|
|
12854
|
-
// maintMargin: '0',
|
|
12855
|
-
// unrealizedProfit: '0.00000000',
|
|
12856
|
-
// positionInitialMargin: '0',
|
|
12857
|
-
// openOrderInitialMargin: '0',
|
|
12858
|
-
// leverage: '20',
|
|
12859
|
-
// isolated: false,
|
|
12860
|
-
// entryPrice: '0.0',
|
|
12861
|
-
// breakEvenPrice: '0.0',
|
|
12862
|
-
// maxNotional: '25000',
|
|
12863
|
-
// positionSide: 'BOTH',
|
|
12864
|
-
// positionAmt: '0',
|
|
12865
|
-
// notional: '0',
|
|
12866
|
-
// isolatedWallet: '0',
|
|
12867
|
-
// updateTime: '0',
|
|
12868
|
-
// bidNotional: '0',
|
|
12869
|
-
// askNotional: '0'
|
|
12870
|
-
// },
|
|
12871
|
-
// ...
|
|
12872
|
-
// ]
|
|
12873
|
-
// }
|
|
12824
|
+
// [
|
|
12825
|
+
// {
|
|
12826
|
+
// "symbol": "BTCUSDT",
|
|
12827
|
+
// "marginType": "CROSSED",
|
|
12828
|
+
// "isAutoAddMargin": "false",
|
|
12829
|
+
// "leverage": 21,
|
|
12830
|
+
// "maxNotionalValue": "1000000",
|
|
12831
|
+
// }
|
|
12832
|
+
// ]
|
|
12874
12833
|
//
|
|
12875
12834
|
}
|
|
12876
12835
|
else if (subType === 'inverse') {
|
|
@@ -12927,17 +12886,28 @@ export default class binance extends Exchange {
|
|
|
12927
12886
|
else {
|
|
12928
12887
|
throw new BadRequest(this.id + ' fetchMarginModes () supports linear and inverse subTypes only');
|
|
12929
12888
|
}
|
|
12930
|
-
|
|
12889
|
+
let assets = this.safeList(response, 'positions', []);
|
|
12890
|
+
if (Array.isArray(response)) {
|
|
12891
|
+
assets = response;
|
|
12892
|
+
}
|
|
12931
12893
|
return this.parseMarginModes(assets, symbols, 'symbol', 'swap');
|
|
12932
12894
|
}
|
|
12933
12895
|
parseMarginMode(marginMode, market = undefined) {
|
|
12934
12896
|
const marketId = this.safeString(marginMode, 'symbol');
|
|
12935
12897
|
market = this.safeMarket(marketId, market);
|
|
12936
|
-
const
|
|
12898
|
+
const marginModeRaw = this.safeBool(marginMode, 'isolated');
|
|
12899
|
+
let reMarginMode = undefined;
|
|
12900
|
+
if (marginModeRaw !== undefined) {
|
|
12901
|
+
reMarginMode = marginModeRaw ? 'isolated' : 'cross';
|
|
12902
|
+
}
|
|
12903
|
+
const marginTypeRaw = this.safeStringLower(marginMode, 'marginType');
|
|
12904
|
+
if (marginTypeRaw !== undefined) {
|
|
12905
|
+
reMarginMode = (marginTypeRaw === 'crossed') ? 'cross' : 'isolated';
|
|
12906
|
+
}
|
|
12937
12907
|
return {
|
|
12938
12908
|
'info': marginMode,
|
|
12939
12909
|
'symbol': market['symbol'],
|
|
12940
|
-
'marginMode':
|
|
12910
|
+
'marginMode': reMarginMode,
|
|
12941
12911
|
};
|
|
12942
12912
|
}
|
|
12943
12913
|
async fetchOption(symbol, params = {}) {
|
package/js/src/bitmart.js
CHANGED
|
@@ -2464,8 +2464,6 @@ export default class bitmart extends Exchange {
|
|
|
2464
2464
|
* @see https://developer-pro.bitmart.com/en/spot/#place-margin-order
|
|
2465
2465
|
* @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
|
2466
2466
|
* @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
|
2467
|
-
* @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
|
2468
|
-
* @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
|
2469
2467
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
|
|
2470
2468
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
2471
2469
|
* @param {string} type 'market', 'limit' or 'trailing' for swap markets only
|
|
@@ -2612,6 +2610,7 @@ export default class bitmart extends Exchange {
|
|
|
2612
2610
|
* @description create a trade order
|
|
2613
2611
|
* @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
|
2614
2612
|
* @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
|
2613
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
|
|
2615
2614
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
2616
2615
|
* @param {string} type 'market', 'limit' or 'trailing'
|
|
2617
2616
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -2671,7 +2670,9 @@ export default class bitmart extends Exchange {
|
|
|
2671
2670
|
request['activation_price_type'] = this.safeInteger(params, 'activation_price_type', 1);
|
|
2672
2671
|
}
|
|
2673
2672
|
if (isTriggerOrder) {
|
|
2674
|
-
|
|
2673
|
+
if (isLimitOrder || price !== undefined) {
|
|
2674
|
+
request['executive_price'] = this.priceToPrecision(symbol, price);
|
|
2675
|
+
}
|
|
2675
2676
|
request['trigger_price'] = this.priceToPrecision(symbol, triggerPrice);
|
|
2676
2677
|
request['price_type'] = this.safeInteger(params, 'price_type', 1);
|
|
2677
2678
|
if (side === 'buy') {
|
package/js/src/bybit.js
CHANGED
|
@@ -5892,10 +5892,12 @@ export default class bybit extends Exchange {
|
|
|
5892
5892
|
* @name bybit#fetchLedger
|
|
5893
5893
|
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
5894
5894
|
* @see https://bybit-exchange.github.io/docs/v5/account/transaction-log
|
|
5895
|
+
* @see https://bybit-exchange.github.io/docs/v5/account/contract-transaction-log
|
|
5895
5896
|
* @param {string} code unified currency code, default is undefined
|
|
5896
5897
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
5897
5898
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
5898
5899
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5900
|
+
* @param {string} [params.subType] if inverse will use v5/account/contract-transaction-log
|
|
5899
5901
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
5900
5902
|
*/
|
|
5901
5903
|
await this.loadMarkets();
|
|
@@ -5939,9 +5941,16 @@ export default class bybit extends Exchange {
|
|
|
5939
5941
|
if (limit !== undefined) {
|
|
5940
5942
|
request['limit'] = limit;
|
|
5941
5943
|
}
|
|
5944
|
+
let subType = undefined;
|
|
5945
|
+
[subType, params] = this.handleSubTypeAndParams('fetchLedger', undefined, params);
|
|
5942
5946
|
let response = undefined;
|
|
5943
5947
|
if (enableUnified[1]) {
|
|
5944
|
-
|
|
5948
|
+
if (subType === 'inverse') {
|
|
5949
|
+
response = await this.privateGetV5AccountContractTransactionLog(this.extend(request, params));
|
|
5950
|
+
}
|
|
5951
|
+
else {
|
|
5952
|
+
response = await this.privateGetV5AccountTransactionLog(this.extend(request, params));
|
|
5953
|
+
}
|
|
5945
5954
|
}
|
|
5946
5955
|
else {
|
|
5947
5956
|
response = await this.privateGetV2PrivateWalletFundRecords(this.extend(request, params));
|
package/js/src/poloniex.js
CHANGED
|
@@ -1108,8 +1108,10 @@ export default class poloniex extends Exchange {
|
|
|
1108
1108
|
market = this.safeMarket(marketId, market, '_');
|
|
1109
1109
|
const symbol = market['symbol'];
|
|
1110
1110
|
let resultingTrades = this.safeValue(order, 'resultingTrades');
|
|
1111
|
-
if (
|
|
1112
|
-
|
|
1111
|
+
if (resultingTrades !== undefined) {
|
|
1112
|
+
if (!Array.isArray(resultingTrades)) {
|
|
1113
|
+
resultingTrades = this.safeValue(resultingTrades, this.safeString(market, 'id', marketId));
|
|
1114
|
+
}
|
|
1113
1115
|
}
|
|
1114
1116
|
const price = this.safeString2(order, 'price', 'rate');
|
|
1115
1117
|
const amount = this.safeString(order, 'quantity');
|
package/js/src/pro/binance.js
CHANGED
|
@@ -2067,7 +2067,7 @@ export default class binance extends binanceRest {
|
|
|
2067
2067
|
* @param {string|undefined} [params.type] 'future', 'delivery', 'savings', 'funding', or 'spot'
|
|
2068
2068
|
* @param {string|undefined} [params.marginMode] 'cross' or 'isolated', for margin trading, uses this.options.defaultMarginMode if not passed, defaults to undefined/None/null
|
|
2069
2069
|
* @param {string[]|undefined} [params.symbols] unified market symbols, only used in isolated margin mode
|
|
2070
|
-
* @param {string|undefined} [params.method] method to use. Can be account.balance or account.status
|
|
2070
|
+
* @param {string|undefined} [params.method] method to use. Can be account.balance, account.status, v2/account.balance or v2/account.status
|
|
2071
2071
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
2072
2072
|
*/
|
|
2073
2073
|
await this.loadMarkets();
|
|
@@ -2099,8 +2099,16 @@ export default class binance extends binanceRest {
|
|
|
2099
2099
|
//
|
|
2100
2100
|
//
|
|
2101
2101
|
const messageHash = this.safeString(message, 'id');
|
|
2102
|
-
|
|
2103
|
-
|
|
2102
|
+
let rawBalance = undefined;
|
|
2103
|
+
if (Array.isArray(message['result'])) {
|
|
2104
|
+
// account.balance
|
|
2105
|
+
rawBalance = this.safeList(message, 'result', []);
|
|
2106
|
+
}
|
|
2107
|
+
else {
|
|
2108
|
+
// account.status
|
|
2109
|
+
const result = this.safeDict(message, 'result', {});
|
|
2110
|
+
rawBalance = this.safeList(result, 'assets', []);
|
|
2111
|
+
}
|
|
2104
2112
|
const parsedBalances = this.parseBalanceCustom(rawBalance);
|
|
2105
2113
|
client.resolve(parsedBalances, messageHash);
|
|
2106
2114
|
}
|
|
@@ -2177,6 +2185,7 @@ export default class binance extends binanceRest {
|
|
|
2177
2185
|
* @param {string[]} [symbols] list of unified market symbols
|
|
2178
2186
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2179
2187
|
* @param {boolean} [params.returnRateLimits] set to true to return rate limit informations, defaults to false.
|
|
2188
|
+
* @param {string|undefined} [params.method] method to use. Can be account.position or v2/account.position
|
|
2180
2189
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
2181
2190
|
*/
|
|
2182
2191
|
await this.loadMarkets();
|
|
@@ -2194,9 +2203,11 @@ export default class binance extends binanceRest {
|
|
|
2194
2203
|
let returnRateLimits = false;
|
|
2195
2204
|
[returnRateLimits, params] = this.handleOptionAndParams(params, 'fetchPositionsWs', 'returnRateLimits', false);
|
|
2196
2205
|
payload['returnRateLimits'] = returnRateLimits;
|
|
2206
|
+
let method = undefined;
|
|
2207
|
+
[method, params] = this.handleOptionAndParams(params, 'fetchPositionsWs', 'method', 'account.position');
|
|
2197
2208
|
const message = {
|
|
2198
2209
|
'id': messageHash,
|
|
2199
|
-
'method':
|
|
2210
|
+
'method': method,
|
|
2200
2211
|
'params': this.signParams(this.extend(payload, params)),
|
|
2201
2212
|
};
|
|
2202
2213
|
const subscription = {
|
|
@@ -3294,7 +3305,7 @@ export default class binance extends binanceRest {
|
|
|
3294
3305
|
this.setBalanceCache(client, type, isPortfolioMargin);
|
|
3295
3306
|
this.setPositionsCache(client, type, symbols, isPortfolioMargin);
|
|
3296
3307
|
const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
|
|
3297
|
-
const awaitPositionsSnapshot = this.
|
|
3308
|
+
const awaitPositionsSnapshot = this.handleOption('watchPositions', 'awaitPositionsSnapshot', true);
|
|
3298
3309
|
const cache = this.safeValue(this.positions, type);
|
|
3299
3310
|
if (fetchPositionsSnapshot && awaitPositionsSnapshot && cache === undefined) {
|
|
3300
3311
|
const snapshot = await client.future(type + ':fetchPositionsSnapshot');
|
package/js/src/pro/bybit.js
CHANGED
|
@@ -1130,7 +1130,7 @@ export default class bybit extends bybitRest {
|
|
|
1130
1130
|
this.setPositionsCache(client, symbols);
|
|
1131
1131
|
const cache = this.positions;
|
|
1132
1132
|
const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
|
|
1133
|
-
const awaitPositionsSnapshot = this.
|
|
1133
|
+
const awaitPositionsSnapshot = this.handleOption('watchPositions', 'awaitPositionsSnapshot', true);
|
|
1134
1134
|
if (fetchPositionsSnapshot && awaitPositionsSnapshot && cache === undefined) {
|
|
1135
1135
|
const snapshot = await client.future('fetchPositionsSnapshot');
|
|
1136
1136
|
return this.filterBySymbolsSinceLimit(snapshot, symbols, since, limit, true);
|
package/js/src/pro/cryptocom.js
CHANGED
|
@@ -564,7 +564,7 @@ export default class cryptocom extends cryptocomRest {
|
|
|
564
564
|
const client = this.client(url);
|
|
565
565
|
this.setPositionsCache(client, symbols);
|
|
566
566
|
const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
|
|
567
|
-
const awaitPositionsSnapshot = this.
|
|
567
|
+
const awaitPositionsSnapshot = this.handleOption('watchPositions', 'awaitPositionsSnapshot', true);
|
|
568
568
|
if (fetchPositionsSnapshot && awaitPositionsSnapshot && this.positions === undefined) {
|
|
569
569
|
const snapshot = await client.future('fetchPositionsSnapshot');
|
|
570
570
|
return this.filterBySymbolsSinceLimit(snapshot, symbols, since, limit, true);
|
package/js/src/pro/gate.js
CHANGED
|
@@ -1089,7 +1089,7 @@ export default class gate extends gateRest {
|
|
|
1089
1089
|
const client = this.client(url);
|
|
1090
1090
|
this.setPositionsCache(client, type, symbols);
|
|
1091
1091
|
const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
|
|
1092
|
-
const awaitPositionsSnapshot = this.
|
|
1092
|
+
const awaitPositionsSnapshot = this.handleOption('watchPositions', 'awaitPositionsSnapshot', true);
|
|
1093
1093
|
const cache = this.safeValue(this.positions, type);
|
|
1094
1094
|
if (fetchPositionsSnapshot && awaitPositionsSnapshot && cache === undefined) {
|
|
1095
1095
|
return await client.future(type + ':fetchPositionsSnapshot');
|
|
@@ -354,7 +354,7 @@ export default class kucoinfutures extends kucoinfuturesRest {
|
|
|
354
354
|
const client = this.client(url);
|
|
355
355
|
this.setPositionCache(client, symbol);
|
|
356
356
|
const fetchPositionSnapshot = this.handleOption('watchPosition', 'fetchPositionSnapshot', true);
|
|
357
|
-
const awaitPositionSnapshot = this.
|
|
357
|
+
const awaitPositionSnapshot = this.handleOption('watchPosition', 'awaitPositionSnapshot', true);
|
|
358
358
|
const currentPosition = this.getCurrentPosition(symbol);
|
|
359
359
|
if (fetchPositionSnapshot && awaitPositionSnapshot && currentPosition === undefined) {
|
|
360
360
|
const snapshot = await client.future('fetchPositionSnapshot:' + symbol);
|
package/js/src/pro/vertex.js
CHANGED
|
@@ -575,7 +575,7 @@ export default class vertex extends vertexRest {
|
|
|
575
575
|
const client = this.client(url);
|
|
576
576
|
this.setPositionsCache(client, symbols, params);
|
|
577
577
|
const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
|
|
578
|
-
const awaitPositionsSnapshot = this.
|
|
578
|
+
const awaitPositionsSnapshot = this.handleOption('watchPositions', 'awaitPositionsSnapshot', true);
|
|
579
579
|
if (fetchPositionsSnapshot && awaitPositionsSnapshot && this.positions === undefined) {
|
|
580
580
|
const snapshot = await client.future('fetchPositionsSnapshot');
|
|
581
581
|
return this.filterBySymbolsSinceLimit(snapshot, symbols, since, limit, true);
|
package/js/src/pro/woo.js
CHANGED
|
@@ -971,7 +971,7 @@ export default class woo extends wooRest {
|
|
|
971
971
|
const client = this.client(url);
|
|
972
972
|
this.setPositionsCache(client, symbols);
|
|
973
973
|
const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
|
|
974
|
-
const awaitPositionsSnapshot = this.
|
|
974
|
+
const awaitPositionsSnapshot = this.handleOption('watchPositions', 'awaitPositionsSnapshot', true);
|
|
975
975
|
if (fetchPositionsSnapshot && awaitPositionsSnapshot && this.positions === undefined) {
|
|
976
976
|
const snapshot = await client.future('fetchPositionsSnapshot');
|
|
977
977
|
return this.filterBySymbolsSinceLimit(snapshot, symbols, since, limit, true);
|
package/js/src/pro/woofipro.js
CHANGED
|
@@ -915,7 +915,7 @@ export default class woofipro extends woofiproRest {
|
|
|
915
915
|
const client = this.client(url);
|
|
916
916
|
this.setPositionsCache(client, symbols);
|
|
917
917
|
const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
|
|
918
|
-
const awaitPositionsSnapshot = this.
|
|
918
|
+
const awaitPositionsSnapshot = this.handleOption('watchPositions', 'awaitPositionsSnapshot', true);
|
|
919
919
|
if (fetchPositionsSnapshot && awaitPositionsSnapshot && this.positions === undefined) {
|
|
920
920
|
const snapshot = await client.future('fetchPositionsSnapshot');
|
|
921
921
|
return this.filterBySymbolsSinceLimit(snapshot, symbols, since, limit, true);
|
package/package.json
CHANGED