ccxt 4.3.23 → 4.3.27

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.
Files changed (49) hide show
  1. package/README.md +5 -5
  2. package/dist/cjs/ccxt.js +9 -6
  3. package/dist/cjs/src/base/Exchange.js +26 -27
  4. package/dist/cjs/src/base/functions/number.js +10 -5
  5. package/dist/cjs/src/bitrue.js +6 -1
  6. package/dist/cjs/src/coinbaseadvanced.js +17 -0
  7. package/dist/cjs/src/{coinbasepro.js → coinbaseexchange.js} +40 -40
  8. package/dist/cjs/src/coinex.js +81 -147
  9. package/dist/cjs/src/kraken.js +60 -7
  10. package/dist/cjs/src/kucoin.js +1 -0
  11. package/dist/cjs/src/phemex.js +18 -2
  12. package/dist/cjs/src/pro/binance.js +1 -1
  13. package/dist/cjs/src/pro/bitget.js +12 -3
  14. package/dist/cjs/src/pro/{coinbasepro.js → coinbaseexchange.js} +13 -13
  15. package/dist/cjs/src/pro/cryptocom.js +9 -7
  16. package/dist/cjs/src/pro/kraken.js +6 -4
  17. package/dist/cjs/src/pro/okx.js +1 -1
  18. package/js/ccxt.d.ts +11 -8
  19. package/js/ccxt.js +8 -6
  20. package/js/src/abstract/coinbaseadvanced.d.ts +97 -0
  21. package/js/src/abstract/coinbaseadvanced.js +11 -0
  22. package/js/src/base/Exchange.d.ts +4 -2
  23. package/js/src/base/Exchange.js +26 -27
  24. package/js/src/base/functions/number.js +10 -5
  25. package/js/src/bitrue.js +6 -1
  26. package/js/src/coinbaseadvanced.d.ts +4 -0
  27. package/js/src/coinbaseadvanced.js +18 -0
  28. package/js/src/{coinbasepro.d.ts → coinbaseexchange.d.ts} +3 -3
  29. package/js/src/{coinbasepro.js → coinbaseexchange.js} +39 -39
  30. package/js/src/coinex.d.ts +1 -1
  31. package/js/src/coinex.js +81 -147
  32. package/js/src/kraken.d.ts +3 -1
  33. package/js/src/kraken.js +60 -7
  34. package/js/src/kucoin.js +1 -0
  35. package/js/src/phemex.js +18 -2
  36. package/js/src/pro/binance.d.ts +1 -1
  37. package/js/src/pro/binance.js +1 -1
  38. package/js/src/pro/bitget.js +12 -3
  39. package/js/src/pro/{coinbasepro.d.ts → coinbaseexchange.d.ts} +2 -2
  40. package/js/src/pro/{coinbasepro.js → coinbaseexchange.js} +12 -12
  41. package/js/src/pro/cryptocom.js +9 -7
  42. package/js/src/pro/kraken.d.ts +1 -1
  43. package/js/src/pro/kraken.js +6 -4
  44. package/js/src/pro/okx.d.ts +1 -1
  45. package/js/src/pro/okx.js +1 -1
  46. package/package.json +1 -1
  47. /package/dist/cjs/src/abstract/{coinbasepro.js → coinbaseexchange.js} +0 -0
  48. /package/js/src/abstract/{coinbasepro.d.ts → coinbaseexchange.d.ts} +0 -0
  49. /package/js/src/abstract/{coinbasepro.js → coinbaseexchange.js} +0 -0
package/js/src/kraken.js CHANGED
@@ -43,6 +43,9 @@ export default class kraken extends Exchange {
43
43
  'cancelOrder': true,
44
44
  'cancelOrders': true,
45
45
  'createDepositAddress': true,
46
+ 'createMarketBuyOrderWithCost': true,
47
+ 'createMarketOrderWithCost': false,
48
+ 'createMarketSellOrderWithCost': false,
46
49
  'createOrder': true,
47
50
  'createStopLimitOrder': true,
48
51
  'createStopMarketOrder': true,
@@ -1353,6 +1356,37 @@ export default class kraken extends Exchange {
1353
1356
  //
1354
1357
  return this.parseBalance(response);
1355
1358
  }
1359
+ async createMarketOrderWithCost(symbol, side, cost, params = {}) {
1360
+ /**
1361
+ * @method
1362
+ * @name kraken#createMarketOrderWithCost
1363
+ * @description create a market order by providing the symbol, side and cost
1364
+ * @see https://docs.kraken.com/rest/#tag/Trading/operation/addOrder
1365
+ * @param {string} symbol unified symbol of the market to create an order in (only USD markets are supported)
1366
+ * @param {string} side 'buy' or 'sell'
1367
+ * @param {float} cost how much you want to trade in units of the quote currency
1368
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1369
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1370
+ */
1371
+ await this.loadMarkets();
1372
+ // only buy orders are supported by the endpoint
1373
+ params['cost'] = cost;
1374
+ return await this.createOrder(symbol, 'market', side, cost, undefined, params);
1375
+ }
1376
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
1377
+ /**
1378
+ * @method
1379
+ * @name kraken#createMarketBuyOrderWithCost
1380
+ * @description create a market buy order by providing the symbol, side and cost
1381
+ * @see https://docs.kraken.com/rest/#tag/Trading/operation/addOrder
1382
+ * @param {string} symbol unified symbol of the market to create an order in
1383
+ * @param {float} cost how much you want to trade in units of the quote currency
1384
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1385
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1386
+ */
1387
+ await this.loadMarkets();
1388
+ return await this.createMarketOrderWithCost(symbol, 'buy', cost, params);
1389
+ }
1356
1390
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
1357
1391
  /**
1358
1392
  * @method
@@ -1383,7 +1417,7 @@ export default class kraken extends Exchange {
1383
1417
  'ordertype': type,
1384
1418
  'volume': this.amountToPrecision(symbol, amount),
1385
1419
  };
1386
- const orderRequest = this.orderRequest('createOrder', symbol, type, request, price, params);
1420
+ const orderRequest = this.orderRequest('createOrder', symbol, type, request, amount, price, params);
1387
1421
  const response = await this.privatePostAddOrder(this.extend(orderRequest[0], orderRequest[1]));
1388
1422
  //
1389
1423
  // {
@@ -1689,7 +1723,7 @@ export default class kraken extends Exchange {
1689
1723
  'trades': trades,
1690
1724
  }, market);
1691
1725
  }
1692
- orderRequest(method, symbol, type, request, price = undefined, params = {}) {
1726
+ orderRequest(method, symbol, type, request, amount, price = undefined, params = {}) {
1693
1727
  const clientOrderId = this.safeString2(params, 'userref', 'clientOrderId');
1694
1728
  params = this.omit(params, ['userref', 'clientOrderId']);
1695
1729
  if (clientOrderId !== undefined) {
@@ -1704,10 +1738,25 @@ export default class kraken extends Exchange {
1704
1738
  const trailingLimitAmount = this.safeString(params, 'trailingLimitAmount');
1705
1739
  const isTrailingAmountOrder = trailingAmount !== undefined;
1706
1740
  const isLimitOrder = type.endsWith('limit'); // supporting limit, stop-loss-limit, take-profit-limit, etc
1707
- if (isLimitOrder && !isTrailingAmountOrder) {
1741
+ const isMarketOrder = type === 'market';
1742
+ const cost = this.safeString(params, 'cost');
1743
+ const flags = this.safeString(params, 'oflags');
1744
+ params = this.omit(params, ['cost', 'oflags']);
1745
+ const isViqcOrder = (flags !== undefined) && (flags.indexOf('viqc') > -1); // volume in quote currency
1746
+ if (isMarketOrder && (cost !== undefined || isViqcOrder)) {
1747
+ if (cost === undefined && (amount !== undefined)) {
1748
+ request['volume'] = this.costToPrecision(symbol, this.numberToString(amount));
1749
+ }
1750
+ else {
1751
+ request['volume'] = this.costToPrecision(symbol, cost);
1752
+ }
1753
+ const extendedOflags = (flags !== undefined) ? flags + ',viqc' : 'viqc';
1754
+ request['oflags'] = extendedOflags;
1755
+ }
1756
+ else if (isLimitOrder && !isTrailingAmountOrder) {
1708
1757
  request['price'] = this.priceToPrecision(symbol, price);
1709
1758
  }
1710
- const reduceOnly = this.safeValue2(params, 'reduceOnly', 'reduce_only');
1759
+ const reduceOnly = this.safeBool2(params, 'reduceOnly', 'reduce_only');
1711
1760
  if (isStopLossOrTakeProfitTrigger) {
1712
1761
  if (isStopLossTriggerOrder) {
1713
1762
  request['price'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
@@ -1755,7 +1804,7 @@ export default class kraken extends Exchange {
1755
1804
  request['reduce_only'] = 'true'; // not using boolean in this case, because the urlencodedNested transforms it into 'True' string
1756
1805
  }
1757
1806
  }
1758
- let close = this.safeValue(params, 'close');
1807
+ let close = this.safeDict(params, 'close');
1759
1808
  if (close !== undefined) {
1760
1809
  close = this.extend({}, close);
1761
1810
  const closePrice = this.safeValue(close, 'price');
@@ -1776,7 +1825,8 @@ export default class kraken extends Exchange {
1776
1825
  let postOnly = undefined;
1777
1826
  [postOnly, params] = this.handlePostOnly(isMarket, false, params);
1778
1827
  if (postOnly) {
1779
- request['oflags'] = 'post';
1828
+ const extendedPostFlags = (flags !== undefined) ? flags + ',post' : 'post';
1829
+ request['oflags'] = extendedPostFlags;
1780
1830
  }
1781
1831
  params = this.omit(params, ['timeInForce', 'reduceOnly', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingLimitAmount', 'offset']);
1782
1832
  return [request, params];
@@ -1814,7 +1864,7 @@ export default class kraken extends Exchange {
1814
1864
  if (amount !== undefined) {
1815
1865
  request['volume'] = this.amountToPrecision(symbol, amount);
1816
1866
  }
1817
- const orderRequest = this.orderRequest('editOrder', symbol, type, request, price, params);
1867
+ const orderRequest = this.orderRequest('editOrder', symbol, type, request, amount, price, params);
1818
1868
  const response = await this.privatePostEditOrder(this.extend(orderRequest[0], orderRequest[1]));
1819
1869
  //
1820
1870
  // {
@@ -3007,6 +3057,9 @@ export default class kraken extends Exchange {
3007
3057
  if (body.indexOf('Invalid arguments:volume') >= 0) {
3008
3058
  throw new InvalidOrder(this.id + ' ' + body);
3009
3059
  }
3060
+ if (body.indexOf('Invalid arguments:viqc') >= 0) {
3061
+ throw new InvalidOrder(this.id + ' ' + body);
3062
+ }
3010
3063
  if (body.indexOf('Rate limit exceeded') >= 0) {
3011
3064
  throw new RateLimitExceeded(this.id + ' ' + body);
3012
3065
  }
package/js/src/kucoin.js CHANGED
@@ -4786,6 +4786,7 @@ export default class kucoin extends Exchange {
4786
4786
  const partnerSignature = this.hmac(this.encode(partnerPayload), this.encode(partnerSecret), sha256, 'base64');
4787
4787
  headers['KC-API-PARTNER-SIGN'] = partnerSignature;
4788
4788
  headers['KC-API-PARTNER'] = partnerId;
4789
+ headers['KC-API-PARTNER-VERIFY'] = 'true';
4789
4790
  }
4790
4791
  if (isBroker) {
4791
4792
  const brokerName = this.safeString(partner, 'name');
package/js/src/phemex.js CHANGED
@@ -2252,7 +2252,7 @@ export default class phemex extends Exchange {
2252
2252
  if (feeCost !== undefined) {
2253
2253
  fee = {
2254
2254
  'cost': feeCost,
2255
- 'currency': undefined,
2255
+ 'currency': this.safeCurrencyCode(this.safeString(order, 'feeCurrency')),
2256
2256
  };
2257
2257
  }
2258
2258
  const timeInForce = this.parseTimeInForce(this.safeString(order, 'timeInForce'));
@@ -2399,6 +2399,7 @@ export default class phemex extends Exchange {
2399
2399
  }
2400
2400
  const marketId = this.safeString(order, 'symbol');
2401
2401
  const symbol = this.safeSymbol(marketId, market);
2402
+ market = this.safeMarket(marketId, market);
2402
2403
  const status = this.parseOrderStatus(this.safeString(order, 'ordStatus'));
2403
2404
  const side = this.parseOrderSide(this.safeStringLower(order, 'side'));
2404
2405
  const type = this.parseOrderType(this.safeString(order, 'orderType'));
@@ -2428,6 +2429,21 @@ export default class phemex extends Exchange {
2428
2429
  }
2429
2430
  const takeProfit = this.safeString(order, 'takeProfitRp');
2430
2431
  const stopLoss = this.safeString(order, 'stopLossRp');
2432
+ const feeValue = this.omitZero(this.safeString(order, 'execFeeRv'));
2433
+ const ptFeeRv = this.omitZero(this.safeString(order, 'ptFeeRv'));
2434
+ let fee = undefined;
2435
+ if (feeValue !== undefined) {
2436
+ fee = {
2437
+ 'cost': feeValue,
2438
+ 'currency': market['quote'],
2439
+ };
2440
+ }
2441
+ else if (ptFeeRv !== undefined) {
2442
+ fee = {
2443
+ 'cost': ptFeeRv,
2444
+ 'currency': 'PT',
2445
+ };
2446
+ }
2431
2447
  return this.safeOrder({
2432
2448
  'info': order,
2433
2449
  'id': id,
@@ -2452,7 +2468,7 @@ export default class phemex extends Exchange {
2452
2468
  'cost': cost,
2453
2469
  'average': undefined,
2454
2470
  'status': status,
2455
- 'fee': undefined,
2471
+ 'fee': fee,
2456
2472
  'trades': undefined,
2457
2473
  });
2458
2474
  }
@@ -52,7 +52,7 @@ export default class binance extends binanceRest {
52
52
  createOrderWs(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
53
53
  handleOrderWs(client: Client, message: any): void;
54
54
  handleOrdersWs(client: Client, message: any): void;
55
- editOrderWs(id: string, symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
55
+ editOrderWs(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
56
56
  handleEditOrderWs(client: Client, message: any): void;
57
57
  cancelOrderWs(id: string, symbol?: Str, params?: {}): Promise<Order>;
58
58
  cancelAllOrdersWs(symbol?: Str, params?: {}): Promise<any>;
@@ -2134,7 +2134,7 @@ export default class binance extends binanceRest {
2134
2134
  const orders = this.parseOrders(result);
2135
2135
  client.resolve(orders, messageHash);
2136
2136
  }
2137
- async editOrderWs(id, symbol, type, side, amount, price = undefined, params = {}) {
2137
+ async editOrderWs(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
2138
2138
  /**
2139
2139
  * @method
2140
2140
  * @name binance#editOrderWs
@@ -1126,7 +1126,7 @@ export default class bitget extends bitgetRest {
1126
1126
  // "executePrice": "35123", // this is limit price
1127
1127
  // "triggerType": "fill_price",
1128
1128
  // "planType": "amount",
1129
- // #### in case order had fill: ####
1129
+ // #### in case order had a partial fill: ####
1130
1130
  // fillPrice: '35123',
1131
1131
  // tradeId: '1171775539946528779',
1132
1132
  // baseVolume: '7', // field present in market order
@@ -1246,6 +1246,8 @@ export default class bitget extends bitgetRest {
1246
1246
  let totalAmount = undefined;
1247
1247
  let filledAmount = undefined;
1248
1248
  let cost = undefined;
1249
+ let remaining = undefined;
1250
+ const totalFilled = this.safeString(order, 'accBaseVolume');
1249
1251
  if (isSpot) {
1250
1252
  if (isMargin) {
1251
1253
  filledAmount = this.omitZero(this.safeString(order, 'fillTotalAmount'));
@@ -1253,7 +1255,13 @@ export default class bitget extends bitgetRest {
1253
1255
  cost = this.safeString(order, 'quoteSize');
1254
1256
  }
1255
1257
  else {
1256
- filledAmount = this.omitZero(this.safeString2(order, 'accBaseVolume', 'baseVolume'));
1258
+ const partialFillAmount = this.safeString(order, 'baseVolume');
1259
+ if (partialFillAmount !== undefined) {
1260
+ filledAmount = partialFillAmount;
1261
+ }
1262
+ else {
1263
+ filledAmount = totalFilled;
1264
+ }
1257
1265
  if (isMarketOrder) {
1258
1266
  if (isBuy) {
1259
1267
  totalAmount = accBaseVolume;
@@ -1276,6 +1284,7 @@ export default class bitget extends bitgetRest {
1276
1284
  totalAmount = this.safeString(order, 'size');
1277
1285
  cost = this.safeString(order, 'fillNotionalUsd');
1278
1286
  }
1287
+ remaining = this.omitZero(Precise.stringSub(totalAmount, totalFilled));
1279
1288
  return this.safeOrder({
1280
1289
  'info': order,
1281
1290
  'symbol': symbol,
@@ -1294,7 +1303,7 @@ export default class bitget extends bitgetRest {
1294
1303
  'cost': cost,
1295
1304
  'average': avgPrice,
1296
1305
  'filled': filledAmount,
1297
- 'remaining': undefined,
1306
+ 'remaining': remaining,
1298
1307
  'status': this.parseWsOrderStatus(rawStatus),
1299
1308
  'fee': feeObject,
1300
1309
  'trades': undefined,
@@ -1,7 +1,7 @@
1
- import coinbaseproRest from '../coinbasepro.js';
1
+ import coinbaseexchangeRest from '../coinbaseexchange.js';
2
2
  import type { Tickers, Int, Ticker, Str, Strings, OrderBook, Trade, Order } from '../base/types.js';
3
3
  import Client from '../base/ws/Client.js';
4
- export default class coinbasepro extends coinbaseproRest {
4
+ export default class coinbaseexchange extends coinbaseexchangeRest {
5
5
  describe(): any;
6
6
  authenticate(): {
7
7
  timestamp: number;
@@ -5,12 +5,12 @@
5
5
  // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
6
 
7
7
  // ---------------------------------------------------------------------------
8
- import coinbaseproRest from '../coinbasepro.js';
8
+ import coinbaseexchangeRest from '../coinbaseexchange.js';
9
9
  import { AuthenticationError, ExchangeError, BadSymbol, BadRequest, ArgumentsRequired } from '../base/errors.js';
10
10
  import { ArrayCache, ArrayCacheBySymbolById } from '../base/ws/Cache.js';
11
11
  import { sha256 } from '../static_dependencies/noble-hashes/sha256.js';
12
12
  // ---------------------------------------------------------------------------
13
- export default class coinbasepro extends coinbaseproRest {
13
+ export default class coinbaseexchange extends coinbaseexchangeRest {
14
14
  describe() {
15
15
  return this.deepExtend(super.describe(), {
16
16
  'has': {
@@ -31,7 +31,7 @@ export default class coinbasepro extends coinbaseproRest {
31
31
  },
32
32
  'urls': {
33
33
  'api': {
34
- 'ws': 'wss://ws-feed.pro.coinbase.com',
34
+ 'ws': 'wss://ws-feed.exchange.coinbase.com',
35
35
  },
36
36
  'test': {
37
37
  'ws': 'wss://ws-feed-public.sandbox.exchange.coinbase.com',
@@ -112,7 +112,7 @@ export default class coinbasepro extends coinbaseproRest {
112
112
  async watchTicker(symbol, params = {}) {
113
113
  /**
114
114
  * @method
115
- * @name coinbasepro#watchTicker
115
+ * @name coinbaseexchange#watchTicker
116
116
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
117
117
  * @param {string} symbol unified symbol of the market to fetch the ticker for
118
118
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -124,7 +124,7 @@ export default class coinbasepro extends coinbaseproRest {
124
124
  async watchTickers(symbols = undefined, params = {}) {
125
125
  /**
126
126
  * @method
127
- * @name coinbasepro#watchTickers
127
+ * @name coinbaseexchange#watchTickers
128
128
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
129
129
  * @param {string[]} [symbols] unified symbol of the market to fetch the ticker for
130
130
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -149,7 +149,7 @@ export default class coinbasepro extends coinbaseproRest {
149
149
  async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
150
150
  /**
151
151
  * @method
152
- * @name coinbasepro#watchTrades
152
+ * @name coinbaseexchange#watchTrades
153
153
  * @description get the list of most recent trades for a particular symbol
154
154
  * @param {string} symbol unified symbol of the market to fetch trades for
155
155
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
@@ -195,7 +195,7 @@ export default class coinbasepro extends coinbaseproRest {
195
195
  async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
196
196
  /**
197
197
  * @method
198
- * @name coinbasepro#watchMyTrades
198
+ * @name coinbaseexchange#watchMyTrades
199
199
  * @description watches information on multiple trades made by the user
200
200
  * @param {string} symbol unified market symbol of the market trades were made in
201
201
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -220,7 +220,7 @@ export default class coinbasepro extends coinbaseproRest {
220
220
  async watchMyTradesForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
221
221
  /**
222
222
  * @method
223
- * @name coinbasepro#watchMyTradesForSymbols
223
+ * @name coinbaseexchange#watchMyTradesForSymbols
224
224
  * @description watches information on multiple trades made by the user
225
225
  * @param {string[]} symbols unified symbol of the market to fetch trades for
226
226
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -244,7 +244,7 @@ export default class coinbasepro extends coinbaseproRest {
244
244
  async watchOrdersForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
245
245
  /**
246
246
  * @method
247
- * @name coinbasepro#watchOrdersForSymbols
247
+ * @name coinbaseexchange#watchOrdersForSymbols
248
248
  * @description watches information on multiple orders made by the user
249
249
  * @param {string[]} symbols unified symbol of the market to fetch orders for
250
250
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -268,7 +268,7 @@ export default class coinbasepro extends coinbaseproRest {
268
268
  async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
269
269
  /**
270
270
  * @method
271
- * @name coinbasepro#watchOrders
271
+ * @name coinbaseexchange#watchOrders
272
272
  * @description watches information on multiple orders made by the user
273
273
  * @param {string} symbol unified market symbol of the market orders were made in
274
274
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -293,7 +293,7 @@ export default class coinbasepro extends coinbaseproRest {
293
293
  async watchOrderBookForSymbols(symbols, limit = undefined, params = {}) {
294
294
  /**
295
295
  * @method
296
- * @name coinbasepro#watchOrderBookForSymbols
296
+ * @name coinbaseexchange#watchOrderBookForSymbols
297
297
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
298
298
  * @param {string[]} symbols unified array of symbols
299
299
  * @param {int} [limit] the maximum amount of order book entries to return
@@ -335,7 +335,7 @@ export default class coinbasepro extends coinbaseproRest {
335
335
  async watchOrderBook(symbol, limit = undefined, params = {}) {
336
336
  /**
337
337
  * @method
338
- * @name coinbasepro#watchOrderBook
338
+ * @name coinbaseexchange#watchOrderBook
339
339
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
340
340
  * @param {string} symbol unified symbol of the market to fetch the order book for
341
341
  * @param {int} [limit] the maximum amount of order book entries to return
@@ -105,14 +105,16 @@ export default class cryptocom extends cryptocomRest {
105
105
  params['params'] = {};
106
106
  }
107
107
  let bookSubscriptionType = undefined;
108
- [bookSubscriptionType, params] = this.handleOptionAndParams2(params, 'watchOrderBook', 'watchOrderBookForSymbols', 'bookSubscriptionType', 'SNAPSHOT_AND_UPDATE');
109
- if (bookSubscriptionType !== undefined) {
110
- params['params']['bookSubscriptionType'] = bookSubscriptionType;
111
- }
108
+ let bookSubscriptionType2 = undefined;
109
+ [bookSubscriptionType, params] = this.handleOptionAndParams(params, 'watchOrderBook', 'bookSubscriptionType', 'SNAPSHOT_AND_UPDATE');
110
+ [bookSubscriptionType2, params] = this.handleOptionAndParams(params, 'watchOrderBookForSymbols', 'bookSubscriptionType', bookSubscriptionType);
111
+ params['params']['bookSubscriptionType'] = bookSubscriptionType2;
112
112
  let bookUpdateFrequency = undefined;
113
- [bookUpdateFrequency, params] = this.handleOptionAndParams2(params, 'watchOrderBook', 'watchOrderBookForSymbols', 'bookUpdateFrequency');
114
- if (bookUpdateFrequency !== undefined) {
115
- params['params']['bookSubscriptionType'] = bookSubscriptionType;
113
+ let bookUpdateFrequency2 = undefined;
114
+ [bookUpdateFrequency, params] = this.handleOptionAndParams(params, 'watchOrderBook', 'bookUpdateFrequency');
115
+ [bookUpdateFrequency2, params] = this.handleOptionAndParams(params, 'watchOrderBookForSymbols', 'bookUpdateFrequency', bookUpdateFrequency);
116
+ if (bookUpdateFrequency2 !== undefined) {
117
+ params['params']['bookSubscriptionType'] = bookUpdateFrequency2;
116
118
  }
117
119
  for (let i = 0; i < symbols.length; i++) {
118
120
  const symbol = symbols[i];
@@ -5,7 +5,7 @@ export default class kraken extends krakenRest {
5
5
  describe(): any;
6
6
  createOrderWs(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
7
7
  handleCreateEditOrder(client: any, message: any): void;
8
- editOrderWs(id: string, symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
8
+ editOrderWs(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
9
9
  cancelOrdersWs(ids: string[], symbol?: Str, params?: {}): Promise<any>;
10
10
  cancelOrderWs(id: string, symbol?: Str, params?: {}): Promise<Order>;
11
11
  handleCancelOrder(client: any, message: any): void;
@@ -137,7 +137,7 @@ export default class kraken extends krakenRest {
137
137
  'pair': market['wsId'],
138
138
  'volume': this.amountToPrecision(symbol, amount),
139
139
  };
140
- [request, params] = this.orderRequest('createOrderWs', symbol, type, request, price, params);
140
+ [request, params] = this.orderRequest('createOrderWs', symbol, type, request, amount, price, params);
141
141
  return await this.watch(url, messageHash, this.extend(request, params), messageHash);
142
142
  }
143
143
  handleCreateEditOrder(client, message) {
@@ -164,7 +164,7 @@ export default class kraken extends krakenRest {
164
164
  const messageHash = this.safeValue(message, 'reqid');
165
165
  client.resolve(order, messageHash);
166
166
  }
167
- async editOrderWs(id, symbol, type, side, amount, price = undefined, params = {}) {
167
+ async editOrderWs(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
168
168
  /**
169
169
  * @method
170
170
  * @name kraken#editOrderWs
@@ -191,9 +191,11 @@ export default class kraken extends krakenRest {
191
191
  'reqid': requestId,
192
192
  'orderid': id,
193
193
  'pair': market['wsId'],
194
- 'volume': this.amountToPrecision(symbol, amount),
195
194
  };
196
- [request, params] = this.orderRequest('editOrderWs', symbol, type, request, price, params);
195
+ if (amount !== undefined) {
196
+ request['volume'] = this.amountToPrecision(symbol, amount);
197
+ }
198
+ [request, params] = this.orderRequest('editOrderWs', symbol, type, request, amount, price, params);
197
199
  return await this.watch(url, messageHash, this.extend(request, params), messageHash);
198
200
  }
199
201
  async cancelOrdersWs(ids, symbol = undefined, params = {}) {
@@ -36,7 +36,7 @@ export default class okx extends okxRest {
36
36
  handleMyTrades(client: Client, message: any): void;
37
37
  createOrderWs(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
38
38
  handlePlaceOrders(client: Client, message: any): void;
39
- editOrderWs(id: string, symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
39
+ editOrderWs(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
40
40
  cancelOrderWs(id: string, symbol?: Str, params?: {}): Promise<Order>;
41
41
  cancelOrdersWs(ids: string[], symbol?: Str, params?: {}): Promise<any>;
42
42
  cancelAllOrdersWs(symbol?: Str, params?: {}): Promise<any>;
package/js/src/pro/okx.js CHANGED
@@ -1436,7 +1436,7 @@ export default class okx extends okxRest {
1436
1436
  const first = this.safeDict(orders, 0, {});
1437
1437
  client.resolve(first, messageHash);
1438
1438
  }
1439
- async editOrderWs(id, symbol, type, side, amount, price = undefined, params = {}) {
1439
+ async editOrderWs(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
1440
1440
  /**
1441
1441
  * @method
1442
1442
  * @name okx#editOrderWs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.3.23",
3
+ "version": "4.3.27",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",