ccxt 4.3.6 → 4.3.7
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/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ace.js +5 -0
- package/dist/cjs/src/alpaca.js +6 -0
- package/dist/cjs/src/base/Exchange.js +34 -0
- package/dist/cjs/src/binance.js +2 -0
- package/dist/cjs/src/bingx.js +2 -0
- package/dist/cjs/src/bitbank.js +3 -0
- package/dist/cjs/src/bitget.js +74 -1
- package/dist/cjs/src/bithumb.js +4 -0
- package/dist/cjs/src/bitmex.js +2 -0
- package/dist/cjs/src/bitopro.js +5 -0
- package/dist/cjs/src/bitso.js +3 -0
- package/dist/cjs/src/bitstamp.js +3 -0
- package/dist/cjs/src/bitteam.js +4 -0
- package/dist/cjs/src/bitvavo.js +3 -0
- package/dist/cjs/src/bl3p.js +3 -0
- package/dist/cjs/src/btcalpha.js +3 -0
- package/dist/cjs/src/btcbox.js +3 -0
- package/dist/cjs/src/btcmarkets.js +3 -0
- package/dist/cjs/src/btcturk.js +3 -0
- package/dist/cjs/src/bybit.js +123 -12
- package/dist/cjs/src/cex.js +6 -0
- package/dist/cjs/src/coinbase.js +95 -17
- package/dist/cjs/src/coinbaseinternational.js +2 -0
- package/dist/cjs/src/coinbasepro.js +6 -0
- package/dist/cjs/src/coincheck.js +3 -0
- package/dist/cjs/src/coinex.js +150 -43
- package/dist/cjs/src/coinlist.js +4 -0
- package/dist/cjs/src/coinmate.js +3 -0
- package/dist/cjs/src/coinone.js +3 -0
- package/dist/cjs/src/coinsph.js +4 -0
- package/dist/cjs/src/coinspot.js +3 -0
- package/dist/cjs/src/cryptocom.js +2 -0
- package/dist/cjs/src/exmo.js +5 -0
- package/dist/cjs/src/gate.js +124 -22
- package/dist/cjs/src/hitbtc.js +4 -3
- package/dist/cjs/src/htx.js +2 -0
- package/dist/cjs/src/idex.js +3 -0
- package/dist/cjs/src/independentreserve.js +3 -0
- package/dist/cjs/src/indodax.js +3 -0
- package/dist/cjs/src/kucoin.js +2 -0
- package/dist/cjs/src/kucoinfutures.js +2 -0
- package/dist/cjs/src/latoken.js +6 -0
- package/dist/cjs/src/luno.js +3 -0
- package/dist/cjs/src/lykke.js +5 -0
- package/dist/cjs/src/mercado.js +3 -0
- package/dist/cjs/src/mexc.js +111 -0
- package/dist/cjs/src/ndax.js +4 -0
- package/dist/cjs/src/novadax.js +4 -0
- package/dist/cjs/src/okx.js +83 -0
- package/dist/cjs/src/onetrading.js +3 -0
- package/dist/cjs/src/p2b.js +3 -0
- package/dist/cjs/src/pro/bybit.js +1 -1
- package/dist/cjs/src/pro/coinbase.js +30 -29
- package/dist/cjs/src/probit.js +3 -0
- package/dist/cjs/src/timex.js +3 -0
- package/dist/cjs/src/tradeogre.js +3 -0
- package/dist/cjs/src/wavesexchange.js +3 -0
- package/dist/cjs/src/wazirx.js +3 -0
- package/dist/cjs/src/woo.js +2 -0
- package/dist/cjs/src/yobit.js +3 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/coinbase.d.ts +5 -0
- package/js/src/ace.js +5 -0
- package/js/src/alpaca.js +6 -0
- package/js/src/ascendex.d.ts +2 -2
- package/js/src/base/Exchange.d.ts +4 -0
- package/js/src/base/Exchange.js +34 -0
- package/js/src/bigone.d.ts +1 -1
- package/js/src/binance.d.ts +3 -3
- package/js/src/binance.js +2 -0
- package/js/src/bingx.d.ts +1 -1
- package/js/src/bingx.js +2 -0
- package/js/src/bitbank.d.ts +1 -1
- package/js/src/bitbank.js +3 -0
- package/js/src/bitfinex.d.ts +1 -1
- package/js/src/bitfinex2.d.ts +1 -1
- package/js/src/bitflyer.d.ts +1 -1
- package/js/src/bitget.d.ts +4 -3
- package/js/src/bitget.js +74 -1
- package/js/src/bithumb.d.ts +1 -1
- package/js/src/bithumb.js +4 -0
- package/js/src/bitmart.d.ts +1 -1
- package/js/src/bitmex.d.ts +1 -1
- package/js/src/bitmex.js +2 -0
- package/js/src/bitopro.d.ts +1 -1
- package/js/src/bitopro.js +5 -0
- package/js/src/bitrue.d.ts +1 -1
- package/js/src/bitso.d.ts +1 -1
- package/js/src/bitso.js +3 -0
- package/js/src/bitstamp.d.ts +1 -1
- package/js/src/bitstamp.js +3 -0
- package/js/src/bitteam.js +4 -0
- package/js/src/bitvavo.d.ts +1 -1
- package/js/src/bitvavo.js +3 -0
- package/js/src/bl3p.js +3 -0
- package/js/src/blockchaincom.d.ts +1 -1
- package/js/src/btcalpha.js +3 -0
- package/js/src/btcbox.js +3 -0
- package/js/src/btcmarkets.d.ts +1 -1
- package/js/src/btcmarkets.js +3 -0
- package/js/src/btcturk.js +3 -0
- package/js/src/bybit.d.ts +7 -6
- package/js/src/bybit.js +123 -12
- package/js/src/cex.js +6 -0
- package/js/src/coinbase.d.ts +1 -1
- package/js/src/coinbase.js +95 -17
- package/js/src/coinbaseinternational.d.ts +1 -1
- package/js/src/coinbaseinternational.js +2 -0
- package/js/src/coinbasepro.d.ts +1 -1
- package/js/src/coinbasepro.js +6 -0
- package/js/src/coincheck.js +3 -0
- package/js/src/coinex.d.ts +8 -7
- package/js/src/coinex.js +150 -43
- package/js/src/coinlist.d.ts +1 -1
- package/js/src/coinlist.js +4 -0
- package/js/src/coinmate.d.ts +1 -1
- package/js/src/coinmate.js +3 -0
- package/js/src/coinone.js +3 -0
- package/js/src/coinsph.d.ts +1 -1
- package/js/src/coinsph.js +4 -0
- package/js/src/coinspot.js +3 -0
- package/js/src/cryptocom.d.ts +1 -1
- package/js/src/cryptocom.js +2 -0
- package/js/src/delta.d.ts +2 -2
- package/js/src/deribit.d.ts +1 -1
- package/js/src/digifinex.d.ts +3 -3
- package/js/src/exmo.d.ts +3 -3
- package/js/src/exmo.js +5 -0
- package/js/src/gate.d.ts +8 -7
- package/js/src/gate.js +124 -22
- package/js/src/gemini.d.ts +1 -1
- package/js/src/hitbtc.d.ts +3 -3
- package/js/src/hitbtc.js +4 -3
- package/js/src/hollaex.d.ts +1 -1
- package/js/src/htx.d.ts +1 -1
- package/js/src/htx.js +2 -0
- package/js/src/huobijp.d.ts +1 -1
- package/js/src/hyperliquid.d.ts +2 -2
- package/js/src/idex.d.ts +1 -1
- package/js/src/idex.js +3 -0
- package/js/src/independentreserve.js +3 -0
- package/js/src/indodax.d.ts +1 -1
- package/js/src/indodax.js +3 -0
- package/js/src/kraken.d.ts +1 -1
- package/js/src/kucoin.d.ts +1 -1
- package/js/src/kucoin.js +2 -0
- package/js/src/kucoinfutures.d.ts +1 -1
- package/js/src/kucoinfutures.js +2 -0
- package/js/src/kuna.d.ts +1 -1
- package/js/src/latoken.js +6 -0
- package/js/src/lbank.d.ts +1 -1
- package/js/src/luno.js +3 -0
- package/js/src/lykke.d.ts +1 -1
- package/js/src/lykke.js +5 -0
- package/js/src/mercado.d.ts +1 -1
- package/js/src/mercado.js +3 -0
- package/js/src/mexc.d.ts +4 -3
- package/js/src/mexc.js +111 -0
- package/js/src/ndax.d.ts +1 -1
- package/js/src/ndax.js +4 -0
- package/js/src/novadax.d.ts +1 -1
- package/js/src/novadax.js +4 -0
- package/js/src/okcoin.d.ts +1 -1
- package/js/src/okx.d.ts +9 -8
- package/js/src/okx.js +83 -0
- package/js/src/onetrading.d.ts +1 -1
- package/js/src/onetrading.js +3 -0
- package/js/src/p2b.js +3 -0
- package/js/src/phemex.d.ts +1 -1
- package/js/src/poloniex.d.ts +1 -1
- package/js/src/pro/bybit.js +1 -1
- package/js/src/pro/coinbase.d.ts +2 -2
- package/js/src/pro/coinbase.js +30 -29
- package/js/src/probit.d.ts +1 -1
- package/js/src/probit.js +3 -0
- package/js/src/timex.js +3 -0
- package/js/src/tokocrypto.d.ts +1 -1
- package/js/src/tradeogre.js +3 -0
- package/js/src/upbit.d.ts +1 -1
- package/js/src/wavesexchange.d.ts +1 -1
- package/js/src/wavesexchange.js +3 -0
- package/js/src/wazirx.js +3 -0
- package/js/src/whitebit.d.ts +1 -1
- package/js/src/woo.d.ts +1 -1
- package/js/src/woo.js +2 -0
- package/js/src/yobit.d.ts +1 -1
- package/js/src/yobit.js +3 -0
- package/js/src/zaif.d.ts +1 -1
- package/js/src/zonda.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -213,13 +213,13 @@ console.log(version, Object.keys(exchanges));
|
|
|
213
213
|
|
|
214
214
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
|
215
215
|
|
|
216
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.
|
|
217
|
-
* unpkg: https://unpkg.com/ccxt@4.3.
|
|
216
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.7/dist/ccxt.browser.js
|
|
217
|
+
* unpkg: https://unpkg.com/ccxt@4.3.7/dist/ccxt.browser.js
|
|
218
218
|
|
|
219
219
|
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
|
220
220
|
|
|
221
221
|
```HTML
|
|
222
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.
|
|
222
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.7/dist/ccxt.browser.js"></script>
|
|
223
223
|
```
|
|
224
224
|
|
|
225
225
|
Creates a global `ccxt` object:
|
package/dist/cjs/ccxt.js
CHANGED
|
@@ -182,7 +182,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
182
182
|
|
|
183
183
|
//-----------------------------------------------------------------------------
|
|
184
184
|
// this is updated by vss.js when building
|
|
185
|
-
const version = '4.3.
|
|
185
|
+
const version = '4.3.7';
|
|
186
186
|
Exchange["default"].ccxtVersion = version;
|
|
187
187
|
const exchanges = {
|
|
188
188
|
'ace': ace,
|
package/dist/cjs/src/ace.js
CHANGED
|
@@ -62,8 +62,13 @@ class ace extends ace$1 {
|
|
|
62
62
|
'fetchOrderBook': true,
|
|
63
63
|
'fetchOrders': false,
|
|
64
64
|
'fetchOrderTrades': true,
|
|
65
|
+
'fetchPosition': false,
|
|
66
|
+
'fetchPositionHistory': false,
|
|
65
67
|
'fetchPositionMode': false,
|
|
66
68
|
'fetchPositions': false,
|
|
69
|
+
'fetchPositionsForSymbol': false,
|
|
70
|
+
'fetchPositionsHistory': false,
|
|
71
|
+
'fetchPositionsRisk': false,
|
|
67
72
|
'fetchPremiumIndexOHLCV': false,
|
|
68
73
|
'fetchTicker': true,
|
|
69
74
|
'fetchTickers': true,
|
package/dist/cjs/src/alpaca.js
CHANGED
|
@@ -71,7 +71,13 @@ class alpaca extends alpaca$1 {
|
|
|
71
71
|
'fetchOrder': true,
|
|
72
72
|
'fetchOrderBook': true,
|
|
73
73
|
'fetchOrders': true,
|
|
74
|
+
'fetchPosition': false,
|
|
75
|
+
'fetchPositionHistory': false,
|
|
76
|
+
'fetchPositionMode': false,
|
|
74
77
|
'fetchPositions': false,
|
|
78
|
+
'fetchPositionsForSymbol': false,
|
|
79
|
+
'fetchPositionsHistory': false,
|
|
80
|
+
'fetchPositionsRisk': false,
|
|
75
81
|
'fetchStatus': false,
|
|
76
82
|
'fetchTicker': false,
|
|
77
83
|
'fetchTickers': false,
|
|
@@ -505,6 +505,8 @@ class Exchange {
|
|
|
505
505
|
'fetchOrderWs': undefined,
|
|
506
506
|
'fetchPermissions': undefined,
|
|
507
507
|
'fetchPosition': undefined,
|
|
508
|
+
'fetchPositionHistory': undefined,
|
|
509
|
+
'fetchPositionsHistory': undefined,
|
|
508
510
|
'fetchPositionWs': undefined,
|
|
509
511
|
'fetchPositionMode': undefined,
|
|
510
512
|
'fetchPositions': undefined,
|
|
@@ -6207,6 +6209,38 @@ class Exchange {
|
|
|
6207
6209
|
const reconstructedDate = day + month + year;
|
|
6208
6210
|
return reconstructedDate;
|
|
6209
6211
|
}
|
|
6212
|
+
async fetchPositionHistory(symbol, since = undefined, limit = undefined, params = {}) {
|
|
6213
|
+
/**
|
|
6214
|
+
* @method
|
|
6215
|
+
* @name exchange#fetchPositionHistory
|
|
6216
|
+
* @description fetches the history of margin added or reduced from contract isolated positions
|
|
6217
|
+
* @param {string} [symbol] unified market symbol
|
|
6218
|
+
* @param {int} [since] timestamp in ms of the position
|
|
6219
|
+
* @param {int} [limit] the maximum amount of candles to fetch, default=1000
|
|
6220
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
6221
|
+
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
6222
|
+
*/
|
|
6223
|
+
if (this.has['fetchPositionsHistory']) {
|
|
6224
|
+
const positions = await this.fetchPositionsHistory([symbol], since, limit, params);
|
|
6225
|
+
return this.safeDict(positions, 0);
|
|
6226
|
+
}
|
|
6227
|
+
else {
|
|
6228
|
+
throw new errors.NotSupported(this.id + ' fetchPositionHistory () is not supported yet');
|
|
6229
|
+
}
|
|
6230
|
+
}
|
|
6231
|
+
async fetchPositionsHistory(symbols = undefined, since = undefined, limit = undefined, params = {}) {
|
|
6232
|
+
/**
|
|
6233
|
+
* @method
|
|
6234
|
+
* @name exchange#fetchPositionsHistory
|
|
6235
|
+
* @description fetches the history of margin added or reduced from contract isolated positions
|
|
6236
|
+
* @param {string} [symbol] unified market symbol
|
|
6237
|
+
* @param {int} [since] timestamp in ms of the position
|
|
6238
|
+
* @param {int} [limit] the maximum amount of candles to fetch, default=1000
|
|
6239
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
6240
|
+
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
6241
|
+
*/
|
|
6242
|
+
throw new errors.NotSupported(this.id + ' fetchPositionsHistory () is not supported yet');
|
|
6243
|
+
}
|
|
6210
6244
|
parseMarginModification(data, market = undefined) {
|
|
6211
6245
|
throw new errors.NotSupported(this.id + ' parseMarginModification() is not supported yet');
|
|
6212
6246
|
}
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -125,8 +125,10 @@ class binance extends binance$1 {
|
|
|
125
125
|
'fetchOrders': true,
|
|
126
126
|
'fetchOrderTrades': true,
|
|
127
127
|
'fetchPosition': true,
|
|
128
|
+
'fetchPositionHistory': false,
|
|
128
129
|
'fetchPositionMode': true,
|
|
129
130
|
'fetchPositions': true,
|
|
131
|
+
'fetchPositionsHistory': false,
|
|
130
132
|
'fetchPositionsRisk': true,
|
|
131
133
|
'fetchPremiumIndexOHLCV': false,
|
|
132
134
|
'fetchSettlementHistory': true,
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -72,8 +72,10 @@ class bingx extends bingx$1 {
|
|
|
72
72
|
'fetchOrder': true,
|
|
73
73
|
'fetchOrderBook': true,
|
|
74
74
|
'fetchOrders': true,
|
|
75
|
+
'fetchPositionHistory': false,
|
|
75
76
|
'fetchPositionMode': true,
|
|
76
77
|
'fetchPositions': true,
|
|
78
|
+
'fetchPositionsHistory': false,
|
|
77
79
|
'fetchTicker': true,
|
|
78
80
|
'fetchTickers': true,
|
|
79
81
|
'fetchTime': true,
|
package/dist/cjs/src/bitbank.js
CHANGED
|
@@ -56,8 +56,11 @@ class bitbank extends bitbank$1 {
|
|
|
56
56
|
'fetchOrder': true,
|
|
57
57
|
'fetchOrderBook': true,
|
|
58
58
|
'fetchPosition': false,
|
|
59
|
+
'fetchPositionHistory': false,
|
|
59
60
|
'fetchPositionMode': false,
|
|
60
61
|
'fetchPositions': false,
|
|
62
|
+
'fetchPositionsForSymbol': false,
|
|
63
|
+
'fetchPositionsHistory': false,
|
|
61
64
|
'fetchPositionsRisk': false,
|
|
62
65
|
'fetchPremiumIndexOHLCV': false,
|
|
63
66
|
'fetchTicker': true,
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -106,8 +106,10 @@ class bitget extends bitget$1 {
|
|
|
106
106
|
'fetchOrders': false,
|
|
107
107
|
'fetchOrderTrades': false,
|
|
108
108
|
'fetchPosition': true,
|
|
109
|
+
'fetchPositionHistory': 'emulated',
|
|
109
110
|
'fetchPositionMode': false,
|
|
110
111
|
'fetchPositions': true,
|
|
112
|
+
'fetchPositionsHistory': true,
|
|
111
113
|
'fetchPositionsRisk': false,
|
|
112
114
|
'fetchPremiumIndexOHLCV': false,
|
|
113
115
|
'fetchStatus': false,
|
|
@@ -6548,7 +6550,7 @@ class bitget extends bitget$1 {
|
|
|
6548
6550
|
// "cTime": "1700807507275"
|
|
6549
6551
|
// }
|
|
6550
6552
|
//
|
|
6551
|
-
//
|
|
6553
|
+
// fetchPositionsHistory: privateMixGetV2MixPositionHistoryPosition
|
|
6552
6554
|
//
|
|
6553
6555
|
// {
|
|
6554
6556
|
// "symbol": "BTCUSDT",
|
|
@@ -8447,6 +8449,77 @@ class bitget extends bitget$1 {
|
|
|
8447
8449
|
'marginMode': marginType,
|
|
8448
8450
|
};
|
|
8449
8451
|
}
|
|
8452
|
+
async fetchPositionsHistory(symbols = undefined, since = undefined, limit = undefined, params = {}) {
|
|
8453
|
+
/**
|
|
8454
|
+
* @method
|
|
8455
|
+
* @name bitget#fetchPositionsHistory
|
|
8456
|
+
* @description fetches historical positions
|
|
8457
|
+
* @see https://www.bitget.com/api-doc/contract/position/Get-History-Position
|
|
8458
|
+
* @param {string} [symbol] unified contract symbols
|
|
8459
|
+
* @param {int} [since] timestamp in ms of the earliest position to fetch, default=3 months ago, max range for params["until"] - since is 3 months
|
|
8460
|
+
* @param {int} [limit] the maximum amount of records to fetch, default=20, max=100
|
|
8461
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
8462
|
+
* @param {int} [params.until] timestamp in ms of the latest position to fetch, max range for params["until"] - since is 3 months
|
|
8463
|
+
*
|
|
8464
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
8465
|
+
* @param {string} [params.productType] USDT-FUTURES (default), COIN-FUTURES, USDC-FUTURES, SUSDT-FUTURES, SCOIN-FUTURES, or SUSDC-FUTURES
|
|
8466
|
+
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
8467
|
+
*/
|
|
8468
|
+
await this.loadMarkets();
|
|
8469
|
+
const until = this.safeInteger(params, 'until');
|
|
8470
|
+
params = this.omit(params, 'until');
|
|
8471
|
+
const request = {};
|
|
8472
|
+
if (symbols !== undefined) {
|
|
8473
|
+
const symbolsLength = symbols.length;
|
|
8474
|
+
if (symbolsLength > 0) {
|
|
8475
|
+
const market = this.market(symbols[0]);
|
|
8476
|
+
request['symbol'] = market['id'];
|
|
8477
|
+
}
|
|
8478
|
+
}
|
|
8479
|
+
if (since !== undefined) {
|
|
8480
|
+
request['startTime'] = since;
|
|
8481
|
+
}
|
|
8482
|
+
if (limit !== undefined) {
|
|
8483
|
+
request['limit'] = limit;
|
|
8484
|
+
}
|
|
8485
|
+
if (until !== undefined) {
|
|
8486
|
+
request['endTime'] = until;
|
|
8487
|
+
}
|
|
8488
|
+
const response = await this.privateMixGetV2MixPositionHistoryPosition(this.extend(request, params));
|
|
8489
|
+
//
|
|
8490
|
+
// {
|
|
8491
|
+
// code: '00000',
|
|
8492
|
+
// msg: 'success',
|
|
8493
|
+
// requestTime: '1712794148791',
|
|
8494
|
+
// data: {
|
|
8495
|
+
// list: [
|
|
8496
|
+
// {
|
|
8497
|
+
// symbol: 'XRPUSDT',
|
|
8498
|
+
// marginCoin: 'USDT',
|
|
8499
|
+
// holdSide: 'long',
|
|
8500
|
+
// openAvgPrice: '0.64967',
|
|
8501
|
+
// closeAvgPrice: '0.58799',
|
|
8502
|
+
// marginMode: 'isolated',
|
|
8503
|
+
// openTotalPos: '10',
|
|
8504
|
+
// closeTotalPos: '10',
|
|
8505
|
+
// pnl: '-0.62976205',
|
|
8506
|
+
// netProfit: '-0.65356802',
|
|
8507
|
+
// totalFunding: '-0.01638',
|
|
8508
|
+
// openFee: '-0.00389802',
|
|
8509
|
+
// closeFee: '-0.00352794',
|
|
8510
|
+
// ctime: '1709590322199',
|
|
8511
|
+
// utime: '1709667583395'
|
|
8512
|
+
// },
|
|
8513
|
+
// ...
|
|
8514
|
+
// ]
|
|
8515
|
+
// }
|
|
8516
|
+
// }
|
|
8517
|
+
//
|
|
8518
|
+
const data = this.safeDict(response, 'data');
|
|
8519
|
+
const responseList = this.safeList(data, 'list');
|
|
8520
|
+
const positions = this.parsePositions(responseList, symbols, params);
|
|
8521
|
+
return this.filterBySinceLimit(positions, since, limit);
|
|
8522
|
+
}
|
|
8450
8523
|
async fetchConvertQuote(fromCode, toCode, amount = undefined, params = {}) {
|
|
8451
8524
|
/**
|
|
8452
8525
|
* @method
|
package/dist/cjs/src/bithumb.js
CHANGED
|
@@ -55,7 +55,11 @@ class bithumb extends bithumb$1 {
|
|
|
55
55
|
'fetchOrder': true,
|
|
56
56
|
'fetchOrderBook': true,
|
|
57
57
|
'fetchPosition': false,
|
|
58
|
+
'fetchPositionHistory': false,
|
|
59
|
+
'fetchPositionMode': false,
|
|
58
60
|
'fetchPositions': false,
|
|
61
|
+
'fetchPositionsForSymbol': false,
|
|
62
|
+
'fetchPositionsHistory': false,
|
|
59
63
|
'fetchPositionsRisk': false,
|
|
60
64
|
'fetchPremiumIndexOHLCV': false,
|
|
61
65
|
'fetchTicker': true,
|
package/dist/cjs/src/bitmex.js
CHANGED
|
@@ -76,7 +76,9 @@ class bitmex extends bitmex$1 {
|
|
|
76
76
|
'fetchOrderBook': true,
|
|
77
77
|
'fetchOrders': true,
|
|
78
78
|
'fetchPosition': false,
|
|
79
|
+
'fetchPositionHistory': false,
|
|
79
80
|
'fetchPositions': true,
|
|
81
|
+
'fetchPositionsHistory': false,
|
|
80
82
|
'fetchPositionsRisk': false,
|
|
81
83
|
'fetchPremiumIndexOHLCV': false,
|
|
82
84
|
'fetchTicker': true,
|
package/dist/cjs/src/bitopro.js
CHANGED
|
@@ -65,8 +65,13 @@ class bitopro extends bitopro$1 {
|
|
|
65
65
|
'fetchOrderBook': true,
|
|
66
66
|
'fetchOrders': false,
|
|
67
67
|
'fetchOrderTrades': false,
|
|
68
|
+
'fetchPosition': false,
|
|
69
|
+
'fetchPositionHistory': false,
|
|
68
70
|
'fetchPositionMode': false,
|
|
69
71
|
'fetchPositions': false,
|
|
72
|
+
'fetchPositionsForSymbol': false,
|
|
73
|
+
'fetchPositionsHistory': false,
|
|
74
|
+
'fetchPositionsRisk': false,
|
|
70
75
|
'fetchPremiumIndexOHLCV': false,
|
|
71
76
|
'fetchTicker': true,
|
|
72
77
|
'fetchTickers': true,
|
package/dist/cjs/src/bitso.js
CHANGED
|
@@ -69,8 +69,11 @@ class bitso extends bitso$1 {
|
|
|
69
69
|
'fetchOrderBook': true,
|
|
70
70
|
'fetchOrderTrades': true,
|
|
71
71
|
'fetchPosition': false,
|
|
72
|
+
'fetchPositionHistory': false,
|
|
72
73
|
'fetchPositionMode': false,
|
|
73
74
|
'fetchPositions': false,
|
|
75
|
+
'fetchPositionsForSymbol': false,
|
|
76
|
+
'fetchPositionsHistory': false,
|
|
74
77
|
'fetchPositionsRisk': false,
|
|
75
78
|
'fetchPremiumIndexOHLCV': false,
|
|
76
79
|
'fetchTicker': true,
|
package/dist/cjs/src/bitstamp.js
CHANGED
|
@@ -69,8 +69,11 @@ class bitstamp extends bitstamp$1 {
|
|
|
69
69
|
'fetchOrder': true,
|
|
70
70
|
'fetchOrderBook': true,
|
|
71
71
|
'fetchPosition': false,
|
|
72
|
+
'fetchPositionHistory': false,
|
|
72
73
|
'fetchPositionMode': false,
|
|
73
74
|
'fetchPositions': false,
|
|
75
|
+
'fetchPositionsForSymbol': false,
|
|
76
|
+
'fetchPositionsHistory': false,
|
|
74
77
|
'fetchPositionsRisk': false,
|
|
75
78
|
'fetchPremiumIndexOHLCV': false,
|
|
76
79
|
'fetchTicker': true,
|
package/dist/cjs/src/bitteam.js
CHANGED
|
@@ -87,7 +87,11 @@ class bitteam extends bitteam$1 {
|
|
|
87
87
|
'fetchOrders': true,
|
|
88
88
|
'fetchOrderTrades': false,
|
|
89
89
|
'fetchPosition': false,
|
|
90
|
+
'fetchPositionHistory': false,
|
|
91
|
+
'fetchPositionMode': false,
|
|
90
92
|
'fetchPositions': false,
|
|
93
|
+
'fetchPositionsForSymbol': false,
|
|
94
|
+
'fetchPositionsHistory': false,
|
|
91
95
|
'fetchPositionsRisk': false,
|
|
92
96
|
'fetchPremiumIndexOHLCV': false,
|
|
93
97
|
'fetchStatus': false,
|
package/dist/cjs/src/bitvavo.js
CHANGED
|
@@ -70,8 +70,11 @@ class bitvavo extends bitvavo$1 {
|
|
|
70
70
|
'fetchOrderBook': true,
|
|
71
71
|
'fetchOrders': true,
|
|
72
72
|
'fetchPosition': false,
|
|
73
|
+
'fetchPositionHistory': false,
|
|
73
74
|
'fetchPositionMode': false,
|
|
74
75
|
'fetchPositions': false,
|
|
76
|
+
'fetchPositionsForSymbol': false,
|
|
77
|
+
'fetchPositionsHistory': false,
|
|
75
78
|
'fetchPositionsRisk': false,
|
|
76
79
|
'fetchPremiumIndexOHLCV': false,
|
|
77
80
|
'fetchTicker': true,
|
package/dist/cjs/src/bl3p.js
CHANGED
|
@@ -59,8 +59,11 @@ class bl3p extends bl3p$1 {
|
|
|
59
59
|
'fetchOpenInterestHistory': false,
|
|
60
60
|
'fetchOrderBook': true,
|
|
61
61
|
'fetchPosition': false,
|
|
62
|
+
'fetchPositionHistory': false,
|
|
62
63
|
'fetchPositionMode': false,
|
|
63
64
|
'fetchPositions': false,
|
|
65
|
+
'fetchPositionsForSymbol': false,
|
|
66
|
+
'fetchPositionsHistory': false,
|
|
64
67
|
'fetchPositionsRisk': false,
|
|
65
68
|
'fetchPremiumIndexOHLCV': false,
|
|
66
69
|
'fetchTicker': true,
|
package/dist/cjs/src/btcalpha.js
CHANGED
|
@@ -67,8 +67,11 @@ class btcalpha extends btcalpha$1 {
|
|
|
67
67
|
'fetchOrderBook': true,
|
|
68
68
|
'fetchOrders': true,
|
|
69
69
|
'fetchPosition': false,
|
|
70
|
+
'fetchPositionHistory': false,
|
|
70
71
|
'fetchPositionMode': false,
|
|
71
72
|
'fetchPositions': false,
|
|
73
|
+
'fetchPositionsForSymbol': false,
|
|
74
|
+
'fetchPositionsHistory': false,
|
|
72
75
|
'fetchPositionsRisk': false,
|
|
73
76
|
'fetchPremiumIndexOHLCV': false,
|
|
74
77
|
'fetchTicker': true,
|
package/dist/cjs/src/btcbox.js
CHANGED
|
@@ -55,8 +55,11 @@ class btcbox extends btcbox$1 {
|
|
|
55
55
|
'fetchOrderBook': true,
|
|
56
56
|
'fetchOrders': true,
|
|
57
57
|
'fetchPosition': false,
|
|
58
|
+
'fetchPositionHistory': false,
|
|
58
59
|
'fetchPositionMode': false,
|
|
59
60
|
'fetchPositions': false,
|
|
61
|
+
'fetchPositionsForSymbol': false,
|
|
62
|
+
'fetchPositionsHistory': false,
|
|
60
63
|
'fetchPositionsRisk': false,
|
|
61
64
|
'fetchPremiumIndexOHLCV': false,
|
|
62
65
|
'fetchTicker': true,
|
|
@@ -65,8 +65,11 @@ class btcmarkets extends btcmarkets$1 {
|
|
|
65
65
|
'fetchOrderBook': true,
|
|
66
66
|
'fetchOrders': true,
|
|
67
67
|
'fetchPosition': false,
|
|
68
|
+
'fetchPositionHistory': false,
|
|
68
69
|
'fetchPositionMode': false,
|
|
69
70
|
'fetchPositions': false,
|
|
71
|
+
'fetchPositionsForSymbol': false,
|
|
72
|
+
'fetchPositionsHistory': false,
|
|
70
73
|
'fetchPositionsRisk': false,
|
|
71
74
|
'fetchPremiumIndexOHLCV': false,
|
|
72
75
|
'fetchTicker': true,
|
package/dist/cjs/src/btcturk.js
CHANGED
|
@@ -60,8 +60,11 @@ class btcturk extends btcturk$1 {
|
|
|
60
60
|
'fetchOrderBook': true,
|
|
61
61
|
'fetchOrders': true,
|
|
62
62
|
'fetchPosition': false,
|
|
63
|
+
'fetchPositionHistory': false,
|
|
63
64
|
'fetchPositionMode': false,
|
|
64
65
|
'fetchPositions': false,
|
|
66
|
+
'fetchPositionsForSymbol': false,
|
|
67
|
+
'fetchPositionsHistory': false,
|
|
65
68
|
'fetchPositionsRisk': false,
|
|
66
69
|
'fetchPremiumIndexOHLCV': false,
|
|
67
70
|
'fetchTicker': true,
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -102,7 +102,9 @@ class bybit extends bybit$1 {
|
|
|
102
102
|
'fetchOrders': false,
|
|
103
103
|
'fetchOrderTrades': true,
|
|
104
104
|
'fetchPosition': true,
|
|
105
|
+
'fetchPositionHistory': 'emulated',
|
|
105
106
|
'fetchPositions': true,
|
|
107
|
+
'fetchPositionsHistory': true,
|
|
106
108
|
'fetchPremiumIndexOHLCV': true,
|
|
107
109
|
'fetchSettlementHistory': true,
|
|
108
110
|
'fetchTicker': true,
|
|
@@ -6457,37 +6459,64 @@ class bybit extends bybit$1 {
|
|
|
6457
6459
|
// "tradeMode": 0
|
|
6458
6460
|
// }
|
|
6459
6461
|
//
|
|
6462
|
+
// fetchPositionsHistory
|
|
6463
|
+
//
|
|
6464
|
+
// {
|
|
6465
|
+
// symbol: 'XRPUSDT',
|
|
6466
|
+
// orderType: 'Market',
|
|
6467
|
+
// leverage: '10',
|
|
6468
|
+
// updatedTime: '1712717265572',
|
|
6469
|
+
// side: 'Sell',
|
|
6470
|
+
// orderId: '071749f3-a9fa-427b-b5ca-27b2f52b81de',
|
|
6471
|
+
// closedPnl: '-0.00049568',
|
|
6472
|
+
// avgEntryPrice: '0.6045',
|
|
6473
|
+
// qty: '3',
|
|
6474
|
+
// cumEntryValue: '1.8135',
|
|
6475
|
+
// createdTime: '1712717265566',
|
|
6476
|
+
// orderPrice: '0.5744',
|
|
6477
|
+
// closedSize: '3',
|
|
6478
|
+
// avgExitPrice: '0.605',
|
|
6479
|
+
// execType: 'Trade',
|
|
6480
|
+
// fillCount: '1',
|
|
6481
|
+
// cumExitValue: '1.815'
|
|
6482
|
+
// }
|
|
6483
|
+
//
|
|
6484
|
+
const closedSize = this.safeString(position, 'closedSize');
|
|
6485
|
+
const isHistory = (closedSize !== undefined);
|
|
6460
6486
|
const contract = this.safeString(position, 'symbol');
|
|
6461
6487
|
market = this.safeMarket(contract, market, undefined, 'contract');
|
|
6462
|
-
const size = Precise["default"].stringAbs(this.
|
|
6488
|
+
const size = Precise["default"].stringAbs(this.safeString2(position, 'size', 'qty'));
|
|
6463
6489
|
let side = this.safeString(position, 'side');
|
|
6464
6490
|
if (side !== undefined) {
|
|
6465
6491
|
if (side === 'Buy') {
|
|
6466
|
-
side = 'long';
|
|
6492
|
+
side = isHistory ? 'short' : 'long';
|
|
6467
6493
|
}
|
|
6468
6494
|
else if (side === 'Sell') {
|
|
6469
|
-
side = 'short';
|
|
6495
|
+
side = isHistory ? 'long' : 'short';
|
|
6470
6496
|
}
|
|
6471
6497
|
else {
|
|
6472
6498
|
side = undefined;
|
|
6473
6499
|
}
|
|
6474
6500
|
}
|
|
6475
|
-
const notional = this.
|
|
6501
|
+
const notional = this.safeString2(position, 'positionValue', 'cumExitValue');
|
|
6476
6502
|
const unrealisedPnl = this.omitZero(this.safeString(position, 'unrealisedPnl'));
|
|
6477
|
-
let initialMarginString = this.
|
|
6503
|
+
let initialMarginString = this.safeStringN(position, ['positionIM', 'cumEntryValue']);
|
|
6478
6504
|
let maintenanceMarginString = this.safeString(position, 'positionMM');
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6505
|
+
const timestamp = this.safeIntegerN(position, ['createdTime', 'createdAt']);
|
|
6506
|
+
let lastUpdateTimestamp = this.parse8601(this.safeString(position, 'updated_at'));
|
|
6507
|
+
if (lastUpdateTimestamp === undefined) {
|
|
6508
|
+
lastUpdateTimestamp = this.safeIntegerN(position, ['updatedTime', 'updatedAt', 'updatedTime']);
|
|
6482
6509
|
}
|
|
6483
6510
|
const tradeMode = this.safeInteger(position, 'tradeMode', 0);
|
|
6484
6511
|
let marginMode = undefined;
|
|
6485
6512
|
if ((!this.options['enableUnifiedAccount']) || (this.options['enableUnifiedAccount'] && market['inverse'])) {
|
|
6486
6513
|
// tradeMode would work for classic and UTA(inverse)
|
|
6487
|
-
marginMode
|
|
6514
|
+
if (!isHistory) { // cannot tell marginMode for fetchPositionsHistory, and closedSize will only be defined for fetchPositionsHistory response
|
|
6515
|
+
marginMode = (tradeMode === 1) ? 'isolated' : 'cross';
|
|
6516
|
+
}
|
|
6488
6517
|
}
|
|
6489
6518
|
let collateralString = this.safeString(position, 'positionBalance');
|
|
6490
|
-
const entryPrice = this.omitZero(this.
|
|
6519
|
+
const entryPrice = this.omitZero(this.safeStringN(position, ['entryPrice', 'avgPrice', 'avgEntryPrice']));
|
|
6491
6520
|
const liquidationPrice = this.omitZero(this.safeString(position, 'liqPrice'));
|
|
6492
6521
|
const leverage = this.safeString(position, 'leverage');
|
|
6493
6522
|
if (liquidationPrice !== undefined) {
|
|
@@ -6533,7 +6562,7 @@ class bybit extends bybit$1 {
|
|
|
6533
6562
|
'symbol': market['symbol'],
|
|
6534
6563
|
'timestamp': timestamp,
|
|
6535
6564
|
'datetime': this.iso8601(timestamp),
|
|
6536
|
-
'lastUpdateTimestamp':
|
|
6565
|
+
'lastUpdateTimestamp': lastUpdateTimestamp,
|
|
6537
6566
|
'initialMargin': this.parseNumber(initialMarginString),
|
|
6538
6567
|
'initialMarginPercentage': this.parseNumber(Precise["default"].stringDiv(initialMarginString, notional)),
|
|
6539
6568
|
'maintenanceMargin': this.parseNumber(maintenanceMarginString),
|
|
@@ -6542,12 +6571,13 @@ class bybit extends bybit$1 {
|
|
|
6542
6571
|
'notional': this.parseNumber(notional),
|
|
6543
6572
|
'leverage': this.parseNumber(leverage),
|
|
6544
6573
|
'unrealizedPnl': this.parseNumber(unrealisedPnl),
|
|
6574
|
+
'realizedPnl': this.safeNumber(position, 'closedPnl'),
|
|
6545
6575
|
'contracts': this.parseNumber(size),
|
|
6546
6576
|
'contractSize': this.safeNumber(market, 'contractSize'),
|
|
6547
6577
|
'marginRatio': this.parseNumber(marginRatio),
|
|
6548
6578
|
'liquidationPrice': this.parseNumber(liquidationPrice),
|
|
6549
6579
|
'markPrice': this.safeNumber(position, 'markPrice'),
|
|
6550
|
-
'lastPrice':
|
|
6580
|
+
'lastPrice': this.safeNumber(position, 'avgExitPrice'),
|
|
6551
6581
|
'collateral': this.parseNumber(collateralString),
|
|
6552
6582
|
'marginMode': marginMode,
|
|
6553
6583
|
'side': side,
|
|
@@ -8470,6 +8500,87 @@ class bybit extends bybit$1 {
|
|
|
8470
8500
|
'quoteVolume': undefined,
|
|
8471
8501
|
};
|
|
8472
8502
|
}
|
|
8503
|
+
async fetchPositionsHistory(symbols = undefined, since = undefined, limit = undefined, params = {}) {
|
|
8504
|
+
/**
|
|
8505
|
+
* @method
|
|
8506
|
+
* @name bybit#fetchPositionsHistory
|
|
8507
|
+
* @description fetches historical positions
|
|
8508
|
+
* @see https://bybit-exchange.github.io/docs/v5/position/close-pnl
|
|
8509
|
+
* @param {string} [symbol] unified market symbols, symbols must have the same subType (must all be linear or all be inverse)
|
|
8510
|
+
* @param {int} [since] timestamp in ms of the earliest position to fetch, params["until"] - since <= 7 days
|
|
8511
|
+
* @param {int} [limit] the maximum amount of records to fetch, default=50, max=100
|
|
8512
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
8513
|
+
* @param {int} [params.until] timestamp in ms of the latest position to fetch, params["until"] - since <= 7 days
|
|
8514
|
+
* @param {string} [params.subType] 'linear' or 'inverse'
|
|
8515
|
+
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
8516
|
+
*/
|
|
8517
|
+
await this.loadMarkets();
|
|
8518
|
+
let market = undefined;
|
|
8519
|
+
let subType = undefined;
|
|
8520
|
+
let symbolsLength = 0;
|
|
8521
|
+
if (symbols !== undefined) {
|
|
8522
|
+
symbolsLength = symbols.length;
|
|
8523
|
+
if (symbolsLength > 0) {
|
|
8524
|
+
market = this.market(symbols[0]);
|
|
8525
|
+
}
|
|
8526
|
+
}
|
|
8527
|
+
const until = this.safeInteger(params, 'until');
|
|
8528
|
+
[subType, params] = this.handleSubTypeAndParams('fetchPositionsHistory', market, params, 'linear');
|
|
8529
|
+
params = this.omit(params, 'until');
|
|
8530
|
+
const request = {
|
|
8531
|
+
'category': subType,
|
|
8532
|
+
};
|
|
8533
|
+
if ((symbols !== undefined) && (symbolsLength === 1)) {
|
|
8534
|
+
request['symbol'] = market['id'];
|
|
8535
|
+
}
|
|
8536
|
+
if (since !== undefined) {
|
|
8537
|
+
request['startTime'] = since;
|
|
8538
|
+
}
|
|
8539
|
+
if (limit !== undefined) {
|
|
8540
|
+
request['limit'] = limit;
|
|
8541
|
+
}
|
|
8542
|
+
if (until !== undefined) {
|
|
8543
|
+
request['endTime'] = until;
|
|
8544
|
+
}
|
|
8545
|
+
const response = await this.privateGetV5PositionClosedPnl(this.extend(request, params));
|
|
8546
|
+
//
|
|
8547
|
+
// {
|
|
8548
|
+
// retCode: '0',
|
|
8549
|
+
// retMsg: 'OK',
|
|
8550
|
+
// result: {
|
|
8551
|
+
// nextPageCursor: '071749f3-a9fa-427b-b5ca-27b2f52b81de%3A1712717265566520788%2C071749f3-a9fa-427b-b5ca-27b2f52b81de%3A1712717265566520788',
|
|
8552
|
+
// category: 'linear',
|
|
8553
|
+
// list: [
|
|
8554
|
+
// {
|
|
8555
|
+
// symbol: 'XRPUSDT',
|
|
8556
|
+
// orderType: 'Market',
|
|
8557
|
+
// leverage: '10',
|
|
8558
|
+
// updatedTime: '1712717265572',
|
|
8559
|
+
// side: 'Sell',
|
|
8560
|
+
// orderId: '071749f3-a9fa-427b-b5ca-27b2f52b81de',
|
|
8561
|
+
// closedPnl: '-0.00049568',
|
|
8562
|
+
// avgEntryPrice: '0.6045',
|
|
8563
|
+
// qty: '3',
|
|
8564
|
+
// cumEntryValue: '1.8135',
|
|
8565
|
+
// createdTime: '1712717265566',
|
|
8566
|
+
// orderPrice: '0.5744',
|
|
8567
|
+
// closedSize: '3',
|
|
8568
|
+
// avgExitPrice: '0.605',
|
|
8569
|
+
// execType: 'Trade',
|
|
8570
|
+
// fillCount: '1',
|
|
8571
|
+
// cumExitValue: '1.815'
|
|
8572
|
+
// }
|
|
8573
|
+
// ]
|
|
8574
|
+
// },
|
|
8575
|
+
// retExtInfo: {},
|
|
8576
|
+
// time: '1712717286073'
|
|
8577
|
+
// }
|
|
8578
|
+
//
|
|
8579
|
+
const result = this.safeDict(response, 'result');
|
|
8580
|
+
const rawPositions = this.safeList(result, 'list');
|
|
8581
|
+
const positions = this.parsePositions(rawPositions, symbols, params);
|
|
8582
|
+
return this.filterBySinceLimit(positions, since, limit);
|
|
8583
|
+
}
|
|
8473
8584
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
8474
8585
|
let url = this.implodeHostname(this.urls['api'][api]) + '/' + path;
|
|
8475
8586
|
if (api === 'public') {
|
package/dist/cjs/src/cex.js
CHANGED
|
@@ -62,7 +62,13 @@ class cex extends cex$1 {
|
|
|
62
62
|
'fetchOrder': true,
|
|
63
63
|
'fetchOrderBook': true,
|
|
64
64
|
'fetchOrders': true,
|
|
65
|
+
'fetchPosition': false,
|
|
66
|
+
'fetchPositionHistory': false,
|
|
65
67
|
'fetchPositionMode': false,
|
|
68
|
+
'fetchPositions': false,
|
|
69
|
+
'fetchPositionsForSymbol': false,
|
|
70
|
+
'fetchPositionsHistory': false,
|
|
71
|
+
'fetchPositionsRisk': false,
|
|
66
72
|
'fetchPremiumIndexOHLCV': false,
|
|
67
73
|
'fetchTicker': true,
|
|
68
74
|
'fetchTickers': true,
|