ccxt 4.5.39 → 4.5.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 (138) hide show
  1. package/README.md +6 -5
  2. package/dist/ccxt.browser.min.js +18 -18
  3. package/dist/cjs/ccxt.js +6 -1
  4. package/dist/cjs/src/abstract/lighter.js +11 -0
  5. package/dist/cjs/src/ascendex.js +73 -1
  6. package/dist/cjs/src/base/Exchange.js +211 -22
  7. package/dist/cjs/src/base/functions/generic.js +1 -0
  8. package/dist/cjs/src/base/functions/io.js +160 -0
  9. package/dist/cjs/src/base/functions.js +6 -0
  10. package/dist/cjs/src/base/ws/Client.js +1 -0
  11. package/dist/cjs/src/base/ws/WsClient.js +1 -0
  12. package/dist/cjs/src/binance.js +143 -0
  13. package/dist/cjs/src/bingx.js +150 -123
  14. package/dist/cjs/src/bitmart.js +20 -6
  15. package/dist/cjs/src/bitmex.js +436 -0
  16. package/dist/cjs/src/blofin.js +86 -1
  17. package/dist/cjs/src/bybit.js +135 -0
  18. package/dist/cjs/src/coinspot.js +7 -2
  19. package/dist/cjs/src/delta.js +367 -0
  20. package/dist/cjs/src/gate.js +11 -4
  21. package/dist/cjs/src/gemini.js +76 -1
  22. package/dist/cjs/src/htx.js +266 -3
  23. package/dist/cjs/src/hyperliquid.js +20 -7
  24. package/dist/cjs/src/independentreserve.js +7 -7
  25. package/dist/cjs/src/kraken.js +1 -1
  26. package/dist/cjs/src/krakenfutures.js +96 -5
  27. package/dist/cjs/src/kucoin.js +3 -3
  28. package/dist/cjs/src/kucoinfutures.js +121 -0
  29. package/dist/cjs/src/lighter.js +2931 -0
  30. package/dist/cjs/src/mexc.js +9 -2
  31. package/dist/cjs/src/phemex.js +359 -0
  32. package/dist/cjs/src/poloniex.js +5 -0
  33. package/dist/cjs/src/pro/binance.js +2 -2
  34. package/dist/cjs/src/pro/bingx.js +248 -35
  35. package/dist/cjs/src/pro/bitget.js +49 -90
  36. package/dist/cjs/src/pro/bitmart.js +68 -0
  37. package/dist/cjs/src/pro/blofin.js +52 -1
  38. package/dist/cjs/src/pro/coinbaseinternational.js +5 -2
  39. package/dist/cjs/src/pro/defx.js +1 -1
  40. package/dist/cjs/src/pro/kucoinfutures.js +1 -1
  41. package/dist/cjs/src/pro/lighter.js +787 -0
  42. package/dist/cjs/src/pro/mexc.js +73 -1
  43. package/dist/cjs/src/pro/okx.js +7 -4
  44. package/dist/cjs/src/pro/paradex.js +138 -1
  45. package/dist/cjs/src/pro/woo.js +43 -0
  46. package/dist/cjs/src/static_dependencies/ethers/abi-coder.js +1 -0
  47. package/dist/cjs/src/static_dependencies/ethers/address/address.js +1 -0
  48. package/dist/cjs/src/static_dependencies/ethers/coders/abstract-coder.js +1 -0
  49. package/dist/cjs/src/static_dependencies/ethers/coders/address.js +1 -0
  50. package/dist/cjs/src/static_dependencies/ethers/coders/array.js +1 -0
  51. package/dist/cjs/src/static_dependencies/ethers/coders/bytes.js +1 -0
  52. package/dist/cjs/src/static_dependencies/ethers/coders/fixed-bytes.js +1 -0
  53. package/dist/cjs/src/static_dependencies/ethers/coders/number.js +1 -0
  54. package/dist/cjs/src/static_dependencies/ethers/fragments.js +1 -0
  55. package/dist/cjs/src/static_dependencies/ethers/index.js +1 -0
  56. package/dist/cjs/src/static_dependencies/ethers/interface.js +1 -0
  57. package/dist/cjs/src/static_dependencies/ethers/typed.js +1 -0
  58. package/dist/cjs/src/static_dependencies/ethers/utils/index.js +1 -0
  59. package/dist/cjs/src/whitebit.js +118 -16
  60. package/dist/cjs/src/woo.js +103 -3
  61. package/js/ccxt.d.ts +9 -3
  62. package/js/ccxt.js +6 -2
  63. package/js/src/abstract/gemini.d.ts +27 -0
  64. package/js/src/abstract/lighter.d.ts +53 -0
  65. package/js/src/abstract/lighter.js +5 -0
  66. package/js/src/ascendex.d.ts +12 -1
  67. package/js/src/ascendex.js +73 -1
  68. package/js/src/base/Exchange.d.ts +29 -14
  69. package/js/src/base/Exchange.js +216 -23
  70. package/js/src/base/functions/generic.js +1 -0
  71. package/js/src/base/functions/io.d.ts +32 -0
  72. package/js/src/base/functions/io.js +131 -0
  73. package/js/src/base/functions.d.ts +1 -0
  74. package/js/src/base/functions.js +1 -0
  75. package/js/src/base/types.d.ts +9 -0
  76. package/js/src/binance.d.ts +27 -1
  77. package/js/src/binance.js +143 -0
  78. package/js/src/bingx.d.ts +113 -108
  79. package/js/src/bingx.js +150 -123
  80. package/js/src/bitmart.js +20 -6
  81. package/js/src/bitmex.d.ts +50 -1
  82. package/js/src/bitmex.js +436 -0
  83. package/js/src/blofin.d.ts +12 -1
  84. package/js/src/blofin.js +86 -1
  85. package/js/src/bybit.d.ts +12 -1
  86. package/js/src/bybit.js +135 -0
  87. package/js/src/coinspot.js +7 -2
  88. package/js/src/delta.d.ts +12 -1
  89. package/js/src/delta.js +367 -0
  90. package/js/src/gate.d.ts +1 -0
  91. package/js/src/gate.js +11 -4
  92. package/js/src/gemini.d.ts +11 -0
  93. package/js/src/gemini.js +76 -1
  94. package/js/src/htx.d.ts +15 -1
  95. package/js/src/htx.js +266 -3
  96. package/js/src/hyperliquid.js +20 -7
  97. package/js/src/independentreserve.js +7 -7
  98. package/js/src/kraken.js +1 -1
  99. package/js/src/krakenfutures.d.ts +1 -1
  100. package/js/src/krakenfutures.js +96 -5
  101. package/js/src/kucoin.d.ts +3 -3
  102. package/js/src/kucoin.js +3 -3
  103. package/js/src/kucoinfutures.d.ts +12 -1
  104. package/js/src/kucoinfutures.js +121 -0
  105. package/js/src/lighter.d.ts +424 -0
  106. package/js/src/lighter.js +2924 -0
  107. package/js/src/mexc.js +9 -2
  108. package/js/src/phemex.d.ts +16 -1
  109. package/js/src/phemex.js +359 -0
  110. package/js/src/poloniex.js +5 -0
  111. package/js/src/pro/binance.js +2 -2
  112. package/js/src/pro/bingx.d.ts +50 -34
  113. package/js/src/pro/bingx.js +249 -36
  114. package/js/src/pro/bitget.d.ts +6 -6
  115. package/js/src/pro/bitget.js +49 -90
  116. package/js/src/pro/bitmart.d.ts +22 -1
  117. package/js/src/pro/bitmart.js +69 -1
  118. package/js/src/pro/blofin.d.ts +12 -1
  119. package/js/src/pro/blofin.js +52 -1
  120. package/js/src/pro/coinbaseinternational.d.ts +2 -2
  121. package/js/src/pro/coinbaseinternational.js +6 -3
  122. package/js/src/pro/defx.js +1 -1
  123. package/js/src/pro/kucoinfutures.js +1 -1
  124. package/js/src/pro/lighter.d.ts +161 -0
  125. package/js/src/pro/lighter.js +780 -0
  126. package/js/src/pro/mexc.d.ts +22 -1
  127. package/js/src/pro/mexc.js +73 -1
  128. package/js/src/pro/okx.d.ts +4 -4
  129. package/js/src/pro/okx.js +7 -4
  130. package/js/src/pro/paradex.d.ts +23 -1
  131. package/js/src/pro/paradex.js +138 -1
  132. package/js/src/pro/woo.d.ts +12 -1
  133. package/js/src/pro/woo.js +43 -0
  134. package/js/src/whitebit.d.ts +2 -1
  135. package/js/src/whitebit.js +118 -16
  136. package/js/src/woo.d.ts +12 -1
  137. package/js/src/woo.js +103 -3
  138. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  // ---------------------------------------------------------------------------
2
2
  import coinbaseinternationalRest from '../coinbaseinternational.js';
3
- import { AuthenticationError, ExchangeError, NotSupported } from '../base/errors.js';
3
+ import { AuthenticationError, ExchangeError, NotSupported, ArgumentsRequired } from '../base/errors.js';
4
4
  import { sha256 } from '../static_dependencies/noble-hashes/sha256.js';
5
5
  import { ArrayCache, ArrayCacheByTimestamp } from '../base/ws/Cache.js';
6
6
  // ---------------------------------------------------------------------------
@@ -185,11 +185,14 @@ export default class coinbaseinternational extends coinbaseinternationalRest {
185
185
  * @name coinbaseinternational#watchFundingRates
186
186
  * @description watch the funding rate for multiple markets
187
187
  * @see https://docs.cloud.coinbase.com/intx/docs/websocket-channels#funding-channel
188
- * @param {string[]|undefined} symbols list of unified market symbols
188
+ * @param {string[]} symbols a list of unified market symbols
189
189
  * @param {object} [params] extra parameters specific to the exchange API endpoint
190
190
  * @returns {object} a dictionary of [funding rates structures]{@link https://docs.ccxt.com/?id=funding-rates-structure}, indexe by market symbols
191
191
  */
192
- async watchFundingRates(symbols, params = {}) {
192
+ async watchFundingRates(symbols = undefined, params = {}) {
193
+ if (symbols === undefined) {
194
+ throw new ArgumentsRequired(this.id + ' watchFundingRates() requires an array of symbols');
195
+ }
193
196
  await this.loadMarkets();
194
197
  const fundingRate = await this.subscribeMultiple('RISK', symbols, params);
195
198
  const symbol = this.safeString(fundingRate, 'symbol');
@@ -668,7 +668,7 @@ export default class defx extends defxRest {
668
668
  //
669
669
  // {
670
670
  // "event": "WALLET_BALANCE_UPDATE",
671
- // "timestamp": 1711015961397,
671
+ // "timestamp": 1711015961396,
672
672
  // "data": {
673
673
  // "asset": "USDC", "balance": "27.64712963"
674
674
  // }
@@ -713,9 +713,9 @@ export default class kucoinfutures extends kucoinfuturesRest {
713
713
  const parsed = [
714
714
  this.safeInteger(ohlcv, 0),
715
715
  this.safeNumber(ohlcv, 1),
716
- this.safeNumber(ohlcv, 2),
717
716
  this.safeNumber(ohlcv, 3),
718
717
  this.safeNumber(ohlcv, 4),
718
+ this.safeNumber(ohlcv, 2),
719
719
  this.safeNumber(ohlcv, 6), // Note value 5 is incorrect and will be fixed in subsequent versions of kucoin
720
720
  ];
721
721
  this.ohlcvs[symbol] = this.safeDict(this.ohlcvs, symbol, {});
@@ -0,0 +1,161 @@
1
+ import type { Dict, Int, Liquidation, OrderBook, Str, Strings, Ticker, Tickers, Trade } from '../base/types.js';
2
+ import Client from '../base/ws/Client.js';
3
+ import lighterRest from '../lighter.js';
4
+ export default class lighter extends lighterRest {
5
+ describe(): any;
6
+ getMessageHash(unifiedChannel: string, symbol?: Str, extra?: Str): string;
7
+ subscribePublic(messageHash: any, params?: {}): Promise<any>;
8
+ subscribePublicMultiple(messageHashes: any, params?: {}): Promise<any>;
9
+ unsubscribePublic(messageHash: any, params?: {}): Promise<any>;
10
+ handleDelta(bookside: any, delta: any): void;
11
+ handleDeltas(bookside: any, deltas: any): void;
12
+ handleOrderBookMessage(client: Client, message: any, orderbook: any): any;
13
+ handleOrderBook(client: Client, message: any): void;
14
+ /**
15
+ * @method
16
+ * @name lighter#watchOrderBook
17
+ * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
18
+ * @see https://apidocs.lighter.xyz/docs/websocket-reference#order-book
19
+ * @param {string} symbol unified symbol of the market to fetch the order book for
20
+ * @param {int} [limit] the maximum amount of order book entries to return
21
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
22
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
23
+ */
24
+ watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
25
+ /**
26
+ * @method
27
+ * @name lighter#unWatchOrderBook
28
+ * @description unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
29
+ * @see https://apidocs.lighter.xyz/docs/websocket-reference#order-book
30
+ * @param {string} symbol unified symbol of the market
31
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
32
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
33
+ */
34
+ unWatchOrderBook(symbol: string, params?: {}): Promise<any>;
35
+ handleTicker(client: Client, message: any): void;
36
+ /**
37
+ * @method
38
+ * @name lighter#watchTicker
39
+ * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
40
+ * @see https://apidocs.lighter.xyz/docs/websocket-reference#market-stats
41
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
42
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
43
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
44
+ */
45
+ watchTicker(symbol: string, params?: {}): Promise<Ticker>;
46
+ /**
47
+ * @method
48
+ * @name lighter#unWatchTicker
49
+ * @description unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
50
+ * @see https://apidocs.lighter.xyz/docs/websocket-reference#market-stats
51
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
52
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
53
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
54
+ */
55
+ unWatchTicker(symbol: string, params?: {}): Promise<any>;
56
+ /**
57
+ * @method
58
+ * @name lighter#watchTickers
59
+ * @see https://apidocs.lighter.xyz/docs/websocket-reference#market-stats
60
+ * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
61
+ * @param {string[]} [symbols] unified symbol of the market to fetch the ticker for
62
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
63
+ * @param {string} [params.channel] the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers
64
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
65
+ */
66
+ watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
67
+ /**
68
+ * @method
69
+ * @name lighter#unWatchTickers
70
+ * @description unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
71
+ * @see https://apidocs.lighter.xyz/docs/websocket-reference#market-stats
72
+ * @param {string[]} [symbols] unified symbol of the market to fetch the ticker for
73
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
74
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
75
+ */
76
+ unWatchTickers(symbols?: Strings, params?: {}): Promise<any>;
77
+ /**
78
+ * @method
79
+ * @name lighter#watchMarkPrice
80
+ * @see https://apidocs.lighter.xyz/docs/websocket-reference#market-stats
81
+ * @description watches a mark price
82
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
83
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
84
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
85
+ */
86
+ watchMarkPrice(symbol: string, params?: {}): Promise<Ticker>;
87
+ /**
88
+ * @method
89
+ * @name lighter#watchMarkPrices
90
+ * @see https://apidocs.lighter.xyz/docs/websocket-reference#market-stats
91
+ * @description watches mark prices
92
+ * @param {string[]} [symbols] unified symbol of the market to fetch the ticker for
93
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
94
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
95
+ */
96
+ watchMarkPrices(symbols?: Strings, params?: {}): Promise<Tickers>;
97
+ /**
98
+ * @method
99
+ * @name lighter#unWatchMarkPrice
100
+ * @see https://apidocs.lighter.xyz/docs/websocket-reference#market-stats
101
+ * @description unWatches a mark price
102
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
103
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
104
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
105
+ */
106
+ unWatchMarkPrice(symbol: string, params?: {}): Promise<any>;
107
+ /**
108
+ * @method
109
+ * @name lighter#unWatchMarkPrices
110
+ * @see https://apidocs.lighter.xyz/docs/websocket-reference#market-stats
111
+ * @description unWatches mark prices
112
+ * @param {string[]} [symbols] unified symbol of the market to fetch the ticker for
113
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
114
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
115
+ */
116
+ unWatchMarkPrices(symbols?: Strings, params?: {}): Promise<any>;
117
+ parseWsTrade(trade: any, market?: any): Trade;
118
+ handleTrades(client: Client, message: any): void;
119
+ /**
120
+ * @method
121
+ * @name lighter#watchTrades
122
+ * @description get the list of most recent trades for a particular symbol
123
+ * @see https://apidocs.lighter.xyz/docs/websocket-reference#trade
124
+ * @param {string} symbol unified symbol of the market to fetch trades for
125
+ * @param {int} [since] timestamp in ms of the earliest trade to fetch
126
+ * @param {int} [limit] the maximum amount of trades to fetch
127
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
128
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
129
+ */
130
+ watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
131
+ /**
132
+ * @method
133
+ * @name lighter#unWatchTrades
134
+ * @description unsubscribe from the trades channel
135
+ * @see https://apidocs.lighter.xyz/docs/websocket-reference#trade
136
+ * @param {string} symbol unified symbol of the market to fetch trades for
137
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
138
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
139
+ */
140
+ unWatchTrades(symbol: string, params?: {}): Promise<any>;
141
+ parseWsLiquidation(liquidation: any, market?: any): Liquidation;
142
+ handleLiquidation(client: Client, message: any): void;
143
+ /**
144
+ * @method
145
+ * @name lighter#watchLiquidations
146
+ * @description watch the public liquidations of a trading pair
147
+ * @see https://apidocs.lighter.xyz/docs/websocket-reference#trade
148
+ * @param {string} symbol unified symbol of the market to fetch trades for
149
+ * @param {int} [since] timestamp in ms of the earliest trade to fetch
150
+ * @param {int} [limit] the maximum amount of trades to fetch
151
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
152
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
153
+ */
154
+ watchLiquidations(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Liquidation[]>;
155
+ handleErrorMessage(client: any, message: any): boolean;
156
+ handleMessage(client: Client, message: any): void;
157
+ handleSubscriptionStatus(client: Client, message: any): any;
158
+ handleUnSubscription(client: Client, subscription: Dict): void;
159
+ handlePing(client: Client, message: any): void;
160
+ pong(client: any, message: any): Promise<void>;
161
+ }