ccxt 4.2.1 → 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/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.1';
172
+ const version = '4.2.3';
173
173
  Exchange["default"].ccxtVersion = version;
174
174
  const exchanges = {
175
175
  'ace': ace,
@@ -50,7 +50,7 @@ class alpaca extends alpaca$1 {
50
50
  'closeAllPositions': false,
51
51
  'closePosition': false,
52
52
  'createOrder': true,
53
- 'fetchBalance': true,
53
+ 'fetchBalance': false,
54
54
  'fetchBidsAsks': false,
55
55
  'fetchClosedOrders': true,
56
56
  'fetchCurrencies': false,
@@ -1592,6 +1592,7 @@ class binance extends binance$1 {
1592
1592
  '-4046': errors.AuthenticationError,
1593
1593
  '-4047': errors.BadRequest,
1594
1594
  '-4054': errors.BadRequest,
1595
+ '-4164': errors.InvalidOrder,
1595
1596
  '-5001': errors.BadRequest,
1596
1597
  '-5002': errors.InsufficientFunds,
1597
1598
  '-5003': errors.InsufficientFunds,
@@ -117,6 +117,7 @@ class bingx extends bingx$1 {
117
117
  'trade/query': 3,
118
118
  'trade/openOrders': 3,
119
119
  'trade/historyOrders': 3,
120
+ 'user/commissionRate': 3,
120
121
  'account/balance': 3,
121
122
  },
122
123
  'post': {
@@ -124,6 +125,7 @@ class bingx extends bingx$1 {
124
125
  'trade/cancel': 3,
125
126
  'trade/batchOrders': 3,
126
127
  'trade/cancelOrders': 3,
128
+ 'trade/cancelOpenOrders': 3,
127
129
  },
128
130
  },
129
131
  },
@@ -275,6 +277,9 @@ class bingx extends bingx$1 {
275
277
  'post': {
276
278
  'userDataStream': 1,
277
279
  },
280
+ 'put': {
281
+ 'userDataStream': 1,
282
+ },
278
283
  },
279
284
  },
280
285
  },
@@ -1314,22 +1319,30 @@ class bingx extends bingx$1 {
1314
1319
  // }
1315
1320
  //
1316
1321
  const marketId = this.safeString(ticker, 'symbol');
1317
- // const change = this.safeString (ticker, 'priceChange'); // this is not ccxt's change because it does high-low instead of last-open
1318
1322
  const lastQty = this.safeString(ticker, 'lastQty');
1319
1323
  // in spot markets, lastQty is not present
1320
1324
  // it's (bad, but) the only way we can check the tickers origin
1321
1325
  const type = (lastQty === undefined) ? 'spot' : 'swap';
1322
- const symbol = this.safeSymbol(marketId, market, undefined, type);
1326
+ market = this.safeMarket(marketId, market, undefined, type);
1327
+ const symbol = market['symbol'];
1323
1328
  const open = this.safeString(ticker, 'openPrice');
1324
1329
  const high = this.safeString(ticker, 'highPrice');
1325
1330
  const low = this.safeString(ticker, 'lowPrice');
1326
1331
  const close = this.safeString(ticker, 'lastPrice');
1327
1332
  const quoteVolume = this.safeString(ticker, 'quoteVolume');
1328
1333
  const baseVolume = this.safeString(ticker, 'volume');
1334
+ let percentage = undefined;
1335
+ let change = undefined;
1336
+ if (market['swap']) {
1337
+ // right now only swap uses the 24h change, spot will be added soon
1338
+ percentage = this.safeString(ticker, 'priceChangePercent');
1339
+ change = this.safeString(ticker, 'priceChange');
1340
+ }
1329
1341
  // let percentage = this.safeString (ticker, 'priceChangePercent');
1330
1342
  // if (percentage !== undefined) {
1331
1343
  // percentage = percentage.replace ('%', '');
1332
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
1333
1346
  const ts = this.safeInteger(ticker, 'closeTime');
1334
1347
  const datetime = this.iso8601(ts);
1335
1348
  const bid = this.safeString(ticker, 'bidPrice');
@@ -1351,8 +1364,8 @@ class bingx extends bingx$1 {
1351
1364
  'close': close,
1352
1365
  'last': undefined,
1353
1366
  'previousClose': undefined,
1354
- 'change': undefined,
1355
- 'percentage': undefined,
1367
+ 'change': change,
1368
+ 'percentage': percentage,
1356
1369
  'average': undefined,
1357
1370
  'baseVolume': baseVolume,
1358
1371
  'quoteVolume': quoteVolume,
@@ -1708,6 +1721,10 @@ class bingx extends bingx$1 {
1708
1721
  const isTrailingAmountOrder = trailingAmount !== undefined;
1709
1722
  const isTrailingPercentOrder = trailingPercent !== undefined;
1710
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;
1711
1728
  if (((type === 'LIMIT') || (type === 'TRIGGER_LIMIT') || (type === 'STOP') || (type === 'TAKE_PROFIT')) && !isTrailing) {
1712
1729
  request['price'] = this.parseToNumeric(this.priceToPrecision(symbol, price));
1713
1730
  }
@@ -1753,6 +1770,42 @@ class bingx extends bingx$1 {
1753
1770
  request['priceRate'] = this.parseToNumeric(requestTrailingPercent);
1754
1771
  }
1755
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
+ }
1756
1809
  let positionSide = undefined;
1757
1810
  if (reduceOnly) {
1758
1811
  positionSide = (side === 'buy') ? 'SHORT' : 'LONG';
@@ -1762,7 +1815,7 @@ class bingx extends bingx$1 {
1762
1815
  }
1763
1816
  request['positionSide'] = positionSide;
1764
1817
  request['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, amount));
1765
- params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent']);
1818
+ params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'takeProfit', 'stopLoss']);
1766
1819
  }
1767
1820
  return this.extend(request, params);
1768
1821
  }
@@ -1772,6 +1825,7 @@ class bingx extends bingx$1 {
1772
1825
  * @name bingx#createOrder
1773
1826
  * @description create a trade order
1774
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
1775
1829
  * @param {string} symbol unified symbol of the market to create an order in
1776
1830
  * @param {string} type 'market' or 'limit'
1777
1831
  * @param {string} side 'buy' or 'sell'
@@ -1787,6 +1841,10 @@ class bingx extends bingx$1 {
1787
1841
  * @param {float} [params.cost] the quote quantity that can be used as an alternative for the amount
1788
1842
  * @param {float} [params.trailingAmount] *swap only* the quote amount to trail away from the current market price
1789
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
1790
1848
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1791
1849
  */
1792
1850
  await this.loadMarkets();
@@ -1837,6 +1895,9 @@ class bingx extends bingx$1 {
1837
1895
  // }
1838
1896
  // }
1839
1897
  //
1898
+ if (typeof response === 'string') {
1899
+ response = JSON.parse(response);
1900
+ }
1840
1901
  const data = this.safeValue(response, 'data', {});
1841
1902
  const order = this.safeValue(data, 'order', data);
1842
1903
  return this.parseOrder(order, market);
@@ -2041,6 +2102,24 @@ class bingx extends bingx$1 {
2041
2102
  // "orderType": "",
2042
2103
  // "workingType": "MARK_PRICE"
2043
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
+ // }
2044
2123
  //
2045
2124
  const positionSide = this.safeString2(order, 'positionSide', 'ps');
2046
2125
  const marketType = (positionSide === undefined) ? 'spot' : 'swap';
@@ -2079,6 +2158,30 @@ class bingx extends bingx$1 {
2079
2158
  'cost': Precise["default"].stringAbs(feeCost),
2080
2159
  };
2081
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
+ }
2082
2185
  return this.safeOrder({
2083
2186
  'info': order,
2084
2187
  'id': orderId,
@@ -2095,8 +2198,8 @@ class bingx extends bingx$1 {
2095
2198
  'price': price,
2096
2199
  'stopPrice': this.safeNumber(order, 'stopPrice'),
2097
2200
  'triggerPrice': this.safeNumber(order, 'stopPrice'),
2098
- 'stopLossPrice': this.safeNumber(order, 'stopLoss'),
2099
- 'takeProfitPrice': this.safeNumber(order, 'takeProfit'),
2201
+ 'stopLossPrice': stopLossPrice,
2202
+ 'takeProfitPrice': takeProfitPrice,
2100
2203
  'average': average,
2101
2204
  'cost': undefined,
2102
2205
  'amount': amount,
@@ -2203,6 +2306,7 @@ class bingx extends bingx$1 {
2203
2306
  * @method
2204
2307
  * @name bingx#cancelAllOrders
2205
2308
  * @description cancel all open orders
2309
+ * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel%20orders%20by%20symbol
2206
2310
  * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Cancel%20All%20Orders
2207
2311
  * @param {string} [symbol] unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
2208
2312
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2213,42 +2317,70 @@ class bingx extends bingx$1 {
2213
2317
  }
2214
2318
  await this.loadMarkets();
2215
2319
  const market = this.market(symbol);
2216
- if (market['type'] !== 'swap') {
2217
- throw new errors.BadRequest(this.id + ' cancelAllOrders is only supported for swap markets.');
2218
- }
2219
2320
  const request = {
2220
2321
  'symbol': market['id'],
2221
2322
  };
2222
- const response = await this.swapV2PrivateDeleteTradeAllOpenOrders(this.extend(request, params));
2223
- //
2224
- // {
2225
- // "code": 0,
2226
- // "msg": "",
2227
- // "data": {
2228
- // "success": [
2229
- // {
2230
- // "symbol": "LINK-USDT",
2231
- // "orderId": 1597783835095859200,
2232
- // "side": "BUY",
2233
- // "positionSide": "LONG",
2234
- // "type": "TRIGGER_LIMIT",
2235
- // "origQty": "5.0",
2236
- // "price": "9.0000",
2237
- // "executedQty": "0.0",
2238
- // "avgPrice": "0.0000",
2239
- // "cumQuote": "0",
2240
- // "stopPrice": "9.5000",
2241
- // "profit": "",
2242
- // "commission": "",
2243
- // "status": "NEW",
2244
- // "time": 1669776326000,
2245
- // "updateTime": 1669776326000
2246
- // }
2247
- // ],
2248
- // "failed": null
2249
- // }
2250
- // }
2251
- //
2323
+ let response = undefined;
2324
+ if (market['spot']) {
2325
+ response = await this.spotV1PrivatePostTradeCancelOpenOrders(this.extend(request, params));
2326
+ //
2327
+ // {
2328
+ // "code": 0,
2329
+ // "msg": "",
2330
+ // "debugMsg": "",
2331
+ // "data": {
2332
+ // "orders": [{
2333
+ // "symbol": "ADA-USDT",
2334
+ // "orderId": 1740659971369992192,
2335
+ // "transactTime": 1703840651730,
2336
+ // "price": 5,
2337
+ // "stopPrice": 0,
2338
+ // "origQty": 10,
2339
+ // "executedQty": 0,
2340
+ // "cummulativeQuoteQty": 0,
2341
+ // "status": "CANCELED",
2342
+ // "type": "LIMIT",
2343
+ // "side": "SELL"
2344
+ // }]
2345
+ // }
2346
+ // }
2347
+ //
2348
+ }
2349
+ else if (market['swap']) {
2350
+ response = await this.swapV2PrivateDeleteTradeAllOpenOrders(this.extend(request, params));
2351
+ //
2352
+ // {
2353
+ // "code": 0,
2354
+ // "msg": "",
2355
+ // "data": {
2356
+ // "success": [
2357
+ // {
2358
+ // "symbol": "LINK-USDT",
2359
+ // "orderId": 1597783835095859200,
2360
+ // "side": "BUY",
2361
+ // "positionSide": "LONG",
2362
+ // "type": "TRIGGER_LIMIT",
2363
+ // "origQty": "5.0",
2364
+ // "price": "9.0000",
2365
+ // "executedQty": "0.0",
2366
+ // "avgPrice": "0.0000",
2367
+ // "cumQuote": "0",
2368
+ // "stopPrice": "9.5000",
2369
+ // "profit": "",
2370
+ // "commission": "",
2371
+ // "status": "NEW",
2372
+ // "time": 1669776326000,
2373
+ // "updateTime": 1669776326000
2374
+ // }
2375
+ // ],
2376
+ // "failed": null
2377
+ // }
2378
+ // }
2379
+ //
2380
+ }
2381
+ else {
2382
+ throw new errors.BadRequest(this.id + ' cancelAllOrders is only supported for spot and swap markets.');
2383
+ }
2252
2384
  return response;
2253
2385
  }
2254
2386
  async cancelOrders(ids, symbol = undefined, params = {}) {
@@ -2261,6 +2393,7 @@ class bingx extends bingx$1 {
2261
2393
  * @param {string[]} ids order ids
2262
2394
  * @param {string} symbol unified market symbol, default is undefined
2263
2395
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2396
+ * @param {string[]} [params.clientOrderIds] client order ids
2264
2397
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
2265
2398
  */
2266
2399
  if (symbol === undefined) {
@@ -2271,19 +2404,27 @@ class bingx extends bingx$1 {
2271
2404
  const request = {
2272
2405
  'symbol': market['id'],
2273
2406
  };
2407
+ const clientOrderIds = this.safeValue(params, 'clientOrderIds');
2408
+ let idsToParse = ids;
2409
+ const areClientOrderIds = (clientOrderIds !== undefined);
2410
+ if (areClientOrderIds) {
2411
+ idsToParse = clientOrderIds;
2412
+ }
2274
2413
  const parsedIds = [];
2275
- for (let i = 0; i < ids.length; i++) {
2276
- const id = ids[i];
2414
+ for (let i = 0; i < idsToParse.length; i++) {
2415
+ const id = idsToParse[i];
2277
2416
  const stringId = id.toString();
2278
2417
  parsedIds.push(stringId);
2279
2418
  }
2280
2419
  let response = undefined;
2281
2420
  if (market['spot']) {
2282
- request['orderIds'] = parsedIds.join(',');
2421
+ const spotReqKey = areClientOrderIds ? 'clientOrderIds' : 'orderIds';
2422
+ request[spotReqKey] = parsedIds.join(',');
2283
2423
  response = await this.spotV1PrivatePostTradeCancelOrders(this.extend(request, params));
2284
2424
  }
2285
2425
  else {
2286
- request['orderIdList'] = parsedIds;
2426
+ const swapReqKey = areClientOrderIds ? 'ClientOrderIDList' : 'orderIdList';
2427
+ request[swapReqKey] = parsedIds;
2287
2428
  response = await this.swapV2PrivateDeleteTradeBatchOrders(this.extend(request, params));
2288
2429
  }
2289
2430
  //
@@ -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.safeValue(params, 'stop');
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.safeValue(params, 'stop');
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) {
@@ -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.safeValue(params, 'stop');
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
  }
@@ -1332,6 +1332,12 @@ class bitstamp extends bitstamp$1 {
1332
1332
  * @method
1333
1333
  * @name bitstamp#createOrder
1334
1334
  * @description create a trade order
1335
+ * @see https://www.bitstamp.net/api/#tag/Orders/operation/OpenInstantBuyOrder
1336
+ * @see https://www.bitstamp.net/api/#tag/Orders/operation/OpenMarketBuyOrder
1337
+ * @see https://www.bitstamp.net/api/#tag/Orders/operation/OpenLimitBuyOrder
1338
+ * @see https://www.bitstamp.net/api/#tag/Orders/operation/OpenInstantSellOrder
1339
+ * @see https://www.bitstamp.net/api/#tag/Orders/operation/OpenMarketSellOrder
1340
+ * @see https://www.bitstamp.net/api/#tag/Orders/operation/OpenLimitSellOrder
1335
1341
  * @param {string} symbol unified symbol of the market to create an order in
1336
1342
  * @param {string} type 'market' or 'limit'
1337
1343
  * @param {string} side 'buy' or 'sell'
@@ -1342,27 +1348,42 @@ class bitstamp extends bitstamp$1 {
1342
1348
  */
1343
1349
  await this.loadMarkets();
1344
1350
  const market = this.market(symbol);
1345
- let method = 'privatePost' + this.capitalize(side);
1346
1351
  const request = {
1347
1352
  'pair': market['id'],
1348
1353
  'amount': this.amountToPrecision(symbol, amount),
1349
1354
  };
1355
+ const clientOrderId = this.safeString2(params, 'client_order_id', 'clientOrderId');
1356
+ if (clientOrderId !== undefined) {
1357
+ request['client_order_id'] = clientOrderId;
1358
+ params = this.omit(params, ['clientOrderId']);
1359
+ }
1360
+ let response = undefined;
1361
+ const capitalizedSide = this.capitalize(side);
1350
1362
  if (type === 'market') {
1351
- method += 'Market';
1363
+ if (capitalizedSide === 'Buy') {
1364
+ response = await this.privatePostBuyMarketPair(this.extend(request, params));
1365
+ }
1366
+ else {
1367
+ response = await this.privatePostSellMarketPair(this.extend(request, params));
1368
+ }
1352
1369
  }
1353
1370
  else if (type === 'instant') {
1354
- method += 'Instant';
1371
+ if (capitalizedSide === 'Buy') {
1372
+ response = await this.privatePostBuyInstantPair(this.extend(request, params));
1373
+ }
1374
+ else {
1375
+ response = await this.privatePostSellInstantPair(this.extend(request, params));
1376
+ }
1355
1377
  }
1356
1378
  else {
1357
1379
  request['price'] = this.priceToPrecision(symbol, price);
1380
+ if (capitalizedSide === 'Buy') {
1381
+ response = await this.privatePostBuyPair(this.extend(request, params));
1382
+ }
1383
+ else {
1384
+ response = await this.privatePostSellPair(this.extend(request, params));
1385
+ }
1358
1386
  }
1359
- method += 'Pair';
1360
- const clientOrderId = this.safeString2(params, 'client_order_id', 'clientOrderId');
1361
- if (clientOrderId !== undefined) {
1362
- request['client_order_id'] = clientOrderId;
1363
- params = this.omit(params, ['client_order_id', 'clientOrderId']);
1364
- }
1365
- const response = await this[method](this.extend(request, params));
1366
1387
  const order = this.parseOrder(response, market);
1367
1388
  order['type'] = type;
1368
1389
  return order;
@@ -1395,13 +1416,16 @@ class bitstamp extends bitstamp$1 {
1395
1416
  await this.loadMarkets();
1396
1417
  let market = undefined;
1397
1418
  const request = {};
1398
- let method = 'privatePostCancelAllOrders';
1419
+ let response = undefined;
1399
1420
  if (symbol !== undefined) {
1400
1421
  market = this.market(symbol);
1401
1422
  request['pair'] = market['id'];
1402
- method = 'privatePostCancelAllOrdersPair';
1423
+ response = await this.privatePostCancelAllOrdersPair(this.extend(request, params));
1424
+ }
1425
+ else {
1426
+ response = await this.privatePostCancelAllOrders(this.extend(request, params));
1403
1427
  }
1404
- return await this[method](this.extend(request, params));
1428
+ return response;
1405
1429
  }
1406
1430
  parseOrderStatus(status) {
1407
1431
  const statuses = {
@@ -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.stop] When true, all the trigger orders will be cancelled
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.safeValue(params, 'stop');
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.stop] set to true to retrieve untriggered stop orders
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.safeValue(params, 'stop');
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
  }
@@ -432,7 +432,13 @@ class lykke extends lykke$1 {
432
432
  };
433
433
  // publicGetTickers or publicGetPrices
434
434
  const method = this.safeString(this.options, 'fetchTickerMethod', 'publicGetTickers');
435
- const response = await this[method](this.extend(request, params));
435
+ let response = undefined;
436
+ if (method === 'publicGetPrices') {
437
+ response = await this.publicGetPrices(this.extend(request, params));
438
+ }
439
+ else {
440
+ response = await this.publicGetTickers(this.extend(request, params));
441
+ }
436
442
  const ticker = this.safeValue(response, 'payload', []);
437
443
  //
438
444
  // publicGetTickers
@@ -786,8 +792,13 @@ class lykke extends lykke$1 {
786
792
  if (type === 'limit') {
787
793
  query['price'] = parseFloat(this.priceToPrecision(market['symbol'], price));
788
794
  }
789
- const method = 'privatePostOrders' + this.capitalize(type);
790
- const result = await this[method](this.extend(query, params));
795
+ let result = undefined;
796
+ if (this.capitalize(type) === 'Market') {
797
+ result = await this.privatePostOrdersMarket(this.extend(query, params));
798
+ }
799
+ else {
800
+ result = await this.privatePostOrdersLimit(this.extend(query, params));
801
+ }
791
802
  //
792
803
  // market
793
804
  //
@@ -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.safeValue(params, 'stop');
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));