ccxt 4.2.4 → 4.2.5
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/dist/ccxt.browser.js +161 -31
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/alpaca.js +7 -1
- package/dist/cjs/src/bingx.js +17 -18
- package/dist/cjs/src/bybit.js +2 -0
- package/dist/cjs/src/delta.js +2 -2
- package/dist/cjs/src/htx.js +131 -9
- package/dist/cjs/src/phemex.js +2 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bybit.d.ts +2 -0
- package/js/src/alpaca.js +7 -1
- package/js/src/binance.d.ts +1 -1
- package/js/src/bingx.d.ts +1 -1
- package/js/src/bingx.js +17 -18
- package/js/src/bybit.js +2 -0
- package/js/src/delta.js +2 -2
- package/js/src/htx.js +131 -9
- package/js/src/phemex.js +2 -1
- package/package.json +1 -1
- package/skip-tests.json +4 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -169,7 +169,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
169
169
|
|
|
170
170
|
//-----------------------------------------------------------------------------
|
|
171
171
|
// this is updated by vss.js when building
|
|
172
|
-
const version = '4.2.
|
|
172
|
+
const version = '4.2.5';
|
|
173
173
|
Exchange["default"].ccxtVersion = version;
|
|
174
174
|
const exchanges = {
|
|
175
175
|
'ace': ace,
|
package/dist/cjs/src/alpaca.js
CHANGED
|
@@ -349,10 +349,16 @@ class alpaca extends alpaca$1 {
|
|
|
349
349
|
//
|
|
350
350
|
const marketId = this.safeString(asset, 'symbol');
|
|
351
351
|
const parts = marketId.split('/');
|
|
352
|
+
const assetClass = this.safeString(asset, 'class');
|
|
352
353
|
const baseId = this.safeString(parts, 0);
|
|
353
354
|
const quoteId = this.safeString(parts, 1);
|
|
354
355
|
const base = this.safeCurrencyCode(baseId);
|
|
355
|
-
|
|
356
|
+
let quote = this.safeCurrencyCode(quoteId);
|
|
357
|
+
// Us equity markets do not include quote in symbol.
|
|
358
|
+
// We can safely coerce us_equity quote to USD
|
|
359
|
+
if (quote === undefined && assetClass === 'us_equity') {
|
|
360
|
+
quote = 'USD';
|
|
361
|
+
}
|
|
356
362
|
const symbol = base + '/' + quote;
|
|
357
363
|
const status = this.safeString(asset, 'status');
|
|
358
364
|
const active = (status === 'active');
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -1331,18 +1331,11 @@ class bingx extends bingx$1 {
|
|
|
1331
1331
|
const close = this.safeString(ticker, 'lastPrice');
|
|
1332
1332
|
const quoteVolume = this.safeString(ticker, 'quoteVolume');
|
|
1333
1333
|
const baseVolume = this.safeString(ticker, 'volume');
|
|
1334
|
-
let percentage =
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
change = this.safeString(ticker, 'priceChange');
|
|
1340
|
-
}
|
|
1341
|
-
// let percentage = this.safeString (ticker, 'priceChangePercent');
|
|
1342
|
-
// if (percentage !== undefined) {
|
|
1343
|
-
// percentage = percentage.replace ('%', '');
|
|
1344
|
-
// } similarly to change, it's not ccxt's percentage because it does priceChange/open, and priceChange is high-low
|
|
1345
|
-
// const change = this.safeString (ticker, 'priceChange'); // this is not ccxt's change because it does high-low instead of last-open
|
|
1334
|
+
let percentage = this.safeString(ticker, 'priceChangePercent');
|
|
1335
|
+
if (percentage !== undefined) {
|
|
1336
|
+
percentage = percentage.replace('%', '');
|
|
1337
|
+
}
|
|
1338
|
+
const change = this.safeString(ticker, 'priceChange');
|
|
1346
1339
|
const ts = this.safeInteger(ticker, 'closeTime');
|
|
1347
1340
|
const datetime = this.iso8601(ts);
|
|
1348
1341
|
const bid = this.safeString(ticker, 'bidPrice');
|
|
@@ -1671,6 +1664,11 @@ class bingx extends bingx$1 {
|
|
|
1671
1664
|
};
|
|
1672
1665
|
const isMarketOrder = type === 'MARKET';
|
|
1673
1666
|
const isSpot = marketType === 'spot';
|
|
1667
|
+
const exchangeClientOrderId = isSpot ? 'newClientOrderId' : 'clientOrderID';
|
|
1668
|
+
const clientOrderId = this.safeString2(params, exchangeClientOrderId, 'clientOrderId');
|
|
1669
|
+
if (clientOrderId !== undefined) {
|
|
1670
|
+
request[exchangeClientOrderId] = clientOrderId;
|
|
1671
|
+
}
|
|
1674
1672
|
const timeInForce = this.safeStringUpper(params, 'timeInForce');
|
|
1675
1673
|
if (timeInForce === 'IOC') {
|
|
1676
1674
|
request['timeInForce'] = 'IOC';
|
|
@@ -1815,7 +1813,7 @@ class bingx extends bingx$1 {
|
|
|
1815
1813
|
}
|
|
1816
1814
|
request['positionSide'] = positionSide;
|
|
1817
1815
|
request['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, amount));
|
|
1818
|
-
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'takeProfit', 'stopLoss']);
|
|
1816
|
+
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'takeProfit', 'stopLoss', 'clientOrderId']);
|
|
1819
1817
|
}
|
|
1820
1818
|
return this.extend(request, params);
|
|
1821
1819
|
}
|
|
@@ -1832,6 +1830,7 @@ class bingx extends bingx$1 {
|
|
|
1832
1830
|
* @param {float} amount how much you want to trade in units of the base currency
|
|
1833
1831
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1834
1832
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1833
|
+
* @param {string} [params.clientOrderId] a unique id for the order
|
|
1835
1834
|
* @param {bool} [params.postOnly] true to place a post only order
|
|
1836
1835
|
* @param {string} [params.timeInForce] spot supports 'PO' and 'IOC', swap supports 'PO', 'GTC', 'IOC' and 'FOK'
|
|
1837
1836
|
* @param {bool} [params.reduceOnly] *swap only* true or false whether the order is reduce only
|
|
@@ -1896,7 +1895,7 @@ class bingx extends bingx$1 {
|
|
|
1896
1895
|
// }
|
|
1897
1896
|
//
|
|
1898
1897
|
if (typeof response === 'string') {
|
|
1899
|
-
response =
|
|
1898
|
+
response = this.parseJson(response);
|
|
1900
1899
|
}
|
|
1901
1900
|
const data = this.safeValue(response, 'data', {});
|
|
1902
1901
|
const order = this.safeValue(data, 'order', data);
|
|
@@ -2157,7 +2156,7 @@ class bingx extends bingx$1 {
|
|
|
2157
2156
|
'currency': feeCurrencyCode,
|
|
2158
2157
|
'cost': Precise["default"].stringAbs(feeCost),
|
|
2159
2158
|
};
|
|
2160
|
-
const clientOrderId = this.
|
|
2159
|
+
const clientOrderId = this.safeStringN(order, ['clientOrderID', 'origClientOrderId', 'c']);
|
|
2161
2160
|
let stopLoss = this.safeValue(order, 'stopLoss');
|
|
2162
2161
|
let stopLossPrice = undefined;
|
|
2163
2162
|
if (stopLoss !== undefined) {
|
|
@@ -2166,7 +2165,7 @@ class bingx extends bingx$1 {
|
|
|
2166
2165
|
if ((stopLoss !== undefined) && (typeof stopLoss !== 'number')) {
|
|
2167
2166
|
// stopLoss: '{"stopPrice":50,"workingType":"MARK_PRICE","type":"STOP_MARKET","quantity":1}',
|
|
2168
2167
|
if (typeof stopLoss === 'string') {
|
|
2169
|
-
stopLoss =
|
|
2168
|
+
stopLoss = this.parseJson(stopLoss);
|
|
2170
2169
|
}
|
|
2171
2170
|
stopLossPrice = this.safeNumber(stopLoss, 'stopPrice');
|
|
2172
2171
|
}
|
|
@@ -2178,7 +2177,7 @@ class bingx extends bingx$1 {
|
|
|
2178
2177
|
if ((takeProfit !== undefined) && (typeof takeProfit !== 'number')) {
|
|
2179
2178
|
// takeProfit: '{"stopPrice":150,"workingType":"MARK_PRICE","type":"TAKE_PROFIT_MARKET","quantity":1}',
|
|
2180
2179
|
if (typeof takeProfit === 'string') {
|
|
2181
|
-
takeProfit =
|
|
2180
|
+
takeProfit = this.parseJson(takeProfit);
|
|
2182
2181
|
}
|
|
2183
2182
|
takeProfitPrice = this.safeNumber(takeProfit, 'stopPrice');
|
|
2184
2183
|
}
|
|
@@ -2418,7 +2417,7 @@ class bingx extends bingx$1 {
|
|
|
2418
2417
|
}
|
|
2419
2418
|
let response = undefined;
|
|
2420
2419
|
if (market['spot']) {
|
|
2421
|
-
const spotReqKey = areClientOrderIds ? '
|
|
2420
|
+
const spotReqKey = areClientOrderIds ? 'clientOrderIDs' : 'orderIds';
|
|
2422
2421
|
request[spotReqKey] = parsedIds.join(',');
|
|
2423
2422
|
response = await this.spotV1PrivatePostTradeCancelOrders(this.extend(request, params));
|
|
2424
2423
|
}
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -280,6 +280,7 @@ class bybit extends bybit$1 {
|
|
|
280
280
|
'v5/position/list': 5,
|
|
281
281
|
'v5/execution/list': 5,
|
|
282
282
|
'v5/position/closed-pnl': 5,
|
|
283
|
+
'v5/position/move-history': 5,
|
|
283
284
|
// pre-upgrade
|
|
284
285
|
'v5/pre-upgrade/order/history': 5,
|
|
285
286
|
'v5/pre-upgrade/execution/list': 5,
|
|
@@ -444,6 +445,7 @@ class bybit extends bybit$1 {
|
|
|
444
445
|
'v5/position/trading-stop': 5,
|
|
445
446
|
'v5/position/set-auto-add-margin': 5,
|
|
446
447
|
'v5/position/add-margin': 5,
|
|
448
|
+
'v5/position/move-positions': 5,
|
|
447
449
|
'v5/position/confirm-pending-mmr': 5,
|
|
448
450
|
// account
|
|
449
451
|
'v5/account/upgrade-to-uta': 5,
|
package/dist/cjs/src/delta.js
CHANGED
|
@@ -327,14 +327,14 @@ class delta extends delta$1 {
|
|
|
327
327
|
const markets = this.markets_by_id[symbol];
|
|
328
328
|
return markets[0];
|
|
329
329
|
}
|
|
330
|
-
else if ((symbol.
|
|
330
|
+
else if ((symbol.endsWith('-C')) || (symbol.endsWith('-P')) || (symbol.startsWith('C-')) || (symbol.startsWith('P-'))) {
|
|
331
331
|
return this.createExpiredOptionMarket(symbol);
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
334
|
throw new errors.BadSymbol(this.id + ' does not have market symbol ' + symbol);
|
|
335
335
|
}
|
|
336
336
|
safeMarket(marketId = undefined, market = undefined, delimiter = undefined, marketType = undefined) {
|
|
337
|
-
const isOption = (marketId !== undefined) && ((marketId.
|
|
337
|
+
const isOption = (marketId !== undefined) && ((marketId.endsWith('-C')) || (marketId.endsWith('-P')) || (marketId.startsWith('C-')) || (marketId.startsWith('P-')));
|
|
338
338
|
if (isOption && !(marketId in this.markets_by_id)) {
|
|
339
339
|
// handle expired option contracts
|
|
340
340
|
return this.createExpiredOptionMarket(marketId);
|
package/dist/cjs/src/htx.js
CHANGED
|
@@ -3852,8 +3852,9 @@ class htx extends htx$1 {
|
|
|
3852
3852
|
let response = undefined;
|
|
3853
3853
|
const stop = this.safeValue(params, 'stop');
|
|
3854
3854
|
const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
|
|
3855
|
-
|
|
3856
|
-
|
|
3855
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
3856
|
+
params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
|
|
3857
|
+
if (stop || stopLossTakeProfit || trailing) {
|
|
3857
3858
|
if (limit !== undefined) {
|
|
3858
3859
|
request['page_size'] = limit;
|
|
3859
3860
|
}
|
|
@@ -3880,6 +3881,9 @@ class htx extends htx$1 {
|
|
|
3880
3881
|
else if (stopLossTakeProfit) {
|
|
3881
3882
|
response = await this.contractPrivatePostLinearSwapApiV1SwapTpslHisorders(this.extend(request, params));
|
|
3882
3883
|
}
|
|
3884
|
+
else if (trailing) {
|
|
3885
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapTrackHisorders(this.extend(request, params));
|
|
3886
|
+
}
|
|
3883
3887
|
else {
|
|
3884
3888
|
response = await this.contractPrivatePostLinearSwapApiV3SwapHisorders(this.extend(request, params));
|
|
3885
3889
|
}
|
|
@@ -3891,6 +3895,9 @@ class htx extends htx$1 {
|
|
|
3891
3895
|
else if (stopLossTakeProfit) {
|
|
3892
3896
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTpslHisorders(this.extend(request, params));
|
|
3893
3897
|
}
|
|
3898
|
+
else if (trailing) {
|
|
3899
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTrackHisorders(this.extend(request, params));
|
|
3900
|
+
}
|
|
3894
3901
|
else {
|
|
3895
3902
|
response = await this.contractPrivatePostLinearSwapApiV3SwapCrossHisorders(this.extend(request, params));
|
|
3896
3903
|
}
|
|
@@ -3904,6 +3911,9 @@ class htx extends htx$1 {
|
|
|
3904
3911
|
else if (stopLossTakeProfit) {
|
|
3905
3912
|
response = await this.contractPrivatePostSwapApiV1SwapTpslHisorders(this.extend(request, params));
|
|
3906
3913
|
}
|
|
3914
|
+
else if (trailing) {
|
|
3915
|
+
response = await this.contractPrivatePostSwapApiV1SwapTrackHisorders(this.extend(request, params));
|
|
3916
|
+
}
|
|
3907
3917
|
else {
|
|
3908
3918
|
response = await this.contractPrivatePostSwapApiV3SwapHisorders(this.extend(request, params));
|
|
3909
3919
|
}
|
|
@@ -3916,6 +3926,9 @@ class htx extends htx$1 {
|
|
|
3916
3926
|
else if (stopLossTakeProfit) {
|
|
3917
3927
|
response = await this.contractPrivatePostApiV1ContractTpslHisorders(this.extend(request, params));
|
|
3918
3928
|
}
|
|
3929
|
+
else if (trailing) {
|
|
3930
|
+
response = await this.contractPrivatePostApiV1ContractTrackHisorders(this.extend(request, params));
|
|
3931
|
+
}
|
|
3919
3932
|
else {
|
|
3920
3933
|
response = await this.contractPrivatePostApiV3ContractHisorders(this.extend(request, params));
|
|
3921
3934
|
}
|
|
@@ -4093,6 +4106,7 @@ class htx extends htx$1 {
|
|
|
4093
4106
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
4094
4107
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
4095
4108
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4109
|
+
* @param {boolean} [params.trailing] *contract only* set to true if you want to fetch trailing stop orders
|
|
4096
4110
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4097
4111
|
*/
|
|
4098
4112
|
await this.loadMarkets();
|
|
@@ -4165,6 +4179,7 @@ class htx extends htx$1 {
|
|
|
4165
4179
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4166
4180
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
4167
4181
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
4182
|
+
* @param {boolean} [params.trailing] *contract only* set to true if you want to fetch trailing stop orders
|
|
4168
4183
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4169
4184
|
*/
|
|
4170
4185
|
await this.loadMarkets();
|
|
@@ -4212,7 +4227,8 @@ class htx extends htx$1 {
|
|
|
4212
4227
|
request['contract_code'] = market['id'];
|
|
4213
4228
|
const stop = this.safeValue(params, 'stop');
|
|
4214
4229
|
const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
|
|
4215
|
-
|
|
4230
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
4231
|
+
params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
|
|
4216
4232
|
if (market['linear']) {
|
|
4217
4233
|
let marginMode = undefined;
|
|
4218
4234
|
[marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
|
|
@@ -4224,6 +4240,9 @@ class htx extends htx$1 {
|
|
|
4224
4240
|
else if (stopLossTakeProfit) {
|
|
4225
4241
|
response = await this.contractPrivatePostLinearSwapApiV1SwapTpslOpenorders(this.extend(request, params));
|
|
4226
4242
|
}
|
|
4243
|
+
else if (trailing) {
|
|
4244
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapTrackOpenorders(this.extend(request, params));
|
|
4245
|
+
}
|
|
4227
4246
|
else {
|
|
4228
4247
|
response = await this.contractPrivatePostLinearSwapApiV1SwapOpenorders(this.extend(request, params));
|
|
4229
4248
|
}
|
|
@@ -4235,6 +4254,9 @@ class htx extends htx$1 {
|
|
|
4235
4254
|
else if (stopLossTakeProfit) {
|
|
4236
4255
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTpslOpenorders(this.extend(request, params));
|
|
4237
4256
|
}
|
|
4257
|
+
else if (trailing) {
|
|
4258
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTrackOpenorders(this.extend(request, params));
|
|
4259
|
+
}
|
|
4238
4260
|
else {
|
|
4239
4261
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossOpenorders(this.extend(request, params));
|
|
4240
4262
|
}
|
|
@@ -4248,6 +4270,9 @@ class htx extends htx$1 {
|
|
|
4248
4270
|
else if (stopLossTakeProfit) {
|
|
4249
4271
|
response = await this.contractPrivatePostSwapApiV1SwapTpslOpenorders(this.extend(request, params));
|
|
4250
4272
|
}
|
|
4273
|
+
else if (trailing) {
|
|
4274
|
+
response = await this.contractPrivatePostSwapApiV1SwapTrackOpenorders(this.extend(request, params));
|
|
4275
|
+
}
|
|
4251
4276
|
else {
|
|
4252
4277
|
response = await this.contractPrivatePostSwapApiV1SwapOpenorders(this.extend(request, params));
|
|
4253
4278
|
}
|
|
@@ -4260,6 +4285,9 @@ class htx extends htx$1 {
|
|
|
4260
4285
|
else if (stopLossTakeProfit) {
|
|
4261
4286
|
response = await this.contractPrivatePostApiV1ContractTpslOpenorders(this.extend(request, params));
|
|
4262
4287
|
}
|
|
4288
|
+
else if (trailing) {
|
|
4289
|
+
response = await this.contractPrivatePostApiV1ContractTrackOpenorders(this.extend(request, params));
|
|
4290
|
+
}
|
|
4263
4291
|
else {
|
|
4264
4292
|
response = await this.contractPrivatePostApiV1ContractOpenorders(this.extend(request, params));
|
|
4265
4293
|
}
|
|
@@ -4411,6 +4439,45 @@ class htx extends htx$1 {
|
|
|
4411
4439
|
// "ts": 1683179527011
|
|
4412
4440
|
// }
|
|
4413
4441
|
//
|
|
4442
|
+
// trailing
|
|
4443
|
+
//
|
|
4444
|
+
// {
|
|
4445
|
+
// "status": "ok",
|
|
4446
|
+
// "data": {
|
|
4447
|
+
// "orders": [
|
|
4448
|
+
// {
|
|
4449
|
+
// "contract_type": "swap",
|
|
4450
|
+
// "business_type": "swap",
|
|
4451
|
+
// "pair": "BTC-USDT",
|
|
4452
|
+
// "symbol": "BTC",
|
|
4453
|
+
// "contract_code": "BTC-USDT",
|
|
4454
|
+
// "volume": 1.000000000000000000,
|
|
4455
|
+
// "order_type": 1,
|
|
4456
|
+
// "direction": "sell",
|
|
4457
|
+
// "offset": "close",
|
|
4458
|
+
// "lever_rate": 1,
|
|
4459
|
+
// "order_id": 1192021437253877761,
|
|
4460
|
+
// "order_id_str": "1192021437253877761",
|
|
4461
|
+
// "order_source": "api",
|
|
4462
|
+
// "created_at": 1704241657328,
|
|
4463
|
+
// "order_price_type": "formula_price",
|
|
4464
|
+
// "status": 2,
|
|
4465
|
+
// "callback_rate": 0.050000000000000000,
|
|
4466
|
+
// "active_price": 50000.000000000000000000,
|
|
4467
|
+
// "is_active": 0,
|
|
4468
|
+
// "margin_mode": "cross",
|
|
4469
|
+
// "margin_account": "USDT",
|
|
4470
|
+
// "trade_partition": "USDT",
|
|
4471
|
+
// "reduce_only": 1
|
|
4472
|
+
// },
|
|
4473
|
+
// ],
|
|
4474
|
+
// "total_page": 1,
|
|
4475
|
+
// "current_page": 1,
|
|
4476
|
+
// "total_size": 2
|
|
4477
|
+
// },
|
|
4478
|
+
// "ts": 1704242440106
|
|
4479
|
+
// }
|
|
4480
|
+
//
|
|
4414
4481
|
let orders = this.safeValue(response, 'data');
|
|
4415
4482
|
if (!Array.isArray(orders)) {
|
|
4416
4483
|
orders = this.safeValue(orders, 'orders', []);
|
|
@@ -4670,6 +4737,33 @@ class htx extends htx$1 {
|
|
|
4670
4737
|
// "trade_partition": "USDT"
|
|
4671
4738
|
// }
|
|
4672
4739
|
//
|
|
4740
|
+
// trailing: fetchOpenOrders
|
|
4741
|
+
//
|
|
4742
|
+
// {
|
|
4743
|
+
// "contract_type": "swap",
|
|
4744
|
+
// "business_type": "swap",
|
|
4745
|
+
// "pair": "BTC-USDT",
|
|
4746
|
+
// "symbol": "BTC",
|
|
4747
|
+
// "contract_code": "BTC-USDT",
|
|
4748
|
+
// "volume": 1.000000000000000000,
|
|
4749
|
+
// "order_type": 1,
|
|
4750
|
+
// "direction": "sell",
|
|
4751
|
+
// "offset": "close",
|
|
4752
|
+
// "lever_rate": 1,
|
|
4753
|
+
// "order_id": 1192021437253877761,
|
|
4754
|
+
// "order_id_str": "1192021437253877761",
|
|
4755
|
+
// "order_source": "api",
|
|
4756
|
+
// "created_at": 1704241657328,
|
|
4757
|
+
// "order_price_type": "formula_price",
|
|
4758
|
+
// "status": 2,
|
|
4759
|
+
// "callback_rate": 0.050000000000000000,
|
|
4760
|
+
// "active_price": 50000.000000000000000000,
|
|
4761
|
+
// "is_active": 0,
|
|
4762
|
+
// "margin_mode": "cross",
|
|
4763
|
+
// "margin_account": "USDT",
|
|
4764
|
+
// "trade_partition": "USDT",
|
|
4765
|
+
// "reduce_only": 1
|
|
4766
|
+
// }
|
|
4673
4767
|
//
|
|
4674
4768
|
// trigger: fetchOrders
|
|
4675
4769
|
//
|
|
@@ -5434,8 +5528,9 @@ class htx extends htx$1 {
|
|
|
5434
5528
|
* @param {string} id order id
|
|
5435
5529
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
5436
5530
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5437
|
-
* @param {
|
|
5438
|
-
* @param {
|
|
5531
|
+
* @param {boolean} [params.stop] *contract only* if the order is a stop trigger order or not
|
|
5532
|
+
* @param {boolean} [params.stopLossTakeProfit] *contract only* if the order is a stop-loss or take-profit order
|
|
5533
|
+
* @param {boolean} [params.trailing] *contract only* set to true if you want to cancel a trailing order
|
|
5439
5534
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5440
5535
|
*/
|
|
5441
5536
|
await this.loadMarkets();
|
|
@@ -5490,7 +5585,8 @@ class htx extends htx$1 {
|
|
|
5490
5585
|
}
|
|
5491
5586
|
const stop = this.safeValue(params, 'stop');
|
|
5492
5587
|
const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
|
|
5493
|
-
|
|
5588
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
5589
|
+
params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
|
|
5494
5590
|
if (market['linear']) {
|
|
5495
5591
|
let marginMode = undefined;
|
|
5496
5592
|
[marginMode, params] = this.handleMarginModeAndParams('cancelOrder', params);
|
|
@@ -5502,6 +5598,9 @@ class htx extends htx$1 {
|
|
|
5502
5598
|
else if (stopLossTakeProfit) {
|
|
5503
5599
|
response = await this.contractPrivatePostLinearSwapApiV1SwapTpslCancel(this.extend(request, params));
|
|
5504
5600
|
}
|
|
5601
|
+
else if (trailing) {
|
|
5602
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapTrackCancel(this.extend(request, params));
|
|
5603
|
+
}
|
|
5505
5604
|
else {
|
|
5506
5605
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCancel(this.extend(request, params));
|
|
5507
5606
|
}
|
|
@@ -5513,6 +5612,9 @@ class htx extends htx$1 {
|
|
|
5513
5612
|
else if (stopLossTakeProfit) {
|
|
5514
5613
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTpslCancel(this.extend(request, params));
|
|
5515
5614
|
}
|
|
5615
|
+
else if (trailing) {
|
|
5616
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTrackCancel(this.extend(request, params));
|
|
5617
|
+
}
|
|
5516
5618
|
else {
|
|
5517
5619
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossCancel(this.extend(request, params));
|
|
5518
5620
|
}
|
|
@@ -5526,6 +5628,9 @@ class htx extends htx$1 {
|
|
|
5526
5628
|
else if (stopLossTakeProfit) {
|
|
5527
5629
|
response = await this.contractPrivatePostSwapApiV1SwapTpslCancel(this.extend(request, params));
|
|
5528
5630
|
}
|
|
5631
|
+
else if (trailing) {
|
|
5632
|
+
response = await this.contractPrivatePostSwapApiV1SwapTrackCancel(this.extend(request, params));
|
|
5633
|
+
}
|
|
5529
5634
|
else {
|
|
5530
5635
|
response = await this.contractPrivatePostSwapApiV1SwapCancel(this.extend(request, params));
|
|
5531
5636
|
}
|
|
@@ -5537,6 +5642,9 @@ class htx extends htx$1 {
|
|
|
5537
5642
|
else if (stopLossTakeProfit) {
|
|
5538
5643
|
response = await this.contractPrivatePostApiV1ContractTpslCancel(this.extend(request, params));
|
|
5539
5644
|
}
|
|
5645
|
+
else if (trailing) {
|
|
5646
|
+
response = await this.contractPrivatePostApiV1ContractTrackCancel(this.extend(request, params));
|
|
5647
|
+
}
|
|
5540
5648
|
else {
|
|
5541
5649
|
response = await this.contractPrivatePostApiV1ContractCancel(this.extend(request, params));
|
|
5542
5650
|
}
|
|
@@ -5759,8 +5867,9 @@ class htx extends htx$1 {
|
|
|
5759
5867
|
* @description cancel all open orders
|
|
5760
5868
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
5761
5869
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5762
|
-
* @param {
|
|
5763
|
-
* @param {
|
|
5870
|
+
* @param {boolean} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
5871
|
+
* @param {boolean} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
5872
|
+
* @param {boolean} [params.trailing] *contract only* set to true if you want to cancel all trailing orders
|
|
5764
5873
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5765
5874
|
*/
|
|
5766
5875
|
await this.loadMarkets();
|
|
@@ -5801,7 +5910,8 @@ class htx extends htx$1 {
|
|
|
5801
5910
|
request['contract_code'] = market['id'];
|
|
5802
5911
|
const stop = this.safeValue(params, 'stop');
|
|
5803
5912
|
const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
|
|
5804
|
-
|
|
5913
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
5914
|
+
params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
|
|
5805
5915
|
if (market['linear']) {
|
|
5806
5916
|
let marginMode = undefined;
|
|
5807
5917
|
[marginMode, params] = this.handleMarginModeAndParams('cancelAllOrders', params);
|
|
@@ -5813,6 +5923,9 @@ class htx extends htx$1 {
|
|
|
5813
5923
|
else if (stopLossTakeProfit) {
|
|
5814
5924
|
response = await this.contractPrivatePostLinearSwapApiV1SwapTpslCancelall(this.extend(request, params));
|
|
5815
5925
|
}
|
|
5926
|
+
else if (trailing) {
|
|
5927
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapTrackCancelall(this.extend(request, params));
|
|
5928
|
+
}
|
|
5816
5929
|
else {
|
|
5817
5930
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCancelall(this.extend(request, params));
|
|
5818
5931
|
}
|
|
@@ -5824,6 +5937,9 @@ class htx extends htx$1 {
|
|
|
5824
5937
|
else if (stopLossTakeProfit) {
|
|
5825
5938
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTpslCancelall(this.extend(request, params));
|
|
5826
5939
|
}
|
|
5940
|
+
else if (trailing) {
|
|
5941
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTrackCancelall(this.extend(request, params));
|
|
5942
|
+
}
|
|
5827
5943
|
else {
|
|
5828
5944
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossCancelall(this.extend(request, params));
|
|
5829
5945
|
}
|
|
@@ -5837,6 +5953,9 @@ class htx extends htx$1 {
|
|
|
5837
5953
|
else if (stopLossTakeProfit) {
|
|
5838
5954
|
response = await this.contractPrivatePostSwapApiV1SwapTpslCancelall(this.extend(request, params));
|
|
5839
5955
|
}
|
|
5956
|
+
else if (trailing) {
|
|
5957
|
+
response = await this.contractPrivatePostSwapApiV1SwapTrackCancelall(this.extend(request, params));
|
|
5958
|
+
}
|
|
5840
5959
|
else {
|
|
5841
5960
|
response = await this.contractPrivatePostSwapApiV1SwapCancelall(this.extend(request, params));
|
|
5842
5961
|
}
|
|
@@ -5848,6 +5967,9 @@ class htx extends htx$1 {
|
|
|
5848
5967
|
else if (stopLossTakeProfit) {
|
|
5849
5968
|
response = await this.contractPrivatePostApiV1ContractTpslCancelall(this.extend(request, params));
|
|
5850
5969
|
}
|
|
5970
|
+
else if (trailing) {
|
|
5971
|
+
response = await this.contractPrivatePostApiV1ContractTrackCancelall(this.extend(request, params));
|
|
5972
|
+
}
|
|
5851
5973
|
else {
|
|
5852
5974
|
response = await this.contractPrivatePostApiV1ContractCancelall(this.extend(request, params));
|
|
5853
5975
|
}
|
package/dist/cjs/src/phemex.js
CHANGED
|
@@ -439,7 +439,8 @@ class phemex extends phemex$1 {
|
|
|
439
439
|
'34003': errors.PermissionDenied,
|
|
440
440
|
'35104': errors.InsufficientFunds,
|
|
441
441
|
'39995': errors.RateLimitExceeded,
|
|
442
|
-
'39996': errors.PermissionDenied,
|
|
442
|
+
'39996': errors.PermissionDenied,
|
|
443
|
+
'39997': errors.BadSymbol, // {"code":39997,"msg":"Symbol not listed sMOVRUSDT","data":null}
|
|
443
444
|
},
|
|
444
445
|
'broad': {
|
|
445
446
|
'401 Insufficient privilege': errors.PermissionDenied,
|
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.2.
|
|
7
|
+
declare const version = "4.2.4";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.2.
|
|
41
|
+
const version = '4.2.5';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -113,6 +113,7 @@ interface Exchange {
|
|
|
113
113
|
privateGetV5PositionList(params?: {}): Promise<implicitReturnType>;
|
|
114
114
|
privateGetV5ExecutionList(params?: {}): Promise<implicitReturnType>;
|
|
115
115
|
privateGetV5PositionClosedPnl(params?: {}): Promise<implicitReturnType>;
|
|
116
|
+
privateGetV5PositionMoveHistory(params?: {}): Promise<implicitReturnType>;
|
|
116
117
|
privateGetV5PreUpgradeOrderHistory(params?: {}): Promise<implicitReturnType>;
|
|
117
118
|
privateGetV5PreUpgradeExecutionList(params?: {}): Promise<implicitReturnType>;
|
|
118
119
|
privateGetV5PreUpgradePositionClosedPnl(params?: {}): Promise<implicitReturnType>;
|
|
@@ -256,6 +257,7 @@ interface Exchange {
|
|
|
256
257
|
privatePostV5PositionTradingStop(params?: {}): Promise<implicitReturnType>;
|
|
257
258
|
privatePostV5PositionSetAutoAddMargin(params?: {}): Promise<implicitReturnType>;
|
|
258
259
|
privatePostV5PositionAddMargin(params?: {}): Promise<implicitReturnType>;
|
|
260
|
+
privatePostV5PositionMovePositions(params?: {}): Promise<implicitReturnType>;
|
|
259
261
|
privatePostV5PositionConfirmPendingMmr(params?: {}): Promise<implicitReturnType>;
|
|
260
262
|
privatePostV5AccountUpgradeToUta(params?: {}): Promise<implicitReturnType>;
|
|
261
263
|
privatePostV5AccountQuickRepayment(params?: {}): Promise<implicitReturnType>;
|
package/js/src/alpaca.js
CHANGED
|
@@ -352,10 +352,16 @@ export default class alpaca extends Exchange {
|
|
|
352
352
|
//
|
|
353
353
|
const marketId = this.safeString(asset, 'symbol');
|
|
354
354
|
const parts = marketId.split('/');
|
|
355
|
+
const assetClass = this.safeString(asset, 'class');
|
|
355
356
|
const baseId = this.safeString(parts, 0);
|
|
356
357
|
const quoteId = this.safeString(parts, 1);
|
|
357
358
|
const base = this.safeCurrencyCode(baseId);
|
|
358
|
-
|
|
359
|
+
let quote = this.safeCurrencyCode(quoteId);
|
|
360
|
+
// Us equity markets do not include quote in symbol.
|
|
361
|
+
// We can safely coerce us_equity quote to USD
|
|
362
|
+
if (quote === undefined && assetClass === 'us_equity') {
|
|
363
|
+
quote = 'USD';
|
|
364
|
+
}
|
|
359
365
|
const symbol = base + '/' + quote;
|
|
360
366
|
const status = this.safeString(asset, 'status');
|
|
361
367
|
const active = (status === 'active');
|
package/js/src/binance.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export default class binance extends Exchange {
|
|
|
58
58
|
fetchCanceledOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
59
59
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
60
60
|
cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
|
|
61
|
-
cancelOrders(ids:
|
|
61
|
+
cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
|
|
62
62
|
fetchOrderTrades(id: string, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
63
63
|
fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
64
64
|
fetchMyDustTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
package/js/src/bingx.d.ts
CHANGED
|
@@ -72,7 +72,7 @@ export default class bingx extends Exchange {
|
|
|
72
72
|
parseOrderStatus(status: any): string;
|
|
73
73
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
74
74
|
cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
|
|
75
|
-
cancelOrders(ids:
|
|
75
|
+
cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<any>;
|
|
76
76
|
fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
77
77
|
fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
78
78
|
fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|