ccxt 4.2.59 → 4.2.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/build.sh +1 -1
- package/dist/ccxt.browser.js +406 -165
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +10 -12
- package/dist/cjs/src/bingx.js +38 -0
- package/dist/cjs/src/bitfinex2.js +21 -4
- package/dist/cjs/src/bitget.js +9 -2
- package/dist/cjs/src/bitmart.js +41 -23
- package/dist/cjs/src/blofin.js +59 -1
- package/dist/cjs/src/hitbtc.js +1 -1
- package/dist/cjs/src/htx.js +4 -1
- package/dist/cjs/src/kraken.js +42 -39
- package/dist/cjs/src/kucoinfutures.js +1 -0
- package/dist/cjs/src/pro/binance.js +16 -3
- package/dist/cjs/src/wazirx.js +6 -1
- package/dist/cjs/src/woo.js +157 -77
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/blofin.d.ts +1 -0
- package/js/src/abstract/wazirx.d.ts +5 -0
- package/js/src/ascendex.d.ts +2 -2
- package/js/src/ascendex.js +10 -12
- package/js/src/bingx.d.ts +3 -1
- package/js/src/bingx.js +38 -0
- package/js/src/bitfinex2.js +21 -4
- package/js/src/bitget.js +9 -2
- package/js/src/bitmart.d.ts +9 -2
- package/js/src/bitmart.js +41 -23
- package/js/src/blofin.d.ts +2 -1
- package/js/src/blofin.js +59 -1
- package/js/src/hitbtc.js +1 -1
- package/js/src/htx.js +4 -1
- package/js/src/kraken.js +42 -39
- package/js/src/kucoinfutures.js +1 -0
- package/js/src/pro/binance.js +16 -3
- package/js/src/pro/deribit.d.ts +1 -1
- package/js/src/wazirx.js +6 -1
- package/js/src/woo.d.ts +8 -0
- package/js/src/woo.js +157 -77
- package/package.json +1 -1
- package/skip-tests.json +42 -16
package/dist/cjs/ccxt.js
CHANGED
|
@@ -176,7 +176,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
176
176
|
|
|
177
177
|
//-----------------------------------------------------------------------------
|
|
178
178
|
// this is updated by vss.js when building
|
|
179
|
-
const version = '4.2.
|
|
179
|
+
const version = '4.2.60';
|
|
180
180
|
Exchange["default"].ccxtVersion = version;
|
|
181
181
|
const exchanges = {
|
|
182
182
|
'ace': ace,
|
package/dist/cjs/src/ascendex.js
CHANGED
|
@@ -754,11 +754,10 @@ class ascendex extends ascendex$1 {
|
|
|
754
754
|
];
|
|
755
755
|
}
|
|
756
756
|
parseBalance(response) {
|
|
757
|
-
const timestamp = this.milliseconds();
|
|
758
757
|
const result = {
|
|
759
758
|
'info': response,
|
|
760
|
-
'timestamp':
|
|
761
|
-
'datetime':
|
|
759
|
+
'timestamp': undefined,
|
|
760
|
+
'datetime': undefined,
|
|
762
761
|
};
|
|
763
762
|
const balances = this.safeValue(response, 'data', []);
|
|
764
763
|
for (let i = 0; i < balances.length; i++) {
|
|
@@ -772,11 +771,10 @@ class ascendex extends ascendex$1 {
|
|
|
772
771
|
return this.safeBalance(result);
|
|
773
772
|
}
|
|
774
773
|
parseMarginBalance(response) {
|
|
775
|
-
const timestamp = this.milliseconds();
|
|
776
774
|
const result = {
|
|
777
775
|
'info': response,
|
|
778
|
-
'timestamp':
|
|
779
|
-
'datetime':
|
|
776
|
+
'timestamp': undefined,
|
|
777
|
+
'datetime': undefined,
|
|
780
778
|
};
|
|
781
779
|
const balances = this.safeValue(response, 'data', []);
|
|
782
780
|
for (let i = 0; i < balances.length; i++) {
|
|
@@ -793,11 +791,10 @@ class ascendex extends ascendex$1 {
|
|
|
793
791
|
return this.safeBalance(result);
|
|
794
792
|
}
|
|
795
793
|
parseSwapBalance(response) {
|
|
796
|
-
const timestamp = this.milliseconds();
|
|
797
794
|
const result = {
|
|
798
795
|
'info': response,
|
|
799
|
-
'timestamp':
|
|
800
|
-
'datetime':
|
|
796
|
+
'timestamp': undefined,
|
|
797
|
+
'datetime': undefined,
|
|
801
798
|
};
|
|
802
799
|
const data = this.safeValue(response, 'data', {});
|
|
803
800
|
const collaterals = this.safeValue(data, 'collaterals', []);
|
|
@@ -819,6 +816,8 @@ class ascendex extends ascendex$1 {
|
|
|
819
816
|
* @see https://ascendex.github.io/ascendex-pro-api/#margin-account-balance
|
|
820
817
|
* @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#position
|
|
821
818
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
819
|
+
* @param {string} [params.type] wallet type, 'spot', 'margin', or 'swap'
|
|
820
|
+
* @param {string} [params.marginMode] 'cross' or undefined, for spot margin trading, value of 'isolated' is invalid
|
|
822
821
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
823
822
|
*/
|
|
824
823
|
await this.loadMarkets();
|
|
@@ -3181,12 +3180,11 @@ class ascendex extends ascendex$1 {
|
|
|
3181
3180
|
//
|
|
3182
3181
|
const status = this.safeInteger(transfer, 'code');
|
|
3183
3182
|
const currencyCode = this.safeCurrencyCode(undefined, currency);
|
|
3184
|
-
const timestamp = this.milliseconds();
|
|
3185
3183
|
return {
|
|
3186
3184
|
'info': transfer,
|
|
3187
3185
|
'id': undefined,
|
|
3188
|
-
'timestamp':
|
|
3189
|
-
'datetime':
|
|
3186
|
+
'timestamp': undefined,
|
|
3187
|
+
'datetime': undefined,
|
|
3190
3188
|
'currency': currencyCode,
|
|
3191
3189
|
'amount': undefined,
|
|
3192
3190
|
'fromAccount': undefined,
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -59,6 +59,7 @@ class bingx extends bingx$1 {
|
|
|
59
59
|
'fetchFundingRates': true,
|
|
60
60
|
'fetchLeverage': true,
|
|
61
61
|
'fetchLiquidations': false,
|
|
62
|
+
'fetchMarginMode': true,
|
|
62
63
|
'fetchMarkets': true,
|
|
63
64
|
'fetchMarkOHLCV': true,
|
|
64
65
|
'fetchMyLiquidations': true,
|
|
@@ -4166,6 +4167,43 @@ class bingx extends bingx$1 {
|
|
|
4166
4167
|
const data = this.safeDict(response, 'data');
|
|
4167
4168
|
return this.parseOrder(data, market);
|
|
4168
4169
|
}
|
|
4170
|
+
async fetchMarginMode(symbol, params = {}) {
|
|
4171
|
+
/**
|
|
4172
|
+
* @method
|
|
4173
|
+
* @name bingx#fetchMarginMode
|
|
4174
|
+
* @description fetches the margin mode of the trading pair
|
|
4175
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Margin%20Mode
|
|
4176
|
+
* @param {string} symbol unified symbol of the market to fetch the margin mode for
|
|
4177
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4178
|
+
* @returns {object} Struct of MarginMode
|
|
4179
|
+
*/
|
|
4180
|
+
await this.loadMarkets();
|
|
4181
|
+
const market = this.market(symbol);
|
|
4182
|
+
const request = {
|
|
4183
|
+
'symbol': market['id'],
|
|
4184
|
+
};
|
|
4185
|
+
const response = await this.swapV2PrivateGetTradeMarginType(this.extend(request, params));
|
|
4186
|
+
//
|
|
4187
|
+
// {
|
|
4188
|
+
// "code": 0,
|
|
4189
|
+
// "msg": "",
|
|
4190
|
+
// "data": {
|
|
4191
|
+
// "marginType": "CROSSED"
|
|
4192
|
+
// }
|
|
4193
|
+
// }
|
|
4194
|
+
//
|
|
4195
|
+
const data = this.safeDict(response, 'data', {});
|
|
4196
|
+
return this.parseMarginMode(data, market);
|
|
4197
|
+
}
|
|
4198
|
+
parseMarginMode(marginMode, market = undefined) {
|
|
4199
|
+
let marginType = this.safeStringLower(marginMode, 'marginType');
|
|
4200
|
+
marginType = (marginType === 'crossed') ? 'cross' : marginType;
|
|
4201
|
+
return {
|
|
4202
|
+
'info': marginMode,
|
|
4203
|
+
'symbol': market['symbol'],
|
|
4204
|
+
'marginMode': marginType,
|
|
4205
|
+
};
|
|
4206
|
+
}
|
|
4169
4207
|
sign(path, section = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
4170
4208
|
const type = section[0];
|
|
4171
4209
|
const version = section[1];
|
|
@@ -27,8 +27,8 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
27
27
|
'spot': true,
|
|
28
28
|
'margin': true,
|
|
29
29
|
'swap': true,
|
|
30
|
-
'future':
|
|
31
|
-
'option':
|
|
30
|
+
'future': false,
|
|
31
|
+
'option': false,
|
|
32
32
|
'addMargin': false,
|
|
33
33
|
'borrowCrossMargin': false,
|
|
34
34
|
'borrowIsolatedMargin': false,
|
|
@@ -39,6 +39,7 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
39
39
|
'createLimitOrder': true,
|
|
40
40
|
'createMarketOrder': true,
|
|
41
41
|
'createOrder': true,
|
|
42
|
+
'createPostOnlyOrder': true,
|
|
42
43
|
'createReduceOnlyOrder': true,
|
|
43
44
|
'createStopLimitOrder': true,
|
|
44
45
|
'createStopMarketOrder': true,
|
|
@@ -49,8 +50,11 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
49
50
|
'editOrder': true,
|
|
50
51
|
'fetchBalance': true,
|
|
51
52
|
'fetchBorrowInterest': false,
|
|
52
|
-
'
|
|
53
|
+
'fetchBorrowRate': false,
|
|
53
54
|
'fetchBorrowRateHistory': false,
|
|
55
|
+
'fetchBorrowRateHistories': false,
|
|
56
|
+
'fetchBorrowRates': false,
|
|
57
|
+
'fetchBorrowRatesPerSymbol': false,
|
|
54
58
|
'fetchClosedOrder': true,
|
|
55
59
|
'fetchClosedOrders': true,
|
|
56
60
|
'fetchCrossBorrowRate': false,
|
|
@@ -79,6 +83,8 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
79
83
|
'fetchOpenOrder': true,
|
|
80
84
|
'fetchOpenOrders': true,
|
|
81
85
|
'fetchOrder': true,
|
|
86
|
+
'fetchOrderBook': true,
|
|
87
|
+
'fetchOrderBooks': false,
|
|
82
88
|
'fetchOrderTrades': true,
|
|
83
89
|
'fetchPosition': false,
|
|
84
90
|
'fetchPositionMode': false,
|
|
@@ -98,6 +104,8 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
98
104
|
'setMargin': true,
|
|
99
105
|
'setMarginMode': false,
|
|
100
106
|
'setPositionMode': false,
|
|
107
|
+
'signIn': false,
|
|
108
|
+
'transfer': true,
|
|
101
109
|
'withdraw': true,
|
|
102
110
|
},
|
|
103
111
|
'timeframes': {
|
|
@@ -1530,7 +1538,16 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
1530
1538
|
* @param {float} amount how much you want to trade in units of the base currency
|
|
1531
1539
|
* @param {float} [price] the price of the order, in units of the quote currency, ignored in market orders
|
|
1532
1540
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1533
|
-
* @
|
|
1541
|
+
* @param {float} [params.stopPrice] The price at which a trigger order is triggered at
|
|
1542
|
+
* @param {string} [params.timeInForce] "GTC", "IOC", "FOK", or "PO"
|
|
1543
|
+
* @param {bool} [params.postOnly]
|
|
1544
|
+
* @param {bool} [params.reduceOnly] Ensures that the executed order does not flip the opened position.
|
|
1545
|
+
* @param {int} [params.flags] additional order parameters: 4096 (Post Only), 1024 (Reduce Only), 16384 (OCO), 64 (Hidden), 512 (Close), 524288 (No Var Rates)
|
|
1546
|
+
* @param {int} [params.lev] leverage for a derivative order, supported by derivative symbol orders only. The value should be between 1 and 100 inclusive.
|
|
1547
|
+
* @param {string} [params.price_traling] The trailing price for a trailing stop order
|
|
1548
|
+
* @param {string} [params.price_aux_limit] Order price for stop limit orders
|
|
1549
|
+
* @param {string} [params.price_oco_stop] OCO stop price
|
|
1550
|
+
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
1534
1551
|
*/
|
|
1535
1552
|
const market = this.market(symbol);
|
|
1536
1553
|
let amountString = this.amountToPrecision(symbol, amount);
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -2928,8 +2928,15 @@ class bitget extends bitget$1 {
|
|
|
2928
2928
|
const currencyCode = this.safeCurrencyCode(this.safeString(feeStructure, 'feeCoin'));
|
|
2929
2929
|
fee = {
|
|
2930
2930
|
'currency': currencyCode,
|
|
2931
|
-
'cost': Precise["default"].stringAbs(this.safeString(feeStructure, 'totalFee')),
|
|
2932
2931
|
};
|
|
2932
|
+
const feeCostString = this.safeString(feeStructure, 'totalFee');
|
|
2933
|
+
const deduction = this.safeString(feeStructure, 'deduction') === 'yes' ? true : false;
|
|
2934
|
+
if (deduction) {
|
|
2935
|
+
fee['cost'] = feeCostString;
|
|
2936
|
+
}
|
|
2937
|
+
else {
|
|
2938
|
+
fee['cost'] = Precise["default"].stringNeg(feeCostString);
|
|
2939
|
+
}
|
|
2933
2940
|
}
|
|
2934
2941
|
return this.safeTrade({
|
|
2935
2942
|
'info': trade,
|
|
@@ -4028,7 +4035,7 @@ class bitget extends bitget$1 {
|
|
|
4028
4035
|
* @see https://www.bitget.com/api-doc/margin/isolated/trade/Isolated-Place-Order
|
|
4029
4036
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
4030
4037
|
* @param {string} type 'market' or 'limit'
|
|
4031
|
-
* @param {string} side 'buy' or 'sell'
|
|
4038
|
+
* @param {string} side 'buy' or 'sell'
|
|
4032
4039
|
* @param {float} amount how much you want to trade in units of the base currency
|
|
4033
4040
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
4034
4041
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -512,6 +512,7 @@ class bitmart extends bitmart$1 {
|
|
|
512
512
|
},
|
|
513
513
|
'networks': {
|
|
514
514
|
'ERC20': 'ERC20',
|
|
515
|
+
'SOL': 'SOL',
|
|
515
516
|
'BTC': 'BTC',
|
|
516
517
|
'TRC20': 'TRC20',
|
|
517
518
|
// todo: should be TRX after unification
|
|
@@ -534,7 +535,6 @@ class bitmart extends bitmart$1 {
|
|
|
534
535
|
'FIO': 'FIO',
|
|
535
536
|
'SCRT': 'SCRT',
|
|
536
537
|
'IOTX': 'IOTX',
|
|
537
|
-
'SOL': 'SOL',
|
|
538
538
|
'ALGO': 'ALGO',
|
|
539
539
|
'ATOM': 'ATOM',
|
|
540
540
|
'DOT': 'DOT',
|
|
@@ -3087,6 +3087,7 @@ class bitmart extends bitmart$1 {
|
|
|
3087
3087
|
* @method
|
|
3088
3088
|
* @name bitmart#fetchDepositAddress
|
|
3089
3089
|
* @description fetch the deposit address for a currency associated with this account
|
|
3090
|
+
* @see https://developer-pro.bitmart.com/en/spot/#deposit-address-keyed
|
|
3090
3091
|
* @param {string} code unified currency code
|
|
3091
3092
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3092
3093
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -3109,40 +3110,57 @@ class bitmart extends bitmart$1 {
|
|
|
3109
3110
|
}
|
|
3110
3111
|
const response = await this.privateGetAccountV1DepositAddress(this.extend(request, params));
|
|
3111
3112
|
//
|
|
3112
|
-
//
|
|
3113
|
-
//
|
|
3114
|
-
//
|
|
3115
|
-
//
|
|
3116
|
-
//
|
|
3117
|
-
//
|
|
3118
|
-
//
|
|
3119
|
-
//
|
|
3120
|
-
//
|
|
3121
|
-
//
|
|
3122
|
-
//
|
|
3113
|
+
// {
|
|
3114
|
+
// "message": "OK",
|
|
3115
|
+
// "code": 1000,
|
|
3116
|
+
// "trace": "0e6edd79-f77f-4251-abe5-83ba75d06c1a",
|
|
3117
|
+
// "data": {
|
|
3118
|
+
// currency: 'ETH',
|
|
3119
|
+
// chain: 'Ethereum',
|
|
3120
|
+
// address: '0x99B5EEc2C520f86F0F62F05820d28D05D36EccCf',
|
|
3121
|
+
// address_memo: ''
|
|
3122
|
+
// }
|
|
3123
|
+
// }
|
|
3123
3124
|
//
|
|
3124
3125
|
const data = this.safeValue(response, 'data', {});
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3126
|
+
return this.parseDepositAddress(data, currency);
|
|
3127
|
+
}
|
|
3128
|
+
parseDepositAddress(depositAddress, currency = undefined) {
|
|
3129
|
+
//
|
|
3130
|
+
// {
|
|
3131
|
+
// currency: 'ETH',
|
|
3132
|
+
// chain: 'Ethereum',
|
|
3133
|
+
// address: '0x99B5EEc2C520f86F0F62F05820d28D05D36EccCf',
|
|
3134
|
+
// address_memo: ''
|
|
3135
|
+
// }
|
|
3136
|
+
//
|
|
3137
|
+
const currencyId = this.safeString(depositAddress, 'currency');
|
|
3138
|
+
const address = this.safeString(depositAddress, 'address');
|
|
3139
|
+
const chain = this.safeString(depositAddress, 'chain');
|
|
3128
3140
|
let network = undefined;
|
|
3141
|
+
currency = this.safeCurrency(currencyId, currency);
|
|
3129
3142
|
if (chain !== undefined) {
|
|
3130
3143
|
const parts = chain.split('-');
|
|
3131
|
-
const
|
|
3132
|
-
|
|
3144
|
+
const partsLength = parts.length;
|
|
3145
|
+
const networkId = this.safeString(parts, partsLength - 1);
|
|
3146
|
+
network = this.safeNetworkCode(networkId, currency);
|
|
3133
3147
|
}
|
|
3134
3148
|
this.checkAddress(address);
|
|
3135
3149
|
return {
|
|
3136
|
-
'
|
|
3150
|
+
'info': depositAddress,
|
|
3151
|
+
'currency': this.safeString(currency, 'code'),
|
|
3137
3152
|
'address': address,
|
|
3138
|
-
'tag':
|
|
3153
|
+
'tag': this.safeString(depositAddress, 'address_memo'),
|
|
3139
3154
|
'network': network,
|
|
3140
|
-
'info': response,
|
|
3141
3155
|
};
|
|
3142
3156
|
}
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3157
|
+
safeNetworkCode(networkId, currency = undefined) {
|
|
3158
|
+
const name = this.safeString(currency, 'name');
|
|
3159
|
+
if (networkId === name) {
|
|
3160
|
+
const code = this.safeString(currency, 'code');
|
|
3161
|
+
return code;
|
|
3162
|
+
}
|
|
3163
|
+
return this.networkIdToCode(networkId);
|
|
3146
3164
|
}
|
|
3147
3165
|
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
3148
3166
|
/**
|
package/dist/cjs/src/blofin.js
CHANGED
|
@@ -80,6 +80,7 @@ class blofin extends blofin$1 {
|
|
|
80
80
|
'fetchLedger': true,
|
|
81
81
|
'fetchLedgerEntry': undefined,
|
|
82
82
|
'fetchLeverage': true,
|
|
83
|
+
'fetchLeverages': true,
|
|
83
84
|
'fetchLeverageTiers': false,
|
|
84
85
|
'fetchMarketLeverageTiers': false,
|
|
85
86
|
'fetchMarkets': true,
|
|
@@ -184,6 +185,7 @@ class blofin extends blofin$1 {
|
|
|
184
185
|
'account/balance': 1,
|
|
185
186
|
'account/positions': 1,
|
|
186
187
|
'account/leverage-info': 1,
|
|
188
|
+
'account/batch-leverage-info': 1,
|
|
187
189
|
'trade/orders-tpsl-pending': 1,
|
|
188
190
|
'trade/orders-history': 1,
|
|
189
191
|
'trade/orders-tpsl-history': 1,
|
|
@@ -1881,12 +1883,68 @@ class blofin extends blofin$1 {
|
|
|
1881
1883
|
'takeProfitPrice': undefined,
|
|
1882
1884
|
});
|
|
1883
1885
|
}
|
|
1886
|
+
async fetchLeverages(symbols = undefined, params = {}) {
|
|
1887
|
+
/**
|
|
1888
|
+
* @method
|
|
1889
|
+
* @name blofin#fetchLeverages
|
|
1890
|
+
* @description fetch the set leverage for all contract markets
|
|
1891
|
+
* @see https://docs.blofin.com/index.html#get-multiple-leverage
|
|
1892
|
+
* @param {string[]} symbols a list of unified market symbols, required on blofin
|
|
1893
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1894
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
1895
|
+
* @returns {object} a list of [leverage structures]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
1896
|
+
*/
|
|
1897
|
+
await this.loadMarkets();
|
|
1898
|
+
if (symbols === undefined) {
|
|
1899
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchLeverages() requires a symbols argument');
|
|
1900
|
+
}
|
|
1901
|
+
let marginMode = undefined;
|
|
1902
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchLeverages', params);
|
|
1903
|
+
if (marginMode === undefined) {
|
|
1904
|
+
marginMode = this.safeString(params, 'marginMode', 'cross'); // cross as default marginMode
|
|
1905
|
+
}
|
|
1906
|
+
if ((marginMode !== 'cross') && (marginMode !== 'isolated')) {
|
|
1907
|
+
throw new errors.BadRequest(this.id + ' fetchLeverages() requires a marginMode parameter that must be either cross or isolated');
|
|
1908
|
+
}
|
|
1909
|
+
symbols = this.marketSymbols(symbols);
|
|
1910
|
+
let instIds = '';
|
|
1911
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
1912
|
+
const entry = symbols[i];
|
|
1913
|
+
const entryMarket = this.market(entry);
|
|
1914
|
+
if (i > 0) {
|
|
1915
|
+
instIds = instIds + ',' + entryMarket['id'];
|
|
1916
|
+
}
|
|
1917
|
+
else {
|
|
1918
|
+
instIds = instIds + entryMarket['id'];
|
|
1919
|
+
}
|
|
1920
|
+
}
|
|
1921
|
+
const request = {
|
|
1922
|
+
'instId': instIds,
|
|
1923
|
+
'marginMode': marginMode,
|
|
1924
|
+
};
|
|
1925
|
+
const response = await this.privateGetAccountBatchLeverageInfo(this.extend(request, params));
|
|
1926
|
+
//
|
|
1927
|
+
// {
|
|
1928
|
+
// "code": "0",
|
|
1929
|
+
// "msg": "success",
|
|
1930
|
+
// "data": [
|
|
1931
|
+
// {
|
|
1932
|
+
// "leverage": "3",
|
|
1933
|
+
// "marginMode": "cross",
|
|
1934
|
+
// "instId": "BTC-USDT"
|
|
1935
|
+
// },
|
|
1936
|
+
// ]
|
|
1937
|
+
// }
|
|
1938
|
+
//
|
|
1939
|
+
const leverages = this.safeList(response, 'data', []);
|
|
1940
|
+
return this.parseLeverages(leverages, symbols, 'instId');
|
|
1941
|
+
}
|
|
1884
1942
|
async fetchLeverage(symbol, params = {}) {
|
|
1885
1943
|
/**
|
|
1886
1944
|
* @method
|
|
1887
1945
|
* @name blofin#fetchLeverage
|
|
1888
1946
|
* @description fetch the set leverage for a market
|
|
1889
|
-
* @see https://blofin.com/
|
|
1947
|
+
* @see https://docs.blofin.com/index.html#get-leverage
|
|
1890
1948
|
* @param {string} symbol unified market symbol
|
|
1891
1949
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1892
1950
|
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
package/dist/cjs/src/hitbtc.js
CHANGED
|
@@ -2699,7 +2699,7 @@ class hitbtc extends hitbtc$1 {
|
|
|
2699
2699
|
if ((network !== undefined) && (code === 'USDT')) {
|
|
2700
2700
|
const parsedNetwork = this.safeString(networks, network);
|
|
2701
2701
|
if (parsedNetwork !== undefined) {
|
|
2702
|
-
request['
|
|
2702
|
+
request['network_code'] = parsedNetwork;
|
|
2703
2703
|
}
|
|
2704
2704
|
params = this.omit(params, 'network');
|
|
2705
2705
|
}
|
package/dist/cjs/src/htx.js
CHANGED
|
@@ -2591,7 +2591,10 @@ class htx extends htx$1 {
|
|
|
2591
2591
|
amountString = this.safeString(trade, 'trade_volume', amountString);
|
|
2592
2592
|
const costString = this.safeString(trade, 'trade_turnover');
|
|
2593
2593
|
let fee = undefined;
|
|
2594
|
-
let feeCost = this.
|
|
2594
|
+
let feeCost = this.safeString(trade, 'filled-fees');
|
|
2595
|
+
if (feeCost === undefined) {
|
|
2596
|
+
feeCost = Precise["default"].stringNeg(this.safeString(trade, 'trade_fee'));
|
|
2597
|
+
}
|
|
2595
2598
|
const feeCurrencyId = this.safeString2(trade, 'fee-currency', 'fee_asset');
|
|
2596
2599
|
let feeCurrency = this.safeCurrencyCode(feeCurrencyId);
|
|
2597
2600
|
const filledPoints = this.safeString(trade, 'filled-points');
|
package/dist/cjs/src/kraken.js
CHANGED
|
@@ -21,7 +21,10 @@ class kraken extends kraken$1 {
|
|
|
21
21
|
'name': 'Kraken',
|
|
22
22
|
'countries': ['US'],
|
|
23
23
|
'version': '0',
|
|
24
|
-
|
|
24
|
+
// rate-limits: https://support.kraken.com/hc/en-us/articles/206548367-What-are-the-API-rate-limits-#1
|
|
25
|
+
// for public: 1 req/s
|
|
26
|
+
// for private: every second 0.33 weight added to your allowed capacity (some private endpoints need 1 weight, some need 2)
|
|
27
|
+
'rateLimit': 1000,
|
|
25
28
|
'certified': false,
|
|
26
29
|
'pro': true,
|
|
27
30
|
'has': {
|
|
@@ -151,7 +154,7 @@ class kraken extends kraken$1 {
|
|
|
151
154
|
},
|
|
152
155
|
'public': {
|
|
153
156
|
'get': {
|
|
154
|
-
//
|
|
157
|
+
// rate-limits explained in comment in the top of this file
|
|
155
158
|
'Assets': 1,
|
|
156
159
|
'AssetPairs': 1,
|
|
157
160
|
'Depth': 1,
|
|
@@ -167,48 +170,48 @@ class kraken extends kraken$1 {
|
|
|
167
170
|
'post': {
|
|
168
171
|
'AddOrder': 0,
|
|
169
172
|
'AddOrderBatch': 0,
|
|
170
|
-
'AddExport':
|
|
171
|
-
'Balance':
|
|
172
|
-
'CancelAll':
|
|
173
|
-
'CancelAllOrdersAfter':
|
|
173
|
+
'AddExport': 3,
|
|
174
|
+
'Balance': 3,
|
|
175
|
+
'CancelAll': 3,
|
|
176
|
+
'CancelAllOrdersAfter': 3,
|
|
174
177
|
'CancelOrder': 0,
|
|
175
178
|
'CancelOrderBatch': 0,
|
|
176
|
-
'ClosedOrders':
|
|
177
|
-
'DepositAddresses':
|
|
178
|
-
'DepositMethods':
|
|
179
|
-
'DepositStatus':
|
|
179
|
+
'ClosedOrders': 3,
|
|
180
|
+
'DepositAddresses': 3,
|
|
181
|
+
'DepositMethods': 3,
|
|
182
|
+
'DepositStatus': 3,
|
|
180
183
|
'EditOrder': 0,
|
|
181
|
-
'ExportStatus':
|
|
182
|
-
'GetWebSocketsToken':
|
|
183
|
-
'Ledgers':
|
|
184
|
-
'OpenOrders':
|
|
185
|
-
'OpenPositions':
|
|
186
|
-
'QueryLedgers':
|
|
187
|
-
'QueryOrders':
|
|
188
|
-
'QueryTrades':
|
|
189
|
-
'RetrieveExport':
|
|
190
|
-
'RemoveExport':
|
|
191
|
-
'BalanceEx':
|
|
192
|
-
'TradeBalance':
|
|
193
|
-
'TradesHistory':
|
|
194
|
-
'TradeVolume':
|
|
195
|
-
'Withdraw':
|
|
196
|
-
'WithdrawCancel':
|
|
197
|
-
'WithdrawInfo':
|
|
198
|
-
'WithdrawMethods':
|
|
199
|
-
'WithdrawAddresses':
|
|
200
|
-
'WithdrawStatus':
|
|
201
|
-
'WalletTransfer':
|
|
184
|
+
'ExportStatus': 3,
|
|
185
|
+
'GetWebSocketsToken': 3,
|
|
186
|
+
'Ledgers': 6,
|
|
187
|
+
'OpenOrders': 3,
|
|
188
|
+
'OpenPositions': 3,
|
|
189
|
+
'QueryLedgers': 3,
|
|
190
|
+
'QueryOrders': 3,
|
|
191
|
+
'QueryTrades': 3,
|
|
192
|
+
'RetrieveExport': 3,
|
|
193
|
+
'RemoveExport': 3,
|
|
194
|
+
'BalanceEx': 3,
|
|
195
|
+
'TradeBalance': 3,
|
|
196
|
+
'TradesHistory': 6,
|
|
197
|
+
'TradeVolume': 3,
|
|
198
|
+
'Withdraw': 3,
|
|
199
|
+
'WithdrawCancel': 3,
|
|
200
|
+
'WithdrawInfo': 3,
|
|
201
|
+
'WithdrawMethods': 3,
|
|
202
|
+
'WithdrawAddresses': 3,
|
|
203
|
+
'WithdrawStatus': 3,
|
|
204
|
+
'WalletTransfer': 3,
|
|
202
205
|
// sub accounts
|
|
203
|
-
'CreateSubaccount':
|
|
204
|
-
'AccountTransfer':
|
|
206
|
+
'CreateSubaccount': 3,
|
|
207
|
+
'AccountTransfer': 3,
|
|
205
208
|
// earn
|
|
206
|
-
'Earn/Allocate':
|
|
207
|
-
'Earn/Deallocate':
|
|
208
|
-
'Earn/AllocateStatus':
|
|
209
|
-
'Earn/DeallocateStatus':
|
|
210
|
-
'Earn/Strategies':
|
|
211
|
-
'Earn/Allocations':
|
|
209
|
+
'Earn/Allocate': 3,
|
|
210
|
+
'Earn/Deallocate': 3,
|
|
211
|
+
'Earn/AllocateStatus': 3,
|
|
212
|
+
'Earn/DeallocateStatus': 3,
|
|
213
|
+
'Earn/Strategies': 3,
|
|
214
|
+
'Earn/Allocations': 3,
|
|
212
215
|
},
|
|
213
216
|
},
|
|
214
217
|
},
|
|
@@ -2599,8 +2599,21 @@ class binance extends binance$1 {
|
|
|
2599
2599
|
// }
|
|
2600
2600
|
//
|
|
2601
2601
|
const marketId = this.safeString(position, 's');
|
|
2602
|
-
const
|
|
2603
|
-
const
|
|
2602
|
+
const contracts = this.safeString(position, 'pa');
|
|
2603
|
+
const contractsAbs = Precise["default"].stringAbs(this.safeString(position, 'pa'));
|
|
2604
|
+
let positionSide = this.safeStringLower(position, 'ps');
|
|
2605
|
+
let hedged = true;
|
|
2606
|
+
if (positionSide === 'both') {
|
|
2607
|
+
hedged = false;
|
|
2608
|
+
if (!Precise["default"].stringEq(contracts, '0')) {
|
|
2609
|
+
if (Precise["default"].stringLt(contracts, '0')) {
|
|
2610
|
+
positionSide = 'short';
|
|
2611
|
+
}
|
|
2612
|
+
else {
|
|
2613
|
+
positionSide = 'long';
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2604
2617
|
return this.safePosition({
|
|
2605
2618
|
'info': position,
|
|
2606
2619
|
'id': undefined,
|
|
@@ -2611,7 +2624,7 @@ class binance extends binance$1 {
|
|
|
2611
2624
|
'entryPrice': this.safeNumber(position, 'ep'),
|
|
2612
2625
|
'unrealizedPnl': this.safeNumber(position, 'up'),
|
|
2613
2626
|
'percentage': undefined,
|
|
2614
|
-
'contracts': this.
|
|
2627
|
+
'contracts': this.parseNumber(contractsAbs),
|
|
2615
2628
|
'contractSize': undefined,
|
|
2616
2629
|
'markPrice': undefined,
|
|
2617
2630
|
'side': positionSide,
|
package/dist/cjs/src/wazirx.js
CHANGED
|
@@ -110,7 +110,7 @@ class wazirx extends wazirx$1 {
|
|
|
110
110
|
'public': {
|
|
111
111
|
'get': {
|
|
112
112
|
'exchangeInfo': 1,
|
|
113
|
-
'depth':
|
|
113
|
+
'depth': 0.5,
|
|
114
114
|
'ping': 1,
|
|
115
115
|
'systemStatus': 1,
|
|
116
116
|
'tickers/24hr': 1,
|
|
@@ -129,6 +129,11 @@ class wazirx extends wazirx$1 {
|
|
|
129
129
|
'openOrders': 1,
|
|
130
130
|
'order': 0.5,
|
|
131
131
|
'myTrades': 0.5,
|
|
132
|
+
'coins': 12,
|
|
133
|
+
'crypto/withdraws': 12,
|
|
134
|
+
'crypto/deposits/address': 60,
|
|
135
|
+
'sub_account/fund_transfer/history': 1,
|
|
136
|
+
'sub_account/accounts': 1,
|
|
132
137
|
},
|
|
133
138
|
'post': {
|
|
134
139
|
'order': 0.1,
|