ccxt-ir 4.9.13 → 4.9.15

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 (99) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +232 -229
  4. package/dist/cjs/package.json +1 -1
  5. package/dist/cjs/src/abantether.js +344 -344
  6. package/dist/cjs/src/abstract/bitbarg.js +1 -1
  7. package/dist/cjs/src/abstract/bitunix.js +1 -1
  8. package/dist/cjs/src/abstract/bydfi.js +1 -1
  9. package/dist/cjs/src/abstract/cafearz.js +1 -1
  10. package/dist/cjs/src/abstract/hamtapay.js +1 -1
  11. package/dist/cjs/src/abstract/kifpoolme.js +1 -1
  12. package/dist/cjs/src/abstract/mazdax.js +1 -1
  13. package/dist/cjs/src/abstract/pingi.js +1 -1
  14. package/dist/cjs/src/abstract/pooleno.js +1 -1
  15. package/dist/cjs/src/abstract/tehran_exchange.js +11 -0
  16. package/dist/cjs/src/afratether.js +347 -347
  17. package/dist/cjs/src/arzplus.js +572 -572
  18. package/dist/cjs/src/bitbarg.js +303 -303
  19. package/dist/cjs/src/bitunix.js +317 -317
  20. package/dist/cjs/src/bydfi.js +425 -425
  21. package/dist/cjs/src/cafearz.js +337 -337
  22. package/dist/cjs/src/hamtapay.js +291 -291
  23. package/dist/cjs/src/kcex.js +326 -326
  24. package/dist/cjs/src/kifpoolme.js +401 -401
  25. package/dist/cjs/src/mazdax.js +525 -526
  26. package/dist/cjs/src/pingi.js +437 -438
  27. package/dist/cjs/src/pooleno.js +338 -338
  28. package/dist/cjs/src/tehran_exchange.js +334 -0
  29. package/dist/cjs/src/tetherland.js +358 -358
  30. package/dist/cjs/src/twox.js +362 -362
  31. package/dist/cjs/src/xt.js +5171 -5171
  32. package/js/ccxt.d.ts +676 -673
  33. package/js/ccxt.js +493 -491
  34. package/js/src/abantether.js +347 -347
  35. package/js/src/abstract/abantether.d.ts +8 -8
  36. package/js/src/abstract/arzplus.d.ts +11 -11
  37. package/js/src/abstract/bitbarg.d.ts +8 -8
  38. package/js/src/abstract/bitbarg.js +5 -5
  39. package/js/src/abstract/bitunix.d.ts +9 -9
  40. package/js/src/abstract/bitunix.js +5 -5
  41. package/js/src/abstract/bydfi.d.ts +11 -11
  42. package/js/src/abstract/bydfi.js +5 -5
  43. package/js/src/abstract/cafearz.d.ts +8 -8
  44. package/js/src/abstract/cafearz.js +5 -5
  45. package/js/src/abstract/hamtapay.d.ts +9 -9
  46. package/js/src/abstract/hamtapay.js +5 -5
  47. package/js/src/abstract/kcex.d.ts +10 -10
  48. package/js/src/abstract/kifpoolme.d.ts +9 -9
  49. package/js/src/abstract/kifpoolme.js +5 -5
  50. package/js/src/abstract/mazdax.d.ts +11 -11
  51. package/js/src/abstract/mazdax.js +5 -5
  52. package/js/src/abstract/pingi.d.ts +9 -9
  53. package/js/src/abstract/pingi.js +5 -5
  54. package/js/src/abstract/pooleno.d.ts +8 -8
  55. package/js/src/abstract/pooleno.js +5 -5
  56. package/js/src/abstract/tehran_exchange.d.ts +9 -0
  57. package/js/src/abstract/tehran_exchange.js +11 -0
  58. package/js/src/afratether.js +350 -350
  59. package/js/src/arzplus.d.ts +26 -26
  60. package/js/src/arzplus.js +575 -575
  61. package/js/src/base/Exchange.d.ts +926 -926
  62. package/js/src/base/types.d.ts +586 -586
  63. package/js/src/bitbarg.d.ts +21 -21
  64. package/js/src/bitbarg.js +306 -306
  65. package/js/src/bitunix.d.ts +21 -21
  66. package/js/src/bitunix.js +320 -320
  67. package/js/src/bydfi.d.ts +23 -23
  68. package/js/src/bydfi.js +428 -428
  69. package/js/src/cafearz.d.ts +21 -21
  70. package/js/src/cafearz.js +340 -340
  71. package/js/src/coinbaseexchange.d.ts +334 -334
  72. package/js/src/hamtapay.d.ts +21 -21
  73. package/js/src/hamtapay.js +294 -294
  74. package/js/src/kcex.d.ts +21 -21
  75. package/js/src/kcex.js +329 -329
  76. package/js/src/kifpoolme.d.ts +23 -23
  77. package/js/src/kifpoolme.js +404 -404
  78. package/js/src/mazdax.d.ts +23 -23
  79. package/js/src/mazdax.js +528 -529
  80. package/js/src/pingi.d.ts +22 -22
  81. package/js/src/pingi.js +440 -441
  82. package/js/src/pooleno.d.ts +21 -21
  83. package/js/src/pooleno.js +341 -341
  84. package/js/src/protobuf/mexc/compiled.d.cts +2 -2
  85. package/js/src/static_dependencies/fflake/browser.d.ts +222 -222
  86. package/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.d.ts +51 -51
  87. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +101 -101
  88. package/js/src/static_dependencies/qs/formats.d.cts +8 -8
  89. package/js/src/static_dependencies/qs/index.d.cts +4 -4
  90. package/js/src/static_dependencies/qs/parse.d.cts +2 -2
  91. package/js/src/static_dependencies/qs/stringify.d.cts +2 -2
  92. package/js/src/static_dependencies/qs/utils.d.cts +9 -9
  93. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -5
  94. package/js/src/tehran_exchange.d.ts +21 -0
  95. package/js/src/tehran_exchange.js +333 -0
  96. package/js/src/tetherland.js +361 -361
  97. package/js/src/twox.js +365 -365
  98. package/js/src/xt.js +5178 -5178
  99. package/package.json +1 -1
@@ -5,332 +5,332 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var kcex$1 = require('./abstract/kcex.js');
6
6
 
7
7
  // ----------------------------------------------------------------------------
8
- // ---------------------------------------------------------------------------
9
- /**
10
- * @class kcex
11
- * @augments Exchange
12
- * @description Set rateLimit to 1000 if fully verified
13
- */
14
- class kcex extends kcex$1["default"] {
15
- describe() {
16
- return this.deepExtend(super.describe(), {
17
- 'id': 'kcex',
18
- 'name': 'Kcex',
19
- 'countries': ['SC'],
20
- 'rateLimit': 1000,
21
- 'version': '1',
22
- 'certified': false,
23
- 'pro': false,
24
- 'has': {
25
- 'CORS': undefined,
26
- 'spot': true,
27
- 'margin': false,
28
- 'swap': false,
29
- 'future': true,
30
- 'option': false,
31
- 'addMargin': false,
32
- 'cancelAllOrders': false,
33
- 'cancelOrder': false,
34
- 'cancelOrders': false,
35
- 'createDepositAddress': false,
36
- 'createOrder': false,
37
- 'createStopLimitOrder': false,
38
- 'createStopMarketOrder': false,
39
- 'createStopOrder': false,
40
- 'editOrder': false,
41
- 'fetchBalance': false,
42
- 'fetchBorrowInterest': false,
43
- 'fetchBorrowRateHistories': false,
44
- 'fetchBorrowRateHistory': false,
45
- 'fetchClosedOrders': false,
46
- 'fetchCrossBorrowRate': false,
47
- 'fetchCrossBorrowRates': false,
48
- 'fetchCurrencies': false,
49
- 'fetchDepositAddress': false,
50
- 'fetchDeposits': false,
51
- 'fetchFundingHistory': false,
52
- 'fetchFundingRate': false,
53
- 'fetchFundingRateHistory': false,
54
- 'fetchFundingRates': false,
55
- 'fetchIndexOHLCV': false,
56
- 'fetchIsolatedBorrowRate': false,
57
- 'fetchIsolatedBorrowRates': false,
58
- 'fetchL2OrderBook': false,
59
- 'fetchL3OrderBook': false,
60
- 'fetchLedger': false,
61
- 'fetchLedgerEntry': false,
62
- 'fetchLeverageTiers': false,
63
- 'fetchMarkets': true,
64
- 'fetchMarkOHLCV': false,
65
- 'fetchMyTrades': false,
66
- 'fetchOHLCV': true,
67
- 'fetchOpenInterestHistory': false,
68
- 'fetchOpenOrders': false,
69
- 'fetchOrder': false,
70
- 'fetchOrderBook': true,
71
- 'fetchOrders': false,
72
- 'fetchOrderTrades': 'emulated',
73
- 'fetchPositions': false,
74
- 'fetchPremiumIndexOHLCV': false,
75
- 'fetchTicker': true,
76
- 'fetchTickers': true,
77
- 'fetchTime': false,
78
- 'fetchTrades': false,
79
- 'fetchTradingFee': false,
80
- 'fetchTradingFees': false,
81
- 'fetchWithdrawals': false,
82
- 'setLeverage': false,
83
- 'setMarginMode': false,
84
- 'transfer': false,
85
- 'withdraw': false,
86
- },
87
- 'comment': 'This comment is optional',
88
- 'urls': {
89
- 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/kcex/64x64.png',
90
- 'api': {
91
- 'public': 'https://www.kcex.com/spot/api',
92
- },
93
- 'www': 'https://www.kcex.com',
94
- 'doc': [
95
- 'https://www.kcex.com',
96
- ],
97
- },
98
- 'timeframes': {
99
- '1m': '1',
100
- '1h': '60',
101
- '3h': '180',
102
- '6h': '360',
103
- '12h': '720',
104
- '1d': '1D',
105
- },
106
- 'api': {
107
- 'public': {
108
- 'get': {
109
- 'market-2/spot/market/v2/web/symbols': 1,
110
- 'market-2/spot/market/v2/web/tickers': 1,
111
- 'market-2/spot/market/v2/web/symbol/ticker': 1,
112
- },
113
- },
114
- },
115
- // 'fees': {
116
- // 'trading': {
117
- // 'tierBased': false,
118
- // 'percentage': true,
119
- // 'maker': this.parseNumber ('0.001'),
120
- // 'taker': this.parseNumber ('0.001'),
121
- // },
122
- // },
123
- });
124
- }
125
- async fetchMarkets(params = {}) {
126
- /**
127
- * @method
128
- * @name kcex#fetchMarkets
129
- * @description retrieves data on all markets for kcex
130
- * @see https://api-docs.kcex.ir/#be8d9c51a2
131
- * @param {object} [params] extra parameters specific to the exchange API endpoint
132
- * @returns {object[]} an array of objects representing market data
133
- */
134
- const response = await this.publicGetMarket2SpotMarketV2WebSymbols(params);
135
- const data = this.safeDict(response, 'data');
136
- const USDTmarketList = this.safeList(data, 'USDT');
137
- const USDCmarketList = this.safeList(data, 'USDC');
138
- const marketList = this.arrayConcat(USDTmarketList, USDCmarketList);
139
- const result = [];
140
- for (let i = 0; i < marketList.length; i++) {
141
- const market = this.parseMarket(marketList[i]);
142
- result.push(market);
143
- }
144
- return result;
145
- }
146
- parseMarket(market) {
147
- // {
148
- // id: "e16a2713c7a44bac9d1d4ef98467e75b",
149
- // mcd: "20f24a571c8544c0b1362794b1804456",
150
- // mnm: "USDT",
151
- // cd: "18f40e5428054a4b9c69ddb0cce486f3",
152
- // vn: "AP",
153
- // fn: "AMERICA PARTY",
154
- // srt: 322,
155
- // sts: 1,
156
- // in: "F20250607111147267iXgSHIElFbibIQ",
157
- // fot: 1749247200000,
158
- // ot: 1749267000000,
159
- // cp: [
160
- // "common_section_meme",
161
- // "common_section_solana"
162
- // ],
163
- // ps: 7,
164
- // qs: 2,
165
- // cdm: 1
166
- // }
167
- const id = this.safeString(market, 'id');
168
- let baseId = this.safeString(market, 'vn');
169
- let quoteId = this.safeString(market, 'mnm');
170
- const base = this.safeCurrencyCode(baseId);
171
- const quote = this.safeCurrencyCode(quoteId);
172
- baseId = baseId.toLowerCase();
173
- quoteId = quoteId.toLowerCase();
174
- return {
175
- 'id': id,
176
- 'symbol': base + '/' + quote,
177
- 'base': base,
178
- 'quote': quote,
179
- 'settle': undefined,
180
- 'baseId': baseId,
181
- 'quoteId': quoteId,
182
- 'settleId': undefined,
183
- 'type': 'spot',
184
- 'spot': true,
185
- 'margin': false,
186
- 'swap': false,
187
- 'future': false,
188
- 'option': false,
189
- 'active': true,
190
- 'contract': false,
191
- 'linear': undefined,
192
- 'inverse': undefined,
193
- 'contractSize': undefined,
194
- 'expiry': undefined,
195
- 'expiryDatetime': undefined,
196
- 'strike': undefined,
197
- 'optionType': undefined,
198
- 'precision': {
199
- 'amount': undefined,
200
- 'price': undefined,
201
- },
202
- 'limits': {
203
- 'leverage': {
204
- 'min': undefined,
205
- 'max': undefined,
206
- },
207
- 'amount': {
208
- 'min': undefined,
209
- 'max': undefined,
210
- },
211
- 'price': {
212
- 'min': undefined,
213
- 'max': undefined,
214
- },
215
- 'cost': {
216
- 'min': undefined,
217
- 'max': undefined,
218
- },
219
- },
220
- 'created': undefined,
221
- 'info': market,
222
- };
223
- }
224
- async fetchTickers(symbols = undefined, params = {}) {
225
- /**
226
- * @method
227
- * @name kcex#fetchTickers
228
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
229
- * @see https://api-docs.kcex.ir/#be8d9c51a2
230
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
231
- * @param {object} [params] extra parameters specific to the exchange API endpoint
232
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
233
- */
234
- await this.loadMarkets();
235
- if (symbols !== undefined) {
236
- symbols = this.marketSymbols(symbols);
237
- }
238
- const response = await this.publicGetMarket2SpotMarketV2WebTickers(params);
239
- const tickers = this.safeList(response, 'data');
240
- const timestamp = this.safeInteger(response, 'timestamp');
241
- const result = {};
242
- const idToMarket = {};
243
- const marketList = Object.values(this.markets);
244
- for (let i = 0; i < marketList.length; i++) {
245
- const market = marketList[i];
246
- idToMarket[market['id']] = market;
247
- }
248
- for (let i = 0; i < tickers.length; i++) {
249
- const ticker = tickers[i];
250
- const id = this.safeString(ticker, 'id');
251
- const market = idToMarket[id];
252
- ticker['timestamp'] = timestamp;
253
- if (market !== undefined) {
254
- const parsedTicker = this.parseTicker(ticker, market);
255
- const symbol = parsedTicker['symbol'];
256
- result[symbol] = parsedTicker;
257
- }
258
- }
259
- return this.filterByArrayTickers(result, 'symbol', symbols);
260
- }
261
- async fetchTicker(symbol, params = {}) {
262
- /**
263
- * @method
264
- * @name kcex#fetchTicker
265
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
266
- * @see https://api-docs.kcex.ir/#be8d9c51a2
267
- * @param {string} symbol unified symbol of the market to fetch the ticker for
268
- * @param {object} [params] extra parameters specific to the exchange API endpoint
269
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
270
- */
271
- await this.loadMarkets();
272
- const market = this.market(symbol);
273
- const request = {
274
- 'symbol': market['base'] + '_' + market['quote'],
275
- };
276
- const response = await this.publicGetMarket2SpotMarketV2WebSymbolTicker(request);
277
- const tickerdata = this.safeDict(response, 'data');
278
- const ticker = this.parseTicker(tickerdata, market);
279
- return ticker;
280
- }
281
- parseTicker(ticker, market = undefined) {
282
- // {
283
- // id: "e16a2713c7a44bac9d1d4ef98467e75b",
284
- // r8: "-0.0261",
285
- // tzr: "-0.0261",
286
- // c: "0.0004552",
287
- // h: "0.0005745",
288
- // l: "0.0004552",
289
- // a: "136545.934217",
290
- // q: "281221205.24",
291
- // o: "0.0004674",
292
- // ot: 1749247200000
293
- // }
294
- const symbol = market['symbol'];
295
- const high = this.safeFloat(ticker, 'h', 0);
296
- const low = this.safeFloat(ticker, 'l', 0);
297
- const open = this.safeFloat(ticker, 'o', 0);
298
- const last = this.safeFloat(ticker, 'c', 0);
299
- const quoteVolume = this.safeFloat(ticker, 'a', 0);
300
- const baseVolume = this.safeFloat(ticker, 'q', 0);
301
- const timestamp = this.safeInteger(ticker, 'timestamp', 0);
302
- return this.safeTicker({
303
- 'symbol': symbol,
304
- 'timestamp': timestamp,
305
- 'datetime': this.iso8601(timestamp),
306
- 'high': high,
307
- 'low': low,
308
- 'bid': undefined,
309
- 'bidVolume': undefined,
310
- 'ask': undefined,
311
- 'askVolume': undefined,
312
- 'vwap': undefined,
313
- 'open': open,
314
- 'close': last,
315
- 'last': last,
316
- 'previousClose': undefined,
317
- 'change': undefined,
318
- 'percentage': undefined,
319
- 'average': undefined,
320
- 'baseVolume': baseVolume,
321
- 'quoteVolume': quoteVolume,
322
- 'info': ticker,
323
- }, market);
324
- }
325
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
326
- const query = this.omit(params, this.extractParams(path));
327
- let url = this.urls['api']['public'] + '/' + path;
328
- if (path === 'market-2/spot/market/v2/web/symbol/ticker') {
329
- url = url + '?' + this.urlencode(query);
330
- }
331
- headers = { 'Content-Type': 'application/json' };
332
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
333
- }
8
+ // ---------------------------------------------------------------------------
9
+ /**
10
+ * @class kcex
11
+ * @augments Exchange
12
+ * @description Set rateLimit to 1000 if fully verified
13
+ */
14
+ class kcex extends kcex$1["default"] {
15
+ describe() {
16
+ return this.deepExtend(super.describe(), {
17
+ 'id': 'kcex',
18
+ 'name': 'Kcex',
19
+ 'countries': ['SC'],
20
+ 'rateLimit': 1000,
21
+ 'version': '1',
22
+ 'certified': false,
23
+ 'pro': false,
24
+ 'has': {
25
+ 'CORS': undefined,
26
+ 'spot': true,
27
+ 'margin': false,
28
+ 'swap': false,
29
+ 'future': true,
30
+ 'option': false,
31
+ 'addMargin': false,
32
+ 'cancelAllOrders': false,
33
+ 'cancelOrder': false,
34
+ 'cancelOrders': false,
35
+ 'createDepositAddress': false,
36
+ 'createOrder': false,
37
+ 'createStopLimitOrder': false,
38
+ 'createStopMarketOrder': false,
39
+ 'createStopOrder': false,
40
+ 'editOrder': false,
41
+ 'fetchBalance': false,
42
+ 'fetchBorrowInterest': false,
43
+ 'fetchBorrowRateHistories': false,
44
+ 'fetchBorrowRateHistory': false,
45
+ 'fetchClosedOrders': false,
46
+ 'fetchCrossBorrowRate': false,
47
+ 'fetchCrossBorrowRates': false,
48
+ 'fetchCurrencies': false,
49
+ 'fetchDepositAddress': false,
50
+ 'fetchDeposits': false,
51
+ 'fetchFundingHistory': false,
52
+ 'fetchFundingRate': false,
53
+ 'fetchFundingRateHistory': false,
54
+ 'fetchFundingRates': false,
55
+ 'fetchIndexOHLCV': false,
56
+ 'fetchIsolatedBorrowRate': false,
57
+ 'fetchIsolatedBorrowRates': false,
58
+ 'fetchL2OrderBook': false,
59
+ 'fetchL3OrderBook': false,
60
+ 'fetchLedger': false,
61
+ 'fetchLedgerEntry': false,
62
+ 'fetchLeverageTiers': false,
63
+ 'fetchMarkets': true,
64
+ 'fetchMarkOHLCV': false,
65
+ 'fetchMyTrades': false,
66
+ 'fetchOHLCV': true,
67
+ 'fetchOpenInterestHistory': false,
68
+ 'fetchOpenOrders': false,
69
+ 'fetchOrder': false,
70
+ 'fetchOrderBook': true,
71
+ 'fetchOrders': false,
72
+ 'fetchOrderTrades': 'emulated',
73
+ 'fetchPositions': false,
74
+ 'fetchPremiumIndexOHLCV': false,
75
+ 'fetchTicker': true,
76
+ 'fetchTickers': true,
77
+ 'fetchTime': false,
78
+ 'fetchTrades': false,
79
+ 'fetchTradingFee': false,
80
+ 'fetchTradingFees': false,
81
+ 'fetchWithdrawals': false,
82
+ 'setLeverage': false,
83
+ 'setMarginMode': false,
84
+ 'transfer': false,
85
+ 'withdraw': false,
86
+ },
87
+ 'comment': 'This comment is optional',
88
+ 'urls': {
89
+ 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/kcex/64x64.png',
90
+ 'api': {
91
+ 'public': 'https://www.kcex.com/spot/api',
92
+ },
93
+ 'www': 'https://www.kcex.com',
94
+ 'doc': [
95
+ 'https://www.kcex.com',
96
+ ],
97
+ },
98
+ 'timeframes': {
99
+ '1m': '1',
100
+ '1h': '60',
101
+ '3h': '180',
102
+ '6h': '360',
103
+ '12h': '720',
104
+ '1d': '1D',
105
+ },
106
+ 'api': {
107
+ 'public': {
108
+ 'get': {
109
+ 'market-2/spot/market/v2/web/symbols': 1,
110
+ 'market-2/spot/market/v2/web/tickers': 1,
111
+ 'market-2/spot/market/v2/web/symbol/ticker': 1,
112
+ },
113
+ },
114
+ },
115
+ // 'fees': {
116
+ // 'trading': {
117
+ // 'tierBased': false,
118
+ // 'percentage': true,
119
+ // 'maker': this.parseNumber ('0.001'),
120
+ // 'taker': this.parseNumber ('0.001'),
121
+ // },
122
+ // },
123
+ });
124
+ }
125
+ async fetchMarkets(params = {}) {
126
+ /**
127
+ * @method
128
+ * @name kcex#fetchMarkets
129
+ * @description retrieves data on all markets for kcex
130
+ * @see https://api-docs.kcex.ir/#be8d9c51a2
131
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
132
+ * @returns {object[]} an array of objects representing market data
133
+ */
134
+ const response = await this.publicGetMarket2SpotMarketV2WebSymbols(params);
135
+ const data = this.safeDict(response, 'data');
136
+ const USDTmarketList = this.safeList(data, 'USDT');
137
+ const USDCmarketList = this.safeList(data, 'USDC');
138
+ const marketList = this.arrayConcat(USDTmarketList, USDCmarketList);
139
+ const result = [];
140
+ for (let i = 0; i < marketList.length; i++) {
141
+ const market = this.parseMarket(marketList[i]);
142
+ result.push(market);
143
+ }
144
+ return result;
145
+ }
146
+ parseMarket(market) {
147
+ // {
148
+ // id: "e16a2713c7a44bac9d1d4ef98467e75b",
149
+ // mcd: "20f24a571c8544c0b1362794b1804456",
150
+ // mnm: "USDT",
151
+ // cd: "18f40e5428054a4b9c69ddb0cce486f3",
152
+ // vn: "AP",
153
+ // fn: "AMERICA PARTY",
154
+ // srt: 322,
155
+ // sts: 1,
156
+ // in: "F20250607111147267iXgSHIElFbibIQ",
157
+ // fot: 1749247200000,
158
+ // ot: 1749267000000,
159
+ // cp: [
160
+ // "common_section_meme",
161
+ // "common_section_solana"
162
+ // ],
163
+ // ps: 7,
164
+ // qs: 2,
165
+ // cdm: 1
166
+ // }
167
+ const id = this.safeString(market, 'id');
168
+ let baseId = this.safeString(market, 'vn');
169
+ let quoteId = this.safeString(market, 'mnm');
170
+ const base = this.safeCurrencyCode(baseId);
171
+ const quote = this.safeCurrencyCode(quoteId);
172
+ baseId = baseId.toLowerCase();
173
+ quoteId = quoteId.toLowerCase();
174
+ return {
175
+ 'id': id,
176
+ 'symbol': base + '/' + quote,
177
+ 'base': base,
178
+ 'quote': quote,
179
+ 'settle': undefined,
180
+ 'baseId': baseId,
181
+ 'quoteId': quoteId,
182
+ 'settleId': undefined,
183
+ 'type': 'spot',
184
+ 'spot': true,
185
+ 'margin': false,
186
+ 'swap': false,
187
+ 'future': false,
188
+ 'option': false,
189
+ 'active': true,
190
+ 'contract': false,
191
+ 'linear': undefined,
192
+ 'inverse': undefined,
193
+ 'contractSize': undefined,
194
+ 'expiry': undefined,
195
+ 'expiryDatetime': undefined,
196
+ 'strike': undefined,
197
+ 'optionType': undefined,
198
+ 'precision': {
199
+ 'amount': undefined,
200
+ 'price': undefined,
201
+ },
202
+ 'limits': {
203
+ 'leverage': {
204
+ 'min': undefined,
205
+ 'max': undefined,
206
+ },
207
+ 'amount': {
208
+ 'min': undefined,
209
+ 'max': undefined,
210
+ },
211
+ 'price': {
212
+ 'min': undefined,
213
+ 'max': undefined,
214
+ },
215
+ 'cost': {
216
+ 'min': undefined,
217
+ 'max': undefined,
218
+ },
219
+ },
220
+ 'created': undefined,
221
+ 'info': market,
222
+ };
223
+ }
224
+ async fetchTickers(symbols = undefined, params = {}) {
225
+ /**
226
+ * @method
227
+ * @name kcex#fetchTickers
228
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
229
+ * @see https://api-docs.kcex.ir/#be8d9c51a2
230
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
231
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
232
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
233
+ */
234
+ await this.loadMarkets();
235
+ if (symbols !== undefined) {
236
+ symbols = this.marketSymbols(symbols);
237
+ }
238
+ const response = await this.publicGetMarket2SpotMarketV2WebTickers(params);
239
+ const tickers = this.safeList(response, 'data');
240
+ const timestamp = this.safeInteger(response, 'timestamp');
241
+ const result = {};
242
+ const idToMarket = {};
243
+ const marketList = Object.values(this.markets);
244
+ for (let i = 0; i < marketList.length; i++) {
245
+ const market = marketList[i];
246
+ idToMarket[market['id']] = market;
247
+ }
248
+ for (let i = 0; i < tickers.length; i++) {
249
+ const ticker = tickers[i];
250
+ const id = this.safeString(ticker, 'id');
251
+ const market = idToMarket[id];
252
+ ticker['timestamp'] = timestamp;
253
+ if (market !== undefined) {
254
+ const parsedTicker = this.parseTicker(ticker, market);
255
+ const symbol = parsedTicker['symbol'];
256
+ result[symbol] = parsedTicker;
257
+ }
258
+ }
259
+ return this.filterByArrayTickers(result, 'symbol', symbols);
260
+ }
261
+ async fetchTicker(symbol, params = {}) {
262
+ /**
263
+ * @method
264
+ * @name kcex#fetchTicker
265
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
266
+ * @see https://api-docs.kcex.ir/#be8d9c51a2
267
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
268
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
269
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
270
+ */
271
+ await this.loadMarkets();
272
+ const market = this.market(symbol);
273
+ const request = {
274
+ 'symbol': market['base'] + '_' + market['quote'],
275
+ };
276
+ const response = await this.publicGetMarket2SpotMarketV2WebSymbolTicker(request);
277
+ const tickerdata = this.safeDict(response, 'data');
278
+ const ticker = this.parseTicker(tickerdata, market);
279
+ return ticker;
280
+ }
281
+ parseTicker(ticker, market = undefined) {
282
+ // {
283
+ // id: "e16a2713c7a44bac9d1d4ef98467e75b",
284
+ // r8: "-0.0261",
285
+ // tzr: "-0.0261",
286
+ // c: "0.0004552",
287
+ // h: "0.0005745",
288
+ // l: "0.0004552",
289
+ // a: "136545.934217",
290
+ // q: "281221205.24",
291
+ // o: "0.0004674",
292
+ // ot: 1749247200000
293
+ // }
294
+ const symbol = market['symbol'];
295
+ const high = this.safeFloat(ticker, 'h', 0);
296
+ const low = this.safeFloat(ticker, 'l', 0);
297
+ const open = this.safeFloat(ticker, 'o', 0);
298
+ const last = this.safeFloat(ticker, 'c', 0);
299
+ const quoteVolume = this.safeFloat(ticker, 'a', 0);
300
+ const baseVolume = this.safeFloat(ticker, 'q', 0);
301
+ const timestamp = this.safeInteger(ticker, 'timestamp', 0);
302
+ return this.safeTicker({
303
+ 'symbol': symbol,
304
+ 'timestamp': timestamp,
305
+ 'datetime': this.iso8601(timestamp),
306
+ 'high': high,
307
+ 'low': low,
308
+ 'bid': undefined,
309
+ 'bidVolume': undefined,
310
+ 'ask': undefined,
311
+ 'askVolume': undefined,
312
+ 'vwap': undefined,
313
+ 'open': open,
314
+ 'close': last,
315
+ 'last': last,
316
+ 'previousClose': undefined,
317
+ 'change': undefined,
318
+ 'percentage': undefined,
319
+ 'average': undefined,
320
+ 'baseVolume': baseVolume,
321
+ 'quoteVolume': quoteVolume,
322
+ 'info': ticker,
323
+ }, market);
324
+ }
325
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
326
+ const query = this.omit(params, this.extractParams(path));
327
+ let url = this.urls['api']['public'] + '/' + path;
328
+ if (path === 'market-2/spot/market/v2/web/symbol/ticker') {
329
+ url = url + '?' + this.urlencode(query);
330
+ }
331
+ headers = { 'Content-Type': 'application/json' };
332
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
333
+ }
334
334
  }
335
335
 
336
336
  exports["default"] = kcex;