ccxt 4.3.40 → 4.3.41

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 (76) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/binance.js +3 -0
  5. package/dist/cjs/src/bitfinex2.js +1 -1
  6. package/dist/cjs/src/bithumb.js +9 -1
  7. package/dist/cjs/src/bitstamp.js +38 -2
  8. package/dist/cjs/src/coinlist.js +20 -1
  9. package/dist/cjs/src/coinmate.js +19 -3
  10. package/dist/cjs/src/coinone.js +1 -1
  11. package/dist/cjs/src/coinspot.js +13 -2
  12. package/dist/cjs/src/independentreserve.js +33 -1
  13. package/dist/cjs/src/indodax.js +43 -2
  14. package/dist/cjs/src/okx.js +7 -0
  15. package/dist/cjs/src/pro/alpaca.js +5 -5
  16. package/dist/cjs/src/pro/ascendex.js +3 -3
  17. package/dist/cjs/src/pro/bingx.js +293 -47
  18. package/dist/cjs/src/pro/bitget.js +6 -5
  19. package/dist/cjs/src/pro/bitrue.js +3 -4
  20. package/dist/cjs/src/pro/currencycom.js +6 -5
  21. package/dist/cjs/src/pro/exmo.js +5 -6
  22. package/dist/cjs/src/pro/gemini.js +4 -3
  23. package/dist/cjs/src/pro/independentreserve.js +7 -7
  24. package/dist/cjs/src/pro/lbank.js +4 -4
  25. package/dist/cjs/src/pro/phemex.js +5 -5
  26. package/dist/cjs/src/pro/probit.js +4 -4
  27. package/dist/cjs/src/pro/upbit.js +318 -2
  28. package/dist/cjs/src/pro/wazirx.js +12 -12
  29. package/dist/cjs/src/upbit.js +17 -9
  30. package/dist/cjs/src/woo.js +6 -2
  31. package/js/ccxt.d.ts +1 -1
  32. package/js/ccxt.js +1 -1
  33. package/js/src/abstract/binance.d.ts +2 -0
  34. package/js/src/abstract/binancecoinm.d.ts +2 -0
  35. package/js/src/abstract/binanceus.d.ts +2 -0
  36. package/js/src/abstract/binanceusdm.d.ts +2 -0
  37. package/js/src/abstract/okx.d.ts +7 -0
  38. package/js/src/binance.js +3 -0
  39. package/js/src/bitfinex2.js +1 -1
  40. package/js/src/bithumb.d.ts +2 -2
  41. package/js/src/bithumb.js +9 -1
  42. package/js/src/bitstamp.d.ts +2 -2
  43. package/js/src/bitstamp.js +38 -2
  44. package/js/src/coinlist.d.ts +1 -1
  45. package/js/src/coinlist.js +20 -1
  46. package/js/src/coinmate.d.ts +1 -3
  47. package/js/src/coinmate.js +19 -3
  48. package/js/src/coinone.d.ts +1 -1
  49. package/js/src/coinone.js +1 -1
  50. package/js/src/coinspot.d.ts +1 -1
  51. package/js/src/coinspot.js +13 -2
  52. package/js/src/independentreserve.d.ts +1 -1
  53. package/js/src/independentreserve.js +33 -1
  54. package/js/src/indodax.d.ts +1 -1
  55. package/js/src/indodax.js +43 -2
  56. package/js/src/okx.js +7 -0
  57. package/js/src/pro/alpaca.js +5 -5
  58. package/js/src/pro/ascendex.js +3 -3
  59. package/js/src/pro/bingx.d.ts +6 -1
  60. package/js/src/pro/bingx.js +294 -48
  61. package/js/src/pro/bitget.js +6 -5
  62. package/js/src/pro/bitrue.js +3 -4
  63. package/js/src/pro/currencycom.js +6 -5
  64. package/js/src/pro/exmo.js +5 -6
  65. package/js/src/pro/gemini.js +4 -3
  66. package/js/src/pro/independentreserve.js +7 -7
  67. package/js/src/pro/lbank.js +4 -4
  68. package/js/src/pro/phemex.js +5 -5
  69. package/js/src/pro/probit.js +4 -4
  70. package/js/src/pro/upbit.d.ts +13 -1
  71. package/js/src/pro/upbit.js +319 -3
  72. package/js/src/pro/wazirx.js +12 -12
  73. package/js/src/upbit.js +17 -9
  74. package/js/src/woo.d.ts +1 -1
  75. package/js/src/woo.js +6 -2
  76. package/package.json +1 -1
@@ -706,11 +706,11 @@ class phemex extends phemex$1 {
706
706
  client.resolve(orderbook, messageHash);
707
707
  }
708
708
  else {
709
- const orderbook = this.safeValue(this.orderbooks, symbol);
710
- if (orderbook !== undefined) {
711
- const changes = this.safeValue2(message, 'book', 'orderbook_p', {});
712
- const asks = this.safeValue(changes, 'asks', []);
713
- const bids = this.safeValue(changes, 'bids', []);
709
+ if (symbol in this.orderbooks) {
710
+ const orderbook = this.orderbooks[symbol];
711
+ const changes = this.safeDict2(message, 'book', 'orderbook_p', {});
712
+ const asks = this.safeList(changes, 'asks', []);
713
+ const bids = this.safeList(changes, 'bids', []);
714
714
  this.customHandleDeltas(orderbook['asks'], asks, market);
715
715
  this.customHandleDeltas(orderbook['bids'], bids, market);
716
716
  orderbook['nonce'] = nonce;
@@ -450,11 +450,11 @@ class probit extends probit$1 {
450
450
  const symbol = this.safeSymbol(marketId);
451
451
  const dataBySide = this.groupBy(orderBook, 'side');
452
452
  const messageHash = 'orderbook:' + symbol;
453
- let orderbook = this.safeValue(this.orderbooks, symbol);
454
- if (orderbook === undefined) {
455
- orderbook = this.orderBook({});
456
- this.orderbooks[symbol] = orderbook;
453
+ // let orderbook = this.safeValue (this.orderbooks, symbol);
454
+ if (!(symbol in this.orderbooks)) {
455
+ this.orderbooks[symbol] = this.orderBook({});
457
456
  }
457
+ const orderbook = this.orderbooks[symbol];
458
458
  const reset = this.safeBool(message, 'reset', false);
459
459
  if (reset) {
460
460
  const snapshot = this.parseOrderBook(dataBySide, symbol, undefined, 'buy', 'sell', 'price', 'quantity');
@@ -2,6 +2,8 @@
2
2
 
3
3
  var upbit$1 = require('../upbit.js');
4
4
  var Cache = require('../base/ws/Cache.js');
5
+ var sha256 = require('../static_dependencies/noble-hashes/sha256.js');
6
+ var rsa = require('../base/functions/rsa.js');
5
7
 
6
8
  // ---------------------------------------------------------------------------
7
9
  // ---------------------------------------------------------------------------
@@ -13,10 +15,13 @@ class upbit extends upbit$1 {
13
15
  'watchOrderBook': true,
14
16
  'watchTicker': true,
15
17
  'watchTrades': true,
18
+ 'watchOrders': true,
19
+ 'watchMyTrades': true,
20
+ 'watchBalance': true,
16
21
  },
17
22
  'urls': {
18
23
  'api': {
19
- 'ws': 'wss://api.upbit.com/websocket/v1',
24
+ 'ws': 'wss://{hostname}/websocket/v1',
20
25
  },
21
26
  },
22
27
  'options': {
@@ -29,7 +34,9 @@ class upbit extends upbit$1 {
29
34
  const market = this.market(symbol);
30
35
  symbol = market['symbol'];
31
36
  const marketId = market['id'];
32
- const url = this.urls['api']['ws'];
37
+ const url = this.implodeParams(this.urls['api']['ws'], {
38
+ 'hostname': this.hostname,
39
+ });
33
40
  this.options[channel] = this.safeValue(this.options, channel, {});
34
41
  this.options[channel][symbol] = true;
35
42
  const symbols = Object.keys(this.options[channel]);
@@ -53,6 +60,7 @@ class upbit extends upbit$1 {
53
60
  * @method
54
61
  * @name upbit#watchTicker
55
62
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
63
+ * @see https://global-docs.upbit.com/reference/websocket-ticker
56
64
  * @param {string} symbol unified symbol of the market to fetch the ticker for
57
65
  * @param {object} [params] extra parameters specific to the exchange API endpoint
58
66
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -64,6 +72,7 @@ class upbit extends upbit$1 {
64
72
  * @method
65
73
  * @name upbit#watchTrades
66
74
  * @description get the list of most recent trades for a particular symbol
75
+ * @see https://global-docs.upbit.com/reference/websocket-trade
67
76
  * @param {string} symbol unified symbol of the market to fetch trades for
68
77
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
69
78
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -83,6 +92,7 @@ class upbit extends upbit$1 {
83
92
  * @method
84
93
  * @name upbit#watchOrderBook
85
94
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
95
+ * @see https://global-docs.upbit.com/reference/websocket-orderbook
86
96
  * @param {string} symbol unified symbol of the market to fetch the order book for
87
97
  * @param {int} [limit] the maximum amount of order book entries to return
88
98
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -217,11 +227,317 @@ class upbit extends upbit$1 {
217
227
  const messageHash = 'trade:' + marketId;
218
228
  client.resolve(stored, messageHash);
219
229
  }
230
+ async authenticate(params = {}) {
231
+ this.checkRequiredCredentials();
232
+ const authenticated = this.options['ws']['token'];
233
+ if (authenticated === undefined) {
234
+ const auth = {
235
+ 'access_key': this.apiKey,
236
+ 'nonce': this.uuid(),
237
+ };
238
+ const token = rsa.jwt(auth, this.encode(this.secret), sha256.sha256, false);
239
+ this.options['ws']['token'] = token;
240
+ this.options['ws']['options']['headers'] = {
241
+ 'authorization': 'Bearer ' + token,
242
+ };
243
+ }
244
+ const url = this.urls['api']['ws'] + '/private';
245
+ const client = this.client(url);
246
+ return client;
247
+ }
248
+ async watchPrivate(symbol, channel, messageHash, params = {}) {
249
+ await this.authenticate();
250
+ const request = {
251
+ 'type': channel,
252
+ };
253
+ if (symbol !== undefined) {
254
+ await this.loadMarkets();
255
+ const market = this.market(symbol);
256
+ symbol = market['symbol'];
257
+ const symbols = [symbol];
258
+ const marketIds = this.marketIds(symbols);
259
+ request['codes'] = marketIds;
260
+ messageHash = messageHash + ':' + symbol;
261
+ }
262
+ let url = this.implodeParams(this.urls['api']['ws'], {
263
+ 'hostname': this.hostname,
264
+ });
265
+ url += '/private';
266
+ const message = [
267
+ {
268
+ 'ticket': this.uuid(),
269
+ },
270
+ request,
271
+ ];
272
+ return await this.watch(url, messageHash, message, messageHash);
273
+ }
274
+ async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
275
+ /**
276
+ * @method
277
+ * @name upbit#watchOrders
278
+ * @description watches information on multiple orders made by the user
279
+ * @see https://global-docs.upbit.com/reference/websocket-myorder
280
+ * @param {string} symbol unified market symbol of the market orders were made in
281
+ * @param {int} [since] the earliest time in ms to fetch orders for
282
+ * @param {int} [limit] the maximum number of order structures to retrieve
283
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
284
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
285
+ */
286
+ await this.loadMarkets();
287
+ const channel = 'myOrder';
288
+ const messageHash = 'myOrder';
289
+ const orders = await this.watchPrivate(symbol, channel, messageHash);
290
+ if (this.newUpdates) {
291
+ limit = orders.getLimit(symbol, limit);
292
+ }
293
+ return this.filterBySymbolSinceLimit(orders, symbol, since, limit, true);
294
+ }
295
+ async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
296
+ /**
297
+ * @method
298
+ * @name upbit#watchMyTrades
299
+ * @description watches information on multiple trades made by the user
300
+ * @see https://global-docs.upbit.com/reference/websocket-myorder
301
+ * @param {string} symbol unified market symbol of the market orders were made in
302
+ * @param {int} [since] the earliest time in ms to fetch orders for
303
+ * @param {int} [limit] the maximum number of order structures to retrieve
304
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
305
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure
306
+ */
307
+ await this.loadMarkets();
308
+ const channel = 'myOrder';
309
+ const messageHash = 'myTrades';
310
+ const trades = await this.watchPrivate(symbol, channel, messageHash);
311
+ if (this.newUpdates) {
312
+ limit = trades.getLimit(symbol, limit);
313
+ }
314
+ return this.filterBySymbolSinceLimit(trades, symbol, since, limit, true);
315
+ }
316
+ parseWsOrderStatus(status) {
317
+ const statuses = {
318
+ 'wait': 'open',
319
+ 'done': 'closed',
320
+ 'cancel': 'canceled',
321
+ 'watch': 'open',
322
+ 'trade': 'open',
323
+ };
324
+ return this.safeString(statuses, status, status);
325
+ }
326
+ parseWsOrder(order, market = undefined) {
327
+ //
328
+ // {
329
+ // "type": "myOrder",
330
+ // "code": "SGD-XRP",
331
+ // "uuid": "ac2dc2a3-fce9-40a2-a4f6-5987c25c438f",
332
+ // "ask_bid": "BID",
333
+ // "order_type": "limit",
334
+ // "state": "trade",
335
+ // "price": 0.001453,
336
+ // "avg_price": 0.00145372,
337
+ // "volume": 30925891.29839369,
338
+ // "remaining_volume": 29968038.09235948,
339
+ // "executed_volume": 30925891.29839369,
340
+ // "trades_count": 1,
341
+ // "reserved_fee": 44.23943970238218,
342
+ // "remaining_fee": 21.77177967409916,
343
+ // "paid_fee": 22.467660028283017,
344
+ // "locked": 43565.33112787242,
345
+ // "executed_funds": 44935.32005656603,
346
+ // "order_timestamp": 1710751590000,
347
+ // "timestamp": 1710751597500,
348
+ // "stream_type": "REALTIME"
349
+ // }
350
+ //
351
+ const id = this.safeString(order, 'uuid');
352
+ let side = this.safeStringLower(order, 'ask_bid');
353
+ if (side === 'bid') {
354
+ side = 'buy';
355
+ }
356
+ else {
357
+ side = 'sell';
358
+ }
359
+ const timestamp = this.parse8601(this.safeString(order, 'order_timestamp'));
360
+ const status = this.parseWsOrderStatus(this.safeString(order, 'state'));
361
+ const marketId = this.safeString(order, 'code');
362
+ market = this.safeMarket(marketId, market);
363
+ let fee = undefined;
364
+ const feeCost = this.safeString(order, 'paid_fee');
365
+ if (feeCost !== undefined) {
366
+ fee = {
367
+ 'currency': market['quote'],
368
+ 'cost': feeCost,
369
+ };
370
+ }
371
+ return this.safeOrder({
372
+ 'info': order,
373
+ 'id': id,
374
+ 'clientOrderId': undefined,
375
+ 'timestamp': timestamp,
376
+ 'datetime': this.iso8601(timestamp),
377
+ 'lastTradeTimestamp': this.safeString(order, 'trade_timestamp'),
378
+ 'symbol': market['symbol'],
379
+ 'type': this.safeString(order, 'order_type'),
380
+ 'timeInForce': this.safeString(order, 'time_in_force'),
381
+ 'postOnly': undefined,
382
+ 'side': side,
383
+ 'price': this.safeString(order, 'price'),
384
+ 'stopPrice': undefined,
385
+ 'triggerPrice': undefined,
386
+ 'cost': this.safeString(order, 'executed_funds'),
387
+ 'average': this.safeString(order, 'avg_price'),
388
+ 'amount': this.safeString(order, 'volume'),
389
+ 'filled': this.safeString(order, 'executed_volume'),
390
+ 'remaining': this.safeString(order, 'remaining_volume'),
391
+ 'status': status,
392
+ 'fee': fee,
393
+ 'trades': undefined,
394
+ });
395
+ }
396
+ parseWsTrade(trade, market = undefined) {
397
+ // see: parseWsOrder
398
+ let side = this.safeStringLower(trade, 'ask_bid');
399
+ if (side === 'bid') {
400
+ side = 'buy';
401
+ }
402
+ else {
403
+ side = 'sell';
404
+ }
405
+ const timestamp = this.parse8601(this.safeString(trade, 'trade_timestamp'));
406
+ const marketId = this.safeString(trade, 'code');
407
+ market = this.safeMarket(marketId, market);
408
+ let fee = undefined;
409
+ const feeCost = this.safeString(trade, 'paid_fee');
410
+ if (feeCost !== undefined) {
411
+ fee = {
412
+ 'currency': market['quote'],
413
+ 'cost': feeCost,
414
+ };
415
+ }
416
+ return this.safeTrade({
417
+ 'id': this.safeString(trade, 'trade_uuid'),
418
+ 'timestamp': timestamp,
419
+ 'datetime': this.iso8601(timestamp),
420
+ 'symbol': market['symbol'],
421
+ 'side': side,
422
+ 'price': this.safeString(trade, 'price'),
423
+ 'amount': this.safeString(trade, 'volume'),
424
+ 'cost': this.safeString(trade, 'executed_funds'),
425
+ 'order': this.safeString(trade, 'uuid'),
426
+ 'takerOrMaker': undefined,
427
+ 'type': this.safeString(trade, 'order_type'),
428
+ 'fee': fee,
429
+ 'info': trade,
430
+ }, market);
431
+ }
432
+ handleMyOrder(client, message) {
433
+ // see: parseWsOrder
434
+ const tradeId = this.safeString(message, 'trade_uuid');
435
+ if (tradeId !== undefined) {
436
+ this.handleMyTrade(client, message);
437
+ }
438
+ this.handleOrder(client, message);
439
+ }
440
+ handleMyTrade(client, message) {
441
+ // see: parseWsOrder
442
+ let myTrades = this.myTrades;
443
+ if (myTrades === undefined) {
444
+ const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
445
+ myTrades = new Cache.ArrayCacheBySymbolById(limit);
446
+ }
447
+ const trade = this.parseWsTrade(message);
448
+ myTrades.append(trade);
449
+ let messageHash = 'myTrades';
450
+ client.resolve(myTrades, messageHash);
451
+ messageHash = 'myTrades:' + trade['symbol'];
452
+ client.resolve(myTrades, messageHash);
453
+ }
454
+ handleOrder(client, message) {
455
+ const parsed = this.parseWsOrder(message);
456
+ const symbol = this.safeString(parsed, 'symbol');
457
+ const orderId = this.safeString(parsed, 'id');
458
+ if (this.orders === undefined) {
459
+ const limit = this.safeInteger(this.options, 'ordersLimit', 1000);
460
+ this.orders = new Cache.ArrayCacheBySymbolById(limit);
461
+ }
462
+ const cachedOrders = this.orders;
463
+ const orders = this.safeValue(cachedOrders.hashmap, symbol, {});
464
+ const order = this.safeValue(orders, orderId);
465
+ if (order !== undefined) {
466
+ const fee = this.safeValue(order, 'fee');
467
+ if (fee !== undefined) {
468
+ parsed['fee'] = fee;
469
+ }
470
+ const fees = this.safeValue(order, 'fees');
471
+ if (fees !== undefined) {
472
+ parsed['fees'] = fees;
473
+ }
474
+ parsed['trades'] = this.safeValue(order, 'trades');
475
+ parsed['timestamp'] = this.safeInteger(order, 'timestamp');
476
+ parsed['datetime'] = this.safeString(order, 'datetime');
477
+ }
478
+ cachedOrders.append(parsed);
479
+ let messageHash = 'myOrder';
480
+ client.resolve(this.orders, messageHash);
481
+ messageHash = messageHash + ':' + symbol;
482
+ client.resolve(this.orders, messageHash);
483
+ }
484
+ async watchBalance(params = {}) {
485
+ /**
486
+ * @method
487
+ * @name upbit#watchBalance
488
+ * @see https://global-docs.upbit.com/reference/websocket-myasset
489
+ * @description query for balance and get the amount of funds available for trading or funds locked in orders
490
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
491
+ * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
492
+ */
493
+ await this.loadMarkets();
494
+ const channel = 'myAsset';
495
+ const messageHash = 'myAsset';
496
+ return await this.watchPrivate(undefined, channel, messageHash);
497
+ }
498
+ handleBalance(client, message) {
499
+ //
500
+ // {
501
+ // "type": "myAsset",
502
+ // "asset_uuid": "e635f223-1609-4969-8fb6-4376937baad6",
503
+ // "assets": [
504
+ // {
505
+ // "currency": "SGD",
506
+ // "balance": 1386929.37231066771348207123,
507
+ // "locked": 10329.670127489597585685
508
+ // }
509
+ // ],
510
+ // "asset_timestamp": 1710146517259,
511
+ // "timestamp": 1710146517267,
512
+ // "stream_type": "REALTIME"
513
+ // }
514
+ //
515
+ const data = this.safeList(message, 'assets', []);
516
+ const timestamp = this.safeInteger(message, 'timestamp');
517
+ this.balance['timestamp'] = timestamp;
518
+ this.balance['datetime'] = this.iso8601(timestamp);
519
+ for (let i = 0; i < data.length; i++) {
520
+ const balance = data[i];
521
+ const currencyId = this.safeString(balance, 'currency');
522
+ const code = this.safeCurrencyCode(currencyId);
523
+ const available = this.safeString(balance, 'balance');
524
+ const frozen = this.safeString(balance, 'locked');
525
+ const account = this.account();
526
+ account['free'] = available;
527
+ account['used'] = frozen;
528
+ this.balance[code] = account;
529
+ this.balance = this.safeBalance(this.balance);
530
+ }
531
+ const messageHash = this.safeString(message, 'type');
532
+ client.resolve(this.balance, messageHash);
533
+ }
220
534
  handleMessage(client, message) {
221
535
  const methods = {
222
536
  'ticker': this.handleTicker,
223
537
  'orderbook': this.handleOrderBook,
224
538
  'trade': this.handleTrades,
539
+ 'myOrder': this.handleMyOrder,
540
+ 'myAsset': this.handleBalance,
225
541
  };
226
542
  const methodName = this.safeString(message, 'type');
227
543
  const method = this.safeValue(methods, methodName);
@@ -520,21 +520,21 @@ class wazirx extends wazirx$1 {
520
520
  const market = this.safeMarket(marketId);
521
521
  const symbol = market['symbol'];
522
522
  const messageHash = 'orderbook:' + symbol;
523
- const currentOrderBook = this.safeValue(this.orderbooks, symbol);
524
- if (currentOrderBook === undefined) {
523
+ // const currentOrderBook = this.safeValue (this.orderbooks, symbol);
524
+ if (!(symbol in this.orderbooks)) {
525
525
  const snapshot = this.parseOrderBook(data, symbol, timestamp, 'b', 'a');
526
- const orderBook = this.orderBook(snapshot);
527
- this.orderbooks[symbol] = orderBook;
526
+ this.orderbooks[symbol] = this.orderBook(snapshot);
528
527
  }
529
528
  else {
530
- const asks = this.safeValue(data, 'a', []);
531
- const bids = this.safeValue(data, 'b', []);
532
- this.handleDeltas(currentOrderBook['asks'], asks);
533
- this.handleDeltas(currentOrderBook['bids'], bids);
534
- currentOrderBook['nonce'] = timestamp;
535
- currentOrderBook['timestamp'] = timestamp;
536
- currentOrderBook['datetime'] = this.iso8601(timestamp);
537
- this.orderbooks[symbol] = currentOrderBook;
529
+ const orderbook = this.orderbooks[symbol];
530
+ const asks = this.safeList(data, 'a', []);
531
+ const bids = this.safeList(data, 'b', []);
532
+ this.handleDeltas(orderbook['asks'], asks);
533
+ this.handleDeltas(orderbook['bids'], bids);
534
+ orderbook['nonce'] = timestamp;
535
+ orderbook['timestamp'] = timestamp;
536
+ orderbook['datetime'] = this.iso8601(timestamp);
537
+ this.orderbooks[symbol] = orderbook;
538
538
  }
539
539
  client.resolve(this.orderbooks[symbol], messageHash);
540
540
  }
@@ -1884,25 +1884,33 @@ class upbit extends upbit$1 {
1884
1884
  }
1885
1885
  if (api === 'private') {
1886
1886
  this.checkRequiredCredentials();
1887
+ headers = {};
1887
1888
  const nonce = this.uuid();
1888
1889
  const request = {
1889
1890
  'access_key': this.apiKey,
1890
1891
  'nonce': nonce,
1891
1892
  };
1892
- if (Object.keys(query).length) {
1893
- const auth = this.urlencode(query);
1893
+ const hasQuery = Object.keys(query).length;
1894
+ let auth = undefined;
1895
+ if ((method !== 'GET') && (method !== 'DELETE')) {
1896
+ body = this.json(params);
1897
+ headers['Content-Type'] = 'application/json';
1898
+ if (hasQuery) {
1899
+ auth = this.urlencode(query);
1900
+ }
1901
+ }
1902
+ else {
1903
+ if (hasQuery) {
1904
+ auth = this.urlencode(this.keysort(query));
1905
+ }
1906
+ }
1907
+ if (auth !== undefined) {
1894
1908
  const hash = this.hash(this.encode(auth), sha512.sha512);
1895
1909
  request['query_hash'] = hash;
1896
1910
  request['query_hash_alg'] = 'SHA512';
1897
1911
  }
1898
1912
  const token = rsa.jwt(request, this.encode(this.secret), sha256.sha256);
1899
- headers = {
1900
- 'Authorization': 'Bearer ' + token,
1901
- };
1902
- if ((method !== 'GET') && (method !== 'DELETE')) {
1903
- body = this.json(params);
1904
- headers['Content-Type'] = 'application/json';
1905
- }
1913
+ headers['Authorization'] = 'Bearer ' + token;
1906
1914
  }
1907
1915
  return { 'url': url, 'method': method, 'body': body, 'headers': headers };
1908
1916
  }
@@ -1297,7 +1297,9 @@ class woo extends woo$1 {
1297
1297
  // "status":"CANCEL_ALL_SENT"
1298
1298
  // }
1299
1299
  //
1300
- return response;
1300
+ return [
1301
+ this.safeOrder(response),
1302
+ ];
1301
1303
  }
1302
1304
  async cancelAllOrdersAfter(timeout, params = {}) {
1303
1305
  /**
@@ -1324,7 +1326,9 @@ class woo extends woo$1 {
1324
1326
  // "timestamp": 1711534302943
1325
1327
  // }
1326
1328
  //
1327
- return response;
1329
+ return [
1330
+ this.safeOrder(response),
1331
+ ];
1328
1332
  }
1329
1333
  async fetchOrder(id, symbol = undefined, params = {}) {
1330
1334
  /**
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, Option, OptionChain, Conversion } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
7
- declare const version = "4.3.39";
7
+ declare const version = "4.3.40";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.3.40';
41
+ const version = '4.3.41';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -1,6 +1,8 @@
1
1
  import { implicitReturnType } from '../base/types.js';
2
2
  import { Exchange as _Exchange } from '../base/Exchange.js';
3
3
  interface Exchange {
4
+ sapiGetCopyTradingFuturesUserStatus(params?: {}): Promise<implicitReturnType>;
5
+ sapiGetCopyTradingFuturesLeadSymbol(params?: {}): Promise<implicitReturnType>;
4
6
  sapiGetSystemStatus(params?: {}): Promise<implicitReturnType>;
5
7
  sapiGetAccountSnapshot(params?: {}): Promise<implicitReturnType>;
6
8
  sapiGetAccountInfo(params?: {}): Promise<implicitReturnType>;
@@ -1,6 +1,8 @@
1
1
  import { implicitReturnType } from '../base/types.js';
2
2
  import _binance from '../binance.js';
3
3
  interface binance {
4
+ sapiGetCopyTradingFuturesUserStatus(params?: {}): Promise<implicitReturnType>;
5
+ sapiGetCopyTradingFuturesLeadSymbol(params?: {}): Promise<implicitReturnType>;
4
6
  sapiGetSystemStatus(params?: {}): Promise<implicitReturnType>;
5
7
  sapiGetAccountSnapshot(params?: {}): Promise<implicitReturnType>;
6
8
  sapiGetAccountInfo(params?: {}): Promise<implicitReturnType>;
@@ -1,6 +1,8 @@
1
1
  import { implicitReturnType } from '../base/types.js';
2
2
  import _binance from '../binance.js';
3
3
  interface binance {
4
+ sapiGetCopyTradingFuturesUserStatus(params?: {}): Promise<implicitReturnType>;
5
+ sapiGetCopyTradingFuturesLeadSymbol(params?: {}): Promise<implicitReturnType>;
4
6
  sapiGetSystemStatus(params?: {}): Promise<implicitReturnType>;
5
7
  sapiGetAccountSnapshot(params?: {}): Promise<implicitReturnType>;
6
8
  sapiGetAccountInfo(params?: {}): Promise<implicitReturnType>;
@@ -1,6 +1,8 @@
1
1
  import { implicitReturnType } from '../base/types.js';
2
2
  import _binance from '../binance.js';
3
3
  interface binance {
4
+ sapiGetCopyTradingFuturesUserStatus(params?: {}): Promise<implicitReturnType>;
5
+ sapiGetCopyTradingFuturesLeadSymbol(params?: {}): Promise<implicitReturnType>;
4
6
  sapiGetSystemStatus(params?: {}): Promise<implicitReturnType>;
5
7
  sapiGetAccountSnapshot(params?: {}): Promise<implicitReturnType>;
6
8
  sapiGetAccountInfo(params?: {}): Promise<implicitReturnType>;
@@ -147,6 +147,9 @@ interface Exchange {
147
147
  privateGetAccountGreeks(params?: {}): Promise<implicitReturnType>;
148
148
  privateGetAccountPositionTiers(params?: {}): Promise<implicitReturnType>;
149
149
  privateGetAccountMmpConfig(params?: {}): Promise<implicitReturnType>;
150
+ privateGetAccountFixedLoanBorrowingLimit(params?: {}): Promise<implicitReturnType>;
151
+ privateGetAccountFixedLoanBorrowingQuote(params?: {}): Promise<implicitReturnType>;
152
+ privateGetAccountFixedLoanBorrowingOrdersList(params?: {}): Promise<implicitReturnType>;
150
153
  privateGetUsersSubaccountList(params?: {}): Promise<implicitReturnType>;
151
154
  privateGetAccountSubaccountBalances(params?: {}): Promise<implicitReturnType>;
152
155
  privateGetAssetSubaccountBalances(params?: {}): Promise<implicitReturnType>;
@@ -258,6 +261,10 @@ interface Exchange {
258
261
  privatePostAccountSetAccountLevel(params?: {}): Promise<implicitReturnType>;
259
262
  privatePostAccountMmpReset(params?: {}): Promise<implicitReturnType>;
260
263
  privatePostAccountMmpConfig(params?: {}): Promise<implicitReturnType>;
264
+ privatePostAccountFixedLoanBorrowingOrder(params?: {}): Promise<implicitReturnType>;
265
+ privatePostAccountFixedLoanAmendBorrowingOrder(params?: {}): Promise<implicitReturnType>;
266
+ privatePostAccountFixedLoanManualReborrow(params?: {}): Promise<implicitReturnType>;
267
+ privatePostAccountFixedLoanRepayBorrowingOrder(params?: {}): Promise<implicitReturnType>;
261
268
  privatePostUsersSubaccountModifyApikey(params?: {}): Promise<implicitReturnType>;
262
269
  privatePostAssetSubaccountTransfer(params?: {}): Promise<implicitReturnType>;
263
270
  privatePostUsersSubaccountSetTransferOut(params?: {}): Promise<implicitReturnType>;
package/js/src/binance.js CHANGED
@@ -239,6 +239,9 @@ export default class binance extends Exchange {
239
239
  // UID (sapi) request rate limit of 180 000 per minute
240
240
  // 1 UID (sapi) => cost = 0.006667 => (1000 / (50 * 0.006667)) * 60 = 180000
241
241
  'get': {
242
+ // copy trading
243
+ 'copyTrading/futures/userStatus': 2,
244
+ 'copyTrading/futures/leadSymbol': 2,
242
245
  'system/status': 0.1,
243
246
  // these endpoints require this.apiKey
244
247
  'accountSnapshot': 240,
@@ -1724,7 +1724,7 @@ export default class bitfinex2 extends Exchange {
1724
1724
  }
1725
1725
  const orders = this.safeList(response, 4, []);
1726
1726
  const order = this.safeList(orders, 0);
1727
- return this.parseOrder(order, market);
1727
+ return this.parseOrder(this.extend({ 'result': order }), market);
1728
1728
  }
1729
1729
  async createOrders(orders, params = {}) {
1730
1730
  /**
@@ -24,8 +24,8 @@ export default class bithumb extends Exchange {
24
24
  parseOrderStatus(status: Str): string;
25
25
  parseOrder(order: Dict, market?: Market): Order;
26
26
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
27
- cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
28
- cancelUnifiedOrder(order: any, params?: {}): Promise<any>;
27
+ cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
28
+ cancelUnifiedOrder(order: any, params?: {}): Promise<Order>;
29
29
  withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
30
30
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
31
31
  fixCommaNumber(numberStr: any): any;
package/js/src/bithumb.js CHANGED
@@ -969,7 +969,15 @@ export default class bithumb extends Exchange {
969
969
  'order_currency': market['base'],
970
970
  'payment_currency': market['quote'],
971
971
  };
972
- return await this.privatePostTradeCancel(this.extend(request, params));
972
+ const response = await this.privatePostTradeCancel(this.extend(request, params));
973
+ //
974
+ // {
975
+ // 'status': 'string',
976
+ // }
977
+ //
978
+ return this.safeOrder({
979
+ 'info': response,
980
+ });
973
981
  }
974
982
  async cancelUnifiedOrder(order, params = {}) {
975
983
  const request = {