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.
- package/README.md +4 -4
- package/build.sh +1 -1
- package/dist/ccxt.browser.js +991 -211
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +3 -1
- package/dist/cjs/src/base/Exchange.js +32 -30
- package/dist/cjs/src/bitget.js +14 -6
- package/dist/cjs/src/coinbase.js +108 -89
- package/dist/cjs/src/digifinex.js +2 -1
- package/dist/cjs/src/gate.js +174 -1
- package/dist/cjs/src/hyperliquid.js +1 -1
- package/dist/cjs/src/kraken.js +1 -0
- package/dist/cjs/src/mexc.js +9 -0
- package/dist/cjs/src/pro/hyperliquid.js +556 -0
- package/js/ccxt.d.ts +4 -1
- package/js/ccxt.js +3 -1
- package/js/src/abstract/coinbase.d.ts +2 -0
- package/js/src/base/Exchange.d.ts +2 -2
- package/js/src/base/Exchange.js +32 -30
- package/js/src/base/types.d.ts +48 -48
- package/js/src/bitget.js +14 -6
- package/js/src/coinbase.d.ts +1 -1
- package/js/src/coinbase.js +108 -89
- package/js/src/digifinex.js +2 -1
- package/js/src/gate.d.ts +4 -1
- package/js/src/gate.js +174 -1
- package/js/src/hyperliquid.js +1 -1
- package/js/src/kraken.js +1 -0
- package/js/src/mexc.js +9 -0
- package/js/src/pro/hyperliquid.d.ts +23 -0
- package/js/src/pro/hyperliquid.js +557 -0
- package/package.json +1 -1
- package/skip-tests.json +49 -58
package/js/src/gate.js
CHANGED
|
@@ -118,7 +118,8 @@ export default class gate extends Exchange {
|
|
|
118
118
|
'fetchIsolatedBorrowRate': false,
|
|
119
119
|
'fetchIsolatedBorrowRates': false,
|
|
120
120
|
'fetchLedger': true,
|
|
121
|
-
'fetchLeverage':
|
|
121
|
+
'fetchLeverage': true,
|
|
122
|
+
'fetchLeverages': true,
|
|
122
123
|
'fetchLeverageTiers': true,
|
|
123
124
|
'fetchLiquidations': true,
|
|
124
125
|
'fetchMarginMode': false,
|
|
@@ -7018,6 +7019,178 @@ export default class gate extends Exchange {
|
|
|
7018
7019
|
}
|
|
7019
7020
|
return await this.createOrder(symbol, 'market', side, 0, undefined, params);
|
|
7020
7021
|
}
|
|
7022
|
+
async fetchLeverage(symbol, params = {}) {
|
|
7023
|
+
/**
|
|
7024
|
+
* @method
|
|
7025
|
+
* @name gate#fetchLeverage
|
|
7026
|
+
* @description fetch the set leverage for a market
|
|
7027
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#get-unified-account-information
|
|
7028
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#get-detail-of-lending-market
|
|
7029
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#query-one-single-margin-currency-pair-deprecated
|
|
7030
|
+
* @param {string} symbol unified market symbol
|
|
7031
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7032
|
+
* @param {boolean} [params.unified] default false, set to true for fetching the unified accounts leverage
|
|
7033
|
+
* @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
7034
|
+
*/
|
|
7035
|
+
await this.loadMarkets();
|
|
7036
|
+
let market = undefined;
|
|
7037
|
+
if (symbol !== undefined) {
|
|
7038
|
+
// unified account does not require a symbol
|
|
7039
|
+
market = this.market(symbol);
|
|
7040
|
+
}
|
|
7041
|
+
const request = {};
|
|
7042
|
+
let response = undefined;
|
|
7043
|
+
const isUnified = this.safeBool(params, 'unified');
|
|
7044
|
+
params = this.omit(params, 'unified');
|
|
7045
|
+
if (market['spot']) {
|
|
7046
|
+
request['currency_pair'] = market['id'];
|
|
7047
|
+
if (isUnified) {
|
|
7048
|
+
response = await this.publicMarginGetUniCurrencyPairsCurrencyPair(this.extend(request, params));
|
|
7049
|
+
//
|
|
7050
|
+
// {
|
|
7051
|
+
// "currency_pair": "BTC_USDT",
|
|
7052
|
+
// "base_min_borrow_amount": "0.0001",
|
|
7053
|
+
// "quote_min_borrow_amount": "1",
|
|
7054
|
+
// "leverage": "10"
|
|
7055
|
+
// }
|
|
7056
|
+
//
|
|
7057
|
+
}
|
|
7058
|
+
else {
|
|
7059
|
+
response = await this.publicMarginGetCurrencyPairsCurrencyPair(this.extend(request, params));
|
|
7060
|
+
//
|
|
7061
|
+
// {
|
|
7062
|
+
// "id": "BTC_USDT",
|
|
7063
|
+
// "base": "BTC",
|
|
7064
|
+
// "quote": "USDT",
|
|
7065
|
+
// "leverage": 10,
|
|
7066
|
+
// "min_base_amount": "0.0001",
|
|
7067
|
+
// "min_quote_amount": "1",
|
|
7068
|
+
// "max_quote_amount": "40000000",
|
|
7069
|
+
// "status": 1
|
|
7070
|
+
// }
|
|
7071
|
+
//
|
|
7072
|
+
}
|
|
7073
|
+
}
|
|
7074
|
+
else if (isUnified) {
|
|
7075
|
+
response = await this.privateUnifiedGetAccounts(this.extend(request, params));
|
|
7076
|
+
//
|
|
7077
|
+
// {
|
|
7078
|
+
// "user_id": 10001,
|
|
7079
|
+
// "locked": false,
|
|
7080
|
+
// "balances": {
|
|
7081
|
+
// "ETH": {
|
|
7082
|
+
// "available": "0",
|
|
7083
|
+
// "freeze": "0",
|
|
7084
|
+
// "borrowed": "0.075393666654",
|
|
7085
|
+
// "negative_liab": "0",
|
|
7086
|
+
// "futures_pos_liab": "0",
|
|
7087
|
+
// "equity": "1016.1",
|
|
7088
|
+
// "total_freeze": "0",
|
|
7089
|
+
// "total_liab": "0"
|
|
7090
|
+
// },
|
|
7091
|
+
// "POINT": {
|
|
7092
|
+
// "available": "9999999999.017023138734",
|
|
7093
|
+
// "freeze": "0",
|
|
7094
|
+
// "borrowed": "0",
|
|
7095
|
+
// "negative_liab": "0",
|
|
7096
|
+
// "futures_pos_liab": "0",
|
|
7097
|
+
// "equity": "12016.1",
|
|
7098
|
+
// "total_freeze": "0",
|
|
7099
|
+
// "total_liab": "0"
|
|
7100
|
+
// },
|
|
7101
|
+
// "USDT": {
|
|
7102
|
+
// "available": "0.00000062023",
|
|
7103
|
+
// "freeze": "0",
|
|
7104
|
+
// "borrowed": "0",
|
|
7105
|
+
// "negative_liab": "0",
|
|
7106
|
+
// "futures_pos_liab": "0",
|
|
7107
|
+
// "equity": "16.1",
|
|
7108
|
+
// "total_freeze": "0",
|
|
7109
|
+
// "total_liab": "0"
|
|
7110
|
+
// }
|
|
7111
|
+
// },
|
|
7112
|
+
// "total": "230.94621713",
|
|
7113
|
+
// "borrowed": "161.66395521",
|
|
7114
|
+
// "total_initial_margin": "1025.0524665088",
|
|
7115
|
+
// "total_margin_balance": "3382495.944473949183",
|
|
7116
|
+
// "total_maintenance_margin": "205.01049330176",
|
|
7117
|
+
// "total_initial_margin_rate": "3299.827135672679",
|
|
7118
|
+
// "total_maintenance_margin_rate": "16499.135678363399",
|
|
7119
|
+
// "total_available_margin": "3381470.892007440383",
|
|
7120
|
+
// "unified_account_total": "3381470.892007440383",
|
|
7121
|
+
// "unified_account_total_liab": "0",
|
|
7122
|
+
// "unified_account_total_equity": "100016.1",
|
|
7123
|
+
// "leverage": "2"
|
|
7124
|
+
// }
|
|
7125
|
+
//
|
|
7126
|
+
}
|
|
7127
|
+
else {
|
|
7128
|
+
throw new NotSupported(this.id + ' fetchLeverage() does not support ' + market['type'] + ' markets');
|
|
7129
|
+
}
|
|
7130
|
+
return this.parseLeverage(response, market);
|
|
7131
|
+
}
|
|
7132
|
+
async fetchLeverages(symbols = undefined, params = {}) {
|
|
7133
|
+
/**
|
|
7134
|
+
* @method
|
|
7135
|
+
* @name gate#fetchLeverages
|
|
7136
|
+
* @description fetch the set leverage for all leverage markets, only spot margin is supported on gate
|
|
7137
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-lending-markets
|
|
7138
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-all-supported-currency-pairs-supported-in-margin-trading-deprecated
|
|
7139
|
+
* @param {string[]} symbols a list of unified market symbols
|
|
7140
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7141
|
+
* @param {boolean} [params.unified] default false, set to true for fetching unified account leverages
|
|
7142
|
+
* @returns {object} a list of [leverage structures]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
7143
|
+
*/
|
|
7144
|
+
await this.loadMarkets();
|
|
7145
|
+
symbols = this.marketSymbols(symbols);
|
|
7146
|
+
let response = undefined;
|
|
7147
|
+
const isUnified = this.safeBool(params, 'unified');
|
|
7148
|
+
params = this.omit(params, 'unified');
|
|
7149
|
+
let marketIdRequest = 'id';
|
|
7150
|
+
if (isUnified) {
|
|
7151
|
+
marketIdRequest = 'currency_pair';
|
|
7152
|
+
response = await this.publicMarginGetUniCurrencyPairs(params);
|
|
7153
|
+
//
|
|
7154
|
+
// [
|
|
7155
|
+
// {
|
|
7156
|
+
// "currency_pair": "1INCH_USDT",
|
|
7157
|
+
// "base_min_borrow_amount": "8",
|
|
7158
|
+
// "quote_min_borrow_amount": "1",
|
|
7159
|
+
// "leverage": "3"
|
|
7160
|
+
// },
|
|
7161
|
+
// ]
|
|
7162
|
+
//
|
|
7163
|
+
}
|
|
7164
|
+
else {
|
|
7165
|
+
response = await this.publicMarginGetCurrencyPairs(params);
|
|
7166
|
+
//
|
|
7167
|
+
// [
|
|
7168
|
+
// {
|
|
7169
|
+
// "id": "1CAT_USDT",
|
|
7170
|
+
// "base": "1CAT",
|
|
7171
|
+
// "quote": "USDT",
|
|
7172
|
+
// "leverage": 3,
|
|
7173
|
+
// "min_base_amount": "71",
|
|
7174
|
+
// "min_quote_amount": "1",
|
|
7175
|
+
// "max_quote_amount": "10000",
|
|
7176
|
+
// "status": 1
|
|
7177
|
+
// },
|
|
7178
|
+
// ]
|
|
7179
|
+
//
|
|
7180
|
+
}
|
|
7181
|
+
return this.parseLeverages(response, symbols, marketIdRequest, 'spot');
|
|
7182
|
+
}
|
|
7183
|
+
parseLeverage(leverage, market = undefined) {
|
|
7184
|
+
const marketId = this.safeString2(leverage, 'currency_pair', 'id');
|
|
7185
|
+
const leverageValue = this.safeInteger(leverage, 'leverage');
|
|
7186
|
+
return {
|
|
7187
|
+
'info': leverage,
|
|
7188
|
+
'symbol': this.safeSymbol(marketId, market, '_', 'spot'),
|
|
7189
|
+
'marginMode': undefined,
|
|
7190
|
+
'longLeverage': leverageValue,
|
|
7191
|
+
'shortLeverage': leverageValue,
|
|
7192
|
+
};
|
|
7193
|
+
}
|
|
7021
7194
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
7022
7195
|
if (response === undefined) {
|
|
7023
7196
|
return undefined;
|
package/js/src/hyperliquid.js
CHANGED
package/js/src/kraken.js
CHANGED
|
@@ -1298,6 +1298,7 @@ export default class kraken extends Exchange {
|
|
|
1298
1298
|
const lastTrade = trades[length - 1];
|
|
1299
1299
|
const lastTradeId = this.safeString(result, 'last');
|
|
1300
1300
|
lastTrade.push(lastTradeId);
|
|
1301
|
+
trades[length - 1] = lastTrade;
|
|
1301
1302
|
return this.parseTrades(trades, market, since, limit);
|
|
1302
1303
|
}
|
|
1303
1304
|
parseBalance(response) {
|
package/js/src/mexc.js
CHANGED
|
@@ -44,6 +44,7 @@ export default class mexc extends Exchange {
|
|
|
44
44
|
'createMarketSellOrderWithCost': false,
|
|
45
45
|
'createOrder': true,
|
|
46
46
|
'createOrders': true,
|
|
47
|
+
'createPostOnlyOrder': true,
|
|
47
48
|
'createReduceOnlyOrder': true,
|
|
48
49
|
'deposit': undefined,
|
|
49
50
|
'editOrder': undefined,
|
|
@@ -2210,6 +2211,14 @@ export default class mexc extends Exchange {
|
|
|
2210
2211
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2211
2212
|
* @param {string} [params.marginMode] only 'isolated' is supported for spot-margin trading
|
|
2212
2213
|
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
2214
|
+
* @param {bool} [params.postOnly] if true, the order will only be posted if it will be a maker order
|
|
2215
|
+
* @param {bool} [params.reduceOnly] *contract only* indicates if this order is to reduce the size of a position
|
|
2216
|
+
*
|
|
2217
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
2218
|
+
* @param {int} [params.leverage] *contract only* leverage is necessary on isolated margin
|
|
2219
|
+
* @param {long} [params.positionId] *contract only* it is recommended to fill in this parameter when closing a position
|
|
2220
|
+
* @param {string} [params.externalOid] *contract only* external order ID
|
|
2221
|
+
* @param {int} [params.positionMode] *contract only* 1:hedge, 2:one-way, default: the user's current config
|
|
2213
2222
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2214
2223
|
*/
|
|
2215
2224
|
await this.loadMarkets();
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import hyperliquidRest from '../hyperliquid.js';
|
|
2
|
+
import Client from '../base/ws/Client.js';
|
|
3
|
+
import { Int, Str, Market, OrderBook, Trade, OHLCV, Order } from '../base/types.js';
|
|
4
|
+
export default class hyperliquid extends hyperliquidRest {
|
|
5
|
+
describe(): any;
|
|
6
|
+
watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
7
|
+
handleOrderBook(client: any, message: any): void;
|
|
8
|
+
watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
9
|
+
handleMyTrades(client: Client, message: any): void;
|
|
10
|
+
watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
11
|
+
handleTrades(client: Client, message: any): void;
|
|
12
|
+
parseWsTrade(trade: any, market?: Market): Trade;
|
|
13
|
+
watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
14
|
+
handleOHLCV(client: Client, message: any): void;
|
|
15
|
+
watchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
16
|
+
handleOrder(client: Client, message: any): void;
|
|
17
|
+
handleErrorMessage(client: Client, message: any): boolean;
|
|
18
|
+
handleMessage(client: Client, message: any): void;
|
|
19
|
+
ping(client: any): {
|
|
20
|
+
method: string;
|
|
21
|
+
};
|
|
22
|
+
handlePong(client: Client, message: any): any;
|
|
23
|
+
}
|