ccxt 4.2.69 → 4.2.71

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.
@@ -115,7 +115,8 @@ class gate extends gate$1 {
115
115
  'fetchIsolatedBorrowRate': false,
116
116
  'fetchIsolatedBorrowRates': false,
117
117
  'fetchLedger': true,
118
- 'fetchLeverage': false,
118
+ 'fetchLeverage': true,
119
+ 'fetchLeverages': true,
119
120
  'fetchLeverageTiers': true,
120
121
  'fetchLiquidations': true,
121
122
  'fetchMarginMode': false,
@@ -7015,6 +7016,178 @@ class gate extends gate$1 {
7015
7016
  }
7016
7017
  return await this.createOrder(symbol, 'market', side, 0, undefined, params);
7017
7018
  }
7019
+ async fetchLeverage(symbol, params = {}) {
7020
+ /**
7021
+ * @method
7022
+ * @name gate#fetchLeverage
7023
+ * @description fetch the set leverage for a market
7024
+ * @see https://www.gate.io/docs/developers/apiv4/en/#get-unified-account-information
7025
+ * @see https://www.gate.io/docs/developers/apiv4/en/#get-detail-of-lending-market
7026
+ * @see https://www.gate.io/docs/developers/apiv4/en/#query-one-single-margin-currency-pair-deprecated
7027
+ * @param {string} symbol unified market symbol
7028
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
7029
+ * @param {boolean} [params.unified] default false, set to true for fetching the unified accounts leverage
7030
+ * @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
7031
+ */
7032
+ await this.loadMarkets();
7033
+ let market = undefined;
7034
+ if (symbol !== undefined) {
7035
+ // unified account does not require a symbol
7036
+ market = this.market(symbol);
7037
+ }
7038
+ const request = {};
7039
+ let response = undefined;
7040
+ const isUnified = this.safeBool(params, 'unified');
7041
+ params = this.omit(params, 'unified');
7042
+ if (market['spot']) {
7043
+ request['currency_pair'] = market['id'];
7044
+ if (isUnified) {
7045
+ response = await this.publicMarginGetUniCurrencyPairsCurrencyPair(this.extend(request, params));
7046
+ //
7047
+ // {
7048
+ // "currency_pair": "BTC_USDT",
7049
+ // "base_min_borrow_amount": "0.0001",
7050
+ // "quote_min_borrow_amount": "1",
7051
+ // "leverage": "10"
7052
+ // }
7053
+ //
7054
+ }
7055
+ else {
7056
+ response = await this.publicMarginGetCurrencyPairsCurrencyPair(this.extend(request, params));
7057
+ //
7058
+ // {
7059
+ // "id": "BTC_USDT",
7060
+ // "base": "BTC",
7061
+ // "quote": "USDT",
7062
+ // "leverage": 10,
7063
+ // "min_base_amount": "0.0001",
7064
+ // "min_quote_amount": "1",
7065
+ // "max_quote_amount": "40000000",
7066
+ // "status": 1
7067
+ // }
7068
+ //
7069
+ }
7070
+ }
7071
+ else if (isUnified) {
7072
+ response = await this.privateUnifiedGetAccounts(this.extend(request, params));
7073
+ //
7074
+ // {
7075
+ // "user_id": 10001,
7076
+ // "locked": false,
7077
+ // "balances": {
7078
+ // "ETH": {
7079
+ // "available": "0",
7080
+ // "freeze": "0",
7081
+ // "borrowed": "0.075393666654",
7082
+ // "negative_liab": "0",
7083
+ // "futures_pos_liab": "0",
7084
+ // "equity": "1016.1",
7085
+ // "total_freeze": "0",
7086
+ // "total_liab": "0"
7087
+ // },
7088
+ // "POINT": {
7089
+ // "available": "9999999999.017023138734",
7090
+ // "freeze": "0",
7091
+ // "borrowed": "0",
7092
+ // "negative_liab": "0",
7093
+ // "futures_pos_liab": "0",
7094
+ // "equity": "12016.1",
7095
+ // "total_freeze": "0",
7096
+ // "total_liab": "0"
7097
+ // },
7098
+ // "USDT": {
7099
+ // "available": "0.00000062023",
7100
+ // "freeze": "0",
7101
+ // "borrowed": "0",
7102
+ // "negative_liab": "0",
7103
+ // "futures_pos_liab": "0",
7104
+ // "equity": "16.1",
7105
+ // "total_freeze": "0",
7106
+ // "total_liab": "0"
7107
+ // }
7108
+ // },
7109
+ // "total": "230.94621713",
7110
+ // "borrowed": "161.66395521",
7111
+ // "total_initial_margin": "1025.0524665088",
7112
+ // "total_margin_balance": "3382495.944473949183",
7113
+ // "total_maintenance_margin": "205.01049330176",
7114
+ // "total_initial_margin_rate": "3299.827135672679",
7115
+ // "total_maintenance_margin_rate": "16499.135678363399",
7116
+ // "total_available_margin": "3381470.892007440383",
7117
+ // "unified_account_total": "3381470.892007440383",
7118
+ // "unified_account_total_liab": "0",
7119
+ // "unified_account_total_equity": "100016.1",
7120
+ // "leverage": "2"
7121
+ // }
7122
+ //
7123
+ }
7124
+ else {
7125
+ throw new errors.NotSupported(this.id + ' fetchLeverage() does not support ' + market['type'] + ' markets');
7126
+ }
7127
+ return this.parseLeverage(response, market);
7128
+ }
7129
+ async fetchLeverages(symbols = undefined, params = {}) {
7130
+ /**
7131
+ * @method
7132
+ * @name gate#fetchLeverages
7133
+ * @description fetch the set leverage for all leverage markets, only spot margin is supported on gate
7134
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-lending-markets
7135
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-supported-currency-pairs-supported-in-margin-trading-deprecated
7136
+ * @param {string[]} symbols a list of unified market symbols
7137
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
7138
+ * @param {boolean} [params.unified] default false, set to true for fetching unified account leverages
7139
+ * @returns {object} a list of [leverage structures]{@link https://docs.ccxt.com/#/?id=leverage-structure}
7140
+ */
7141
+ await this.loadMarkets();
7142
+ symbols = this.marketSymbols(symbols);
7143
+ let response = undefined;
7144
+ const isUnified = this.safeBool(params, 'unified');
7145
+ params = this.omit(params, 'unified');
7146
+ let marketIdRequest = 'id';
7147
+ if (isUnified) {
7148
+ marketIdRequest = 'currency_pair';
7149
+ response = await this.publicMarginGetUniCurrencyPairs(params);
7150
+ //
7151
+ // [
7152
+ // {
7153
+ // "currency_pair": "1INCH_USDT",
7154
+ // "base_min_borrow_amount": "8",
7155
+ // "quote_min_borrow_amount": "1",
7156
+ // "leverage": "3"
7157
+ // },
7158
+ // ]
7159
+ //
7160
+ }
7161
+ else {
7162
+ response = await this.publicMarginGetCurrencyPairs(params);
7163
+ //
7164
+ // [
7165
+ // {
7166
+ // "id": "1CAT_USDT",
7167
+ // "base": "1CAT",
7168
+ // "quote": "USDT",
7169
+ // "leverage": 3,
7170
+ // "min_base_amount": "71",
7171
+ // "min_quote_amount": "1",
7172
+ // "max_quote_amount": "10000",
7173
+ // "status": 1
7174
+ // },
7175
+ // ]
7176
+ //
7177
+ }
7178
+ return this.parseLeverages(response, symbols, marketIdRequest, 'spot');
7179
+ }
7180
+ parseLeverage(leverage, market = undefined) {
7181
+ const marketId = this.safeString2(leverage, 'currency_pair', 'id');
7182
+ const leverageValue = this.safeInteger(leverage, 'leverage');
7183
+ return {
7184
+ 'info': leverage,
7185
+ 'symbol': this.safeSymbol(marketId, market, '_', 'spot'),
7186
+ 'marginMode': undefined,
7187
+ 'longLeverage': leverageValue,
7188
+ 'shortLeverage': leverageValue,
7189
+ };
7190
+ }
7018
7191
  handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
7019
7192
  if (response === undefined) {
7020
7193
  return undefined;
@@ -23,7 +23,7 @@ class hyperliquid extends hyperliquid$1 {
23
23
  'version': 'v1',
24
24
  'rateLimit': 50,
25
25
  'certified': false,
26
- 'pro': false,
26
+ 'pro': true,
27
27
  'has': {
28
28
  'CORS': undefined,
29
29
  'spot': false,
@@ -1295,6 +1295,7 @@ class kraken extends kraken$1 {
1295
1295
  const lastTrade = trades[length - 1];
1296
1296
  const lastTradeId = this.safeString(result, 'last');
1297
1297
  lastTrade.push(lastTradeId);
1298
+ trades[length - 1] = lastTrade;
1298
1299
  return this.parseTrades(trades, market, since, limit);
1299
1300
  }
1300
1301
  parseBalance(response) {
@@ -41,6 +41,7 @@ class mexc extends mexc$1 {
41
41
  'createMarketSellOrderWithCost': false,
42
42
  'createOrder': true,
43
43
  'createOrders': true,
44
+ 'createPostOnlyOrder': true,
44
45
  'createReduceOnlyOrder': true,
45
46
  'deposit': undefined,
46
47
  'editOrder': undefined,
@@ -2207,6 +2208,14 @@ class mexc extends mexc$1 {
2207
2208
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2208
2209
  * @param {string} [params.marginMode] only 'isolated' is supported for spot-margin trading
2209
2210
  * @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
2211
+ * @param {bool} [params.postOnly] if true, the order will only be posted if it will be a maker order
2212
+ * @param {bool} [params.reduceOnly] *contract only* indicates if this order is to reduce the size of a position
2213
+ *
2214
+ * EXCHANGE SPECIFIC PARAMETERS
2215
+ * @param {int} [params.leverage] *contract only* leverage is necessary on isolated margin
2216
+ * @param {long} [params.positionId] *contract only* it is recommended to fill in this parameter when closing a position
2217
+ * @param {string} [params.externalOid] *contract only* external order ID
2218
+ * @param {int} [params.positionMode] *contract only* 1:hedge, 2:one-way, default: the user's current config
2210
2219
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2211
2220
  */
2212
2221
  await this.loadMarkets();