ccxt 4.3.1 → 4.3.2
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 +6 -5
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +3 -0
- package/dist/cjs/src/bitget.js +5 -3
- package/dist/cjs/src/coinbase.js +2 -1
- package/dist/cjs/src/coinbasepro.js +1 -1
- package/dist/cjs/src/coinex.js +109 -146
- package/dist/cjs/src/cryptocom.js +5 -5
- package/dist/cjs/src/hyperliquid.js +74 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +2 -1
- package/js/src/base/Exchange.js +3 -0
- package/js/src/base/types.d.ts +5 -0
- package/js/src/bitget.js +5 -3
- package/js/src/coinbase.js +2 -1
- package/js/src/coinbasepro.d.ts +1 -1
- package/js/src/coinbasepro.js +1 -1
- package/js/src/coinex.js +109 -146
- package/js/src/cryptocom.js +5 -5
- package/js/src/hyperliquid.d.ts +2 -1
- package/js/src/hyperliquid.js +75 -1
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/package.json +1 -1
package/js/src/hyperliquid.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
import Exchange from './abstract/hyperliquid.js';
|
|
9
|
-
import { ExchangeError, ArgumentsRequired, NotSupported, InvalidOrder, OrderNotFound } from './base/errors.js';
|
|
9
|
+
import { ExchangeError, ArgumentsRequired, NotSupported, InvalidOrder, OrderNotFound, BadRequest } from './base/errors.js';
|
|
10
10
|
import { Precise } from './base/Precise.js';
|
|
11
11
|
import { TICK_SIZE, ROUND, SIGNIFICANT_DIGITS, DECIMAL_PLACES } from './base/functions/number.js';
|
|
12
12
|
import { keccak_256 as keccak } from './static_dependencies/noble-hashes/sha3.js';
|
|
@@ -40,6 +40,7 @@ export default class hyperliquid extends Exchange {
|
|
|
40
40
|
'cancelAllOrders': false,
|
|
41
41
|
'cancelOrder': true,
|
|
42
42
|
'cancelOrders': true,
|
|
43
|
+
'cancelOrdersForSymbols': true,
|
|
43
44
|
'closeAllPositions': false,
|
|
44
45
|
'closePosition': false,
|
|
45
46
|
'createMarketBuyOrderWithCost': false,
|
|
@@ -1222,6 +1223,79 @@ export default class hyperliquid extends Exchange {
|
|
|
1222
1223
|
//
|
|
1223
1224
|
return response;
|
|
1224
1225
|
}
|
|
1226
|
+
async cancelOrdersForSymbols(orders, params = {}) {
|
|
1227
|
+
/**
|
|
1228
|
+
* @method
|
|
1229
|
+
* @name hyperliquid#cancelOrdersForSymbols
|
|
1230
|
+
* @description cancel multiple orders for multiple symbols
|
|
1231
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
|
|
1232
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
|
|
1233
|
+
* @param {CancellationRequest[]} orders each order should contain the parameters required by cancelOrder namely id and symbol
|
|
1234
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1235
|
+
* @param {string} [params.vaultAddress] the vault address
|
|
1236
|
+
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1237
|
+
*/
|
|
1238
|
+
this.checkRequiredCredentials();
|
|
1239
|
+
await this.loadMarkets();
|
|
1240
|
+
const nonce = this.milliseconds();
|
|
1241
|
+
const request = {
|
|
1242
|
+
'nonce': nonce,
|
|
1243
|
+
// 'vaultAddress': vaultAddress,
|
|
1244
|
+
};
|
|
1245
|
+
const cancelReq = [];
|
|
1246
|
+
const cancelAction = {
|
|
1247
|
+
'type': '',
|
|
1248
|
+
'cancels': [],
|
|
1249
|
+
};
|
|
1250
|
+
let cancelByCloid = false;
|
|
1251
|
+
for (let i = 0; i < orders.length; i++) {
|
|
1252
|
+
const order = orders[i];
|
|
1253
|
+
const clientOrderId = this.safeString(order, 'clientOrderId');
|
|
1254
|
+
if (clientOrderId !== undefined) {
|
|
1255
|
+
cancelByCloid = true;
|
|
1256
|
+
}
|
|
1257
|
+
const id = this.safeString(order, 'id');
|
|
1258
|
+
const symbol = this.safeString(order, 'symbol');
|
|
1259
|
+
if (symbol === undefined) {
|
|
1260
|
+
throw new ArgumentsRequired(this.id + ' cancelOrdersForSymbols() requires a symbol argument in each order');
|
|
1261
|
+
}
|
|
1262
|
+
if (id !== undefined && cancelByCloid) {
|
|
1263
|
+
throw new BadRequest(this.id + ' cancelOrdersForSymbols() all orders must have either id or clientOrderId');
|
|
1264
|
+
}
|
|
1265
|
+
const assetKey = cancelByCloid ? 'asset' : 'a';
|
|
1266
|
+
const idKey = cancelByCloid ? 'cloid' : 'o';
|
|
1267
|
+
const market = this.market(symbol);
|
|
1268
|
+
const cancelObj = {};
|
|
1269
|
+
cancelObj[assetKey] = this.parseToNumeric(market['baseId']);
|
|
1270
|
+
cancelObj[idKey] = cancelByCloid ? clientOrderId : this.parseToNumeric(id);
|
|
1271
|
+
cancelReq.push(cancelObj);
|
|
1272
|
+
}
|
|
1273
|
+
cancelAction['type'] = cancelByCloid ? 'cancelByCloid' : 'cancel';
|
|
1274
|
+
cancelAction['cancels'] = cancelReq;
|
|
1275
|
+
const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
|
|
1276
|
+
const signature = this.signL1Action(cancelAction, nonce, vaultAddress);
|
|
1277
|
+
request['action'] = cancelAction;
|
|
1278
|
+
request['signature'] = signature;
|
|
1279
|
+
if (vaultAddress !== undefined) {
|
|
1280
|
+
params = this.omit(params, 'vaultAddress');
|
|
1281
|
+
request['vaultAddress'] = vaultAddress;
|
|
1282
|
+
}
|
|
1283
|
+
const response = await this.privatePostExchange(this.extend(request, params));
|
|
1284
|
+
//
|
|
1285
|
+
// {
|
|
1286
|
+
// "status":"ok",
|
|
1287
|
+
// "response":{
|
|
1288
|
+
// "type":"cancel",
|
|
1289
|
+
// "data":{
|
|
1290
|
+
// "statuses":[
|
|
1291
|
+
// "success"
|
|
1292
|
+
// ]
|
|
1293
|
+
// }
|
|
1294
|
+
// }
|
|
1295
|
+
// }
|
|
1296
|
+
//
|
|
1297
|
+
return response;
|
|
1298
|
+
}
|
|
1225
1299
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
1226
1300
|
/**
|
|
1227
1301
|
* @method
|
|
@@ -15,7 +15,7 @@ export declare class BigInteger {
|
|
|
15
15
|
protected intValue(): number;
|
|
16
16
|
protected byteValue(): number;
|
|
17
17
|
protected shortValue(): number;
|
|
18
|
-
protected signum():
|
|
18
|
+
protected signum(): 0 | 1 | -1;
|
|
19
19
|
toByteArray(): number[];
|
|
20
20
|
protected equals(a: BigInteger): boolean;
|
|
21
21
|
protected min(a: BigInteger): BigInteger;
|
package/package.json
CHANGED