ccxt 4.2.48 → 4.2.50

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 (67) hide show
  1. package/README.md +3 -3
  2. package/build.sh +7 -0
  3. package/dist/ccxt.browser.js +598 -48
  4. package/dist/ccxt.browser.min.js +3 -3
  5. package/dist/cjs/ccxt.js +1 -1
  6. package/dist/cjs/src/base/Exchange.js +5 -0
  7. package/dist/cjs/src/binance.js +9 -4
  8. package/dist/cjs/src/bitmart.js +30 -4
  9. package/dist/cjs/src/bitstamp.js +8 -0
  10. package/dist/cjs/src/bl3p.js +47 -0
  11. package/dist/cjs/src/btcalpha.js +4 -0
  12. package/dist/cjs/src/btcmarkets.js +4 -0
  13. package/dist/cjs/src/btcturk.js +4 -0
  14. package/dist/cjs/src/bybit.js +138 -6
  15. package/dist/cjs/src/independentreserve.js +48 -0
  16. package/dist/cjs/src/latoken.js +16 -0
  17. package/dist/cjs/src/luno.js +18 -0
  18. package/dist/cjs/src/lykke.js +19 -0
  19. package/dist/cjs/src/ndax.js +18 -0
  20. package/dist/cjs/src/pro/ascendex.js +22 -7
  21. package/dist/cjs/src/pro/bequant.js +3 -4
  22. package/dist/cjs/src/pro/binance.js +29 -2
  23. package/dist/cjs/src/pro/bitget.js +28 -7
  24. package/dist/cjs/src/pro/bitstamp.js +1 -1
  25. package/dist/cjs/src/pro/gemini.js +89 -1
  26. package/dist/cjs/src/pro/mexc.js +2 -1
  27. package/dist/cjs/src/pro/whitebit.js +9 -8
  28. package/dist/cjs/src/timex.js +35 -1
  29. package/dist/cjs/src/upbit.js +11 -2
  30. package/js/ccxt.d.ts +1 -1
  31. package/js/ccxt.js +1 -1
  32. package/js/src/abstract/bitstamp.d.ts +8 -0
  33. package/js/src/base/Exchange.d.ts +1 -0
  34. package/js/src/base/Exchange.js +5 -0
  35. package/js/src/binance.js +9 -4
  36. package/js/src/bitmart.js +30 -4
  37. package/js/src/bitstamp.js +8 -0
  38. package/js/src/bl3p.d.ts +15 -1
  39. package/js/src/bl3p.js +47 -0
  40. package/js/src/btcalpha.js +4 -0
  41. package/js/src/btcmarkets.js +4 -0
  42. package/js/src/btcturk.js +4 -0
  43. package/js/src/bybit.d.ts +3 -1
  44. package/js/src/bybit.js +138 -6
  45. package/js/src/independentreserve.d.ts +15 -1
  46. package/js/src/independentreserve.js +48 -0
  47. package/js/src/latoken.js +16 -0
  48. package/js/src/luno.js +18 -0
  49. package/js/src/lykke.js +19 -0
  50. package/js/src/ndax.js +18 -0
  51. package/js/src/pro/ascendex.d.ts +1 -0
  52. package/js/src/pro/ascendex.js +22 -7
  53. package/js/src/pro/bequant.js +3 -4
  54. package/js/src/pro/binance.d.ts +1 -0
  55. package/js/src/pro/binance.js +29 -2
  56. package/js/src/pro/bitget.js +28 -7
  57. package/js/src/pro/bitstamp.js +1 -1
  58. package/js/src/pro/gemini.d.ts +3 -1
  59. package/js/src/pro/gemini.js +89 -1
  60. package/js/src/pro/mexc.js +2 -1
  61. package/js/src/pro/whitebit.js +9 -8
  62. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
  63. package/js/src/timex.d.ts +1 -0
  64. package/js/src/timex.js +35 -1
  65. package/js/src/upbit.js +11 -2
  66. package/package.json +3 -1
  67. package/skip-tests.json +4 -3
@@ -15,6 +15,7 @@ class gemini extends gemini$1 {
15
15
  'watchBalance': false,
16
16
  'watchTicker': false,
17
17
  'watchTickers': false,
18
+ 'watchBidsAsks': true,
18
19
  'watchTrades': true,
19
20
  'watchTradesForSymbols': true,
20
21
  'watchMyTrades': false,
@@ -414,6 +415,79 @@ class gemini extends gemini$1 {
414
415
  const orderbook = await this.helperForWatchMultipleConstruct('orderbook', symbols, params);
415
416
  return orderbook.limit();
416
417
  }
418
+ async watchBidsAsks(symbols, limit = undefined, params = {}) {
419
+ /**
420
+ * @method
421
+ * @name gemini#watchBidsAsks
422
+ * @description watches best bid & ask for symbols
423
+ * @see https://docs.gemini.com/websocket-api/#multi-market-data
424
+ * @param {string[]} symbols unified symbol of the market to fetch the ticker for
425
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
426
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
427
+ */
428
+ return await this.helperForWatchMultipleConstruct('bidsasks', symbols, params);
429
+ }
430
+ handleBidsAsksForMultidata(client, rawBidAskChanges, timestamp, nonce) {
431
+ //
432
+ // {
433
+ // eventId: '1683002916916153',
434
+ // events: [
435
+ // {
436
+ // price: '50945.37',
437
+ // reason: 'top-of-book',
438
+ // remaining: '0.0',
439
+ // side: 'bid',
440
+ // symbol: 'BTCUSDT',
441
+ // type: 'change'
442
+ // },
443
+ // {
444
+ // price: '50947.75',
445
+ // reason: 'top-of-book',
446
+ // remaining: '0.11725',
447
+ // side: 'bid',
448
+ // symbol: 'BTCUSDT',
449
+ // type: 'change'
450
+ // }
451
+ // ],
452
+ // socket_sequence: 322,
453
+ // timestamp: 1708674495,
454
+ // timestampms: 1708674495174,
455
+ // type: 'update'
456
+ // }
457
+ //
458
+ const marketId = rawBidAskChanges[0]['symbol'];
459
+ const market = this.safeMarket(marketId.toLowerCase());
460
+ const symbol = market['symbol'];
461
+ if (!(symbol in this.bidsasks)) {
462
+ this.bidsasks[symbol] = this.parseTicker({});
463
+ this.bidsasks[symbol]['symbol'] = symbol;
464
+ }
465
+ const currentBidAsk = this.bidsasks[symbol];
466
+ const messageHash = 'bidsasks:' + symbol;
467
+ // last update always overwrites the previous state and is the latest state
468
+ for (let i = 0; i < rawBidAskChanges.length; i++) {
469
+ const entry = rawBidAskChanges[i];
470
+ const rawSide = this.safeString(entry, 'side');
471
+ const price = this.safeNumber(entry, 'price');
472
+ const size = this.safeNumber(entry, 'remaining');
473
+ if (size === 0) {
474
+ continue;
475
+ }
476
+ if (rawSide === 'bid') {
477
+ currentBidAsk['bid'] = price;
478
+ currentBidAsk['bidVolume'] = size;
479
+ }
480
+ else {
481
+ currentBidAsk['ask'] = price;
482
+ currentBidAsk['askVolume'] = size;
483
+ }
484
+ }
485
+ currentBidAsk['timestamp'] = timestamp;
486
+ currentBidAsk['datetime'] = this.iso8601(timestamp);
487
+ currentBidAsk['info'] = rawBidAskChanges;
488
+ this.bidsasks[symbol] = currentBidAsk;
489
+ client.resolve(currentBidAsk, messageHash);
490
+ }
417
491
  async helperForWatchMultipleConstruct(itemHashName, symbols, params = {}) {
418
492
  await this.loadMarkets();
419
493
  symbols = this.marketSymbols(symbols, undefined, false, true, true);
@@ -435,6 +509,9 @@ class gemini extends gemini$1 {
435
509
  if (itemHashName === 'orderbook') {
436
510
  url += 'trades=false&bids=true&offers=true';
437
511
  }
512
+ else if (itemHashName === 'bidsasks') {
513
+ url += 'trades=false&bids=true&offers=true&top_of_book=true';
514
+ }
438
515
  else if (itemHashName === 'trades') {
439
516
  url += 'trades=true&bids=false&offers=false';
440
517
  }
@@ -777,18 +854,29 @@ class gemini extends gemini$1 {
777
854
  const eventId = this.safeInteger(message, 'eventId');
778
855
  const events = this.safeList(message, 'events');
779
856
  const orderBookItems = [];
857
+ const bidaskItems = [];
780
858
  const collectedEventsOfTrades = [];
859
+ const eventsLength = events.length;
781
860
  for (let i = 0; i < events.length; i++) {
782
861
  const event = events[i];
783
862
  const eventType = this.safeString(event, 'type');
784
863
  const isOrderBook = (eventType === 'change') && ('side' in event) && this.inArray(event['side'], ['ask', 'bid']);
785
- if (isOrderBook) {
864
+ const eventReason = this.safeString(event, 'reason');
865
+ const isBidAsk = (eventReason === 'top-of-book') || (isOrderBook && (eventReason === 'initial') && eventsLength === 2);
866
+ if (isBidAsk) {
867
+ bidaskItems.push(event);
868
+ }
869
+ else if (isOrderBook) {
786
870
  orderBookItems.push(event);
787
871
  }
788
872
  else if (eventType === 'trade') {
789
873
  collectedEventsOfTrades.push(events[i]);
790
874
  }
791
875
  }
876
+ const lengthBa = bidaskItems.length;
877
+ if (lengthBa > 0) {
878
+ this.handleBidsAsksForMultidata(client, bidaskItems, ts, eventId);
879
+ }
792
880
  const lengthOb = orderBookItems.length;
793
881
  if (lengthOb > 0) {
794
882
  this.handleOrderBookForMultidata(client, orderBookItems, ts, eventId);
@@ -450,6 +450,7 @@ class mexc extends mexc$1 {
450
450
  const symbol = this.safeSymbol(marketId);
451
451
  const messageHash = 'orderbook:' + symbol;
452
452
  const subscription = this.safeValue(client.subscriptions, messageHash);
453
+ const limit = this.safeInteger(subscription, 'limit');
453
454
  if (subscription === true) {
454
455
  // we set client.subscriptions[messageHash] to 1
455
456
  // once we have received the first delta and initialized the orderbook
@@ -462,7 +463,7 @@ class mexc extends mexc$1 {
462
463
  const cacheLength = storedOrderBook.cache.length;
463
464
  const snapshotDelay = this.handleOption('watchOrderBook', 'snapshotDelay', 25);
464
465
  if (cacheLength === snapshotDelay) {
465
- this.spawn(this.loadOrderBook, client, messageHash, symbol);
466
+ this.spawn(this.loadOrderBook, client, messageHash, symbol, limit, {});
466
467
  }
467
468
  storedOrderBook.cache.push(data);
468
469
  return;
@@ -163,6 +163,7 @@ class whitebit extends whitebit$1 {
163
163
  // "params":[
164
164
  // true,
165
165
  // {
166
+ // "timestamp": 1708679568.940867,
166
167
  // "asks":[
167
168
  // [ "21252.45","0.01957"],
168
169
  // ["21252.55","0.126205"],
@@ -199,14 +200,14 @@ class whitebit extends whitebit$1 {
199
200
  const market = this.safeMarket(marketId);
200
201
  const symbol = market['symbol'];
201
202
  const data = this.safeValue(params, 1);
202
- let orderbook = undefined;
203
- if (symbol in this.orderbooks) {
204
- orderbook = this.orderbooks[symbol];
205
- }
206
- else {
207
- orderbook = this.orderBook();
208
- this.orderbooks[symbol] = orderbook;
209
- }
203
+ const timestamp = this.safeTimestamp(data, 'timestamp');
204
+ if (!(symbol in this.orderbooks)) {
205
+ const ob = this.orderBook();
206
+ this.orderbooks[symbol] = ob;
207
+ }
208
+ const orderbook = this.orderbooks[symbol];
209
+ orderbook['timestamp'] = timestamp;
210
+ orderbook['datetime'] = this.iso8601(timestamp);
210
211
  if (isSnapshot) {
211
212
  const snapshot = this.parseOrderBook(data, symbol);
212
213
  orderbook.reset(snapshot);
@@ -70,6 +70,7 @@ class timex extends timex$1 {
70
70
  'fetchPremiumIndexOHLCV': false,
71
71
  'fetchTicker': true,
72
72
  'fetchTickers': true,
73
+ 'fetchTime': true,
73
74
  'fetchTrades': true,
74
75
  'fetchTradingFee': true,
75
76
  'fetchWithdrawal': false,
@@ -265,11 +266,26 @@ class timex extends timex$1 {
265
266
  },
266
267
  });
267
268
  }
269
+ async fetchTime(params = {}) {
270
+ /**
271
+ * @method
272
+ * @name timex#fetchTime
273
+ * @description fetches the current integer timestamp in milliseconds from the exchange server
274
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
275
+ * @returns {int} the current integer timestamp in milliseconds from the exchange server
276
+ */
277
+ const response = await this.tradingviewGetTime(params);
278
+ //
279
+ // 1708682617
280
+ //
281
+ return this.parseToInt(response) * 1000;
282
+ }
268
283
  async fetchMarkets(params = {}) {
269
284
  /**
270
285
  * @method
271
286
  * @name timex#fetchMarkets
272
287
  * @description retrieves data on all markets for timex
288
+ * @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/listMarkets
273
289
  * @param {object} [params] extra parameters specific to the exchange API endpoint
274
290
  * @returns {object[]} an array of objects representing market data
275
291
  */
@@ -302,6 +318,7 @@ class timex extends timex$1 {
302
318
  * @method
303
319
  * @name timex#fetchCurrencies
304
320
  * @description fetches all available currencies on an exchange
321
+ * @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/listCurrencies
305
322
  * @param {object} [params] extra parameters specific to the exchange API endpoint
306
323
  * @returns {object} an associative dictionary of currencies
307
324
  */
@@ -343,6 +360,7 @@ class timex extends timex$1 {
343
360
  * @method
344
361
  * @name timex#fetchDeposits
345
362
  * @description fetch all deposits made to an account
363
+ * @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Manager/getDeposits
346
364
  * @param {string} code unified currency code
347
365
  * @param {int} [since] the earliest time in ms to fetch deposits for
348
366
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -378,6 +396,7 @@ class timex extends timex$1 {
378
396
  * @method
379
397
  * @name timex#fetchWithdrawals
380
398
  * @description fetch all withdrawals made to an account
399
+ * @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Manager/getWithdraws
381
400
  * @param {string} code unified currency code
382
401
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
383
402
  * @param {int} [limit] the maximum number of transaction structures to retrieve
@@ -462,6 +481,7 @@ class timex extends timex$1 {
462
481
  * @method
463
482
  * @name timex#fetchTickers
464
483
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
484
+ * @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/listTickers
465
485
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
466
486
  * @param {object} [params] extra parameters specific to the exchange API endpoint
467
487
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -496,6 +516,7 @@ class timex extends timex$1 {
496
516
  * @method
497
517
  * @name timex#fetchTicker
498
518
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
519
+ * @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/listTickers
499
520
  * @param {string} symbol unified symbol of the market to fetch the ticker for
500
521
  * @param {object} [params] extra parameters specific to the exchange API endpoint
501
522
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -533,6 +554,7 @@ class timex extends timex$1 {
533
554
  * @method
534
555
  * @name timex#fetchOrderBook
535
556
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
557
+ * @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/orderbookV2
536
558
  * @param {string} symbol unified symbol of the market to fetch the order book for
537
559
  * @param {int} [limit] the maximum amount of order book entries to return
538
560
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -579,6 +601,7 @@ class timex extends timex$1 {
579
601
  * @method
580
602
  * @name timex#fetchTrades
581
603
  * @description get the list of most recent trades for a particular symbol
604
+ * @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/listTrades
582
605
  * @param {string} symbol unified symbol of the market to fetch trades for
583
606
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
584
607
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -626,6 +649,7 @@ class timex extends timex$1 {
626
649
  * @method
627
650
  * @name timex#fetchOHLCV
628
651
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
652
+ * @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/listCandles
629
653
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
630
654
  * @param {string} timeframe the length of time each candle represents
631
655
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -691,6 +715,7 @@ class timex extends timex$1 {
691
715
  * @method
692
716
  * @name timex#fetchBalance
693
717
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
718
+ * @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Trading/getBalances
694
719
  * @param {object} [params] extra parameters specific to the exchange API endpoint
695
720
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
696
721
  */
@@ -712,6 +737,7 @@ class timex extends timex$1 {
712
737
  * @method
713
738
  * @name timex#createOrder
714
739
  * @description create a trade order
740
+ * @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Trading/createOrder
715
741
  * @param {string} symbol unified symbol of the market to create an order in
716
742
  * @param {string} type 'market' or 'limit'
717
743
  * @param {string} side 'buy' or 'sell'
@@ -840,6 +866,7 @@ class timex extends timex$1 {
840
866
  * @method
841
867
  * @name timex#cancelOrder
842
868
  * @description cancels an open order
869
+ * @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Trading/deleteOrders
843
870
  * @param {string} id order id
844
871
  * @param {string} symbol not used by timex cancelOrder ()
845
872
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -853,6 +880,7 @@ class timex extends timex$1 {
853
880
  * @method
854
881
  * @name timex#cancelOrders
855
882
  * @description cancel multiple orders
883
+ * @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Trading/deleteOrders
856
884
  * @param {string[]} ids order ids
857
885
  * @param {string} symbol unified market symbol, default is undefined
858
886
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -894,6 +922,7 @@ class timex extends timex$1 {
894
922
  * @method
895
923
  * @name timex#fetchOrder
896
924
  * @description fetches information on an order made by the user
925
+ * @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/History/getOrderDetails
897
926
  * @param {string} symbol not used by timex fetchOrder
898
927
  * @param {object} [params] extra parameters specific to the exchange API endpoint
899
928
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -945,6 +974,7 @@ class timex extends timex$1 {
945
974
  * @method
946
975
  * @name timex#fetchOpenOrders
947
976
  * @description fetch all unfilled currently open orders
977
+ * @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Trading/getOpenOrders
948
978
  * @param {string} symbol unified market symbol
949
979
  * @param {int} [since] the earliest time in ms to fetch open orders for
950
980
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -999,6 +1029,7 @@ class timex extends timex$1 {
999
1029
  * @method
1000
1030
  * @name timex#fetchClosedOrders
1001
1031
  * @description fetches information on multiple closed orders made by the user
1032
+ * @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/History/getOrders
1002
1033
  * @param {string} symbol unified market symbol of the market orders were made in
1003
1034
  * @param {int} [since] the earliest time in ms to fetch orders for
1004
1035
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -1058,6 +1089,7 @@ class timex extends timex$1 {
1058
1089
  * @method
1059
1090
  * @name timex#fetchMyTrades
1060
1091
  * @description fetch all trades made by the user
1092
+ * @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/History/getTrades_1
1061
1093
  * @param {string} symbol unified market symbol
1062
1094
  * @param {int} [since] the earliest time in ms to fetch trades for
1063
1095
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -1136,6 +1168,7 @@ class timex extends timex$1 {
1136
1168
  * @method
1137
1169
  * @name timex#fetchTradingFee
1138
1170
  * @description fetch the trading fees for a market
1171
+ * @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Trading/getFees
1139
1172
  * @param {string} symbol unified market symbol
1140
1173
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1141
1174
  * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
@@ -1529,6 +1562,7 @@ class timex extends timex$1 {
1529
1562
  * @method
1530
1563
  * @name timex#fetchDepositAddress
1531
1564
  * @description fetch the deposit address for a currency associated with this account, does not accept params["network"]
1565
+ * @see https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Currency/selectCurrencyBySymbol
1532
1566
  * @param {string} code unified currency code
1533
1567
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1534
1568
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
@@ -1591,7 +1625,7 @@ class timex extends timex$1 {
1591
1625
  if (Object.keys(params).length) {
1592
1626
  url += '?' + this.urlencodeWithArrayRepeat(params);
1593
1627
  }
1594
- if (api !== 'public') {
1628
+ if (api !== 'public' && api !== 'tradingview') {
1595
1629
  this.checkRequiredCredentials();
1596
1630
  const auth = this.stringToBase64(this.apiKey + ':' + this.secret);
1597
1631
  const secret = 'Basic ' + auth;
@@ -41,9 +41,9 @@ class upbit extends upbit$1 {
41
41
  'fetchBalance': true,
42
42
  'fetchCanceledOrders': true,
43
43
  'fetchClosedOrders': true,
44
+ 'fetchDeposit': true,
44
45
  'fetchDepositAddress': true,
45
46
  'fetchDepositAddresses': true,
46
- 'fetchDeposit': true,
47
47
  'fetchDeposits': true,
48
48
  'fetchFundingHistory': false,
49
49
  'fetchFundingRate': false,
@@ -1027,6 +1027,7 @@ class upbit extends upbit$1 {
1027
1027
  * @name upbit#createOrder
1028
1028
  * @description create a trade order
1029
1029
  * @see https://docs.upbit.com/reference/%EC%A3%BC%EB%AC%B8%ED%95%98%EA%B8%B0
1030
+ * @see https://global-docs.upbit.com/reference/order
1030
1031
  * @param {string} symbol unified symbol of the market to create an order in
1031
1032
  * @param {string} type 'market' or 'limit'
1032
1033
  * @param {string} side 'buy' or 'sell'
@@ -1034,6 +1035,7 @@ class upbit extends upbit$1 {
1034
1035
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1035
1036
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1036
1037
  * @param {float} [params.cost] for market buy orders, the quote quantity that can be used as an alternative for the amount
1038
+ * @param {string} [params.timeInForce] 'IOC' or 'FOK'
1037
1039
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1038
1040
  */
1039
1041
  await this.loadMarkets();
@@ -1090,6 +1092,13 @@ class upbit extends upbit$1 {
1090
1092
  if (clientOrderId !== undefined) {
1091
1093
  request['identifier'] = clientOrderId;
1092
1094
  }
1095
+ if (type !== 'market') {
1096
+ const timeInForce = this.safeStringLower2(params, 'timeInForce', 'time_in_force');
1097
+ params = this.omit(params, 'timeInForce');
1098
+ if (timeInForce !== undefined) {
1099
+ request['time_in_force'] = timeInForce;
1100
+ }
1101
+ }
1093
1102
  params = this.omit(params, ['clientOrderId', 'identifier']);
1094
1103
  const response = await this.privatePostOrders(this.extend(request, params));
1095
1104
  //
@@ -1873,7 +1882,7 @@ class upbit extends upbit$1 {
1873
1882
  }
1874
1883
  if (api === 'private') {
1875
1884
  this.checkRequiredCredentials();
1876
- const nonce = this.nonce();
1885
+ const nonce = this.uuid();
1877
1886
  const request = {
1878
1887
  'access_key': this.apiKey,
1879
1888
  'nonce': nonce,
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
7
- declare const version = "4.2.47";
7
+ declare const version = "4.2.49";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.2.48';
41
+ const version = '4.2.50';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -225,6 +225,14 @@ interface Exchange {
225
225
  privatePostEurcvAddress(params?: {}): Promise<implicitReturnType>;
226
226
  privatePostPyusdWithdrawal(params?: {}): Promise<implicitReturnType>;
227
227
  privatePostPyusdAddress(params?: {}): Promise<implicitReturnType>;
228
+ privatePostLmwrWithdrawal(params?: {}): Promise<implicitReturnType>;
229
+ privatePostLmwrAddress(params?: {}): Promise<implicitReturnType>;
230
+ privatePostPepeWithdrawal(params?: {}): Promise<implicitReturnType>;
231
+ privatePostPepeAddress(params?: {}): Promise<implicitReturnType>;
232
+ privatePostBlurWithdrawal(params?: {}): Promise<implicitReturnType>;
233
+ privatePostBlurAddress(params?: {}): Promise<implicitReturnType>;
234
+ privatePostVextWithdrawal(params?: {}): Promise<implicitReturnType>;
235
+ privatePostVextAddress(params?: {}): Promise<implicitReturnType>;
228
236
  }
229
237
  declare abstract class Exchange extends _Exchange {
230
238
  }
@@ -690,6 +690,7 @@ export default class Exchange {
690
690
  safeCurrencyStructure(currency: object): any;
691
691
  safeMarketStructure(market?: any): MarketInterface;
692
692
  setMarkets(markets: any, currencies?: any): Dictionary<any>;
693
+ getDescribeForExtendedWsExchange(currentRestInstance: any, parentRestInstance: any, wsBaseDescribe: Dictionary<any>): any;
693
694
  safeBalance(balance: object): Balances;
694
695
  safeOrder(order: object, market?: Market): Order;
695
696
  parseOrders(orders: object, market?: Market, since?: Int, limit?: Int, params?: {}): Order[];
@@ -2259,6 +2259,11 @@ export default class Exchange {
2259
2259
  this.codes = Object.keys(currenciesSortedByCode);
2260
2260
  return this.markets;
2261
2261
  }
2262
+ getDescribeForExtendedWsExchange(currentRestInstance, parentRestInstance, wsBaseDescribe) {
2263
+ const extendedRestDescribe = this.deepExtend(parentRestInstance.describe(), currentRestInstance.describe());
2264
+ const superWithRestDescribe = this.deepExtend(extendedRestDescribe, wsBaseDescribe);
2265
+ return superWithRestDescribe;
2266
+ }
2262
2267
  safeBalance(balance) {
2263
2268
  const balances = this.omit(balance, ['info', 'timestamp', 'datetime', 'free', 'used', 'total']);
2264
2269
  const codes = Object.keys(balances);
package/js/src/binance.js CHANGED
@@ -49,6 +49,7 @@ export default class binance extends Exchange {
49
49
  'createMarketSellOrderWithCost': true,
50
50
  'createOrder': true,
51
51
  'createOrders': true,
52
+ 'createOrderWithTakeProfitAndStopLoss': true,
52
53
  'createPostOnlyOrder': true,
53
54
  'createReduceOnlyOrder': true,
54
55
  'createStopLimitOrder': true,
@@ -122,7 +123,7 @@ export default class binance extends Exchange {
122
123
  'fetchTradingFee': true,
123
124
  'fetchTradingFees': true,
124
125
  'fetchTradingLimits': undefined,
125
- 'fetchTransactionFee': undefined,
126
+ 'fetchTransactionFee': 'emulated',
126
127
  'fetchTransactionFees': true,
127
128
  'fetchTransactions': false,
128
129
  'fetchTransfers': true,
@@ -3020,7 +3021,7 @@ export default class binance extends Exchange {
3020
3021
  let fees = this.fees;
3021
3022
  let linear = undefined;
3022
3023
  let inverse = undefined;
3023
- const strike = this.safeInteger(market, 'strikePrice');
3024
+ const strike = this.safeString(market, 'strikePrice');
3024
3025
  let symbol = base + '/' + quote;
3025
3026
  if (contract) {
3026
3027
  if (swap) {
@@ -3030,7 +3031,7 @@ export default class binance extends Exchange {
3030
3031
  symbol = symbol + ':' + settle + '-' + this.yymmdd(expiry);
3031
3032
  }
3032
3033
  else if (option) {
3033
- symbol = symbol + ':' + settle + '-' + this.yymmdd(expiry) + '-' + this.numberToString(strike) + '-' + this.safeString(optionParts, 3);
3034
+ symbol = symbol + ':' + settle + '-' + this.yymmdd(expiry) + '-' + strike + '-' + this.safeString(optionParts, 3);
3034
3035
  }
3035
3036
  contractSize = this.safeNumber2(market, 'contractSize', 'unit', this.parseNumber('1'));
3036
3037
  linear = settle === quote;
@@ -3063,6 +3064,10 @@ export default class binance extends Exchange {
3063
3064
  unifiedType = 'option';
3064
3065
  active = undefined;
3065
3066
  }
3067
+ let parsedStrike = undefined;
3068
+ if (strike !== undefined) {
3069
+ parsedStrike = this.parseToNumeric(strike);
3070
+ }
3066
3071
  const entry = {
3067
3072
  'id': id,
3068
3073
  'lowercaseId': lowercaseId,
@@ -3088,7 +3093,7 @@ export default class binance extends Exchange {
3088
3093
  'contractSize': contractSize,
3089
3094
  'expiry': expiry,
3090
3095
  'expiryDatetime': this.iso8601(expiry),
3091
- 'strike': strike,
3096
+ 'strike': parsedStrike,
3092
3097
  'optionType': this.safeStringLower(market, 'side'),
3093
3098
  'precision': {
3094
3099
  'amount': this.safeInteger2(market, 'quantityPrecision', 'quantityScale'),
package/js/src/bitmart.js CHANGED
@@ -1126,7 +1126,7 @@ export default class bitmart extends Exchange {
1126
1126
  }
1127
1127
  parseTicker(ticker, market = undefined) {
1128
1128
  //
1129
- // spot
1129
+ // spot (REST)
1130
1130
  //
1131
1131
  // {
1132
1132
  // "symbol": "SOLAR_USDT",
@@ -1146,6 +1146,17 @@ export default class bitmart extends Exchange {
1146
1146
  // "timestamp": 1667403439367
1147
1147
  // }
1148
1148
  //
1149
+ // spot (WS)
1150
+ // {
1151
+ // "symbol":"BTC_USDT",
1152
+ // "last_price":"146.24",
1153
+ // "open_24h":"147.17",
1154
+ // "high_24h":"147.48",
1155
+ // "low_24h":"143.88",
1156
+ // "base_volume_24h":"117387.58", // NOT base, but quote currency!!!
1157
+ // "s_t": 1610936002
1158
+ // }
1159
+ //
1149
1160
  // swap
1150
1161
  //
1151
1162
  // {
@@ -1161,7 +1172,11 @@ export default class bitmart extends Exchange {
1161
1172
  // "legal_coin_price":"0.1302699"
1162
1173
  // }
1163
1174
  //
1164
- const timestamp = this.safeInteger(ticker, 'timestamp');
1175
+ let timestamp = this.safeInteger(ticker, 'timestamp');
1176
+ if (timestamp === undefined) {
1177
+ // ticker from WS has a different field (in seconds)
1178
+ timestamp = this.safeIntegerProduct(ticker, 's_t', 1000);
1179
+ }
1165
1180
  const marketId = this.safeString2(ticker, 'symbol', 'contract_symbol');
1166
1181
  market = this.safeMarket(marketId, market);
1167
1182
  const symbol = market['symbol'];
@@ -1177,9 +1192,20 @@ export default class bitmart extends Exchange {
1177
1192
  percentage = '0';
1178
1193
  }
1179
1194
  }
1180
- const baseVolume = this.safeString(ticker, 'base_volume_24h');
1195
+ let baseVolume = this.safeString(ticker, 'base_volume_24h');
1181
1196
  let quoteVolume = this.safeString(ticker, 'quote_volume_24h');
1182
- quoteVolume = this.safeString(ticker, 'volume_24h', quoteVolume);
1197
+ if (quoteVolume === undefined) {
1198
+ if (baseVolume === undefined) {
1199
+ // this is swap
1200
+ quoteVolume = this.safeString(ticker, 'volume_24h', quoteVolume);
1201
+ }
1202
+ else {
1203
+ // this is a ticker from websockets
1204
+ // contrary to name and documentation, base_volume_24h is actually the quote volume
1205
+ quoteVolume = baseVolume;
1206
+ baseVolume = undefined;
1207
+ }
1208
+ }
1183
1209
  const average = this.safeString2(ticker, 'avg_price', 'index_price');
1184
1210
  const high = this.safeString2(ticker, 'high_24h', 'high_price');
1185
1211
  const low = this.safeString2(ticker, 'low_24h', 'low_price');
@@ -351,6 +351,14 @@ export default class bitstamp extends Exchange {
351
351
  'eurcv_address/': 1,
352
352
  'pyusd_withdrawal/': 1,
353
353
  'pyusd_address/': 1,
354
+ 'lmwr_withdrawal/': 1,
355
+ 'lmwr_address/': 1,
356
+ 'pepe_withdrawal/': 1,
357
+ 'pepe_address/': 1,
358
+ 'blur_withdrawal/': 1,
359
+ 'blur_address/': 1,
360
+ 'vext_withdrawal/': 1,
361
+ 'vext_address/': 1,
354
362
  },
355
363
  },
356
364
  },
package/js/src/bl3p.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bl3p.js';
2
- import type { Balances, Int, Market, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, IndexType } from './base/types.js';
2
+ import type { Balances, Int, Market, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, IndexType, Currency } from './base/types.js';
3
3
  /**
4
4
  * @class bl3p
5
5
  * @augments Exchange
@@ -17,6 +17,20 @@ export default class bl3p extends Exchange {
17
17
  fetchTradingFees(params?: {}): Promise<{}>;
18
18
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<import("./base/types.js").Order>;
19
19
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
20
+ createDepositAddress(code: string, params?: {}): Promise<{
21
+ info: any;
22
+ currency: string;
23
+ address: string;
24
+ tag: any;
25
+ network: any;
26
+ }>;
27
+ parseDepositAddress(depositAddress: any, currency?: Currency): {
28
+ info: any;
29
+ currency: string;
30
+ address: string;
31
+ tag: any;
32
+ network: any;
33
+ };
20
34
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
21
35
  url: string;
22
36
  method: string;