ccxt-ir 4.9.13 → 4.9.14

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 (82) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +229 -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/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/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/afratether.js +347 -347
  15. package/dist/cjs/src/arzplus.js +572 -572
  16. package/dist/cjs/src/bitbarg.js +303 -303
  17. package/dist/cjs/src/bydfi.js +425 -425
  18. package/dist/cjs/src/cafearz.js +337 -337
  19. package/dist/cjs/src/hamtapay.js +291 -291
  20. package/dist/cjs/src/kifpoolme.js +401 -401
  21. package/dist/cjs/src/mazdax.js +525 -526
  22. package/dist/cjs/src/pingi.js +437 -438
  23. package/dist/cjs/src/pooleno.js +338 -338
  24. package/dist/cjs/src/tetherland.js +358 -358
  25. package/dist/cjs/src/twox.js +362 -362
  26. package/js/ccxt.d.ts +673 -673
  27. package/js/ccxt.js +491 -491
  28. package/js/src/abantether.js +347 -347
  29. package/js/src/abstract/abantether.d.ts +8 -8
  30. package/js/src/abstract/arzplus.d.ts +11 -11
  31. package/js/src/abstract/bitbarg.d.ts +8 -8
  32. package/js/src/abstract/bitbarg.js +5 -5
  33. package/js/src/abstract/bydfi.d.ts +11 -11
  34. package/js/src/abstract/bydfi.js +5 -5
  35. package/js/src/abstract/cafearz.d.ts +8 -8
  36. package/js/src/abstract/cafearz.js +5 -5
  37. package/js/src/abstract/hamtapay.d.ts +9 -9
  38. package/js/src/abstract/hamtapay.js +5 -5
  39. package/js/src/abstract/kifpoolme.d.ts +9 -9
  40. package/js/src/abstract/kifpoolme.js +5 -5
  41. package/js/src/abstract/mazdax.d.ts +11 -11
  42. package/js/src/abstract/mazdax.js +5 -5
  43. package/js/src/abstract/pingi.d.ts +9 -9
  44. package/js/src/abstract/pingi.js +5 -5
  45. package/js/src/abstract/pooleno.d.ts +8 -8
  46. package/js/src/abstract/pooleno.js +5 -5
  47. package/js/src/afratether.js +350 -350
  48. package/js/src/arzplus.d.ts +26 -26
  49. package/js/src/arzplus.js +575 -575
  50. package/js/src/base/Exchange.d.ts +926 -926
  51. package/js/src/base/types.d.ts +586 -586
  52. package/js/src/bitbarg.d.ts +21 -21
  53. package/js/src/bitbarg.js +306 -306
  54. package/js/src/bydfi.d.ts +23 -23
  55. package/js/src/bydfi.js +428 -428
  56. package/js/src/cafearz.d.ts +21 -21
  57. package/js/src/cafearz.js +340 -340
  58. package/js/src/coinbaseexchange.d.ts +334 -334
  59. package/js/src/hamtapay.d.ts +21 -21
  60. package/js/src/hamtapay.js +294 -294
  61. package/js/src/kifpoolme.d.ts +23 -23
  62. package/js/src/kifpoolme.js +404 -404
  63. package/js/src/mazdax.d.ts +23 -23
  64. package/js/src/mazdax.js +528 -529
  65. package/js/src/pingi.d.ts +22 -22
  66. package/js/src/pingi.js +440 -441
  67. package/js/src/pooleno.d.ts +21 -21
  68. package/js/src/pooleno.js +341 -341
  69. package/js/src/protobuf/mexc/compiled.d.cts +2 -2
  70. package/js/src/static_dependencies/fflake/browser.d.ts +222 -222
  71. package/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.d.ts +51 -51
  72. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +101 -101
  73. package/js/src/static_dependencies/noble-curves/abstract/weierstrass.d.ts +204 -204
  74. package/js/src/static_dependencies/qs/formats.d.cts +8 -8
  75. package/js/src/static_dependencies/qs/index.d.cts +4 -4
  76. package/js/src/static_dependencies/qs/parse.d.cts +2 -2
  77. package/js/src/static_dependencies/qs/stringify.d.cts +2 -2
  78. package/js/src/static_dependencies/qs/utils.d.cts +9 -9
  79. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -5
  80. package/js/src/tetherland.js +361 -361
  81. package/js/src/twox.js +365 -365
  82. package/package.json +1 -1
@@ -5,368 +5,368 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var twox$1 = require('./abstract/twox.js');
6
6
 
7
7
  // ----------------------------------------------------------------------------
8
- // ---------------------------------------------------------------------------
9
- /**
10
- * @class twox
11
- * @augments Exchange
12
- * @description Set rateLimit to 1000 if fully verified
13
- */
14
- class twox extends twox$1["default"] {
15
- describe() {
16
- return this.deepExtend(super.describe(), {
17
- 'id': 'twox',
18
- 'name': 'Twox',
19
- 'countries': ['IR'],
20
- 'rateLimit': 1000,
21
- 'version': '1',
22
- 'certified': false,
23
- 'pro': false,
24
- 'has': {
25
- 'CORS': undefined,
26
- 'spot': false,
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
- 'otc': true,
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/twox/64x64.png',
91
- 'api': {
92
- 'public': 'https://api.twox.ir',
93
- },
94
- 'www': 'https://twox.ir',
95
- 'doc': [
96
- 'https://twox.ir',
97
- ],
98
- },
99
- 'api': {
100
- 'public': {
101
- 'get': {
102
- 'api/currencies': 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 twox#fetchMarkets
120
- * @description retrieves data on all markets for twox
121
- * @see https://api.twox.ir/api/currencies
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.publicGetApiCurrencies(params);
126
- const result = [];
127
- const quotes = ['IRT', 'USDT'];
128
- for (let i = 0; i < response.length; i++) {
129
- const marketData = this.extend({}, response[i]);
130
- const base = this.safeString(marketData, 'symbol');
131
- for (let index = 0; index < quotes.length; index++) {
132
- const quote = quotes[index];
133
- if (base === quote || marketData['sellPrice'] === 0 || base === 'IRT') {
134
- break;
135
- }
136
- marketData['base'] = base;
137
- marketData['quote'] = quote;
138
- const market = this.parseMarket(marketData);
139
- result.push(market);
140
- }
141
- }
142
- return result;
143
- }
144
- parseMarket(market) {
145
- // {
146
- // sellPrice: 0,
147
- // buyPrice: 0,
148
- // latestPrice: 0,
149
- // weeklyChart: "https://cdn.twox.trade/currencies/charts/7d/irt_toman.svg?v=2024061017",
150
- // priceChangePercent: 0,
151
- // minAmount: 10000,
152
- // tags: [ ],
153
- // marketCategories: [ ],
154
- // id: 1,
155
- // symbol: "IRT",
156
- // name: "Toman",
157
- // icon: "https://cdn.twox.trade/currencies/icons/128x128/irt_toman.png",
158
- // persianName: "تومان",
159
- // isStableCoin: false,
160
- // isActive: true,
161
- // colorCode: null,
162
- // type: 0,
163
- // isNeedRiskWarning: false,
164
- // assetPrecision: 0,
165
- // isLeveragedToken: false,
166
- // commissionPrecision: 0,
167
- // isDepositAllEnable: true,
168
- // isTrading: true,
169
- // isWithdrawAllEnable: true,
170
- // currencySlug: "IRT_Toman",
171
- // marketCurrencyId: 0,
172
- // order: 0
173
- // },
174
- let baseId = this.safeString(market, 'base');
175
- let quoteId = this.safeString(market, 'quote');
176
- const base = this.safeCurrencyCode(baseId);
177
- const quote = this.safeCurrencyCode(quoteId);
178
- const id = base + quote;
179
- baseId = baseId.toLowerCase();
180
- quoteId = quoteId.toLowerCase();
181
- return {
182
- 'id': id,
183
- 'symbol': base + '/' + quote,
184
- 'base': base,
185
- 'quote': quote,
186
- 'settle': undefined,
187
- 'baseId': baseId,
188
- 'quoteId': quoteId,
189
- 'settleId': undefined,
190
- 'type': 'spot',
191
- 'spot': true,
192
- 'margin': false,
193
- 'swap': false,
194
- 'future': false,
195
- 'option': false,
196
- 'active': true,
197
- 'contract': false,
198
- 'linear': undefined,
199
- 'inverse': undefined,
200
- 'contractSize': undefined,
201
- 'expiry': undefined,
202
- 'expiryDatetime': undefined,
203
- 'strike': undefined,
204
- 'optionType': undefined,
205
- 'precision': {
206
- 'amount': undefined,
207
- 'price': undefined,
208
- },
209
- 'limits': {
210
- 'leverage': {
211
- 'min': undefined,
212
- 'max': undefined,
213
- },
214
- 'amount': {
215
- 'min': undefined,
216
- 'max': undefined,
217
- },
218
- 'price': {
219
- 'min': undefined,
220
- 'max': undefined,
221
- },
222
- 'cost': {
223
- 'min': undefined,
224
- 'max': undefined,
225
- },
226
- },
227
- 'created': undefined,
228
- 'info': market,
229
- };
230
- }
231
- async fetchTickers(symbols = undefined, params = {}) {
232
- /**
233
- * @method
234
- * @name twox#fetchTickers
235
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
236
- * @see https://api.twox.ir/api/currencies
237
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
238
- * @param {object} [params] extra parameters specific to the exchange API endpoint
239
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
240
- */
241
- await this.loadMarkets();
242
- if (symbols !== undefined) {
243
- symbols = this.marketSymbols(symbols);
244
- }
245
- const response = await this.publicGetApiCurrencies(params);
246
- const result = {};
247
- const quotes = ['IRT', 'USDT'];
248
- for (let i = 0; i < response.length; i++) {
249
- const base = this.safeString(response[i], 'symbol');
250
- for (let index = 0; index < quotes.length; index++) {
251
- const quote = quotes[index];
252
- if (base === quote || response[i]['sellPrice'] === 0 || base === 'IRT') {
253
- continue;
254
- }
255
- response[i]['base'] = base;
256
- response[i]['quote'] = quote;
257
- response[i]['symbol'] = base + quote;
258
- const ticker = this.parseTicker(response[i]);
259
- const symbol = ticker['symbol'];
260
- result[symbol] = ticker;
261
- }
262
- }
263
- return this.filterByArrayTickers(result, 'symbol', symbols);
264
- }
265
- async fetchTicker(symbol, params = {}) {
266
- /**
267
- * @method
268
- * @name twox#fetchTicker
269
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
270
- * @see https://api.twox.ir/api/currencies
271
- * @param {string} symbol unified symbol of the market to fetch the ticker for
272
- * @param {object} [params] extra parameters specific to the exchange API endpoint
273
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
274
- */
275
- const ticker = await this.fetchTickers([symbol]);
276
- return ticker[symbol];
277
- }
278
- parseTicker(ticker, market = undefined) {
279
- // {
280
- // sellPrice: 113201.0,
281
- // buyPrice: 112151.0,
282
- // latestPrice: 1.0,
283
- // weeklyChart: "https://cdn.twox.info/resource/w/tether.webp?v=101313",
284
- // priceChangePercent: 0.0,
285
- // sellPriceChange: 0.00,
286
- // buyPriceChange: 0.00,
287
- // minAmount: 2.0,
288
- // tags: [ ],
289
- // marketCategories: [ ],
290
- // id: 2,
291
- // symbol: "USDT",
292
- // name: "Tether USDt",
293
- // icon: "https://cdn.twox.info/resource/c/tether.webp",
294
- // persianName: "تتر",
295
- // isStableCoin: true,
296
- // isActive: true,
297
- // type: 2,
298
- // isNeedRiskWarning: false,
299
- // assetPrecision: 2,
300
- // isDepositAllEnable: true,
301
- // tradeStatus: 1,
302
- // isWithdrawAllEnable: true,
303
- // currencySlug: "tether",
304
- // marketCurrencyId: 825,
305
- // order: 1,
306
- // isTrading: true,
307
- // commissionPrecision: 8,
308
- // isDepositNeedManualConfirm: false,
309
- // supportedBy: [ ]
310
- // },
311
- const marketType = 'otc';
312
- const marketId = this.safeString(ticker, 'symbol');
313
- const symbol = this.safeSymbol(marketId, market, undefined, marketType);
314
- const sellPrice = this.safeFloat(ticker, 'sellPrice');
315
- const buyPrice = this.safeFloat(ticker, 'buyPrice');
316
- const latestPrice = this.safeFloat(ticker, 'latestPrice');
317
- let last = undefined;
318
- let bid = undefined;
319
- let ask = undefined;
320
- if (ticker['quote'] === 'IRT') {
321
- // For IRT pairs, sellPrice is what user pays (ask), buyPrice is what user receives (bid)
322
- last = sellPrice;
323
- bid = buyPrice;
324
- ask = sellPrice;
325
- }
326
- else {
327
- // For USDT pairs, use latestPrice
328
- last = latestPrice;
329
- bid = buyPrice;
330
- ask = sellPrice;
331
- }
332
- const percentage = this.safeFloat(ticker, 'priceChangePercent');
333
- const sellPriceChange = this.safeFloat(ticker, 'sellPriceChange');
334
- const buyPriceChange = this.safeFloat(ticker, 'buyPriceChange');
335
- let change = undefined;
336
- if (ticker['quote'] === 'IRT') {
337
- change = sellPriceChange;
338
- }
339
- else {
340
- change = buyPriceChange;
341
- }
342
- return this.safeTicker({
343
- 'symbol': symbol,
344
- 'timestamp': undefined,
345
- 'datetime': undefined,
346
- 'high': undefined,
347
- 'low': undefined,
348
- 'bid': bid,
349
- 'bidVolume': undefined,
350
- 'ask': ask,
351
- 'askVolume': undefined,
352
- 'vwap': undefined,
353
- 'open': undefined,
354
- 'close': last,
355
- 'last': last,
356
- 'previousClose': undefined,
357
- 'change': change,
358
- 'percentage': percentage,
359
- 'average': undefined,
360
- 'baseVolume': undefined,
361
- 'quoteVolume': undefined,
362
- 'info': ticker,
363
- }, market);
364
- }
365
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
366
- const url = this.urls['api']['public'] + '/' + path;
367
- headers = { 'Content-Type': 'application/json' };
368
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
369
- }
8
+ // ---------------------------------------------------------------------------
9
+ /**
10
+ * @class twox
11
+ * @augments Exchange
12
+ * @description Set rateLimit to 1000 if fully verified
13
+ */
14
+ class twox extends twox$1["default"] {
15
+ describe() {
16
+ return this.deepExtend(super.describe(), {
17
+ 'id': 'twox',
18
+ 'name': 'Twox',
19
+ 'countries': ['IR'],
20
+ 'rateLimit': 1000,
21
+ 'version': '1',
22
+ 'certified': false,
23
+ 'pro': false,
24
+ 'has': {
25
+ 'CORS': undefined,
26
+ 'spot': false,
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
+ 'otc': true,
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/twox/64x64.png',
91
+ 'api': {
92
+ 'public': 'https://api.twox.ir',
93
+ },
94
+ 'www': 'https://twox.ir',
95
+ 'doc': [
96
+ 'https://twox.ir',
97
+ ],
98
+ },
99
+ 'api': {
100
+ 'public': {
101
+ 'get': {
102
+ 'api/currencies': 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 twox#fetchMarkets
120
+ * @description retrieves data on all markets for twox
121
+ * @see https://api.twox.ir/api/currencies
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.publicGetApiCurrencies(params);
126
+ const result = [];
127
+ const quotes = ['IRT', 'USDT'];
128
+ for (let i = 0; i < response.length; i++) {
129
+ const marketData = this.extend({}, response[i]);
130
+ const base = this.safeString(marketData, 'symbol');
131
+ for (let index = 0; index < quotes.length; index++) {
132
+ const quote = quotes[index];
133
+ if (base === quote || marketData['sellPrice'] === 0 || base === 'IRT') {
134
+ break;
135
+ }
136
+ marketData['base'] = base;
137
+ marketData['quote'] = quote;
138
+ const market = this.parseMarket(marketData);
139
+ result.push(market);
140
+ }
141
+ }
142
+ return result;
143
+ }
144
+ parseMarket(market) {
145
+ // {
146
+ // sellPrice: 0,
147
+ // buyPrice: 0,
148
+ // latestPrice: 0,
149
+ // weeklyChart: "https://cdn.twox.trade/currencies/charts/7d/irt_toman.svg?v=2024061017",
150
+ // priceChangePercent: 0,
151
+ // minAmount: 10000,
152
+ // tags: [ ],
153
+ // marketCategories: [ ],
154
+ // id: 1,
155
+ // symbol: "IRT",
156
+ // name: "Toman",
157
+ // icon: "https://cdn.twox.trade/currencies/icons/128x128/irt_toman.png",
158
+ // persianName: "تومان",
159
+ // isStableCoin: false,
160
+ // isActive: true,
161
+ // colorCode: null,
162
+ // type: 0,
163
+ // isNeedRiskWarning: false,
164
+ // assetPrecision: 0,
165
+ // isLeveragedToken: false,
166
+ // commissionPrecision: 0,
167
+ // isDepositAllEnable: true,
168
+ // isTrading: true,
169
+ // isWithdrawAllEnable: true,
170
+ // currencySlug: "IRT_Toman",
171
+ // marketCurrencyId: 0,
172
+ // order: 0
173
+ // },
174
+ let baseId = this.safeString(market, 'base');
175
+ let quoteId = this.safeString(market, 'quote');
176
+ const base = this.safeCurrencyCode(baseId);
177
+ const quote = this.safeCurrencyCode(quoteId);
178
+ const id = base + quote;
179
+ baseId = baseId.toLowerCase();
180
+ quoteId = quoteId.toLowerCase();
181
+ return {
182
+ 'id': id,
183
+ 'symbol': base + '/' + quote,
184
+ 'base': base,
185
+ 'quote': quote,
186
+ 'settle': undefined,
187
+ 'baseId': baseId,
188
+ 'quoteId': quoteId,
189
+ 'settleId': undefined,
190
+ 'type': 'spot',
191
+ 'spot': true,
192
+ 'margin': false,
193
+ 'swap': false,
194
+ 'future': false,
195
+ 'option': false,
196
+ 'active': true,
197
+ 'contract': false,
198
+ 'linear': undefined,
199
+ 'inverse': undefined,
200
+ 'contractSize': undefined,
201
+ 'expiry': undefined,
202
+ 'expiryDatetime': undefined,
203
+ 'strike': undefined,
204
+ 'optionType': undefined,
205
+ 'precision': {
206
+ 'amount': undefined,
207
+ 'price': undefined,
208
+ },
209
+ 'limits': {
210
+ 'leverage': {
211
+ 'min': undefined,
212
+ 'max': undefined,
213
+ },
214
+ 'amount': {
215
+ 'min': undefined,
216
+ 'max': undefined,
217
+ },
218
+ 'price': {
219
+ 'min': undefined,
220
+ 'max': undefined,
221
+ },
222
+ 'cost': {
223
+ 'min': undefined,
224
+ 'max': undefined,
225
+ },
226
+ },
227
+ 'created': undefined,
228
+ 'info': market,
229
+ };
230
+ }
231
+ async fetchTickers(symbols = undefined, params = {}) {
232
+ /**
233
+ * @method
234
+ * @name twox#fetchTickers
235
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
236
+ * @see https://api.twox.ir/api/currencies
237
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
238
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
239
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
240
+ */
241
+ await this.loadMarkets();
242
+ if (symbols !== undefined) {
243
+ symbols = this.marketSymbols(symbols);
244
+ }
245
+ const response = await this.publicGetApiCurrencies(params);
246
+ const result = {};
247
+ const quotes = ['IRT', 'USDT'];
248
+ for (let i = 0; i < response.length; i++) {
249
+ const base = this.safeString(response[i], 'symbol');
250
+ for (let index = 0; index < quotes.length; index++) {
251
+ const quote = quotes[index];
252
+ if (base === quote || response[i]['sellPrice'] === 0 || base === 'IRT') {
253
+ continue;
254
+ }
255
+ response[i]['base'] = base;
256
+ response[i]['quote'] = quote;
257
+ response[i]['symbol'] = base + quote;
258
+ const ticker = this.parseTicker(response[i]);
259
+ const symbol = ticker['symbol'];
260
+ result[symbol] = ticker;
261
+ }
262
+ }
263
+ return this.filterByArrayTickers(result, 'symbol', symbols);
264
+ }
265
+ async fetchTicker(symbol, params = {}) {
266
+ /**
267
+ * @method
268
+ * @name twox#fetchTicker
269
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
270
+ * @see https://api.twox.ir/api/currencies
271
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
272
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
273
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
274
+ */
275
+ const ticker = await this.fetchTickers([symbol]);
276
+ return ticker[symbol];
277
+ }
278
+ parseTicker(ticker, market = undefined) {
279
+ // {
280
+ // sellPrice: 113201.0,
281
+ // buyPrice: 112151.0,
282
+ // latestPrice: 1.0,
283
+ // weeklyChart: "https://cdn.twox.info/resource/w/tether.webp?v=101313",
284
+ // priceChangePercent: 0.0,
285
+ // sellPriceChange: 0.00,
286
+ // buyPriceChange: 0.00,
287
+ // minAmount: 2.0,
288
+ // tags: [ ],
289
+ // marketCategories: [ ],
290
+ // id: 2,
291
+ // symbol: "USDT",
292
+ // name: "Tether USDt",
293
+ // icon: "https://cdn.twox.info/resource/c/tether.webp",
294
+ // persianName: "تتر",
295
+ // isStableCoin: true,
296
+ // isActive: true,
297
+ // type: 2,
298
+ // isNeedRiskWarning: false,
299
+ // assetPrecision: 2,
300
+ // isDepositAllEnable: true,
301
+ // tradeStatus: 1,
302
+ // isWithdrawAllEnable: true,
303
+ // currencySlug: "tether",
304
+ // marketCurrencyId: 825,
305
+ // order: 1,
306
+ // isTrading: true,
307
+ // commissionPrecision: 8,
308
+ // isDepositNeedManualConfirm: false,
309
+ // supportedBy: [ ]
310
+ // },
311
+ const marketType = 'otc';
312
+ const marketId = this.safeString(ticker, 'symbol');
313
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
314
+ const sellPrice = this.safeFloat(ticker, 'sellPrice');
315
+ const buyPrice = this.safeFloat(ticker, 'buyPrice');
316
+ const latestPrice = this.safeFloat(ticker, 'latestPrice');
317
+ let last = undefined;
318
+ let bid = undefined;
319
+ let ask = undefined;
320
+ if (ticker['quote'] === 'IRT') {
321
+ // For IRT pairs, sellPrice is what user pays (ask), buyPrice is what user receives (bid)
322
+ last = sellPrice;
323
+ bid = buyPrice;
324
+ ask = sellPrice;
325
+ }
326
+ else {
327
+ // For USDT pairs, use latestPrice
328
+ last = latestPrice;
329
+ bid = buyPrice;
330
+ ask = sellPrice;
331
+ }
332
+ const percentage = this.safeFloat(ticker, 'priceChangePercent');
333
+ const sellPriceChange = this.safeFloat(ticker, 'sellPriceChange');
334
+ const buyPriceChange = this.safeFloat(ticker, 'buyPriceChange');
335
+ let change = undefined;
336
+ if (ticker['quote'] === 'IRT') {
337
+ change = sellPriceChange;
338
+ }
339
+ else {
340
+ change = buyPriceChange;
341
+ }
342
+ return this.safeTicker({
343
+ 'symbol': symbol,
344
+ 'timestamp': undefined,
345
+ 'datetime': undefined,
346
+ 'high': undefined,
347
+ 'low': undefined,
348
+ 'bid': bid,
349
+ 'bidVolume': undefined,
350
+ 'ask': ask,
351
+ 'askVolume': undefined,
352
+ 'vwap': undefined,
353
+ 'open': undefined,
354
+ 'close': last,
355
+ 'last': last,
356
+ 'previousClose': undefined,
357
+ 'change': change,
358
+ 'percentage': percentage,
359
+ 'average': undefined,
360
+ 'baseVolume': undefined,
361
+ 'quoteVolume': undefined,
362
+ 'info': ticker,
363
+ }, market);
364
+ }
365
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
366
+ const url = this.urls['api']['public'] + '/' + path;
367
+ headers = { 'Content-Type': 'application/json' };
368
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
369
+ }
370
370
  }
371
371
 
372
372
  exports["default"] = twox;