ccxt 4.2.2 → 4.2.3
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/dist/ccxt.browser.js +141 -46
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/alpaca.js +1 -1
- package/dist/cjs/src/bingx.js +109 -7
- package/dist/cjs/src/bitget.js +4 -4
- package/dist/cjs/src/bitmart.js +2 -2
- package/dist/cjs/src/kucoinfutures.js +6 -6
- package/dist/cjs/src/okcoin.js +2 -2
- package/dist/cjs/src/okx.js +11 -9
- package/dist/cjs/src/pro/bingx.js +2 -1
- package/dist/cjs/src/pro/bybit.js +3 -13
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bingx.d.ts +1 -0
- package/js/src/alpaca.js +1 -1
- package/js/src/bingx.js +109 -7
- package/js/src/bitget.js +4 -4
- package/js/src/bitmart.js +2 -2
- package/js/src/kucoinfutures.js +6 -6
- package/js/src/okcoin.js +2 -2
- package/js/src/okx.js +11 -9
- package/js/src/pro/bingx.js +2 -1
- package/js/src/pro/bybit.js +3 -13
- package/package.json +1 -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.3';
|
|
173
173
|
Exchange["default"].ccxtVersion = version;
|
|
174
174
|
const exchanges = {
|
|
175
175
|
'ace': ace,
|
package/dist/cjs/src/alpaca.js
CHANGED
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -277,6 +277,9 @@ class bingx extends bingx$1 {
|
|
|
277
277
|
'post': {
|
|
278
278
|
'userDataStream': 1,
|
|
279
279
|
},
|
|
280
|
+
'put': {
|
|
281
|
+
'userDataStream': 1,
|
|
282
|
+
},
|
|
280
283
|
},
|
|
281
284
|
},
|
|
282
285
|
},
|
|
@@ -1718,6 +1721,10 @@ class bingx extends bingx$1 {
|
|
|
1718
1721
|
const isTrailingAmountOrder = trailingAmount !== undefined;
|
|
1719
1722
|
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
1720
1723
|
const isTrailing = isTrailingAmountOrder || isTrailingPercentOrder;
|
|
1724
|
+
const stopLoss = this.safeValue(params, 'stopLoss');
|
|
1725
|
+
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
1726
|
+
const isStopLoss = stopLoss !== undefined;
|
|
1727
|
+
const isTakeProfit = takeProfit !== undefined;
|
|
1721
1728
|
if (((type === 'LIMIT') || (type === 'TRIGGER_LIMIT') || (type === 'STOP') || (type === 'TAKE_PROFIT')) && !isTrailing) {
|
|
1722
1729
|
request['price'] = this.parseToNumeric(this.priceToPrecision(symbol, price));
|
|
1723
1730
|
}
|
|
@@ -1763,6 +1770,42 @@ class bingx extends bingx$1 {
|
|
|
1763
1770
|
request['priceRate'] = this.parseToNumeric(requestTrailingPercent);
|
|
1764
1771
|
}
|
|
1765
1772
|
}
|
|
1773
|
+
if (isStopLoss || isTakeProfit) {
|
|
1774
|
+
if (isStopLoss) {
|
|
1775
|
+
const slTriggerPrice = this.safeString2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
|
|
1776
|
+
const slWorkingType = this.safeString(stopLoss, 'workingType', 'MARK_PRICE');
|
|
1777
|
+
const slType = this.safeString(stopLoss, 'type', 'STOP_MARKET');
|
|
1778
|
+
const slRequest = {
|
|
1779
|
+
'stopPrice': this.parseToNumeric(this.priceToPrecision(symbol, slTriggerPrice)),
|
|
1780
|
+
'workingType': slWorkingType,
|
|
1781
|
+
'type': slType,
|
|
1782
|
+
};
|
|
1783
|
+
const slPrice = this.safeString(stopLoss, 'price');
|
|
1784
|
+
if (slPrice !== undefined) {
|
|
1785
|
+
slRequest['price'] = this.parseToNumeric(this.priceToPrecision(symbol, slPrice));
|
|
1786
|
+
}
|
|
1787
|
+
const slQuantity = this.safeString(stopLoss, 'quantity', amount);
|
|
1788
|
+
slRequest['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, slQuantity));
|
|
1789
|
+
request['stopLoss'] = this.json(slRequest);
|
|
1790
|
+
}
|
|
1791
|
+
if (isTakeProfit) {
|
|
1792
|
+
const tkTriggerPrice = this.safeString2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
|
|
1793
|
+
const tkWorkingType = this.safeString(takeProfit, 'workingType', 'MARK_PRICE');
|
|
1794
|
+
const tpType = this.safeString(takeProfit, 'type', 'TAKE_PROFIT_MARKET');
|
|
1795
|
+
const tpRequest = {
|
|
1796
|
+
'stopPrice': this.parseToNumeric(this.priceToPrecision(symbol, tkTriggerPrice)),
|
|
1797
|
+
'workingType': tkWorkingType,
|
|
1798
|
+
'type': tpType,
|
|
1799
|
+
};
|
|
1800
|
+
const slPrice = this.safeString(takeProfit, 'price');
|
|
1801
|
+
if (slPrice !== undefined) {
|
|
1802
|
+
tpRequest['price'] = this.parseToNumeric(this.priceToPrecision(symbol, slPrice));
|
|
1803
|
+
}
|
|
1804
|
+
const tkQuantity = this.safeString(takeProfit, 'quantity', amount);
|
|
1805
|
+
tpRequest['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, tkQuantity));
|
|
1806
|
+
request['takeProfit'] = this.json(tpRequest);
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1766
1809
|
let positionSide = undefined;
|
|
1767
1810
|
if (reduceOnly) {
|
|
1768
1811
|
positionSide = (side === 'buy') ? 'SHORT' : 'LONG';
|
|
@@ -1772,7 +1815,7 @@ class bingx extends bingx$1 {
|
|
|
1772
1815
|
}
|
|
1773
1816
|
request['positionSide'] = positionSide;
|
|
1774
1817
|
request['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, amount));
|
|
1775
|
-
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent']);
|
|
1818
|
+
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'takeProfit', 'stopLoss']);
|
|
1776
1819
|
}
|
|
1777
1820
|
return this.extend(request, params);
|
|
1778
1821
|
}
|
|
@@ -1782,6 +1825,7 @@ class bingx extends bingx$1 {
|
|
|
1782
1825
|
* @name bingx#createOrder
|
|
1783
1826
|
* @description create a trade order
|
|
1784
1827
|
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Trade%20order
|
|
1828
|
+
* @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Create%20an%20Order
|
|
1785
1829
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
1786
1830
|
* @param {string} type 'market' or 'limit'
|
|
1787
1831
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -1797,6 +1841,10 @@ class bingx extends bingx$1 {
|
|
|
1797
1841
|
* @param {float} [params.cost] the quote quantity that can be used as an alternative for the amount
|
|
1798
1842
|
* @param {float} [params.trailingAmount] *swap only* the quote amount to trail away from the current market price
|
|
1799
1843
|
* @param {float} [params.trailingPercent] *swap only* the percent to trail away from the current market price
|
|
1844
|
+
* @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered
|
|
1845
|
+
* @param {float} [params.takeProfit.triggerPrice] take profit trigger price
|
|
1846
|
+
* @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
|
|
1847
|
+
* @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
|
|
1800
1848
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1801
1849
|
*/
|
|
1802
1850
|
await this.loadMarkets();
|
|
@@ -1847,6 +1895,9 @@ class bingx extends bingx$1 {
|
|
|
1847
1895
|
// }
|
|
1848
1896
|
// }
|
|
1849
1897
|
//
|
|
1898
|
+
if (typeof response === 'string') {
|
|
1899
|
+
response = JSON.parse(response);
|
|
1900
|
+
}
|
|
1850
1901
|
const data = this.safeValue(response, 'data', {});
|
|
1851
1902
|
const order = this.safeValue(data, 'order', data);
|
|
1852
1903
|
return this.parseOrder(order, market);
|
|
@@ -2051,6 +2102,24 @@ class bingx extends bingx$1 {
|
|
|
2051
2102
|
// "orderType": "",
|
|
2052
2103
|
// "workingType": "MARK_PRICE"
|
|
2053
2104
|
// }
|
|
2105
|
+
// with tp and sl
|
|
2106
|
+
// {
|
|
2107
|
+
// orderId: 1741440894764281900,
|
|
2108
|
+
// symbol: 'LTC-USDT',
|
|
2109
|
+
// positionSide: 'LONG',
|
|
2110
|
+
// side: 'BUY',
|
|
2111
|
+
// type: 'MARKET',
|
|
2112
|
+
// price: 0,
|
|
2113
|
+
// quantity: 1,
|
|
2114
|
+
// stopPrice: 0,
|
|
2115
|
+
// workingType: 'MARK_PRICE',
|
|
2116
|
+
// clientOrderID: '',
|
|
2117
|
+
// timeInForce: 'GTC',
|
|
2118
|
+
// priceRate: 0,
|
|
2119
|
+
// stopLoss: '{"stopPrice":50,"workingType":"MARK_PRICE","type":"STOP_MARKET","quantity":1}',
|
|
2120
|
+
// takeProfit: '{"stopPrice":150,"workingType":"MARK_PRICE","type":"TAKE_PROFIT_MARKET","quantity":1}',
|
|
2121
|
+
// reduceOnly: false
|
|
2122
|
+
// }
|
|
2054
2123
|
//
|
|
2055
2124
|
const positionSide = this.safeString2(order, 'positionSide', 'ps');
|
|
2056
2125
|
const marketType = (positionSide === undefined) ? 'spot' : 'swap';
|
|
@@ -2089,6 +2158,30 @@ class bingx extends bingx$1 {
|
|
|
2089
2158
|
'cost': Precise["default"].stringAbs(feeCost),
|
|
2090
2159
|
};
|
|
2091
2160
|
const clientOrderId = this.safeString2(order, 'clientOrderId', 'c');
|
|
2161
|
+
let stopLoss = this.safeValue(order, 'stopLoss');
|
|
2162
|
+
let stopLossPrice = undefined;
|
|
2163
|
+
if (stopLoss !== undefined) {
|
|
2164
|
+
stopLossPrice = this.safeNumber(stopLoss, 'stopLoss');
|
|
2165
|
+
}
|
|
2166
|
+
if ((stopLoss !== undefined) && (typeof stopLoss !== 'number')) {
|
|
2167
|
+
// stopLoss: '{"stopPrice":50,"workingType":"MARK_PRICE","type":"STOP_MARKET","quantity":1}',
|
|
2168
|
+
if (typeof stopLoss === 'string') {
|
|
2169
|
+
stopLoss = JSON.parse(stopLoss);
|
|
2170
|
+
}
|
|
2171
|
+
stopLossPrice = this.safeNumber(stopLoss, 'stopPrice');
|
|
2172
|
+
}
|
|
2173
|
+
let takeProfit = this.safeValue(order, 'takeProfit');
|
|
2174
|
+
let takeProfitPrice = undefined;
|
|
2175
|
+
if (takeProfit !== undefined) {
|
|
2176
|
+
takeProfitPrice = this.safeNumber(takeProfit, 'takeProfit');
|
|
2177
|
+
}
|
|
2178
|
+
if ((takeProfit !== undefined) && (typeof takeProfit !== 'number')) {
|
|
2179
|
+
// takeProfit: '{"stopPrice":150,"workingType":"MARK_PRICE","type":"TAKE_PROFIT_MARKET","quantity":1}',
|
|
2180
|
+
if (typeof takeProfit === 'string') {
|
|
2181
|
+
takeProfit = JSON.parse(takeProfit);
|
|
2182
|
+
}
|
|
2183
|
+
takeProfitPrice = this.safeNumber(takeProfit, 'stopPrice');
|
|
2184
|
+
}
|
|
2092
2185
|
return this.safeOrder({
|
|
2093
2186
|
'info': order,
|
|
2094
2187
|
'id': orderId,
|
|
@@ -2105,8 +2198,8 @@ class bingx extends bingx$1 {
|
|
|
2105
2198
|
'price': price,
|
|
2106
2199
|
'stopPrice': this.safeNumber(order, 'stopPrice'),
|
|
2107
2200
|
'triggerPrice': this.safeNumber(order, 'stopPrice'),
|
|
2108
|
-
'stopLossPrice':
|
|
2109
|
-
'takeProfitPrice':
|
|
2201
|
+
'stopLossPrice': stopLossPrice,
|
|
2202
|
+
'takeProfitPrice': takeProfitPrice,
|
|
2110
2203
|
'average': average,
|
|
2111
2204
|
'cost': undefined,
|
|
2112
2205
|
'amount': amount,
|
|
@@ -2300,6 +2393,7 @@ class bingx extends bingx$1 {
|
|
|
2300
2393
|
* @param {string[]} ids order ids
|
|
2301
2394
|
* @param {string} symbol unified market symbol, default is undefined
|
|
2302
2395
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2396
|
+
* @param {string[]} [params.clientOrderIds] client order ids
|
|
2303
2397
|
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2304
2398
|
*/
|
|
2305
2399
|
if (symbol === undefined) {
|
|
@@ -2310,19 +2404,27 @@ class bingx extends bingx$1 {
|
|
|
2310
2404
|
const request = {
|
|
2311
2405
|
'symbol': market['id'],
|
|
2312
2406
|
};
|
|
2407
|
+
const clientOrderIds = this.safeValue(params, 'clientOrderIds');
|
|
2408
|
+
let idsToParse = ids;
|
|
2409
|
+
const areClientOrderIds = (clientOrderIds !== undefined);
|
|
2410
|
+
if (areClientOrderIds) {
|
|
2411
|
+
idsToParse = clientOrderIds;
|
|
2412
|
+
}
|
|
2313
2413
|
const parsedIds = [];
|
|
2314
|
-
for (let i = 0; i <
|
|
2315
|
-
const id =
|
|
2414
|
+
for (let i = 0; i < idsToParse.length; i++) {
|
|
2415
|
+
const id = idsToParse[i];
|
|
2316
2416
|
const stringId = id.toString();
|
|
2317
2417
|
parsedIds.push(stringId);
|
|
2318
2418
|
}
|
|
2319
2419
|
let response = undefined;
|
|
2320
2420
|
if (market['spot']) {
|
|
2321
|
-
|
|
2421
|
+
const spotReqKey = areClientOrderIds ? 'clientOrderIds' : 'orderIds';
|
|
2422
|
+
request[spotReqKey] = parsedIds.join(',');
|
|
2322
2423
|
response = await this.spotV1PrivatePostTradeCancelOrders(this.extend(request, params));
|
|
2323
2424
|
}
|
|
2324
2425
|
else {
|
|
2325
|
-
|
|
2426
|
+
const swapReqKey = areClientOrderIds ? 'ClientOrderIDList' : 'orderIdList';
|
|
2427
|
+
request[swapReqKey] = parsedIds;
|
|
2326
2428
|
response = await this.swapV2PrivateDeleteTradeBatchOrders(this.extend(request, params));
|
|
2327
2429
|
}
|
|
2328
2430
|
//
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -4742,8 +4742,8 @@ class bitget extends bitget$1 {
|
|
|
4742
4742
|
}
|
|
4743
4743
|
let marginMode = undefined;
|
|
4744
4744
|
[marginMode, params] = this.handleMarginModeAndParams('cancelOrders', params);
|
|
4745
|
-
const stop = this.
|
|
4746
|
-
params = this.omit(params, 'stop');
|
|
4745
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
4746
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
4747
4747
|
const orderIdList = [];
|
|
4748
4748
|
for (let i = 0; i < ids.length; i++) {
|
|
4749
4749
|
const individualId = ids[i];
|
|
@@ -4839,8 +4839,8 @@ class bitget extends bitget$1 {
|
|
|
4839
4839
|
const request = {
|
|
4840
4840
|
'symbol': market['id'],
|
|
4841
4841
|
};
|
|
4842
|
-
const stop = this.
|
|
4843
|
-
params = this.omit(params, 'stop');
|
|
4842
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
4843
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
4844
4844
|
let response = undefined;
|
|
4845
4845
|
if (market['spot']) {
|
|
4846
4846
|
if (marginMode !== undefined) {
|
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -2507,8 +2507,8 @@ class bitmart extends bitmart$1 {
|
|
|
2507
2507
|
response = await this.privatePostSpotV3CancelOrder(this.extend(request, params));
|
|
2508
2508
|
}
|
|
2509
2509
|
else {
|
|
2510
|
-
const stop = this.
|
|
2511
|
-
params = this.omit(params, ['stop']);
|
|
2510
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
2511
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
2512
2512
|
if (!stop) {
|
|
2513
2513
|
response = await this.privatePostContractPrivateCancelOrder(this.extend(request, params));
|
|
2514
2514
|
}
|
|
@@ -1278,7 +1278,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
1278
1278
|
* @see https://www.kucoin.com/docs/rest/futures-trading/orders/cancel-multiple-futures-stop-orders
|
|
1279
1279
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
1280
1280
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1281
|
-
* @param {object} [params.
|
|
1281
|
+
* @param {object} [params.trigger] When true, all the trigger orders will be cancelled
|
|
1282
1282
|
* @returns Response from the exchange
|
|
1283
1283
|
*/
|
|
1284
1284
|
await this.loadMarkets();
|
|
@@ -1286,8 +1286,8 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
1286
1286
|
if (symbol !== undefined) {
|
|
1287
1287
|
request['symbol'] = this.marketId(symbol);
|
|
1288
1288
|
}
|
|
1289
|
-
const stop = this.
|
|
1290
|
-
params = this.omit(params, 'stop');
|
|
1289
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
1290
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
1291
1291
|
let response = undefined;
|
|
1292
1292
|
if (stop) {
|
|
1293
1293
|
response = await this.futuresPrivateDeleteStopOrders(this.extend(request, params));
|
|
@@ -1456,7 +1456,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
1456
1456
|
* @param {int} [since] timestamp in ms of the earliest order to retrieve
|
|
1457
1457
|
* @param {int} [limit] The maximum number of orders to retrieve
|
|
1458
1458
|
* @param {object} [params] exchange specific parameters
|
|
1459
|
-
* @param {bool} [params.
|
|
1459
|
+
* @param {bool} [params.trigger] set to true to retrieve untriggered stop orders
|
|
1460
1460
|
* @param {int} [params.until] End time in ms
|
|
1461
1461
|
* @param {string} [params.side] buy or sell
|
|
1462
1462
|
* @param {string} [params.type] limit or market
|
|
@@ -1469,9 +1469,9 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
1469
1469
|
if (paginate) {
|
|
1470
1470
|
return await this.fetchPaginatedCallDynamic('fetchOrdersByStatus', symbol, since, limit, params);
|
|
1471
1471
|
}
|
|
1472
|
-
const stop = this.
|
|
1472
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
1473
1473
|
const until = this.safeInteger2(params, 'until', 'till');
|
|
1474
|
-
params = this.omit(params, ['stop', 'until', 'till']);
|
|
1474
|
+
params = this.omit(params, ['stop', 'until', 'till', 'trigger']);
|
|
1475
1475
|
if (status === 'closed') {
|
|
1476
1476
|
status = 'done';
|
|
1477
1477
|
}
|
package/dist/cjs/src/okcoin.js
CHANGED
|
@@ -1971,7 +1971,7 @@ class okcoin extends okcoin$1 {
|
|
|
1971
1971
|
// 'ordId': id,
|
|
1972
1972
|
};
|
|
1973
1973
|
const clientOrderId = this.safeString2(params, 'clOrdId', 'clientOrderId');
|
|
1974
|
-
const stop = this.
|
|
1974
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
1975
1975
|
if (stop) {
|
|
1976
1976
|
if (clientOrderId !== undefined) {
|
|
1977
1977
|
request['algoClOrdId'] = clientOrderId;
|
|
@@ -1988,7 +1988,7 @@ class okcoin extends okcoin$1 {
|
|
|
1988
1988
|
request['ordId'] = id;
|
|
1989
1989
|
}
|
|
1990
1990
|
}
|
|
1991
|
-
const query = this.omit(params, ['clientOrderId', 'stop']);
|
|
1991
|
+
const query = this.omit(params, ['clientOrderId', 'stop', 'trigger']);
|
|
1992
1992
|
let response = undefined;
|
|
1993
1993
|
if (stop) {
|
|
1994
1994
|
response = await this.privateGetTradeOrderAlgo(this.extend(request, query));
|
package/dist/cjs/src/okx.js
CHANGED
|
@@ -3029,12 +3029,13 @@ class okx extends okx$1 {
|
|
|
3029
3029
|
* @param {string} id order id
|
|
3030
3030
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
3031
3031
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3032
|
+
* @param {boolean} [params.trigger] true if trigger orders
|
|
3032
3033
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3033
3034
|
*/
|
|
3034
3035
|
if (symbol === undefined) {
|
|
3035
3036
|
throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
3036
3037
|
}
|
|
3037
|
-
const stop = this.
|
|
3038
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
3038
3039
|
if (stop) {
|
|
3039
3040
|
const orderInner = await this.cancelOrders([id], symbol, params);
|
|
3040
3041
|
return this.safeValue(orderInner, 0);
|
|
@@ -3406,6 +3407,7 @@ class okx extends okx$1 {
|
|
|
3406
3407
|
* @param {string} id the order id
|
|
3407
3408
|
* @param {string} symbol unified market symbol
|
|
3408
3409
|
* @param {object} [params] extra and exchange specific parameters
|
|
3410
|
+
* @param {boolean} [params.trigger] true if fetching trigger orders
|
|
3409
3411
|
* @returns [an order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3410
3412
|
*/
|
|
3411
3413
|
if (symbol === undefined) {
|
|
@@ -3423,7 +3425,7 @@ class okx extends okx$1 {
|
|
|
3423
3425
|
const options = this.safeValue(this.options, 'fetchOrder', {});
|
|
3424
3426
|
const defaultMethod = this.safeString(options, 'method', 'privateGetTradeOrder');
|
|
3425
3427
|
let method = this.safeString(params, 'method', defaultMethod);
|
|
3426
|
-
const stop = this.
|
|
3428
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
3427
3429
|
if (stop) {
|
|
3428
3430
|
method = 'privateGetTradeOrderAlgo';
|
|
3429
3431
|
if (clientOrderId !== undefined) {
|
|
@@ -3441,7 +3443,7 @@ class okx extends okx$1 {
|
|
|
3441
3443
|
request['ordId'] = id;
|
|
3442
3444
|
}
|
|
3443
3445
|
}
|
|
3444
|
-
const query = this.omit(params, ['method', 'clOrdId', 'clientOrderId', 'stop']);
|
|
3446
|
+
const query = this.omit(params, ['method', 'clOrdId', 'clientOrderId', 'stop', 'trigger']);
|
|
3445
3447
|
let response = undefined;
|
|
3446
3448
|
if (method === 'privateGetTradeOrderAlgo') {
|
|
3447
3449
|
response = await this.privateGetTradeOrderAlgo(this.extend(request, query));
|
|
@@ -3597,7 +3599,7 @@ class okx extends okx$1 {
|
|
|
3597
3599
|
const defaultMethod = this.safeString(options, 'method', 'privateGetTradeOrdersPending');
|
|
3598
3600
|
let method = this.safeString(params, 'method', defaultMethod);
|
|
3599
3601
|
const ordType = this.safeString(params, 'ordType');
|
|
3600
|
-
const stop = this.
|
|
3602
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
3601
3603
|
if (stop || (ordType in algoOrderTypes)) {
|
|
3602
3604
|
method = 'privateGetTradeOrdersAlgoPending';
|
|
3603
3605
|
if (stop) {
|
|
@@ -3606,7 +3608,7 @@ class okx extends okx$1 {
|
|
|
3606
3608
|
}
|
|
3607
3609
|
}
|
|
3608
3610
|
}
|
|
3609
|
-
const query = this.omit(params, ['method', 'stop']);
|
|
3611
|
+
const query = this.omit(params, ['method', 'stop', 'trigger']);
|
|
3610
3612
|
let response = undefined;
|
|
3611
3613
|
if (method === 'privateGetTradeOrdersAlgoPending') {
|
|
3612
3614
|
response = await this.privateGetTradeOrdersAlgoPending(this.extend(request, query));
|
|
@@ -3759,7 +3761,7 @@ class okx extends okx$1 {
|
|
|
3759
3761
|
const defaultMethod = this.safeString(options, 'method', 'privateGetTradeOrdersHistory');
|
|
3760
3762
|
let method = this.safeString(params, 'method', defaultMethod);
|
|
3761
3763
|
const ordType = this.safeString(params, 'ordType');
|
|
3762
|
-
const stop = this.
|
|
3764
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
3763
3765
|
if (stop || (ordType in algoOrderTypes)) {
|
|
3764
3766
|
method = 'privateGetTradeOrdersAlgoHistory';
|
|
3765
3767
|
const algoId = this.safeString(params, 'algoId');
|
|
@@ -3784,7 +3786,7 @@ class okx extends okx$1 {
|
|
|
3784
3786
|
query = this.omit(query, ['until', 'till']);
|
|
3785
3787
|
}
|
|
3786
3788
|
}
|
|
3787
|
-
const send = this.omit(query, ['method', 'stop', 'ordType']);
|
|
3789
|
+
const send = this.omit(query, ['method', 'stop', 'ordType', 'trigger']);
|
|
3788
3790
|
let response = undefined;
|
|
3789
3791
|
if (method === 'privateGetTradeOrdersAlgoHistory') {
|
|
3790
3792
|
response = await this.privateGetTradeOrdersAlgoHistory(this.extend(request, send));
|
|
@@ -3946,7 +3948,7 @@ class okx extends okx$1 {
|
|
|
3946
3948
|
const defaultMethod = this.safeString(options, 'method', 'privateGetTradeOrdersHistory');
|
|
3947
3949
|
let method = this.safeString(params, 'method', defaultMethod);
|
|
3948
3950
|
const ordType = this.safeString(params, 'ordType');
|
|
3949
|
-
const stop = this.
|
|
3951
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
3950
3952
|
if (stop || (ordType in algoOrderTypes)) {
|
|
3951
3953
|
method = 'privateGetTradeOrdersAlgoHistory';
|
|
3952
3954
|
if (stop) {
|
|
@@ -3967,7 +3969,7 @@ class okx extends okx$1 {
|
|
|
3967
3969
|
}
|
|
3968
3970
|
request['state'] = 'filled';
|
|
3969
3971
|
}
|
|
3970
|
-
const send = this.omit(query, ['method', 'stop']);
|
|
3972
|
+
const send = this.omit(query, ['method', 'stop', 'trigger']);
|
|
3971
3973
|
let response = undefined;
|
|
3972
3974
|
if (method === 'privateGetTradeOrdersAlgoHistory') {
|
|
3973
3975
|
response = await this.privateGetTradeOrdersAlgoHistory(this.extend(request, send));
|
|
@@ -30,6 +30,7 @@ class bingx extends bingx$1 {
|
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
32
|
'options': {
|
|
33
|
+
'listenKeyRefreshRate': 3540000,
|
|
33
34
|
'ws': {
|
|
34
35
|
'gunzip': true,
|
|
35
36
|
},
|
|
@@ -627,7 +628,7 @@ class bingx extends bingx$1 {
|
|
|
627
628
|
const lastAuthenticatedTime = this.safeInteger(this.options, 'lastAuthenticatedTime', 0);
|
|
628
629
|
const listenKeyRefreshRate = this.safeInteger(this.options, 'listenKeyRefreshRate', 3600000); // 1 hour
|
|
629
630
|
if (time - lastAuthenticatedTime > listenKeyRefreshRate) {
|
|
630
|
-
const response = await this.
|
|
631
|
+
const response = await this.userAuthPrivatePutUserDataStream({ 'listenKey': listenKey }); // extend the expiry
|
|
631
632
|
this.options['listenKey'] = this.safeString(response, 'listenKey');
|
|
632
633
|
this.options['lastAuthenticatedTime'] = time;
|
|
633
634
|
}
|
|
@@ -208,7 +208,7 @@ class bybit extends bybit$1 {
|
|
|
208
208
|
*/
|
|
209
209
|
await this.loadMarkets();
|
|
210
210
|
symbols = this.marketSymbols(symbols, undefined, false);
|
|
211
|
-
const
|
|
211
|
+
const messageHashes = [];
|
|
212
212
|
const url = this.getUrlByMarketType(symbols[0], false, params);
|
|
213
213
|
params = this.cleanParams(params);
|
|
214
214
|
const options = this.safeValue(this.options, 'watchTickers', {});
|
|
@@ -218,8 +218,9 @@ class bybit extends bybit$1 {
|
|
|
218
218
|
for (let i = 0; i < marketIds.length; i++) {
|
|
219
219
|
const marketId = marketIds[i];
|
|
220
220
|
topics.push(topic + '.' + marketId);
|
|
221
|
+
messageHashes.push('ticker:' + symbols[i]);
|
|
221
222
|
}
|
|
222
|
-
const ticker = await this.watchTopics(url,
|
|
223
|
+
const ticker = await this.watchTopics(url, messageHashes, topics, params);
|
|
223
224
|
if (this.newUpdates) {
|
|
224
225
|
return ticker;
|
|
225
226
|
}
|
|
@@ -355,17 +356,6 @@ class bybit extends bybit$1 {
|
|
|
355
356
|
this.tickers[symbol] = parsed;
|
|
356
357
|
const messageHash = 'ticker:' + symbol;
|
|
357
358
|
client.resolve(this.tickers[symbol], messageHash);
|
|
358
|
-
// watchTickers part
|
|
359
|
-
const messageHashes = this.findMessageHashes(client, 'tickers::');
|
|
360
|
-
for (let i = 0; i < messageHashes.length; i++) {
|
|
361
|
-
const messageHashTicker = messageHashes[i];
|
|
362
|
-
const parts = messageHashTicker.split('::');
|
|
363
|
-
const symbolsString = parts[1];
|
|
364
|
-
const symbols = symbolsString.split(',');
|
|
365
|
-
if (this.inArray(parsed['symbol'], symbols)) {
|
|
366
|
-
client.resolve(parsed, messageHashTicker);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
359
|
}
|
|
370
360
|
async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
371
361
|
/**
|
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.2";
|
|
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.3';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -82,6 +82,7 @@ interface Exchange {
|
|
|
82
82
|
accountV1PrivateGetUid(params?: {}): Promise<implicitReturnType>;
|
|
83
83
|
accountV1PrivatePostInnerTransferAuthorizeSubAccount(params?: {}): Promise<implicitReturnType>;
|
|
84
84
|
userAuthPrivatePostUserDataStream(params?: {}): Promise<implicitReturnType>;
|
|
85
|
+
userAuthPrivatePutUserDataStream(params?: {}): Promise<implicitReturnType>;
|
|
85
86
|
copyTradingV1PrivateGetSwapTraceCurrentTrack(params?: {}): Promise<implicitReturnType>;
|
|
86
87
|
copyTradingV1PrivatePostSwapTraceCloseTrackOrder(params?: {}): Promise<implicitReturnType>;
|
|
87
88
|
copyTradingV1PrivatePostSwapTraceSetTPSL(params?: {}): Promise<implicitReturnType>;
|
package/js/src/alpaca.js
CHANGED
|
@@ -53,7 +53,7 @@ export default class alpaca extends Exchange {
|
|
|
53
53
|
'closeAllPositions': false,
|
|
54
54
|
'closePosition': false,
|
|
55
55
|
'createOrder': true,
|
|
56
|
-
'fetchBalance':
|
|
56
|
+
'fetchBalance': false,
|
|
57
57
|
'fetchBidsAsks': false,
|
|
58
58
|
'fetchClosedOrders': true,
|
|
59
59
|
'fetchCurrencies': false,
|