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