ccxt 4.2.2 → 4.2.4
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 +227 -62
- package/dist/ccxt.browser.min.js +5 -5
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/alpaca.js +1 -1
- package/dist/cjs/src/base/Exchange.js +5 -2
- package/dist/cjs/src/bingx.js +109 -7
- package/dist/cjs/src/bitget.js +4 -4
- package/dist/cjs/src/bitmart.js +20 -10
- package/dist/cjs/src/bybit.js +2 -0
- package/dist/cjs/src/coinsph.js +20 -2
- package/dist/cjs/src/htx.js +35 -3
- package/dist/cjs/src/kucoinfutures.js +6 -6
- package/dist/cjs/src/okcoin.js +2 -2
- package/dist/cjs/src/okx.js +16 -9
- package/dist/cjs/src/phemex.js +1 -1
- 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/abstract/bitmart.d.ts +1 -0
- package/js/src/alpaca.js +1 -1
- package/js/src/base/Exchange.js +5 -2
- package/js/src/bingx.js +109 -7
- package/js/src/bitget.js +4 -4
- package/js/src/bitmart.js +20 -10
- package/js/src/bybit.js +2 -0
- package/js/src/coinsph.js +20 -2
- package/js/src/htx.js +35 -3
- package/js/src/kucoinfutures.js +6 -6
- package/js/src/okcoin.js +2 -2
- package/js/src/okx.js +16 -9
- package/js/src/phemex.js +1 -1
- package/js/src/pro/bingx.js +2 -1
- package/js/src/pro/bybit.js +3 -13
- package/package.json +1 -1
package/dist/ccxt.browser.js
CHANGED
|
@@ -2536,7 +2536,7 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
2536
2536
|
'closeAllPositions': false,
|
|
2537
2537
|
'closePosition': false,
|
|
2538
2538
|
'createOrder': true,
|
|
2539
|
-
'fetchBalance':
|
|
2539
|
+
'fetchBalance': false,
|
|
2540
2540
|
'fetchBidsAsks': false,
|
|
2541
2541
|
'fetchClosedOrders': true,
|
|
2542
2542
|
'fetchCurrencies': false,
|
|
@@ -7738,8 +7738,11 @@ class Exchange {
|
|
|
7738
7738
|
// proxy agents
|
|
7739
7739
|
const [httpProxy, httpsProxy, socksProxy] = this.checkProxySettings(url, method, headers, body);
|
|
7740
7740
|
this.checkConflictingProxies(httpProxy || httpsProxy || socksProxy, proxyUrl);
|
|
7741
|
-
if (
|
|
7742
|
-
|
|
7741
|
+
if (isNode) {
|
|
7742
|
+
// skip this on the browser
|
|
7743
|
+
if (!this.proxyModulesLoaded) {
|
|
7744
|
+
await this.loadProxyModules(); // this is needed in JS, independently whether proxy properties were set or not, we have to load them because of necessity in WS, which would happen beyond 'fetch' method (WS/etc)
|
|
7745
|
+
}
|
|
7743
7746
|
}
|
|
7744
7747
|
const chosenAgent = this.setProxyAgents(httpProxy, httpsProxy, socksProxy);
|
|
7745
7748
|
// user-agent
|
|
@@ -27332,6 +27335,9 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
27332
27335
|
'post': {
|
|
27333
27336
|
'userDataStream': 1,
|
|
27334
27337
|
},
|
|
27338
|
+
'put': {
|
|
27339
|
+
'userDataStream': 1,
|
|
27340
|
+
},
|
|
27335
27341
|
},
|
|
27336
27342
|
},
|
|
27337
27343
|
},
|
|
@@ -28773,6 +28779,10 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28773
28779
|
const isTrailingAmountOrder = trailingAmount !== undefined;
|
|
28774
28780
|
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
28775
28781
|
const isTrailing = isTrailingAmountOrder || isTrailingPercentOrder;
|
|
28782
|
+
const stopLoss = this.safeValue(params, 'stopLoss');
|
|
28783
|
+
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
28784
|
+
const isStopLoss = stopLoss !== undefined;
|
|
28785
|
+
const isTakeProfit = takeProfit !== undefined;
|
|
28776
28786
|
if (((type === 'LIMIT') || (type === 'TRIGGER_LIMIT') || (type === 'STOP') || (type === 'TAKE_PROFIT')) && !isTrailing) {
|
|
28777
28787
|
request['price'] = this.parseToNumeric(this.priceToPrecision(symbol, price));
|
|
28778
28788
|
}
|
|
@@ -28818,6 +28828,42 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28818
28828
|
request['priceRate'] = this.parseToNumeric(requestTrailingPercent);
|
|
28819
28829
|
}
|
|
28820
28830
|
}
|
|
28831
|
+
if (isStopLoss || isTakeProfit) {
|
|
28832
|
+
if (isStopLoss) {
|
|
28833
|
+
const slTriggerPrice = this.safeString2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
|
|
28834
|
+
const slWorkingType = this.safeString(stopLoss, 'workingType', 'MARK_PRICE');
|
|
28835
|
+
const slType = this.safeString(stopLoss, 'type', 'STOP_MARKET');
|
|
28836
|
+
const slRequest = {
|
|
28837
|
+
'stopPrice': this.parseToNumeric(this.priceToPrecision(symbol, slTriggerPrice)),
|
|
28838
|
+
'workingType': slWorkingType,
|
|
28839
|
+
'type': slType,
|
|
28840
|
+
};
|
|
28841
|
+
const slPrice = this.safeString(stopLoss, 'price');
|
|
28842
|
+
if (slPrice !== undefined) {
|
|
28843
|
+
slRequest['price'] = this.parseToNumeric(this.priceToPrecision(symbol, slPrice));
|
|
28844
|
+
}
|
|
28845
|
+
const slQuantity = this.safeString(stopLoss, 'quantity', amount);
|
|
28846
|
+
slRequest['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, slQuantity));
|
|
28847
|
+
request['stopLoss'] = this.json(slRequest);
|
|
28848
|
+
}
|
|
28849
|
+
if (isTakeProfit) {
|
|
28850
|
+
const tkTriggerPrice = this.safeString2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
|
|
28851
|
+
const tkWorkingType = this.safeString(takeProfit, 'workingType', 'MARK_PRICE');
|
|
28852
|
+
const tpType = this.safeString(takeProfit, 'type', 'TAKE_PROFIT_MARKET');
|
|
28853
|
+
const tpRequest = {
|
|
28854
|
+
'stopPrice': this.parseToNumeric(this.priceToPrecision(symbol, tkTriggerPrice)),
|
|
28855
|
+
'workingType': tkWorkingType,
|
|
28856
|
+
'type': tpType,
|
|
28857
|
+
};
|
|
28858
|
+
const slPrice = this.safeString(takeProfit, 'price');
|
|
28859
|
+
if (slPrice !== undefined) {
|
|
28860
|
+
tpRequest['price'] = this.parseToNumeric(this.priceToPrecision(symbol, slPrice));
|
|
28861
|
+
}
|
|
28862
|
+
const tkQuantity = this.safeString(takeProfit, 'quantity', amount);
|
|
28863
|
+
tpRequest['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, tkQuantity));
|
|
28864
|
+
request['takeProfit'] = this.json(tpRequest);
|
|
28865
|
+
}
|
|
28866
|
+
}
|
|
28821
28867
|
let positionSide = undefined;
|
|
28822
28868
|
if (reduceOnly) {
|
|
28823
28869
|
positionSide = (side === 'buy') ? 'SHORT' : 'LONG';
|
|
@@ -28827,7 +28873,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28827
28873
|
}
|
|
28828
28874
|
request['positionSide'] = positionSide;
|
|
28829
28875
|
request['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, amount));
|
|
28830
|
-
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent']);
|
|
28876
|
+
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'takeProfit', 'stopLoss']);
|
|
28831
28877
|
}
|
|
28832
28878
|
return this.extend(request, params);
|
|
28833
28879
|
}
|
|
@@ -28837,6 +28883,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28837
28883
|
* @name bingx#createOrder
|
|
28838
28884
|
* @description create a trade order
|
|
28839
28885
|
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Trade%20order
|
|
28886
|
+
* @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Create%20an%20Order
|
|
28840
28887
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
28841
28888
|
* @param {string} type 'market' or 'limit'
|
|
28842
28889
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -28852,6 +28899,10 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28852
28899
|
* @param {float} [params.cost] the quote quantity that can be used as an alternative for the amount
|
|
28853
28900
|
* @param {float} [params.trailingAmount] *swap only* the quote amount to trail away from the current market price
|
|
28854
28901
|
* @param {float} [params.trailingPercent] *swap only* the percent to trail away from the current market price
|
|
28902
|
+
* @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered
|
|
28903
|
+
* @param {float} [params.takeProfit.triggerPrice] take profit trigger price
|
|
28904
|
+
* @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
|
|
28905
|
+
* @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
|
|
28855
28906
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
28856
28907
|
*/
|
|
28857
28908
|
await this.loadMarkets();
|
|
@@ -28902,6 +28953,9 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28902
28953
|
// }
|
|
28903
28954
|
// }
|
|
28904
28955
|
//
|
|
28956
|
+
if (typeof response === 'string') {
|
|
28957
|
+
response = JSON.parse(response);
|
|
28958
|
+
}
|
|
28905
28959
|
const data = this.safeValue(response, 'data', {});
|
|
28906
28960
|
const order = this.safeValue(data, 'order', data);
|
|
28907
28961
|
return this.parseOrder(order, market);
|
|
@@ -29106,6 +29160,24 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
29106
29160
|
// "orderType": "",
|
|
29107
29161
|
// "workingType": "MARK_PRICE"
|
|
29108
29162
|
// }
|
|
29163
|
+
// with tp and sl
|
|
29164
|
+
// {
|
|
29165
|
+
// orderId: 1741440894764281900,
|
|
29166
|
+
// symbol: 'LTC-USDT',
|
|
29167
|
+
// positionSide: 'LONG',
|
|
29168
|
+
// side: 'BUY',
|
|
29169
|
+
// type: 'MARKET',
|
|
29170
|
+
// price: 0,
|
|
29171
|
+
// quantity: 1,
|
|
29172
|
+
// stopPrice: 0,
|
|
29173
|
+
// workingType: 'MARK_PRICE',
|
|
29174
|
+
// clientOrderID: '',
|
|
29175
|
+
// timeInForce: 'GTC',
|
|
29176
|
+
// priceRate: 0,
|
|
29177
|
+
// stopLoss: '{"stopPrice":50,"workingType":"MARK_PRICE","type":"STOP_MARKET","quantity":1}',
|
|
29178
|
+
// takeProfit: '{"stopPrice":150,"workingType":"MARK_PRICE","type":"TAKE_PROFIT_MARKET","quantity":1}',
|
|
29179
|
+
// reduceOnly: false
|
|
29180
|
+
// }
|
|
29109
29181
|
//
|
|
29110
29182
|
const positionSide = this.safeString2(order, 'positionSide', 'ps');
|
|
29111
29183
|
const marketType = (positionSide === undefined) ? 'spot' : 'swap';
|
|
@@ -29144,6 +29216,30 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
29144
29216
|
'cost': _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(feeCost),
|
|
29145
29217
|
};
|
|
29146
29218
|
const clientOrderId = this.safeString2(order, 'clientOrderId', 'c');
|
|
29219
|
+
let stopLoss = this.safeValue(order, 'stopLoss');
|
|
29220
|
+
let stopLossPrice = undefined;
|
|
29221
|
+
if (stopLoss !== undefined) {
|
|
29222
|
+
stopLossPrice = this.safeNumber(stopLoss, 'stopLoss');
|
|
29223
|
+
}
|
|
29224
|
+
if ((stopLoss !== undefined) && (typeof stopLoss !== 'number')) {
|
|
29225
|
+
// stopLoss: '{"stopPrice":50,"workingType":"MARK_PRICE","type":"STOP_MARKET","quantity":1}',
|
|
29226
|
+
if (typeof stopLoss === 'string') {
|
|
29227
|
+
stopLoss = JSON.parse(stopLoss);
|
|
29228
|
+
}
|
|
29229
|
+
stopLossPrice = this.safeNumber(stopLoss, 'stopPrice');
|
|
29230
|
+
}
|
|
29231
|
+
let takeProfit = this.safeValue(order, 'takeProfit');
|
|
29232
|
+
let takeProfitPrice = undefined;
|
|
29233
|
+
if (takeProfit !== undefined) {
|
|
29234
|
+
takeProfitPrice = this.safeNumber(takeProfit, 'takeProfit');
|
|
29235
|
+
}
|
|
29236
|
+
if ((takeProfit !== undefined) && (typeof takeProfit !== 'number')) {
|
|
29237
|
+
// takeProfit: '{"stopPrice":150,"workingType":"MARK_PRICE","type":"TAKE_PROFIT_MARKET","quantity":1}',
|
|
29238
|
+
if (typeof takeProfit === 'string') {
|
|
29239
|
+
takeProfit = JSON.parse(takeProfit);
|
|
29240
|
+
}
|
|
29241
|
+
takeProfitPrice = this.safeNumber(takeProfit, 'stopPrice');
|
|
29242
|
+
}
|
|
29147
29243
|
return this.safeOrder({
|
|
29148
29244
|
'info': order,
|
|
29149
29245
|
'id': orderId,
|
|
@@ -29160,8 +29256,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
29160
29256
|
'price': price,
|
|
29161
29257
|
'stopPrice': this.safeNumber(order, 'stopPrice'),
|
|
29162
29258
|
'triggerPrice': this.safeNumber(order, 'stopPrice'),
|
|
29163
|
-
'stopLossPrice':
|
|
29164
|
-
'takeProfitPrice':
|
|
29259
|
+
'stopLossPrice': stopLossPrice,
|
|
29260
|
+
'takeProfitPrice': takeProfitPrice,
|
|
29165
29261
|
'average': average,
|
|
29166
29262
|
'cost': undefined,
|
|
29167
29263
|
'amount': amount,
|
|
@@ -29355,6 +29451,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
29355
29451
|
* @param {string[]} ids order ids
|
|
29356
29452
|
* @param {string} symbol unified market symbol, default is undefined
|
|
29357
29453
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
29454
|
+
* @param {string[]} [params.clientOrderIds] client order ids
|
|
29358
29455
|
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
29359
29456
|
*/
|
|
29360
29457
|
if (symbol === undefined) {
|
|
@@ -29365,19 +29462,27 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
29365
29462
|
const request = {
|
|
29366
29463
|
'symbol': market['id'],
|
|
29367
29464
|
};
|
|
29465
|
+
const clientOrderIds = this.safeValue(params, 'clientOrderIds');
|
|
29466
|
+
let idsToParse = ids;
|
|
29467
|
+
const areClientOrderIds = (clientOrderIds !== undefined);
|
|
29468
|
+
if (areClientOrderIds) {
|
|
29469
|
+
idsToParse = clientOrderIds;
|
|
29470
|
+
}
|
|
29368
29471
|
const parsedIds = [];
|
|
29369
|
-
for (let i = 0; i <
|
|
29370
|
-
const id =
|
|
29472
|
+
for (let i = 0; i < idsToParse.length; i++) {
|
|
29473
|
+
const id = idsToParse[i];
|
|
29371
29474
|
const stringId = id.toString();
|
|
29372
29475
|
parsedIds.push(stringId);
|
|
29373
29476
|
}
|
|
29374
29477
|
let response = undefined;
|
|
29375
29478
|
if (market['spot']) {
|
|
29376
|
-
|
|
29479
|
+
const spotReqKey = areClientOrderIds ? 'clientOrderIds' : 'orderIds';
|
|
29480
|
+
request[spotReqKey] = parsedIds.join(',');
|
|
29377
29481
|
response = await this.spotV1PrivatePostTradeCancelOrders(this.extend(request, params));
|
|
29378
29482
|
}
|
|
29379
29483
|
else {
|
|
29380
|
-
|
|
29484
|
+
const swapReqKey = areClientOrderIds ? 'ClientOrderIDList' : 'orderIdList';
|
|
29485
|
+
request[swapReqKey] = parsedIds;
|
|
29381
29486
|
response = await this.swapV2PrivateDeleteTradeBatchOrders(this.extend(request, params));
|
|
29382
29487
|
}
|
|
29383
29488
|
//
|
|
@@ -45231,8 +45336,8 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45231
45336
|
}
|
|
45232
45337
|
let marginMode = undefined;
|
|
45233
45338
|
[marginMode, params] = this.handleMarginModeAndParams('cancelOrders', params);
|
|
45234
|
-
const stop = this.
|
|
45235
|
-
params = this.omit(params, 'stop');
|
|
45339
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
45340
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
45236
45341
|
const orderIdList = [];
|
|
45237
45342
|
for (let i = 0; i < ids.length; i++) {
|
|
45238
45343
|
const individualId = ids[i];
|
|
@@ -45328,8 +45433,8 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45328
45433
|
const request = {
|
|
45329
45434
|
'symbol': market['id'],
|
|
45330
45435
|
};
|
|
45331
|
-
const stop = this.
|
|
45332
|
-
params = this.omit(params, 'stop');
|
|
45436
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
45437
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
45333
45438
|
let response = undefined;
|
|
45334
45439
|
if (market['spot']) {
|
|
45335
45440
|
if (marginMode !== undefined) {
|
|
@@ -50057,6 +50162,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
50057
50162
|
'contract/private/order-history': 10,
|
|
50058
50163
|
'contract/private/position': 10,
|
|
50059
50164
|
'contract/private/get-open-orders': 1.2,
|
|
50165
|
+
'contract/private/current-plan-order': 1.2,
|
|
50060
50166
|
'contract/private/trades': 10,
|
|
50061
50167
|
},
|
|
50062
50168
|
'post': {
|
|
@@ -52368,8 +52474,8 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52368
52474
|
response = await this.privatePostSpotV3CancelOrder(this.extend(request, params));
|
|
52369
52475
|
}
|
|
52370
52476
|
else {
|
|
52371
|
-
const stop = this.
|
|
52372
|
-
params = this.omit(params, ['stop']);
|
|
52477
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
52478
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
52373
52479
|
if (!stop) {
|
|
52374
52480
|
response = await this.privatePostContractPrivateCancelOrder(this.extend(request, params));
|
|
52375
52481
|
}
|
|
@@ -52539,6 +52645,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52539
52645
|
* @name bitmart#fetchOpenOrders
|
|
52540
52646
|
* @see https://developer-pro.bitmart.com/en/spot/#current-open-orders-v4-signed
|
|
52541
52647
|
* @see https://developer-pro.bitmart.com/en/futures/#get-all-open-orders-keyed
|
|
52648
|
+
* @see https://developer-pro.bitmart.com/en/futures/#get-all-current-plan-orders-keyed
|
|
52542
52649
|
* @description fetch all unfilled currently open orders
|
|
52543
52650
|
* @param {string} symbol unified market symbol
|
|
52544
52651
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
@@ -52550,6 +52657,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52550
52657
|
* @param {string} [params.order_state] *swap* the order state, 'all' or 'partially_filled', default is 'all'
|
|
52551
52658
|
* @param {string} [params.orderType] *swap only* 'limit', 'market', or 'trailing'
|
|
52552
52659
|
* @param {boolean} [params.trailing] *swap only* set to true if you want to fetch trailing orders
|
|
52660
|
+
* @param {boolean} [params.trigger] *swap only* set to true if you want to fetch trigger orders
|
|
52553
52661
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
52554
52662
|
*/
|
|
52555
52663
|
await this.loadMarkets();
|
|
@@ -52582,16 +52690,23 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52582
52690
|
response = await this.privatePostSpotV4QueryOpenOrders(this.extend(request, params));
|
|
52583
52691
|
}
|
|
52584
52692
|
else if (type === 'swap') {
|
|
52585
|
-
const
|
|
52586
|
-
|
|
52587
|
-
|
|
52588
|
-
|
|
52589
|
-
orderType = 'trailing';
|
|
52693
|
+
const isStop = this.safeValue2(params, 'stop', 'trigger');
|
|
52694
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
52695
|
+
if (isStop) {
|
|
52696
|
+
response = await this.privateGetContractPrivateCurrentPlanOrder(this.extend(request, params));
|
|
52590
52697
|
}
|
|
52591
|
-
|
|
52592
|
-
|
|
52698
|
+
else {
|
|
52699
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
52700
|
+
let orderType = this.safeString(params, 'orderType');
|
|
52701
|
+
params = this.omit(params, ['orderType', 'trailing']);
|
|
52702
|
+
if (trailing) {
|
|
52703
|
+
orderType = 'trailing';
|
|
52704
|
+
}
|
|
52705
|
+
if (orderType !== undefined) {
|
|
52706
|
+
request['type'] = orderType;
|
|
52707
|
+
}
|
|
52708
|
+
response = await this.privateGetContractPrivateGetOpenOrders(this.extend(request, params));
|
|
52593
52709
|
}
|
|
52594
|
-
response = await this.privateGetContractPrivateGetOpenOrders(this.extend(request, params));
|
|
52595
52710
|
}
|
|
52596
52711
|
else {
|
|
52597
52712
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOpenOrders() does not support ' + type + ' orders, only spot and swap orders are accepted');
|
|
@@ -78284,6 +78399,8 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
78284
78399
|
'131215': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
|
|
78285
78400
|
'131216': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError,
|
|
78286
78401
|
'131217': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError,
|
|
78402
|
+
'131231': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported,
|
|
78403
|
+
'131232': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported,
|
|
78287
78404
|
'131002': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
|
|
78288
78405
|
'131003': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError,
|
|
78289
78406
|
'131004': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError,
|
|
@@ -103594,7 +103711,16 @@ class coinsph extends _abstract_coinsph_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
103594
103711
|
const defaultMethod = 'publicGetOpenapiQuoteV1Ticker24hr';
|
|
103595
103712
|
const options = this.safeValue(this.options, 'fetchTickers', {});
|
|
103596
103713
|
const method = this.safeString(options, 'method', defaultMethod);
|
|
103597
|
-
|
|
103714
|
+
let tickers = undefined;
|
|
103715
|
+
if (method === 'publicGetOpenapiQuoteV1TickerPrice') {
|
|
103716
|
+
tickers = await this.publicGetOpenapiQuoteV1TickerPrice(this.extend(request, params));
|
|
103717
|
+
}
|
|
103718
|
+
else if (method === 'publicGetOpenapiQuoteV1TickerBookTicker') {
|
|
103719
|
+
tickers = await this.publicGetOpenapiQuoteV1TickerBookTicker(this.extend(request, params));
|
|
103720
|
+
}
|
|
103721
|
+
else {
|
|
103722
|
+
tickers = await this.publicGetOpenapiQuoteV1Ticker24hr(this.extend(request, params));
|
|
103723
|
+
}
|
|
103598
103724
|
return this.parseTickers(tickers, symbols, params);
|
|
103599
103725
|
}
|
|
103600
103726
|
async fetchTicker(symbol, params = {}) {
|
|
@@ -103614,7 +103740,16 @@ class coinsph extends _abstract_coinsph_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
103614
103740
|
const defaultMethod = 'publicGetOpenapiQuoteV1Ticker24hr';
|
|
103615
103741
|
const options = this.safeValue(this.options, 'fetchTicker', {});
|
|
103616
103742
|
const method = this.safeString(options, 'method', defaultMethod);
|
|
103617
|
-
|
|
103743
|
+
let ticker = undefined;
|
|
103744
|
+
if (method === 'publicGetOpenapiQuoteV1TickerPrice') {
|
|
103745
|
+
ticker = await this.publicGetOpenapiQuoteV1TickerPrice(this.extend(request, params));
|
|
103746
|
+
}
|
|
103747
|
+
else if (method === 'publicGetOpenapiQuoteV1TickerBookTicker') {
|
|
103748
|
+
ticker = await this.publicGetOpenapiQuoteV1TickerBookTicker(this.extend(request, params));
|
|
103749
|
+
}
|
|
103750
|
+
else {
|
|
103751
|
+
ticker = await this.publicGetOpenapiQuoteV1Ticker24hr(this.extend(request, params));
|
|
103752
|
+
}
|
|
103618
103753
|
return this.parseTicker(ticker, market);
|
|
103619
103754
|
}
|
|
103620
103755
|
parseTicker(ticker, market = undefined) {
|
|
@@ -143574,6 +143709,8 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
143574
143709
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
143575
143710
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
143576
143711
|
* @param {string} [params.timeInForce] supports 'IOC' and 'FOK'
|
|
143712
|
+
* @param {float} [params.trailingPercent] *contract only* the percent to trail away from the current market price
|
|
143713
|
+
* @param {float} [params.trailingTriggerPrice] *contract only* the price to trigger a trailing order, default uses the price argument
|
|
143577
143714
|
* @returns {object} request to be sent to the exchange
|
|
143578
143715
|
*/
|
|
143579
143716
|
const market = this.market(symbol);
|
|
@@ -143597,6 +143734,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
143597
143734
|
const triggerPrice = this.safeNumber2(params, 'stopPrice', 'trigger_price');
|
|
143598
143735
|
const stopLossTriggerPrice = this.safeNumber2(params, 'stopLossPrice', 'sl_trigger_price');
|
|
143599
143736
|
const takeProfitTriggerPrice = this.safeNumber2(params, 'takeProfitPrice', 'tp_trigger_price');
|
|
143737
|
+
const trailingPercent = this.safeString2(params, 'trailingPercent', 'callback_rate');
|
|
143738
|
+
const trailingTriggerPrice = this.safeNumber(params, 'trailingTriggerPrice', price);
|
|
143739
|
+
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
143600
143740
|
const isStop = triggerPrice !== undefined;
|
|
143601
143741
|
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
143602
143742
|
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
@@ -143624,6 +143764,12 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
143624
143764
|
}
|
|
143625
143765
|
}
|
|
143626
143766
|
}
|
|
143767
|
+
else if (isTrailingPercentOrder) {
|
|
143768
|
+
const trailingPercentString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringDiv(trailingPercent, '100');
|
|
143769
|
+
request['callback_rate'] = this.parseToNumeric(trailingPercentString);
|
|
143770
|
+
request['active_price'] = trailingTriggerPrice;
|
|
143771
|
+
request['order_price_type'] = this.safeString(params, 'order_price_type', 'formula_price');
|
|
143772
|
+
}
|
|
143627
143773
|
else {
|
|
143628
143774
|
const clientOrderId = this.safeInteger2(params, 'client_order_id', 'clientOrderId');
|
|
143629
143775
|
if (clientOrderId !== undefined) {
|
|
@@ -143635,7 +143781,7 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
143635
143781
|
}
|
|
143636
143782
|
}
|
|
143637
143783
|
if (!isStopLossTriggerOrder && !isTakeProfitTriggerOrder) {
|
|
143638
|
-
const leverRate = this.
|
|
143784
|
+
const leverRate = this.safeIntegerN(params, ['leverRate', 'lever_rate', 'leverage'], 1);
|
|
143639
143785
|
const reduceOnly = this.safeValue2(params, 'reduceOnly', 'reduce_only', false);
|
|
143640
143786
|
const openOrClose = (reduceOnly) ? 'close' : 'open';
|
|
143641
143787
|
const offset = this.safeString(params, 'offset', openOrClose);
|
|
@@ -143644,12 +143790,14 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
143644
143790
|
request['reduce_only'] = 1;
|
|
143645
143791
|
}
|
|
143646
143792
|
request['lever_rate'] = leverRate;
|
|
143647
|
-
|
|
143793
|
+
if (!isTrailingPercentOrder) {
|
|
143794
|
+
request['order_price_type'] = type;
|
|
143795
|
+
}
|
|
143648
143796
|
}
|
|
143649
143797
|
const broker = this.safeValue(this.options, 'broker', {});
|
|
143650
143798
|
const brokerId = this.safeString(broker, 'id');
|
|
143651
143799
|
request['channel_code'] = brokerId;
|
|
143652
|
-
params = this.omit(params, ['reduceOnly', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'triggerType', 'leverRate', 'timeInForce']);
|
|
143800
|
+
params = this.omit(params, ['reduceOnly', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'triggerType', 'leverRate', 'timeInForce', 'leverage', 'trailingPercent', 'trailingTriggerPrice']);
|
|
143653
143801
|
return this.extend(request, params);
|
|
143654
143802
|
}
|
|
143655
143803
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
@@ -143682,6 +143830,8 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
143682
143830
|
* @param {int} [params.leverRate] *contract only* required for all contract orders except tpsl, leverage greater than 20x requires prior approval of high-leverage agreement
|
|
143683
143831
|
* @param {string} [params.timeInForce] supports 'IOC' and 'FOK'
|
|
143684
143832
|
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
|
|
143833
|
+
* @param {float} [params.trailingPercent] *contract only* the percent to trail away from the current market price
|
|
143834
|
+
* @param {float} [params.trailingTriggerPrice] *contract only* the price to trigger a trailing order, default uses the price argument
|
|
143685
143835
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
143686
143836
|
*/
|
|
143687
143837
|
await this.loadMarkets();
|
|
@@ -143689,11 +143839,16 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
143689
143839
|
const triggerPrice = this.safeNumber2(params, 'stopPrice', 'trigger_price');
|
|
143690
143840
|
const stopLossTriggerPrice = this.safeNumber2(params, 'stopLossPrice', 'sl_trigger_price');
|
|
143691
143841
|
const takeProfitTriggerPrice = this.safeNumber2(params, 'takeProfitPrice', 'tp_trigger_price');
|
|
143842
|
+
const trailingPercent = this.safeNumber(params, 'trailingPercent');
|
|
143843
|
+
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
143692
143844
|
const isStop = triggerPrice !== undefined;
|
|
143693
143845
|
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
143694
143846
|
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
143695
143847
|
let response = undefined;
|
|
143696
143848
|
if (market['spot']) {
|
|
143849
|
+
if (isTrailingPercentOrder) {
|
|
143850
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' createOrder() does not support trailing orders for spot markets');
|
|
143851
|
+
}
|
|
143697
143852
|
const spotRequest = await this.createSpotOrderRequest(symbol, type, side, amount, price, params);
|
|
143698
143853
|
response = await this.spotPrivatePostV1OrderOrdersPlace(spotRequest);
|
|
143699
143854
|
}
|
|
@@ -143710,6 +143865,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
143710
143865
|
else if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
|
|
143711
143866
|
response = await this.contractPrivatePostLinearSwapApiV1SwapTpslOrder(contractRequest);
|
|
143712
143867
|
}
|
|
143868
|
+
else if (isTrailingPercentOrder) {
|
|
143869
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapTrackOrder(contractRequest);
|
|
143870
|
+
}
|
|
143713
143871
|
else {
|
|
143714
143872
|
response = await this.contractPrivatePostLinearSwapApiV1SwapOrder(contractRequest);
|
|
143715
143873
|
}
|
|
@@ -143721,6 +143879,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
143721
143879
|
else if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
|
|
143722
143880
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTpslOrder(contractRequest);
|
|
143723
143881
|
}
|
|
143882
|
+
else if (isTrailingPercentOrder) {
|
|
143883
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTrackOrder(contractRequest);
|
|
143884
|
+
}
|
|
143724
143885
|
else {
|
|
143725
143886
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossOrder(contractRequest);
|
|
143726
143887
|
}
|
|
@@ -143734,6 +143895,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
143734
143895
|
else if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
|
|
143735
143896
|
response = await this.contractPrivatePostSwapApiV1SwapTpslOrder(contractRequest);
|
|
143736
143897
|
}
|
|
143898
|
+
else if (isTrailingPercentOrder) {
|
|
143899
|
+
response = await this.contractPrivatePostSwapApiV1SwapTrackOrder(contractRequest);
|
|
143900
|
+
}
|
|
143737
143901
|
else {
|
|
143738
143902
|
response = await this.contractPrivatePostSwapApiV1SwapOrder(contractRequest);
|
|
143739
143903
|
}
|
|
@@ -143745,6 +143909,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
143745
143909
|
else if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
|
|
143746
143910
|
response = await this.contractPrivatePostApiV1ContractTpslOrder(contractRequest);
|
|
143747
143911
|
}
|
|
143912
|
+
else if (isTrailingPercentOrder) {
|
|
143913
|
+
response = await this.contractPrivatePostApiV1ContractTrackOrder(contractRequest);
|
|
143914
|
+
}
|
|
143748
143915
|
else {
|
|
143749
143916
|
response = await this.contractPrivatePostApiV1ContractOrder(contractRequest);
|
|
143750
143917
|
}
|
|
@@ -163999,7 +164166,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
163999
164166
|
* @see https://www.kucoin.com/docs/rest/futures-trading/orders/cancel-multiple-futures-stop-orders
|
|
164000
164167
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
164001
164168
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
164002
|
-
* @param {object} [params.
|
|
164169
|
+
* @param {object} [params.trigger] When true, all the trigger orders will be cancelled
|
|
164003
164170
|
* @returns Response from the exchange
|
|
164004
164171
|
*/
|
|
164005
164172
|
await this.loadMarkets();
|
|
@@ -164007,8 +164174,8 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
164007
164174
|
if (symbol !== undefined) {
|
|
164008
164175
|
request['symbol'] = this.marketId(symbol);
|
|
164009
164176
|
}
|
|
164010
|
-
const stop = this.
|
|
164011
|
-
params = this.omit(params, 'stop');
|
|
164177
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
164178
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
164012
164179
|
let response = undefined;
|
|
164013
164180
|
if (stop) {
|
|
164014
164181
|
response = await this.futuresPrivateDeleteStopOrders(this.extend(request, params));
|
|
@@ -164177,7 +164344,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
164177
164344
|
* @param {int} [since] timestamp in ms of the earliest order to retrieve
|
|
164178
164345
|
* @param {int} [limit] The maximum number of orders to retrieve
|
|
164179
164346
|
* @param {object} [params] exchange specific parameters
|
|
164180
|
-
* @param {bool} [params.
|
|
164347
|
+
* @param {bool} [params.trigger] set to true to retrieve untriggered stop orders
|
|
164181
164348
|
* @param {int} [params.until] End time in ms
|
|
164182
164349
|
* @param {string} [params.side] buy or sell
|
|
164183
164350
|
* @param {string} [params.type] limit or market
|
|
@@ -164190,9 +164357,9 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
164190
164357
|
if (paginate) {
|
|
164191
164358
|
return await this.fetchPaginatedCallDynamic('fetchOrdersByStatus', symbol, since, limit, params);
|
|
164192
164359
|
}
|
|
164193
|
-
const stop = this.
|
|
164360
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
164194
164361
|
const until = this.safeInteger2(params, 'until', 'till');
|
|
164195
|
-
params = this.omit(params, ['stop', 'until', 'till']);
|
|
164362
|
+
params = this.omit(params, ['stop', 'until', 'till', 'trigger']);
|
|
164196
164363
|
if (status === 'closed') {
|
|
164197
164364
|
status = 'done';
|
|
164198
164365
|
}
|
|
@@ -187402,7 +187569,7 @@ class okcoin extends _abstract_okcoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
187402
187569
|
// 'ordId': id,
|
|
187403
187570
|
};
|
|
187404
187571
|
const clientOrderId = this.safeString2(params, 'clOrdId', 'clientOrderId');
|
|
187405
|
-
const stop = this.
|
|
187572
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
187406
187573
|
if (stop) {
|
|
187407
187574
|
if (clientOrderId !== undefined) {
|
|
187408
187575
|
request['algoClOrdId'] = clientOrderId;
|
|
@@ -187419,7 +187586,7 @@ class okcoin extends _abstract_okcoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
187419
187586
|
request['ordId'] = id;
|
|
187420
187587
|
}
|
|
187421
187588
|
}
|
|
187422
|
-
const query = this.omit(params, ['clientOrderId', 'stop']);
|
|
187589
|
+
const query = this.omit(params, ['clientOrderId', 'stop', 'trigger']);
|
|
187423
187590
|
let response = undefined;
|
|
187424
187591
|
if (stop) {
|
|
187425
187592
|
response = await this.privateGetTradeOrderAlgo(this.extend(request, query));
|
|
@@ -191585,12 +191752,13 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
191585
191752
|
* @param {string} id order id
|
|
191586
191753
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
191587
191754
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
191755
|
+
* @param {boolean} [params.trigger] true if trigger orders
|
|
191588
191756
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
191589
191757
|
*/
|
|
191590
191758
|
if (symbol === undefined) {
|
|
191591
191759
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
191592
191760
|
}
|
|
191593
|
-
const stop = this.
|
|
191761
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
191594
191762
|
if (stop) {
|
|
191595
191763
|
const orderInner = await this.cancelOrders([id], symbol, params);
|
|
191596
191764
|
return this.safeValue(orderInner, 0);
|
|
@@ -191962,6 +192130,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
191962
192130
|
* @param {string} id the order id
|
|
191963
192131
|
* @param {string} symbol unified market symbol
|
|
191964
192132
|
* @param {object} [params] extra and exchange specific parameters
|
|
192133
|
+
* @param {boolean} [params.trigger] true if fetching trigger orders
|
|
191965
192134
|
* @returns [an order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
191966
192135
|
*/
|
|
191967
192136
|
if (symbol === undefined) {
|
|
@@ -191979,7 +192148,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
191979
192148
|
const options = this.safeValue(this.options, 'fetchOrder', {});
|
|
191980
192149
|
const defaultMethod = this.safeString(options, 'method', 'privateGetTradeOrder');
|
|
191981
192150
|
let method = this.safeString(params, 'method', defaultMethod);
|
|
191982
|
-
const stop = this.
|
|
192151
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
191983
192152
|
if (stop) {
|
|
191984
192153
|
method = 'privateGetTradeOrderAlgo';
|
|
191985
192154
|
if (clientOrderId !== undefined) {
|
|
@@ -191997,7 +192166,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
191997
192166
|
request['ordId'] = id;
|
|
191998
192167
|
}
|
|
191999
192168
|
}
|
|
192000
|
-
const query = this.omit(params, ['method', 'clOrdId', 'clientOrderId', 'stop']);
|
|
192169
|
+
const query = this.omit(params, ['method', 'clOrdId', 'clientOrderId', 'stop', 'trigger']);
|
|
192001
192170
|
let response = undefined;
|
|
192002
192171
|
if (method === 'privateGetTradeOrderAlgo') {
|
|
192003
192172
|
response = await this.privateGetTradeOrderAlgo(this.extend(request, query));
|
|
@@ -192153,7 +192322,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
192153
192322
|
const defaultMethod = this.safeString(options, 'method', 'privateGetTradeOrdersPending');
|
|
192154
192323
|
let method = this.safeString(params, 'method', defaultMethod);
|
|
192155
192324
|
const ordType = this.safeString(params, 'ordType');
|
|
192156
|
-
const stop = this.
|
|
192325
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
192157
192326
|
if (stop || (ordType in algoOrderTypes)) {
|
|
192158
192327
|
method = 'privateGetTradeOrdersAlgoPending';
|
|
192159
192328
|
if (stop) {
|
|
@@ -192162,7 +192331,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
192162
192331
|
}
|
|
192163
192332
|
}
|
|
192164
192333
|
}
|
|
192165
|
-
const query = this.omit(params, ['method', 'stop']);
|
|
192334
|
+
const query = this.omit(params, ['method', 'stop', 'trigger']);
|
|
192166
192335
|
let response = undefined;
|
|
192167
192336
|
if (method === 'privateGetTradeOrdersAlgoPending') {
|
|
192168
192337
|
response = await this.privateGetTradeOrdersAlgoPending(this.extend(request, query));
|
|
@@ -192315,7 +192484,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
192315
192484
|
const defaultMethod = this.safeString(options, 'method', 'privateGetTradeOrdersHistory');
|
|
192316
192485
|
let method = this.safeString(params, 'method', defaultMethod);
|
|
192317
192486
|
const ordType = this.safeString(params, 'ordType');
|
|
192318
|
-
const stop = this.
|
|
192487
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
192319
192488
|
if (stop || (ordType in algoOrderTypes)) {
|
|
192320
192489
|
method = 'privateGetTradeOrdersAlgoHistory';
|
|
192321
192490
|
const algoId = this.safeString(params, 'algoId');
|
|
@@ -192340,7 +192509,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
192340
192509
|
query = this.omit(query, ['until', 'till']);
|
|
192341
192510
|
}
|
|
192342
192511
|
}
|
|
192343
|
-
const send = this.omit(query, ['method', 'stop', 'ordType']);
|
|
192512
|
+
const send = this.omit(query, ['method', 'stop', 'ordType', 'trigger']);
|
|
192344
192513
|
let response = undefined;
|
|
192345
192514
|
if (method === 'privateGetTradeOrdersAlgoHistory') {
|
|
192346
192515
|
response = await this.privateGetTradeOrdersAlgoHistory(this.extend(request, send));
|
|
@@ -192457,6 +192626,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
192457
192626
|
* @description fetches information on multiple closed orders made by the user
|
|
192458
192627
|
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-7-days
|
|
192459
192628
|
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-history
|
|
192629
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-3-months
|
|
192460
192630
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
192461
192631
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
192462
192632
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -192466,6 +192636,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
192466
192636
|
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
192467
192637
|
* @param {int} [params.until] timestamp in ms to fetch orders for
|
|
192468
192638
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
192639
|
+
* @param {string} [params.method] method to be used, either 'privateGetTradeOrdersHistory', 'privateGetTradeOrdersHistoryArchive' or 'privateGetTradeOrdersAlgoHistory' default is 'privateGetTradeOrdersHistory'
|
|
192469
192640
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
192470
192641
|
*/
|
|
192471
192642
|
await this.loadMarkets();
|
|
@@ -192502,7 +192673,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
192502
192673
|
const defaultMethod = this.safeString(options, 'method', 'privateGetTradeOrdersHistory');
|
|
192503
192674
|
let method = this.safeString(params, 'method', defaultMethod);
|
|
192504
192675
|
const ordType = this.safeString(params, 'ordType');
|
|
192505
|
-
const stop = this.
|
|
192676
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
192506
192677
|
if (stop || (ordType in algoOrderTypes)) {
|
|
192507
192678
|
method = 'privateGetTradeOrdersAlgoHistory';
|
|
192508
192679
|
if (stop) {
|
|
@@ -192523,11 +192694,14 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
192523
192694
|
}
|
|
192524
192695
|
request['state'] = 'filled';
|
|
192525
192696
|
}
|
|
192526
|
-
const send = this.omit(query, ['method', 'stop']);
|
|
192697
|
+
const send = this.omit(query, ['method', 'stop', 'trigger']);
|
|
192527
192698
|
let response = undefined;
|
|
192528
192699
|
if (method === 'privateGetTradeOrdersAlgoHistory') {
|
|
192529
192700
|
response = await this.privateGetTradeOrdersAlgoHistory(this.extend(request, send));
|
|
192530
192701
|
}
|
|
192702
|
+
else if (method === 'privateGetTradeOrdersHistoryArchive') {
|
|
192703
|
+
response = await this.privateGetTradeOrdersHistoryArchive(this.extend(request, send));
|
|
192704
|
+
}
|
|
192531
192705
|
else {
|
|
192532
192706
|
response = await this.privateGetTradeOrdersHistory(this.extend(request, send));
|
|
192533
192707
|
}
|
|
@@ -199191,7 +199365,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
199191
199365
|
if (type === 'spot') {
|
|
199192
199366
|
response = await this.v1GetMdSpotTicker24hrAll(query);
|
|
199193
199367
|
}
|
|
199194
|
-
else if (subType === 'inverse' || market
|
|
199368
|
+
else if (subType === 'inverse' || this.safeString(market, 'settle') === 'USD') {
|
|
199195
199369
|
response = await this.v1GetMdTicker24hrAll(query);
|
|
199196
199370
|
}
|
|
199197
199371
|
else {
|
|
@@ -211238,6 +211412,7 @@ class bingx extends _bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
211238
211412
|
},
|
|
211239
211413
|
},
|
|
211240
211414
|
'options': {
|
|
211415
|
+
'listenKeyRefreshRate': 3540000,
|
|
211241
211416
|
'ws': {
|
|
211242
211417
|
'gunzip': true,
|
|
211243
211418
|
},
|
|
@@ -211835,7 +212010,7 @@ class bingx extends _bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
211835
212010
|
const lastAuthenticatedTime = this.safeInteger(this.options, 'lastAuthenticatedTime', 0);
|
|
211836
212011
|
const listenKeyRefreshRate = this.safeInteger(this.options, 'listenKeyRefreshRate', 3600000); // 1 hour
|
|
211837
212012
|
if (time - lastAuthenticatedTime > listenKeyRefreshRate) {
|
|
211838
|
-
const response = await this.
|
|
212013
|
+
const response = await this.userAuthPrivatePutUserDataStream({ 'listenKey': listenKey }); // extend the expiry
|
|
211839
212014
|
this.options['listenKey'] = this.safeString(response, 'listenKey');
|
|
211840
212015
|
this.options['lastAuthenticatedTime'] = time;
|
|
211841
212016
|
}
|
|
@@ -223289,7 +223464,7 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
223289
223464
|
*/
|
|
223290
223465
|
await this.loadMarkets();
|
|
223291
223466
|
symbols = this.marketSymbols(symbols, undefined, false);
|
|
223292
|
-
const
|
|
223467
|
+
const messageHashes = [];
|
|
223293
223468
|
const url = this.getUrlByMarketType(symbols[0], false, params);
|
|
223294
223469
|
params = this.cleanParams(params);
|
|
223295
223470
|
const options = this.safeValue(this.options, 'watchTickers', {});
|
|
@@ -223299,8 +223474,9 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
223299
223474
|
for (let i = 0; i < marketIds.length; i++) {
|
|
223300
223475
|
const marketId = marketIds[i];
|
|
223301
223476
|
topics.push(topic + '.' + marketId);
|
|
223477
|
+
messageHashes.push('ticker:' + symbols[i]);
|
|
223302
223478
|
}
|
|
223303
|
-
const ticker = await this.watchTopics(url,
|
|
223479
|
+
const ticker = await this.watchTopics(url, messageHashes, topics, params);
|
|
223304
223480
|
if (this.newUpdates) {
|
|
223305
223481
|
return ticker;
|
|
223306
223482
|
}
|
|
@@ -223436,17 +223612,6 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
223436
223612
|
this.tickers[symbol] = parsed;
|
|
223437
223613
|
const messageHash = 'ticker:' + symbol;
|
|
223438
223614
|
client.resolve(this.tickers[symbol], messageHash);
|
|
223439
|
-
// watchTickers part
|
|
223440
|
-
const messageHashes = this.findMessageHashes(client, 'tickers::');
|
|
223441
|
-
for (let i = 0; i < messageHashes.length; i++) {
|
|
223442
|
-
const messageHashTicker = messageHashes[i];
|
|
223443
|
-
const parts = messageHashTicker.split('::');
|
|
223444
|
-
const symbolsString = parts[1];
|
|
223445
|
-
const symbols = symbolsString.split(',');
|
|
223446
|
-
if (this.inArray(parsed['symbol'], symbols)) {
|
|
223447
|
-
client.resolve(parsed, messageHashTicker);
|
|
223448
|
-
}
|
|
223449
|
-
}
|
|
223450
223615
|
}
|
|
223451
223616
|
async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
223452
223617
|
/**
|
|
@@ -291423,7 +291588,7 @@ SOFTWARE.
|
|
|
291423
291588
|
|
|
291424
291589
|
//-----------------------------------------------------------------------------
|
|
291425
291590
|
// this is updated by vss.js when building
|
|
291426
|
-
const version = '4.2.
|
|
291591
|
+
const version = '4.2.4';
|
|
291427
291592
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
291428
291593
|
//-----------------------------------------------------------------------------
|
|
291429
291594
|
|