ccxt-ir 4.9.22 → 4.9.23

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 (102) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +4 -1
  4. package/dist/cjs/src/abantether.js +344 -344
  5. package/dist/cjs/src/abstract/bitbarg.js +1 -1
  6. package/dist/cjs/src/abstract/bydfi.js +1 -1
  7. package/dist/cjs/src/abstract/cafearz.js +1 -1
  8. package/dist/cjs/src/abstract/hamtapay.js +1 -1
  9. package/dist/cjs/src/abstract/iranexchange.js +11 -0
  10. package/dist/cjs/src/abstract/kifpoolme.js +1 -1
  11. package/dist/cjs/src/abstract/mazdax.js +1 -1
  12. package/dist/cjs/src/abstract/pingi.js +1 -1
  13. package/dist/cjs/src/abstract/pooleno.js +1 -1
  14. package/dist/cjs/src/abstract/tehran_exchange.js +1 -1
  15. package/dist/cjs/src/afratether.js +347 -347
  16. package/dist/cjs/src/arzplus.js +572 -572
  17. package/dist/cjs/src/bitbarg.js +303 -303
  18. package/dist/cjs/src/bydfi.js +425 -425
  19. package/dist/cjs/src/cafearz.js +337 -337
  20. package/dist/cjs/src/hamtapay.js +294 -294
  21. package/dist/cjs/src/iranexchange.js +398 -0
  22. package/dist/cjs/src/kcex.js +326 -326
  23. package/dist/cjs/src/kifpoolme.js +401 -401
  24. package/dist/cjs/src/mazdax.js +525 -525
  25. package/dist/cjs/src/ompfinex.js +501 -501
  26. package/dist/cjs/src/pingi.js +437 -437
  27. package/dist/cjs/src/pooleno.js +338 -338
  28. package/dist/cjs/src/sarmayex.js +367 -367
  29. package/dist/cjs/src/tehran_exchange.js +324 -324
  30. package/dist/cjs/src/tetherland.js +358 -358
  31. package/dist/cjs/src/toobit.js +436 -436
  32. package/dist/cjs/src/twox.js +362 -362
  33. package/js/ccxt.d.ts +5 -2
  34. package/js/ccxt.js +4 -2
  35. package/js/src/abantether.js +347 -347
  36. package/js/src/abstract/abantether.d.ts +8 -8
  37. package/js/src/abstract/arzplus.d.ts +11 -11
  38. package/js/src/abstract/bitbarg.d.ts +8 -8
  39. package/js/src/abstract/bitbarg.js +5 -5
  40. package/js/src/abstract/bydfi.d.ts +11 -11
  41. package/js/src/abstract/bydfi.js +5 -5
  42. package/js/src/abstract/cafearz.d.ts +8 -8
  43. package/js/src/abstract/cafearz.js +5 -5
  44. package/js/src/abstract/hamtapay.d.ts +9 -9
  45. package/js/src/abstract/hamtapay.js +5 -5
  46. package/js/src/abstract/iranexchange.d.ts +9 -0
  47. package/js/src/abstract/iranexchange.js +11 -0
  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 -9
  57. package/js/src/abstract/tehran_exchange.js +5 -5
  58. package/js/src/abstract/toobit.d.ts +10 -10
  59. package/js/src/afratether.js +350 -350
  60. package/js/src/arzplus.d.ts +26 -26
  61. package/js/src/arzplus.js +575 -575
  62. package/js/src/base/Exchange.d.ts +2 -2
  63. package/js/src/base/types.d.ts +586 -586
  64. package/js/src/bitbarg.d.ts +21 -21
  65. package/js/src/bitbarg.js +306 -306
  66. package/js/src/bydfi.d.ts +23 -23
  67. package/js/src/bydfi.js +428 -428
  68. package/js/src/cafearz.d.ts +21 -21
  69. package/js/src/cafearz.js +340 -340
  70. package/js/src/coinbaseexchange.d.ts +1 -1
  71. package/js/src/hamtapay.d.ts +21 -21
  72. package/js/src/hamtapay.js +297 -297
  73. package/js/src/iranexchange.d.ts +21 -0
  74. package/js/src/iranexchange.js +397 -0
  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 -528
  80. package/js/src/ompfinex.js +504 -504
  81. package/js/src/pingi.d.ts +22 -22
  82. package/js/src/pingi.js +440 -440
  83. package/js/src/pooleno.d.ts +21 -21
  84. package/js/src/pooleno.js +341 -341
  85. package/js/src/protobuf/mexc/compiled.d.cts +0 -6
  86. package/js/src/sarmayex.js +370 -370
  87. package/js/src/static_dependencies/fflake/browser.d.ts +5 -5
  88. package/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.d.ts +51 -51
  89. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +101 -101
  90. package/js/src/static_dependencies/noble-curves/abstract/weierstrass.d.ts +204 -204
  91. package/js/src/static_dependencies/qs/formats.d.cts +0 -6
  92. package/js/src/static_dependencies/qs/index.d.cts +0 -6
  93. package/js/src/static_dependencies/qs/parse.d.cts +0 -6
  94. package/js/src/static_dependencies/qs/stringify.d.cts +0 -6
  95. package/js/src/static_dependencies/qs/utils.d.cts +0 -6
  96. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -5
  97. package/js/src/tehran_exchange.d.ts +21 -21
  98. package/js/src/tehran_exchange.js +327 -327
  99. package/js/src/tetherland.js +361 -361
  100. package/js/src/toobit.js +439 -439
  101. package/js/src/twox.js +365 -365
  102. package/package.json +1 -1
@@ -5,344 +5,344 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var pooleno$1 = require('./abstract/pooleno.js');
6
6
 
7
7
  // ----------------------------------------------------------------------------
8
- // ---------------------------------------------------------------------------
9
- /**
10
- * @class pooleno
11
- * @augments Exchange
12
- * @description Set rateLimit to 1000 if fully verified
13
- */
14
- class pooleno extends pooleno$1["default"] {
15
- describe() {
16
- return this.deepExtend(super.describe(), {
17
- 'id': 'pooleno',
18
- 'name': 'Pooleno',
19
- 'countries': ['IR'],
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': false,
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': false,
67
- 'fetchOpenInterestHistory': false,
68
- 'fetchOpenOrders': false,
69
- 'fetchOrder': false,
70
- 'fetchOrderBook': false,
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/pooleno/64x64.png',
90
- 'api': {
91
- 'public': 'https://api-beta.pooleno.ir',
92
- },
93
- 'www': 'https://pooleno.ir',
94
- 'doc': [
95
- 'https://pooleno.ir',
96
- ],
97
- },
98
- 'api': {
99
- 'public': {
100
- 'get': {
101
- 'api/v1/tokens/public': 1,
102
- },
103
- },
104
- },
105
- 'fees': {
106
- 'trading': {
107
- 'tierBased': false,
108
- 'percentage': true,
109
- 'maker': this.parseNumber('0.001'),
110
- 'taker': this.parseNumber('0.001'),
111
- },
112
- },
113
- });
114
- }
115
- async fetchMarkets(params = {}) {
116
- /**
117
- * @method
118
- * @name pooleno#fetchMarkets
119
- * @description retrieves data on all markets for pooleno
120
- * @see https://api-beta.pooleno.ir/api/v1/tokens/public
121
- * @param {object} [params] extra parameters specific to the exchange API endpoint
122
- * @returns {object[]} an array of objects representing market data
123
- */
124
- const response = await this.publicGetApiV1TokensPublic(params);
125
- const payload = this.safeList(response, 'payload', []);
126
- const result = [];
127
- for (let i = 0; i < payload.length; i++) {
128
- const token = payload[i];
129
- const baseAsset = this.safeString(token, 'baseAsset');
130
- const quoteAsset = this.safeString(token, 'quoteAsset');
131
- // Skip if base equals quote
132
- if (baseAsset === quoteAsset) {
133
- continue;
134
- }
135
- const market = this.parseMarket(token);
136
- result.push(market);
137
- }
138
- return result;
139
- }
140
- parseMarket(market) {
141
- // {
142
- // "baseAsset": "USDT",
143
- // "quoteAsset": "TMN",
144
- // "symbolName": "USDT",
145
- // "longEnName": "Tether",
146
- // "longFaName": "تتر",
147
- // "createdAt": "2025-02-25T13:47:27.102Z",
148
- // "id": "cm43t74jo00000hrm8tw9aspo",
149
- // "price": "1",
150
- // "priceTMN": "112950",
151
- // "sparkline": {
152
- // "data": [...],
153
- // "change": -538,
154
- // "percentage": -0.48,
155
- // "isPositive": false
156
- // },
157
- // "market": {
158
- // "totalSupply": null,
159
- // "maxSupply": null,
160
- // "circulatingSupply": null,
161
- // "volume24hBase": null,
162
- // "high24h": null,
163
- // "low24h": null,
164
- // "volume24h": null,
165
- // "marketCap": null
166
- // },
167
- // "blockchains": [...]
168
- // }
169
- let baseId = this.safeString(market, 'baseAsset');
170
- let quoteId = this.safeString(market, 'quoteAsset');
171
- const base = this.safeCurrencyCode(baseId);
172
- const quote = this.safeCurrencyCode(quoteId);
173
- const id = base + quote;
174
- baseId = baseId.toLowerCase();
175
- quoteId = quoteId.toLowerCase();
176
- return {
177
- 'id': id,
178
- 'symbol': base + '/' + quote,
179
- 'base': base,
180
- 'quote': quote,
181
- 'settle': undefined,
182
- 'baseId': baseId,
183
- 'quoteId': quoteId,
184
- 'settleId': undefined,
185
- 'type': 'spot',
186
- 'spot': true,
187
- 'margin': false,
188
- 'swap': false,
189
- 'future': false,
190
- 'option': false,
191
- 'active': true,
192
- 'contract': false,
193
- 'linear': undefined,
194
- 'inverse': undefined,
195
- 'contractSize': undefined,
196
- 'expiry': undefined,
197
- 'expiryDatetime': undefined,
198
- 'strike': undefined,
199
- 'optionType': undefined,
200
- 'precision': {
201
- 'amount': undefined,
202
- 'price': undefined,
203
- },
204
- 'limits': {
205
- 'leverage': {
206
- 'min': undefined,
207
- 'max': undefined,
208
- },
209
- 'amount': {
210
- 'min': undefined,
211
- 'max': undefined,
212
- },
213
- 'price': {
214
- 'min': undefined,
215
- 'max': undefined,
216
- },
217
- 'cost': {
218
- 'min': undefined,
219
- 'max': undefined,
220
- },
221
- },
222
- 'created': undefined,
223
- 'info': market,
224
- };
225
- }
226
- async fetchTickers(symbols = undefined, params = {}) {
227
- /**
228
- * @method
229
- * @name pooleno#fetchTickers
230
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
231
- * @see https://api-beta.pooleno.ir/api/v1/tokens/public
232
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
233
- * @param {object} [params] extra parameters specific to the exchange API endpoint
234
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
235
- */
236
- await this.loadMarkets();
237
- if (symbols !== undefined) {
238
- symbols = this.marketSymbols(symbols);
239
- }
240
- const response = await this.publicGetApiV1TokensPublic(params);
241
- const payload = this.safeList(response, 'payload', []);
242
- const result = {};
243
- for (let i = 0; i < payload.length; i++) {
244
- const token = payload[i];
245
- const ticker = this.parseTicker(token);
246
- const symbol = ticker['symbol'];
247
- result[symbol] = ticker;
248
- }
249
- return this.filterByArrayTickers(result, 'symbol', symbols);
250
- }
251
- async fetchTicker(symbol, params = {}) {
252
- /**
253
- * @method
254
- * @name pooleno#fetchTicker
255
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
256
- * @see https://api-beta.pooleno.ir/api/v1/tokens/public
257
- * @param {string} symbol unified symbol of the market to fetch the ticker for
258
- * @param {object} [params] extra parameters specific to the exchange API endpoint
259
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
260
- */
261
- const ticker = await this.fetchTickers([symbol]);
262
- return ticker[symbol];
263
- }
264
- parseTicker(ticker, market = undefined) {
265
- // {
266
- // "baseAsset": "BTC",
267
- // "quoteAsset": "USDT",
268
- // "symbolName": "BTC",
269
- // "longEnName": "Bitcoin",
270
- // "longFaName": "بیتکوین",
271
- // "createdAt": "2025-02-25T13:47:27.103Z",
272
- // "id": "cm43t74jp00010hrmed9i7l76",
273
- // "price": "115024.7",
274
- // "priceTMN": "12980537395",
275
- // "sparkline": {
276
- // "data": [...],
277
- // "change": -538,
278
- // "percentage": -0.48,
279
- // "isPositive": false
280
- // },
281
- // "market": {
282
- // "totalSupply": null,
283
- // "maxSupply": null,
284
- // "circulatingSupply": null,
285
- // "volume24hBase": null,
286
- // "high24h": null,
287
- // "low24h": null,
288
- // "volume24h": null,
289
- // "marketCap": null
290
- // },
291
- // "blockchains": [...]
292
- // }
293
- const marketType = 'spot';
294
- const baseAsset = this.safeString(ticker, 'baseAsset');
295
- const quoteAsset = this.safeString(ticker, 'quoteAsset');
296
- const marketId = baseAsset + '/' + quoteAsset;
297
- const symbol = this.safeSymbol(marketId, market, undefined, marketType);
298
- const price = this.safeFloat(ticker, 'price');
299
- const priceTMN = this.safeFloat(ticker, 'priceTMN');
300
- const sparkline = this.safeDict(ticker, 'sparkline', {});
301
- const change = this.safeFloat(sparkline, 'change');
302
- const percentage = this.safeFloat(sparkline, 'percentage');
303
- const marketData = this.safeDict(ticker, 'market', {});
304
- const high24h = this.safeFloat(marketData, 'high24h');
305
- const low24h = this.safeFloat(marketData, 'low24h');
306
- const volume24h = this.safeFloat(marketData, 'volume24h');
307
- let last = undefined;
308
- let baseVolume = undefined;
309
- if (quoteAsset === 'TMN' || quoteAsset === 'IRT') {
310
- // For TMN/IRT pairs, use priceTMN
311
- last = priceTMN;
312
- }
313
- else {
314
- // For other pairs (like USDT), use price
315
- last = price;
316
- baseVolume = volume24h;
317
- }
318
- return this.safeTicker({
319
- 'symbol': symbol,
320
- 'timestamp': undefined,
321
- 'datetime': undefined,
322
- 'high': high24h,
323
- 'low': low24h,
324
- 'bid': last,
325
- 'bidVolume': undefined,
326
- 'ask': last,
327
- 'askVolume': undefined,
328
- 'vwap': undefined,
329
- 'open': undefined,
330
- 'close': last,
331
- 'last': last,
332
- 'previousClose': undefined,
333
- 'change': change,
334
- 'percentage': percentage,
335
- 'average': undefined,
336
- 'baseVolume': baseVolume,
337
- 'quoteVolume': undefined,
338
- 'info': ticker,
339
- }, market);
340
- }
341
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
342
- const url = this.urls['api']['public'] + '/' + path;
343
- headers = { 'Content-Type': 'application/json' };
344
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
345
- }
8
+ // ---------------------------------------------------------------------------
9
+ /**
10
+ * @class pooleno
11
+ * @augments Exchange
12
+ * @description Set rateLimit to 1000 if fully verified
13
+ */
14
+ class pooleno extends pooleno$1["default"] {
15
+ describe() {
16
+ return this.deepExtend(super.describe(), {
17
+ 'id': 'pooleno',
18
+ 'name': 'Pooleno',
19
+ 'countries': ['IR'],
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': false,
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': false,
67
+ 'fetchOpenInterestHistory': false,
68
+ 'fetchOpenOrders': false,
69
+ 'fetchOrder': false,
70
+ 'fetchOrderBook': false,
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/pooleno/64x64.png',
90
+ 'api': {
91
+ 'public': 'https://api-beta.pooleno.ir',
92
+ },
93
+ 'www': 'https://pooleno.ir',
94
+ 'doc': [
95
+ 'https://pooleno.ir',
96
+ ],
97
+ },
98
+ 'api': {
99
+ 'public': {
100
+ 'get': {
101
+ 'api/v1/tokens/public': 1,
102
+ },
103
+ },
104
+ },
105
+ 'fees': {
106
+ 'trading': {
107
+ 'tierBased': false,
108
+ 'percentage': true,
109
+ 'maker': this.parseNumber('0.001'),
110
+ 'taker': this.parseNumber('0.001'),
111
+ },
112
+ },
113
+ });
114
+ }
115
+ async fetchMarkets(params = {}) {
116
+ /**
117
+ * @method
118
+ * @name pooleno#fetchMarkets
119
+ * @description retrieves data on all markets for pooleno
120
+ * @see https://api-beta.pooleno.ir/api/v1/tokens/public
121
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
122
+ * @returns {object[]} an array of objects representing market data
123
+ */
124
+ const response = await this.publicGetApiV1TokensPublic(params);
125
+ const payload = this.safeList(response, 'payload', []);
126
+ const result = [];
127
+ for (let i = 0; i < payload.length; i++) {
128
+ const token = payload[i];
129
+ const baseAsset = this.safeString(token, 'baseAsset');
130
+ const quoteAsset = this.safeString(token, 'quoteAsset');
131
+ // Skip if base equals quote
132
+ if (baseAsset === quoteAsset) {
133
+ continue;
134
+ }
135
+ const market = this.parseMarket(token);
136
+ result.push(market);
137
+ }
138
+ return result;
139
+ }
140
+ parseMarket(market) {
141
+ // {
142
+ // "baseAsset": "USDT",
143
+ // "quoteAsset": "TMN",
144
+ // "symbolName": "USDT",
145
+ // "longEnName": "Tether",
146
+ // "longFaName": "تتر",
147
+ // "createdAt": "2025-02-25T13:47:27.102Z",
148
+ // "id": "cm43t74jo00000hrm8tw9aspo",
149
+ // "price": "1",
150
+ // "priceTMN": "112950",
151
+ // "sparkline": {
152
+ // "data": [...],
153
+ // "change": -538,
154
+ // "percentage": -0.48,
155
+ // "isPositive": false
156
+ // },
157
+ // "market": {
158
+ // "totalSupply": null,
159
+ // "maxSupply": null,
160
+ // "circulatingSupply": null,
161
+ // "volume24hBase": null,
162
+ // "high24h": null,
163
+ // "low24h": null,
164
+ // "volume24h": null,
165
+ // "marketCap": null
166
+ // },
167
+ // "blockchains": [...]
168
+ // }
169
+ let baseId = this.safeString(market, 'baseAsset');
170
+ let quoteId = this.safeString(market, 'quoteAsset');
171
+ const base = this.safeCurrencyCode(baseId);
172
+ const quote = this.safeCurrencyCode(quoteId);
173
+ const id = base + quote;
174
+ baseId = baseId.toLowerCase();
175
+ quoteId = quoteId.toLowerCase();
176
+ return {
177
+ 'id': id,
178
+ 'symbol': base + '/' + quote,
179
+ 'base': base,
180
+ 'quote': quote,
181
+ 'settle': undefined,
182
+ 'baseId': baseId,
183
+ 'quoteId': quoteId,
184
+ 'settleId': undefined,
185
+ 'type': 'spot',
186
+ 'spot': true,
187
+ 'margin': false,
188
+ 'swap': false,
189
+ 'future': false,
190
+ 'option': false,
191
+ 'active': true,
192
+ 'contract': false,
193
+ 'linear': undefined,
194
+ 'inverse': undefined,
195
+ 'contractSize': undefined,
196
+ 'expiry': undefined,
197
+ 'expiryDatetime': undefined,
198
+ 'strike': undefined,
199
+ 'optionType': undefined,
200
+ 'precision': {
201
+ 'amount': undefined,
202
+ 'price': undefined,
203
+ },
204
+ 'limits': {
205
+ 'leverage': {
206
+ 'min': undefined,
207
+ 'max': undefined,
208
+ },
209
+ 'amount': {
210
+ 'min': undefined,
211
+ 'max': undefined,
212
+ },
213
+ 'price': {
214
+ 'min': undefined,
215
+ 'max': undefined,
216
+ },
217
+ 'cost': {
218
+ 'min': undefined,
219
+ 'max': undefined,
220
+ },
221
+ },
222
+ 'created': undefined,
223
+ 'info': market,
224
+ };
225
+ }
226
+ async fetchTickers(symbols = undefined, params = {}) {
227
+ /**
228
+ * @method
229
+ * @name pooleno#fetchTickers
230
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
231
+ * @see https://api-beta.pooleno.ir/api/v1/tokens/public
232
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
233
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
234
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
235
+ */
236
+ await this.loadMarkets();
237
+ if (symbols !== undefined) {
238
+ symbols = this.marketSymbols(symbols);
239
+ }
240
+ const response = await this.publicGetApiV1TokensPublic(params);
241
+ const payload = this.safeList(response, 'payload', []);
242
+ const result = {};
243
+ for (let i = 0; i < payload.length; i++) {
244
+ const token = payload[i];
245
+ const ticker = this.parseTicker(token);
246
+ const symbol = ticker['symbol'];
247
+ result[symbol] = ticker;
248
+ }
249
+ return this.filterByArrayTickers(result, 'symbol', symbols);
250
+ }
251
+ async fetchTicker(symbol, params = {}) {
252
+ /**
253
+ * @method
254
+ * @name pooleno#fetchTicker
255
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
256
+ * @see https://api-beta.pooleno.ir/api/v1/tokens/public
257
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
258
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
259
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
260
+ */
261
+ const ticker = await this.fetchTickers([symbol]);
262
+ return ticker[symbol];
263
+ }
264
+ parseTicker(ticker, market = undefined) {
265
+ // {
266
+ // "baseAsset": "BTC",
267
+ // "quoteAsset": "USDT",
268
+ // "symbolName": "BTC",
269
+ // "longEnName": "Bitcoin",
270
+ // "longFaName": "بیتکوین",
271
+ // "createdAt": "2025-02-25T13:47:27.103Z",
272
+ // "id": "cm43t74jp00010hrmed9i7l76",
273
+ // "price": "115024.7",
274
+ // "priceTMN": "12980537395",
275
+ // "sparkline": {
276
+ // "data": [...],
277
+ // "change": -538,
278
+ // "percentage": -0.48,
279
+ // "isPositive": false
280
+ // },
281
+ // "market": {
282
+ // "totalSupply": null,
283
+ // "maxSupply": null,
284
+ // "circulatingSupply": null,
285
+ // "volume24hBase": null,
286
+ // "high24h": null,
287
+ // "low24h": null,
288
+ // "volume24h": null,
289
+ // "marketCap": null
290
+ // },
291
+ // "blockchains": [...]
292
+ // }
293
+ const marketType = 'spot';
294
+ const baseAsset = this.safeString(ticker, 'baseAsset');
295
+ const quoteAsset = this.safeString(ticker, 'quoteAsset');
296
+ const marketId = baseAsset + '/' + quoteAsset;
297
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
298
+ const price = this.safeFloat(ticker, 'price');
299
+ const priceTMN = this.safeFloat(ticker, 'priceTMN');
300
+ const sparkline = this.safeDict(ticker, 'sparkline', {});
301
+ const change = this.safeFloat(sparkline, 'change');
302
+ const percentage = this.safeFloat(sparkline, 'percentage');
303
+ const marketData = this.safeDict(ticker, 'market', {});
304
+ const high24h = this.safeFloat(marketData, 'high24h');
305
+ const low24h = this.safeFloat(marketData, 'low24h');
306
+ const volume24h = this.safeFloat(marketData, 'volume24h');
307
+ let last = undefined;
308
+ let baseVolume = undefined;
309
+ if (quoteAsset === 'TMN' || quoteAsset === 'IRT') {
310
+ // For TMN/IRT pairs, use priceTMN
311
+ last = priceTMN;
312
+ }
313
+ else {
314
+ // For other pairs (like USDT), use price
315
+ last = price;
316
+ baseVolume = volume24h;
317
+ }
318
+ return this.safeTicker({
319
+ 'symbol': symbol,
320
+ 'timestamp': undefined,
321
+ 'datetime': undefined,
322
+ 'high': high24h,
323
+ 'low': low24h,
324
+ 'bid': last,
325
+ 'bidVolume': undefined,
326
+ 'ask': last,
327
+ 'askVolume': undefined,
328
+ 'vwap': undefined,
329
+ 'open': undefined,
330
+ 'close': last,
331
+ 'last': last,
332
+ 'previousClose': undefined,
333
+ 'change': change,
334
+ 'percentage': percentage,
335
+ 'average': undefined,
336
+ 'baseVolume': baseVolume,
337
+ 'quoteVolume': undefined,
338
+ 'info': ticker,
339
+ }, market);
340
+ }
341
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
342
+ const url = this.urls['api']['public'] + '/' + path;
343
+ headers = { 'Content-Type': 'application/json' };
344
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
345
+ }
346
346
  }
347
347
 
348
348
  exports["default"] = pooleno;