ccxt 4.4.68 → 4.4.70
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 +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +0 -1
- package/dist/cjs/src/binance.js +20 -3
- package/dist/cjs/src/bitget.js +49 -335
- package/dist/cjs/src/bitstamp.js +2 -3
- package/dist/cjs/src/bybit.js +7 -0
- package/dist/cjs/src/coinbase.js +25 -9
- package/dist/cjs/src/cryptomus.js +214 -116
- package/dist/cjs/src/hyperliquid.js +19 -8
- package/dist/cjs/src/okx.js +4 -0
- package/dist/cjs/src/paradex.js +172 -4
- package/dist/cjs/src/phemex.js +2 -2
- package/dist/cjs/src/pro/bitget.js +40 -7
- package/dist/cjs/src/pro/bybit.js +86 -38
- package/dist/cjs/src/tradeogre.js +34 -11
- package/dist/cjs/src/whitebit.js +211 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bybit.d.ts +4 -0
- package/js/src/abstract/myokx.d.ts +3 -0
- package/js/src/abstract/okx.d.ts +3 -0
- package/js/src/abstract/paradex.d.ts +23 -0
- package/js/src/abstract/tradeogre.d.ts +2 -1
- package/js/src/base/Exchange.js +0 -1
- package/js/src/base/types.d.ts +2 -2
- package/js/src/binance.js +20 -3
- package/js/src/bitget.d.ts +0 -1
- package/js/src/bitget.js +49 -335
- package/js/src/bitstamp.js +2 -3
- package/js/src/bybit.js +7 -0
- package/js/src/coinbase.d.ts +0 -5
- package/js/src/coinbase.js +25 -9
- package/js/src/cryptomus.d.ts +127 -1
- package/js/src/cryptomus.js +214 -116
- package/js/src/hyperliquid.js +19 -8
- package/js/src/okx.d.ts +1 -0
- package/js/src/okx.js +4 -0
- package/js/src/paradex.d.ts +48 -1
- package/js/src/paradex.js +172 -4
- package/js/src/phemex.d.ts +1 -1
- package/js/src/phemex.js +2 -2
- package/js/src/pro/bitget.js +40 -7
- package/js/src/pro/bybit.d.ts +1 -0
- package/js/src/pro/bybit.js +86 -38
- package/js/src/tradeogre.d.ts +1 -0
- package/js/src/tradeogre.js +34 -11
- package/js/src/whitebit.d.ts +35 -1
- package/js/src/whitebit.js +211 -1
- package/package.json +1 -1
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -1668,38 +1668,6 @@ class bitget extends bitget$1 {
|
|
|
1668
1668
|
setSandboxMode(enabled) {
|
|
1669
1669
|
this.options['sandboxMode'] = enabled;
|
|
1670
1670
|
}
|
|
1671
|
-
convertSymbolForSandbox(symbol) {
|
|
1672
|
-
if (symbol.startsWith('S')) {
|
|
1673
|
-
// handle using the exchange specified sandbox symbols
|
|
1674
|
-
return symbol;
|
|
1675
|
-
}
|
|
1676
|
-
let convertedSymbol = undefined;
|
|
1677
|
-
if (symbol.indexOf('/') > -1) {
|
|
1678
|
-
if (symbol.indexOf(':') === -1) {
|
|
1679
|
-
throw new errors.NotSupported(this.id + ' sandbox supports swap and future markets only');
|
|
1680
|
-
}
|
|
1681
|
-
const splitBase = symbol.split('/');
|
|
1682
|
-
const previousBase = this.safeString(splitBase, 0);
|
|
1683
|
-
const previousQuoteSettleExpiry = this.safeString(splitBase, 1);
|
|
1684
|
-
const splitQuote = previousQuoteSettleExpiry.split(':');
|
|
1685
|
-
const previousQuote = this.safeString(splitQuote, 0);
|
|
1686
|
-
const previousSettleExpiry = this.safeString(splitQuote, 1);
|
|
1687
|
-
const splitSettle = previousSettleExpiry.split('-');
|
|
1688
|
-
const previousSettle = this.safeString(splitSettle, 0);
|
|
1689
|
-
const expiry = this.safeString(splitSettle, 1);
|
|
1690
|
-
convertedSymbol = 'S' + previousBase + '/S' + previousQuote + ':S' + previousSettle;
|
|
1691
|
-
if (expiry !== undefined) {
|
|
1692
|
-
convertedSymbol = convertedSymbol + '-' + expiry;
|
|
1693
|
-
}
|
|
1694
|
-
}
|
|
1695
|
-
else {
|
|
1696
|
-
// handle using a market id instead of a unified symbol
|
|
1697
|
-
const base = symbol.slice(0, 3);
|
|
1698
|
-
const remaining = symbol.slice(3);
|
|
1699
|
-
convertedSymbol = 'S' + base + 'S' + remaining;
|
|
1700
|
-
}
|
|
1701
|
-
return convertedSymbol;
|
|
1702
|
-
}
|
|
1703
1671
|
handleProductTypeAndParams(market = undefined, params = {}) {
|
|
1704
1672
|
let subType = undefined;
|
|
1705
1673
|
[subType, params] = this.handleSubTypeAndParams('handleProductTypeAndParams', undefined, params);
|
|
@@ -1789,14 +1757,7 @@ class bitget extends bitget$1 {
|
|
|
1789
1757
|
for (let i = 0; i < types.length; i++) {
|
|
1790
1758
|
const type = types[i];
|
|
1791
1759
|
if ((type === 'swap') || (type === 'future')) {
|
|
1792
|
-
|
|
1793
|
-
if (sandboxMode) {
|
|
1794
|
-
// the following are simulated trading markets [ 'SUSDT-FUTURES', 'SCOIN-FUTURES', 'SUSDC-FUTURES' ];
|
|
1795
|
-
subTypes = ['SUSDT-FUTURES', 'SCOIN-FUTURES', 'SUSDC-FUTURES'];
|
|
1796
|
-
}
|
|
1797
|
-
else {
|
|
1798
|
-
subTypes = ['USDT-FUTURES', 'COIN-FUTURES', 'USDC-FUTURES'];
|
|
1799
|
-
}
|
|
1760
|
+
const subTypes = ['USDT-FUTURES', 'COIN-FUTURES', 'USDC-FUTURES', 'SUSDT-FUTURES', 'SCOIN-FUTURES', 'SUSDC-FUTURES'];
|
|
1800
1761
|
for (let j = 0; j < subTypes.length; j++) {
|
|
1801
1762
|
promises.push(this.publicMixGetV2MixMarketContracts(this.extend(params, {
|
|
1802
1763
|
'productType': subTypes[j],
|
|
@@ -2189,15 +2150,7 @@ class bitget extends bitget$1 {
|
|
|
2189
2150
|
*/
|
|
2190
2151
|
async fetchMarketLeverageTiers(symbol, params = {}) {
|
|
2191
2152
|
await this.loadMarkets();
|
|
2192
|
-
const
|
|
2193
|
-
let market = undefined;
|
|
2194
|
-
if (sandboxMode) {
|
|
2195
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
2196
|
-
market = this.market(sandboxSymbol);
|
|
2197
|
-
}
|
|
2198
|
-
else {
|
|
2199
|
-
market = this.market(symbol);
|
|
2200
|
-
}
|
|
2153
|
+
const market = this.market(symbol);
|
|
2201
2154
|
const request = {};
|
|
2202
2155
|
let response = undefined;
|
|
2203
2156
|
let marginMode = undefined;
|
|
@@ -2704,15 +2657,7 @@ class bitget extends bitget$1 {
|
|
|
2704
2657
|
*/
|
|
2705
2658
|
async fetchOrderBook(symbol, limit = undefined, params = {}) {
|
|
2706
2659
|
await this.loadMarkets();
|
|
2707
|
-
const
|
|
2708
|
-
let market = undefined;
|
|
2709
|
-
if (sandboxMode) {
|
|
2710
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
2711
|
-
market = this.market(sandboxSymbol);
|
|
2712
|
-
}
|
|
2713
|
-
else {
|
|
2714
|
-
market = this.market(symbol);
|
|
2715
|
-
}
|
|
2660
|
+
const market = this.market(symbol);
|
|
2716
2661
|
const request = {
|
|
2717
2662
|
'symbol': market['id'],
|
|
2718
2663
|
};
|
|
@@ -2877,15 +2822,7 @@ class bitget extends bitget$1 {
|
|
|
2877
2822
|
*/
|
|
2878
2823
|
async fetchTicker(symbol, params = {}) {
|
|
2879
2824
|
await this.loadMarkets();
|
|
2880
|
-
const
|
|
2881
|
-
let market = undefined;
|
|
2882
|
-
if (sandboxMode) {
|
|
2883
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
2884
|
-
market = this.market(sandboxSymbol);
|
|
2885
|
-
}
|
|
2886
|
-
else {
|
|
2887
|
-
market = this.market(symbol);
|
|
2888
|
-
}
|
|
2825
|
+
const market = this.market(symbol);
|
|
2889
2826
|
const request = {
|
|
2890
2827
|
'symbol': market['id'],
|
|
2891
2828
|
};
|
|
@@ -2976,15 +2913,7 @@ class bitget extends bitget$1 {
|
|
|
2976
2913
|
*/
|
|
2977
2914
|
async fetchMarkPrice(symbol, params = {}) {
|
|
2978
2915
|
await this.loadMarkets();
|
|
2979
|
-
const
|
|
2980
|
-
let market = undefined;
|
|
2981
|
-
if (sandboxMode) {
|
|
2982
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
2983
|
-
market = this.market(sandboxSymbol);
|
|
2984
|
-
}
|
|
2985
|
-
else {
|
|
2986
|
-
market = this.market(symbol);
|
|
2987
|
-
}
|
|
2916
|
+
const market = this.market(symbol);
|
|
2988
2917
|
const request = {
|
|
2989
2918
|
'symbol': market['id'],
|
|
2990
2919
|
};
|
|
@@ -3018,14 +2947,7 @@ class bitget extends bitget$1 {
|
|
|
3018
2947
|
let market = undefined;
|
|
3019
2948
|
if (symbols !== undefined) {
|
|
3020
2949
|
const symbol = this.safeValue(symbols, 0);
|
|
3021
|
-
|
|
3022
|
-
if (sandboxMode) {
|
|
3023
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
3024
|
-
market = this.market(sandboxSymbol);
|
|
3025
|
-
}
|
|
3026
|
-
else {
|
|
3027
|
-
market = this.market(symbol);
|
|
3028
|
-
}
|
|
2950
|
+
market = this.market(symbol);
|
|
3029
2951
|
}
|
|
3030
2952
|
let response = undefined;
|
|
3031
2953
|
const request = {};
|
|
@@ -3248,15 +3170,7 @@ class bitget extends bitget$1 {
|
|
|
3248
3170
|
if (paginate) {
|
|
3249
3171
|
return await this.fetchPaginatedCallCursor('fetchTrades', symbol, since, limit, params, 'idLessThan', 'idLessThan');
|
|
3250
3172
|
}
|
|
3251
|
-
const
|
|
3252
|
-
let market = undefined;
|
|
3253
|
-
if (sandboxMode) {
|
|
3254
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
3255
|
-
market = this.market(sandboxSymbol);
|
|
3256
|
-
}
|
|
3257
|
-
else {
|
|
3258
|
-
market = this.market(symbol);
|
|
3259
|
-
}
|
|
3173
|
+
const market = this.market(symbol);
|
|
3260
3174
|
let request = {
|
|
3261
3175
|
'symbol': market['id'],
|
|
3262
3176
|
};
|
|
@@ -3573,16 +3487,8 @@ class bitget extends bitget$1 {
|
|
|
3573
3487
|
if (paginate) {
|
|
3574
3488
|
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, maxLimitForRecentEndpoint);
|
|
3575
3489
|
}
|
|
3576
|
-
const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
|
|
3577
3490
|
const useHistoryEndpoint = this.safeBool(params, 'useHistoryEndpoint', false);
|
|
3578
|
-
|
|
3579
|
-
if (sandboxMode) {
|
|
3580
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
3581
|
-
market = this.market(sandboxSymbol);
|
|
3582
|
-
}
|
|
3583
|
-
else {
|
|
3584
|
-
market = this.market(symbol);
|
|
3585
|
-
}
|
|
3491
|
+
const market = this.market(symbol);
|
|
3586
3492
|
const marketType = market['spot'] ? 'spot' : 'swap';
|
|
3587
3493
|
const timeframes = this.options['timeframes'][marketType];
|
|
3588
3494
|
const msInDay = 86400000;
|
|
@@ -4440,15 +4346,7 @@ class bitget extends bitget$1 {
|
|
|
4440
4346
|
return this.parseOrder(data, market);
|
|
4441
4347
|
}
|
|
4442
4348
|
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
4443
|
-
const
|
|
4444
|
-
let market = undefined;
|
|
4445
|
-
if (sandboxMode) {
|
|
4446
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
4447
|
-
market = this.market(sandboxSymbol);
|
|
4448
|
-
}
|
|
4449
|
-
else {
|
|
4450
|
-
market = this.market(symbol);
|
|
4451
|
-
}
|
|
4349
|
+
const market = this.market(symbol);
|
|
4452
4350
|
let marketType = undefined;
|
|
4453
4351
|
let marginMode = undefined;
|
|
4454
4352
|
[marketType, params] = this.handleMarketTypeAndParams('createOrder', market, params);
|
|
@@ -4717,15 +4615,7 @@ class bitget extends bitget$1 {
|
|
|
4717
4615
|
const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams);
|
|
4718
4616
|
ordersRequests.push(orderRequest);
|
|
4719
4617
|
}
|
|
4720
|
-
const
|
|
4721
|
-
let market = undefined;
|
|
4722
|
-
if (sandboxMode) {
|
|
4723
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
4724
|
-
market = this.market(sandboxSymbol);
|
|
4725
|
-
}
|
|
4726
|
-
else {
|
|
4727
|
-
market = this.market(symbol);
|
|
4728
|
-
}
|
|
4618
|
+
const market = this.market(symbol);
|
|
4729
4619
|
const request = {
|
|
4730
4620
|
'symbol': market['id'],
|
|
4731
4621
|
'orderList': ordersRequests,
|
|
@@ -4814,15 +4704,7 @@ class bitget extends bitget$1 {
|
|
|
4814
4704
|
*/
|
|
4815
4705
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
4816
4706
|
await this.loadMarkets();
|
|
4817
|
-
const
|
|
4818
|
-
let market = undefined;
|
|
4819
|
-
if (sandboxMode) {
|
|
4820
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
4821
|
-
market = this.market(sandboxSymbol);
|
|
4822
|
-
}
|
|
4823
|
-
else {
|
|
4824
|
-
market = this.market(symbol);
|
|
4825
|
-
}
|
|
4707
|
+
const market = this.market(symbol);
|
|
4826
4708
|
const request = {
|
|
4827
4709
|
'orderId': id,
|
|
4828
4710
|
};
|
|
@@ -4985,15 +4867,7 @@ class bitget extends bitget$1 {
|
|
|
4985
4867
|
throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
4986
4868
|
}
|
|
4987
4869
|
await this.loadMarkets();
|
|
4988
|
-
const
|
|
4989
|
-
let market = undefined;
|
|
4990
|
-
if (sandboxMode) {
|
|
4991
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
4992
|
-
market = this.market(sandboxSymbol);
|
|
4993
|
-
}
|
|
4994
|
-
else {
|
|
4995
|
-
market = this.market(symbol);
|
|
4996
|
-
}
|
|
4870
|
+
const market = this.market(symbol);
|
|
4997
4871
|
let marginMode = undefined;
|
|
4998
4872
|
let response = undefined;
|
|
4999
4873
|
[marginMode, params] = this.handleMarginModeAndParams('cancelOrder', params);
|
|
@@ -5125,15 +4999,7 @@ class bitget extends bitget$1 {
|
|
|
5125
4999
|
throw new errors.ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument');
|
|
5126
5000
|
}
|
|
5127
5001
|
await this.loadMarkets();
|
|
5128
|
-
const
|
|
5129
|
-
let market = undefined;
|
|
5130
|
-
if (sandboxMode) {
|
|
5131
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
5132
|
-
market = this.market(sandboxSymbol);
|
|
5133
|
-
}
|
|
5134
|
-
else {
|
|
5135
|
-
market = this.market(symbol);
|
|
5136
|
-
}
|
|
5002
|
+
const market = this.market(symbol);
|
|
5137
5003
|
let marginMode = undefined;
|
|
5138
5004
|
[marginMode, params] = this.handleMarginModeAndParams('cancelOrders', params);
|
|
5139
5005
|
const trigger = this.safeValue2(params, 'stop', 'trigger');
|
|
@@ -5220,15 +5086,7 @@ class bitget extends bitget$1 {
|
|
|
5220
5086
|
throw new errors.ArgumentsRequired(this.id + ' cancelAllOrders() requires a symbol argument');
|
|
5221
5087
|
}
|
|
5222
5088
|
await this.loadMarkets();
|
|
5223
|
-
const
|
|
5224
|
-
let market = undefined;
|
|
5225
|
-
if (sandboxMode) {
|
|
5226
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
5227
|
-
market = this.market(sandboxSymbol);
|
|
5228
|
-
}
|
|
5229
|
-
else {
|
|
5230
|
-
market = this.market(symbol);
|
|
5231
|
-
}
|
|
5089
|
+
const market = this.market(symbol);
|
|
5232
5090
|
let marginMode = undefined;
|
|
5233
5091
|
[marginMode, params] = this.handleMarginModeAndParams('cancelAllOrders', params);
|
|
5234
5092
|
const request = {
|
|
@@ -5342,15 +5200,7 @@ class bitget extends bitget$1 {
|
|
|
5342
5200
|
throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
5343
5201
|
}
|
|
5344
5202
|
await this.loadMarkets();
|
|
5345
|
-
const
|
|
5346
|
-
let market = undefined;
|
|
5347
|
-
if (sandboxMode) {
|
|
5348
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
5349
|
-
market = this.market(sandboxSymbol);
|
|
5350
|
-
}
|
|
5351
|
-
else {
|
|
5352
|
-
market = this.market(symbol);
|
|
5353
|
-
}
|
|
5203
|
+
const market = this.market(symbol);
|
|
5354
5204
|
const request = {
|
|
5355
5205
|
'orderId': id,
|
|
5356
5206
|
};
|
|
@@ -5474,20 +5324,13 @@ class bitget extends bitget$1 {
|
|
|
5474
5324
|
*/
|
|
5475
5325
|
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
5476
5326
|
await this.loadMarkets();
|
|
5477
|
-
const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
|
|
5478
5327
|
let market = undefined;
|
|
5479
5328
|
let type = undefined;
|
|
5480
5329
|
let request = {};
|
|
5481
5330
|
let marginMode = undefined;
|
|
5482
5331
|
[marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
|
|
5483
5332
|
if (symbol !== undefined) {
|
|
5484
|
-
|
|
5485
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
5486
|
-
market = this.market(sandboxSymbol);
|
|
5487
|
-
}
|
|
5488
|
-
else {
|
|
5489
|
-
market = this.market(symbol);
|
|
5490
|
-
}
|
|
5333
|
+
market = this.market(symbol);
|
|
5491
5334
|
request['symbol'] = market['id'];
|
|
5492
5335
|
const defaultType = this.safeString2(this.options, 'fetchOpenOrders', 'defaultType', 'spot');
|
|
5493
5336
|
const marketType = ('type' in market) ? market['type'] : defaultType;
|
|
@@ -5839,14 +5682,7 @@ class bitget extends bitget$1 {
|
|
|
5839
5682
|
*/
|
|
5840
5683
|
async fetchCanceledAndClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
5841
5684
|
await this.loadMarkets();
|
|
5842
|
-
const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
|
|
5843
5685
|
let market = undefined;
|
|
5844
|
-
if (sandboxMode) {
|
|
5845
|
-
if (symbol !== undefined) {
|
|
5846
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
5847
|
-
symbol = sandboxSymbol;
|
|
5848
|
-
}
|
|
5849
|
-
}
|
|
5850
5686
|
let request = {};
|
|
5851
5687
|
if (symbol !== undefined) {
|
|
5852
5688
|
market = this.market(symbol);
|
|
@@ -6155,14 +5991,7 @@ class bitget extends bitget$1 {
|
|
|
6155
5991
|
params = this.omit(params, 'symbol');
|
|
6156
5992
|
let market = undefined;
|
|
6157
5993
|
if (symbol !== undefined) {
|
|
6158
|
-
|
|
6159
|
-
if (sandboxMode) {
|
|
6160
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
6161
|
-
market = this.market(sandboxSymbol);
|
|
6162
|
-
}
|
|
6163
|
-
else {
|
|
6164
|
-
market = this.market(symbol);
|
|
6165
|
-
}
|
|
5994
|
+
market = this.market(symbol);
|
|
6166
5995
|
}
|
|
6167
5996
|
let marketType = undefined;
|
|
6168
5997
|
[marketType, params] = this.handleMarketTypeAndParams('fetchLedger', market, params);
|
|
@@ -6379,15 +6208,7 @@ class bitget extends bitget$1 {
|
|
|
6379
6208
|
throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
|
|
6380
6209
|
}
|
|
6381
6210
|
await this.loadMarkets();
|
|
6382
|
-
const
|
|
6383
|
-
let market = undefined;
|
|
6384
|
-
if (sandboxMode) {
|
|
6385
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
6386
|
-
market = this.market(sandboxSymbol);
|
|
6387
|
-
}
|
|
6388
|
-
else {
|
|
6389
|
-
market = this.market(symbol);
|
|
6390
|
-
}
|
|
6211
|
+
const market = this.market(symbol);
|
|
6391
6212
|
let marginMode = undefined;
|
|
6392
6213
|
[marginMode, params] = this.handleMarginModeAndParams('fetchMyTrades', params);
|
|
6393
6214
|
let paginate = false;
|
|
@@ -6558,15 +6379,7 @@ class bitget extends bitget$1 {
|
|
|
6558
6379
|
*/
|
|
6559
6380
|
async fetchPosition(symbol, params = {}) {
|
|
6560
6381
|
await this.loadMarkets();
|
|
6561
|
-
const
|
|
6562
|
-
let market = undefined;
|
|
6563
|
-
if (sandboxMode) {
|
|
6564
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
6565
|
-
market = this.market(sandboxSymbol);
|
|
6566
|
-
}
|
|
6567
|
-
else {
|
|
6568
|
-
market = this.market(symbol);
|
|
6569
|
-
}
|
|
6382
|
+
const market = this.market(symbol);
|
|
6570
6383
|
let productType = undefined;
|
|
6571
6384
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
6572
6385
|
const request = {
|
|
@@ -6642,14 +6455,7 @@ class bitget extends bitget$1 {
|
|
|
6642
6455
|
let market = undefined;
|
|
6643
6456
|
if (symbols !== undefined) {
|
|
6644
6457
|
const first = this.safeString(symbols, 0);
|
|
6645
|
-
|
|
6646
|
-
if (sandboxMode) {
|
|
6647
|
-
const sandboxSymbol = this.convertSymbolForSandbox(first);
|
|
6648
|
-
market = this.market(sandboxSymbol);
|
|
6649
|
-
}
|
|
6650
|
-
else {
|
|
6651
|
-
market = this.market(first);
|
|
6652
|
-
}
|
|
6458
|
+
market = this.market(first);
|
|
6653
6459
|
}
|
|
6654
6460
|
let productType = undefined;
|
|
6655
6461
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
@@ -6962,15 +6768,7 @@ class bitget extends bitget$1 {
|
|
|
6962
6768
|
if (paginate) {
|
|
6963
6769
|
return await this.fetchPaginatedCallIncremental('fetchFundingRateHistory', symbol, since, limit, params, 'pageNo', 100);
|
|
6964
6770
|
}
|
|
6965
|
-
const
|
|
6966
|
-
let market = undefined;
|
|
6967
|
-
if (sandboxMode) {
|
|
6968
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
6969
|
-
market = this.market(sandboxSymbol);
|
|
6970
|
-
}
|
|
6971
|
-
else {
|
|
6972
|
-
market = this.market(symbol);
|
|
6973
|
-
}
|
|
6771
|
+
const market = this.market(symbol);
|
|
6974
6772
|
let productType = undefined;
|
|
6975
6773
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
6976
6774
|
const request = {
|
|
@@ -7026,15 +6824,7 @@ class bitget extends bitget$1 {
|
|
|
7026
6824
|
*/
|
|
7027
6825
|
async fetchFundingRate(symbol, params = {}) {
|
|
7028
6826
|
await this.loadMarkets();
|
|
7029
|
-
const
|
|
7030
|
-
let market = undefined;
|
|
7031
|
-
if (sandboxMode) {
|
|
7032
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
7033
|
-
market = this.market(sandboxSymbol);
|
|
7034
|
-
}
|
|
7035
|
-
else {
|
|
7036
|
-
market = this.market(symbol);
|
|
7037
|
-
}
|
|
6827
|
+
const market = this.market(symbol);
|
|
7038
6828
|
if (!market['swap']) {
|
|
7039
6829
|
throw new errors.BadSymbol(this.id + ' fetchFundingRate() supports swap contracts only');
|
|
7040
6830
|
}
|
|
@@ -7077,14 +6867,7 @@ class bitget extends bitget$1 {
|
|
|
7077
6867
|
let market = undefined;
|
|
7078
6868
|
if (symbols !== undefined) {
|
|
7079
6869
|
const symbol = this.safeValue(symbols, 0);
|
|
7080
|
-
|
|
7081
|
-
if (sandboxMode) {
|
|
7082
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
7083
|
-
market = this.market(sandboxSymbol);
|
|
7084
|
-
}
|
|
7085
|
-
else {
|
|
7086
|
-
market = this.market(symbol);
|
|
7087
|
-
}
|
|
6870
|
+
market = this.market(symbol);
|
|
7088
6871
|
}
|
|
7089
6872
|
const request = {};
|
|
7090
6873
|
let productType = undefined;
|
|
@@ -7224,15 +7007,7 @@ class bitget extends bitget$1 {
|
|
|
7224
7007
|
if (paginate) {
|
|
7225
7008
|
return await this.fetchPaginatedCallCursor('fetchFundingHistory', symbol, since, limit, params, 'endId', 'idLessThan');
|
|
7226
7009
|
}
|
|
7227
|
-
const
|
|
7228
|
-
let market = undefined;
|
|
7229
|
-
if (sandboxMode) {
|
|
7230
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
7231
|
-
market = this.market(sandboxSymbol);
|
|
7232
|
-
}
|
|
7233
|
-
else {
|
|
7234
|
-
market = this.market(symbol);
|
|
7235
|
-
}
|
|
7010
|
+
const market = this.market(symbol);
|
|
7236
7011
|
if (!market['swap']) {
|
|
7237
7012
|
throw new errors.BadSymbol(this.id + ' fetchFundingHistory() supports swap contracts only');
|
|
7238
7013
|
}
|
|
@@ -7315,20 +7090,16 @@ class bitget extends bitget$1 {
|
|
|
7315
7090
|
result.push(this.parseFundingHistory(contract, market));
|
|
7316
7091
|
}
|
|
7317
7092
|
const sorted = this.sortBy(result, 'timestamp');
|
|
7318
|
-
|
|
7093
|
+
let symbol = undefined;
|
|
7094
|
+
if (market !== undefined) {
|
|
7095
|
+
symbol = market['symbol'];
|
|
7096
|
+
}
|
|
7097
|
+
return this.filterBySymbolSinceLimit(sorted, symbol, since, limit);
|
|
7319
7098
|
}
|
|
7320
7099
|
async modifyMarginHelper(symbol, amount, type, params = {}) {
|
|
7321
7100
|
await this.loadMarkets();
|
|
7322
7101
|
const holdSide = this.safeString(params, 'holdSide');
|
|
7323
|
-
const
|
|
7324
|
-
let market = undefined;
|
|
7325
|
-
if (sandboxMode) {
|
|
7326
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
7327
|
-
market = this.market(sandboxSymbol);
|
|
7328
|
-
}
|
|
7329
|
-
else {
|
|
7330
|
-
market = this.market(symbol);
|
|
7331
|
-
}
|
|
7102
|
+
const market = this.market(symbol);
|
|
7332
7103
|
let productType = undefined;
|
|
7333
7104
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
7334
7105
|
const request = {
|
|
@@ -7427,15 +7198,7 @@ class bitget extends bitget$1 {
|
|
|
7427
7198
|
*/
|
|
7428
7199
|
async fetchLeverage(symbol, params = {}) {
|
|
7429
7200
|
await this.loadMarkets();
|
|
7430
|
-
const
|
|
7431
|
-
let market = undefined;
|
|
7432
|
-
if (sandboxMode) {
|
|
7433
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
7434
|
-
market = this.market(sandboxSymbol);
|
|
7435
|
-
}
|
|
7436
|
-
else {
|
|
7437
|
-
market = this.market(symbol);
|
|
7438
|
-
}
|
|
7201
|
+
const market = this.market(symbol);
|
|
7439
7202
|
let productType = undefined;
|
|
7440
7203
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
7441
7204
|
const request = {
|
|
@@ -7476,12 +7239,15 @@ class bitget extends bitget$1 {
|
|
|
7476
7239
|
return this.parseLeverage(data, market);
|
|
7477
7240
|
}
|
|
7478
7241
|
parseLeverage(leverage, market = undefined) {
|
|
7242
|
+
const isCrossMarginMode = this.safeString(leverage, 'marginMode') === 'crossed';
|
|
7243
|
+
const longLevKey = isCrossMarginMode ? 'crossedMarginLeverage' : 'isolatedLongLever';
|
|
7244
|
+
const shortLevKey = isCrossMarginMode ? 'crossedMarginLeverage' : 'isolatedShortLever';
|
|
7479
7245
|
return {
|
|
7480
7246
|
'info': leverage,
|
|
7481
7247
|
'symbol': market['symbol'],
|
|
7482
|
-
'marginMode': 'isolated',
|
|
7483
|
-
'longLeverage': this.safeInteger(leverage,
|
|
7484
|
-
'shortLeverage': this.safeInteger(leverage,
|
|
7248
|
+
'marginMode': isCrossMarginMode ? 'cross' : 'isolated',
|
|
7249
|
+
'longLeverage': this.safeInteger(leverage, longLevKey),
|
|
7250
|
+
'shortLeverage': this.safeInteger(leverage, shortLevKey),
|
|
7485
7251
|
};
|
|
7486
7252
|
}
|
|
7487
7253
|
/**
|
|
@@ -7500,15 +7266,7 @@ class bitget extends bitget$1 {
|
|
|
7500
7266
|
throw new errors.ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
|
|
7501
7267
|
}
|
|
7502
7268
|
await this.loadMarkets();
|
|
7503
|
-
const
|
|
7504
|
-
let market = undefined;
|
|
7505
|
-
if (sandboxMode) {
|
|
7506
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
7507
|
-
market = this.market(sandboxSymbol);
|
|
7508
|
-
}
|
|
7509
|
-
else {
|
|
7510
|
-
market = this.market(symbol);
|
|
7511
|
-
}
|
|
7269
|
+
const market = this.market(symbol);
|
|
7512
7270
|
let productType = undefined;
|
|
7513
7271
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
7514
7272
|
const request = {
|
|
@@ -7558,15 +7316,7 @@ class bitget extends bitget$1 {
|
|
|
7558
7316
|
throw new errors.ArgumentsRequired(this.id + ' setMarginMode() marginMode must be either isolated or crossed (cross)');
|
|
7559
7317
|
}
|
|
7560
7318
|
await this.loadMarkets();
|
|
7561
|
-
const
|
|
7562
|
-
let market = undefined;
|
|
7563
|
-
if (sandboxMode) {
|
|
7564
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
7565
|
-
market = this.market(sandboxSymbol);
|
|
7566
|
-
}
|
|
7567
|
-
else {
|
|
7568
|
-
market = this.market(symbol);
|
|
7569
|
-
}
|
|
7319
|
+
const market = this.market(symbol);
|
|
7570
7320
|
let productType = undefined;
|
|
7571
7321
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
7572
7322
|
const request = {
|
|
@@ -7608,14 +7358,7 @@ class bitget extends bitget$1 {
|
|
|
7608
7358
|
const posMode = hedged ? 'hedge_mode' : 'one_way_mode';
|
|
7609
7359
|
let market = undefined;
|
|
7610
7360
|
if (symbol !== undefined) {
|
|
7611
|
-
|
|
7612
|
-
if (sandboxMode) {
|
|
7613
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
7614
|
-
market = this.market(sandboxSymbol);
|
|
7615
|
-
}
|
|
7616
|
-
else {
|
|
7617
|
-
market = this.market(symbol);
|
|
7618
|
-
}
|
|
7361
|
+
market = this.market(symbol);
|
|
7619
7362
|
}
|
|
7620
7363
|
let productType = undefined;
|
|
7621
7364
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
@@ -7647,15 +7390,7 @@ class bitget extends bitget$1 {
|
|
|
7647
7390
|
*/
|
|
7648
7391
|
async fetchOpenInterest(symbol, params = {}) {
|
|
7649
7392
|
await this.loadMarkets();
|
|
7650
|
-
const
|
|
7651
|
-
let market = undefined;
|
|
7652
|
-
if (sandboxMode) {
|
|
7653
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
7654
|
-
market = this.market(sandboxSymbol);
|
|
7655
|
-
}
|
|
7656
|
-
else {
|
|
7657
|
-
market = this.market(symbol);
|
|
7658
|
-
}
|
|
7393
|
+
const market = this.market(symbol);
|
|
7659
7394
|
if (!market['contract']) {
|
|
7660
7395
|
throw new errors.BadRequest(this.id + ' fetchOpenInterest() supports contract markets only');
|
|
7661
7396
|
}
|
|
@@ -8681,15 +8416,7 @@ class bitget extends bitget$1 {
|
|
|
8681
8416
|
*/
|
|
8682
8417
|
async closePosition(symbol, side = undefined, params = {}) {
|
|
8683
8418
|
await this.loadMarkets();
|
|
8684
|
-
const
|
|
8685
|
-
let market = undefined;
|
|
8686
|
-
if (sandboxMode) {
|
|
8687
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
8688
|
-
market = this.market(sandboxSymbol);
|
|
8689
|
-
}
|
|
8690
|
-
else {
|
|
8691
|
-
market = this.market(symbol);
|
|
8692
|
-
}
|
|
8419
|
+
const market = this.market(symbol);
|
|
8693
8420
|
let productType = undefined;
|
|
8694
8421
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
8695
8422
|
const request = {
|
|
@@ -8770,15 +8497,7 @@ class bitget extends bitget$1 {
|
|
|
8770
8497
|
*/
|
|
8771
8498
|
async fetchMarginMode(symbol, params = {}) {
|
|
8772
8499
|
await this.loadMarkets();
|
|
8773
|
-
const
|
|
8774
|
-
let market = undefined;
|
|
8775
|
-
if (sandboxMode) {
|
|
8776
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
8777
|
-
market = this.market(sandboxSymbol);
|
|
8778
|
-
}
|
|
8779
|
-
else {
|
|
8780
|
-
market = this.market(symbol);
|
|
8781
|
-
}
|
|
8500
|
+
const market = this.market(symbol);
|
|
8782
8501
|
let productType = undefined;
|
|
8783
8502
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
8784
8503
|
const request = {
|
|
@@ -9180,15 +8899,7 @@ class bitget extends bitget$1 {
|
|
|
9180
8899
|
*/
|
|
9181
8900
|
async fetchFundingInterval(symbol, params = {}) {
|
|
9182
8901
|
await this.loadMarkets();
|
|
9183
|
-
const
|
|
9184
|
-
let market = undefined;
|
|
9185
|
-
if (sandboxMode) {
|
|
9186
|
-
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
9187
|
-
market = this.market(sandboxSymbol);
|
|
9188
|
-
}
|
|
9189
|
-
else {
|
|
9190
|
-
market = this.market(symbol);
|
|
9191
|
-
}
|
|
8902
|
+
const market = this.market(symbol);
|
|
9192
8903
|
let productType = undefined;
|
|
9193
8904
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
9194
8905
|
const request = {
|
|
@@ -9383,13 +9094,16 @@ class bitget extends bitget$1 {
|
|
|
9383
9094
|
headers['Content-Type'] = 'application/json';
|
|
9384
9095
|
}
|
|
9385
9096
|
}
|
|
9386
|
-
const sandboxMode = this.
|
|
9097
|
+
const sandboxMode = this.safeBool2(this.options, 'sandboxMode', 'sandbox', false);
|
|
9387
9098
|
if (sandboxMode && (path !== 'v2/public/time')) {
|
|
9388
9099
|
// https://github.com/ccxt/ccxt/issues/25252#issuecomment-2662742336
|
|
9389
9100
|
if (headers === undefined) {
|
|
9390
9101
|
headers = {};
|
|
9391
9102
|
}
|
|
9392
|
-
|
|
9103
|
+
const productType = this.safeString(params, 'productType');
|
|
9104
|
+
if ((productType !== 'SCOIN-FUTURES') && (productType !== 'SUSDT-FUTURES') && (productType !== 'SUSDC-FUTURES')) {
|
|
9105
|
+
headers['PAPTRADING'] = '1';
|
|
9106
|
+
}
|
|
9393
9107
|
}
|
|
9394
9108
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
9395
9109
|
}
|
package/dist/cjs/src/bitstamp.js
CHANGED
|
@@ -1307,10 +1307,9 @@ class bitstamp extends bitstamp$1 {
|
|
|
1307
1307
|
}
|
|
1308
1308
|
parseTradingFees(fees) {
|
|
1309
1309
|
const result = { 'info': fees };
|
|
1310
|
-
|
|
1311
|
-
for (let i = 0; i < symbols.length; i++) {
|
|
1312
|
-
const symbol = symbols[i];
|
|
1310
|
+
for (let i = 0; i < fees.length; i++) {
|
|
1313
1311
|
const fee = this.parseTradingFee(fees[i]);
|
|
1312
|
+
const symbol = fee['symbol'];
|
|
1314
1313
|
result[symbol] = fee;
|
|
1315
1314
|
}
|
|
1316
1315
|
return result;
|