ccxt-ir 4.9.23 → 4.9.25

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 (89) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +1 -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/kifpoolme.js +1 -1
  10. package/dist/cjs/src/abstract/mazdax.js +1 -1
  11. package/dist/cjs/src/abstract/pingi.js +1 -1
  12. package/dist/cjs/src/abstract/pooleno.js +1 -1
  13. package/dist/cjs/src/abstract/tehran_exchange.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 +294 -294
  20. package/dist/cjs/src/iranexchange.js +9 -7
  21. package/dist/cjs/src/kcex.js +326 -326
  22. package/dist/cjs/src/kifpoolme.js +401 -401
  23. package/dist/cjs/src/mazdax.js +525 -525
  24. package/dist/cjs/src/ompfinex.js +501 -501
  25. package/dist/cjs/src/pingi.js +437 -437
  26. package/dist/cjs/src/pooleno.js +338 -338
  27. package/dist/cjs/src/sarmayex.js +367 -367
  28. package/dist/cjs/src/tehran_exchange.js +324 -324
  29. package/dist/cjs/src/tetherland.js +358 -358
  30. package/dist/cjs/src/toobit.js +436 -436
  31. package/dist/cjs/src/twox.js +362 -362
  32. package/js/ccxt.d.ts +1 -1
  33. package/js/ccxt.js +1 -1
  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/bydfi.d.ts +11 -11
  40. package/js/src/abstract/bydfi.js +5 -5
  41. package/js/src/abstract/cafearz.d.ts +8 -8
  42. package/js/src/abstract/cafearz.js +5 -5
  43. package/js/src/abstract/hamtapay.d.ts +9 -9
  44. package/js/src/abstract/hamtapay.js +5 -5
  45. package/js/src/abstract/kifpoolme.d.ts +9 -9
  46. package/js/src/abstract/kifpoolme.js +5 -5
  47. package/js/src/abstract/mazdax.d.ts +11 -11
  48. package/js/src/abstract/mazdax.js +5 -5
  49. package/js/src/abstract/pingi.d.ts +9 -9
  50. package/js/src/abstract/pingi.js +5 -5
  51. package/js/src/abstract/pooleno.d.ts +8 -8
  52. package/js/src/abstract/pooleno.js +5 -5
  53. package/js/src/abstract/tehran_exchange.d.ts +9 -9
  54. package/js/src/abstract/tehran_exchange.js +5 -5
  55. package/js/src/abstract/toobit.d.ts +10 -10
  56. package/js/src/afratether.js +350 -350
  57. package/js/src/arzplus.d.ts +26 -26
  58. package/js/src/arzplus.js +575 -575
  59. package/js/src/base/types.d.ts +586 -586
  60. package/js/src/bitbarg.d.ts +21 -21
  61. package/js/src/bitbarg.js +306 -306
  62. package/js/src/bydfi.d.ts +23 -23
  63. package/js/src/bydfi.js +428 -428
  64. package/js/src/cafearz.d.ts +21 -21
  65. package/js/src/cafearz.js +340 -340
  66. package/js/src/hamtapay.d.ts +21 -21
  67. package/js/src/hamtapay.js +297 -297
  68. package/js/src/iranexchange.js +9 -7
  69. package/js/src/kcex.js +329 -329
  70. package/js/src/kifpoolme.d.ts +23 -23
  71. package/js/src/kifpoolme.js +404 -404
  72. package/js/src/mazdax.d.ts +23 -23
  73. package/js/src/mazdax.js +528 -528
  74. package/js/src/ompfinex.js +504 -504
  75. package/js/src/pingi.d.ts +22 -22
  76. package/js/src/pingi.js +440 -440
  77. package/js/src/pooleno.d.ts +21 -21
  78. package/js/src/pooleno.js +341 -341
  79. package/js/src/sarmayex.js +370 -370
  80. package/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.d.ts +51 -51
  81. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +101 -101
  82. package/js/src/static_dependencies/noble-curves/abstract/weierstrass.d.ts +204 -204
  83. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -5
  84. package/js/src/tehran_exchange.d.ts +21 -21
  85. package/js/src/tehran_exchange.js +327 -327
  86. package/js/src/tetherland.js +361 -361
  87. package/js/src/toobit.js +439 -439
  88. package/js/src/twox.js +365 -365
  89. package/package.json +1 -1
@@ -5,330 +5,330 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var tehran_exchange$1 = require('./abstract/tehran_exchange.js');
6
6
 
7
7
  // ----------------------------------------------------------------------------
8
- // ---------------------------------------------------------------------------
9
- /**
10
- * @class tehran_exchange
11
- * @augments Exchange
12
- * @description Set rateLimit to 1000 if fully verified
13
- */
14
- class tehran_exchange extends tehran_exchange$1["default"] {
15
- describe() {
16
- return this.deepExtend(super.describe(), {
17
- 'id': 'tehran_exchange',
18
- 'name': 'Tehran Exchange',
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
- 'fetchLedger': false,
60
- 'fetchLedgerEntry': false,
61
- 'fetchLeverageTiers': false,
62
- 'fetchMarkets': true,
63
- 'fetchMarkOHLCV': false,
64
- 'fetchMyTrades': false,
65
- 'fetchOHLCV': false,
66
- 'fetchOpenInterestHistory': false,
67
- 'fetchOpenOrders': false,
68
- 'fetchOrder': false,
69
- 'fetchOrderBook': false,
70
- 'fetchOrders': false,
71
- 'fetchOrderTrades': 'emulated',
72
- 'fetchPositions': false,
73
- 'fetchPremiumIndexOHLCV': false,
74
- 'fetchTicker': true,
75
- 'fetchTickers': true,
76
- 'fetchTime': false,
77
- 'fetchTrades': false,
78
- 'fetchTradingFee': false,
79
- 'fetchTradingFees': false,
80
- 'fetchWithdrawals': false,
81
- 'setLeverage': false,
82
- 'setMarginMode': false,
83
- 'transfer': false,
84
- 'withdraw': false,
85
- },
86
- 'comment': 'This comment is optional',
87
- 'urls': {
88
- 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/tehran_exchange/64x64.png',
89
- 'api': {
90
- 'public': 'https://otc-api.tehran.exchange',
91
- },
92
- 'www': 'https://tehran.exchange',
93
- 'doc': [
94
- 'https://tehran.exchange',
95
- ],
96
- },
97
- 'api': {
98
- 'public': {
99
- 'get': {
100
- 'otc/v1/market/pair': 1,
101
- 'otc/v1/market/order/pair/price': 1,
102
- },
103
- },
104
- },
105
- 'fees': {
106
- 'trading': {
107
- 'tierBased': false,
108
- 'percentage': true,
109
- 'maker': this.parseNumber('0.0025'),
110
- 'taker': this.parseNumber('0.0025'),
111
- },
112
- },
113
- });
114
- }
115
- async fetchMarkets(params = {}) {
116
- /**
117
- * @method
118
- * @name tehran_exchange#fetchMarkets
119
- * @description retrieves data on all markets for tehran_exchange
120
- * @see https://otc-api.tehran.exchange/otc/v1/market/pair
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.publicGetOtcV1MarketPair(params);
125
- const data = this.safeDict(response, 'data', {});
126
- const pairs = this.safeList(data, 'pairs', []);
127
- const result = [];
128
- for (let i = 0; i < pairs.length; i++) {
129
- const market = this.parseMarket(pairs[i]);
130
- result.push(market);
131
- }
132
- return result;
133
- }
134
- parseMarket(market) {
135
- // {
136
- // "id": 6054,
137
- // "pair": "HBAR_USDT",
138
- // "status": "TRADABLE",
139
- // "tradable": true,
140
- // "fiatOrder": false,
141
- // "quoteName": "Tether",
142
- // "baseName": "Hedera",
143
- // "quoteNameFa": "تتر",
144
- // "baseNameFa": "هدرا هش گراف ",
145
- // "quoteImageUrl": "https://s3-dev.tehranex.com/asset/coin_icon/64/usdt.png",
146
- // "baseImageUrl": "https://s3-dev.tehranex.com/asset/coin_icon/64/hbar.png",
147
- // "quoteSymbol": "USDT",
148
- // "baseSymbol": "HBAR",
149
- // "amountPrecision": 2,
150
- // "feePercentage": 0.25,
151
- // "providerFeePercentage": 0.05,
152
- // "maxQuoteAmount": 600000,
153
- // "minBaseAmount": 0.01,
154
- // "minQuoteAmount": 1,
155
- // "pricePrecision": 5,
156
- // "baseVirtualCurrencyId": 989,
157
- // "quoteVirtualCurrencyId": 1
158
- // }
159
- const id = this.safeString(market, 'pair');
160
- const baseId = this.safeString(market, 'baseSymbol');
161
- const quoteId = this.safeString(market, 'quoteSymbol');
162
- const base = this.safeCurrencyCode(baseId);
163
- const quote = this.safeCurrencyCode(quoteId);
164
- const status = this.safeString(market, 'status');
165
- const tradable = this.safeBool(market, 'tradable', false);
166
- const active = (status === 'TRADABLE') && tradable;
167
- const amountPrecision = this.safeInteger(market, 'amountPrecision');
168
- const pricePrecision = this.safeInteger(market, 'pricePrecision');
169
- const minBaseAmount = this.safeString(market, 'minBaseAmount');
170
- const minQuoteAmount = this.safeString(market, 'minQuoteAmount');
171
- const maxQuoteAmount = this.safeString(market, 'maxQuoteAmount');
172
- return {
173
- 'id': id,
174
- 'symbol': base + '/' + quote,
175
- 'base': base,
176
- 'quote': quote,
177
- 'settle': undefined,
178
- 'baseId': baseId,
179
- 'quoteId': quoteId,
180
- 'settleId': undefined,
181
- 'type': 'spot',
182
- 'spot': true,
183
- 'margin': false,
184
- 'swap': false,
185
- 'future': false,
186
- 'option': false,
187
- 'active': active,
188
- 'contract': false,
189
- 'linear': undefined,
190
- 'inverse': undefined,
191
- 'contractSize': undefined,
192
- 'expiry': undefined,
193
- 'expiryDatetime': undefined,
194
- 'strike': undefined,
195
- 'optionType': undefined,
196
- 'precision': {
197
- 'amount': amountPrecision,
198
- 'price': pricePrecision,
199
- },
200
- 'limits': {
201
- 'leverage': {
202
- 'min': undefined,
203
- 'max': undefined,
204
- },
205
- 'amount': {
206
- 'min': this.parseNumber(minBaseAmount),
207
- 'max': undefined,
208
- },
209
- 'price': {
210
- 'min': undefined,
211
- 'max': undefined,
212
- },
213
- 'cost': {
214
- 'min': this.parseNumber(minQuoteAmount),
215
- 'max': this.parseNumber(maxQuoteAmount),
216
- },
217
- },
218
- 'created': undefined,
219
- 'info': market,
220
- };
221
- }
222
- async fetchTickers(symbols = undefined, params = {}) {
223
- /**
224
- * @method
225
- * @name tehran_exchange#fetchTickers
226
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
227
- * @see https://otc-api.tehran.exchange/otc/v1/market/pair
228
- * @see https://otc-api.tehran.exchange/otc/v1/market/order/pair/price
229
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
230
- * @param {object} [params] extra parameters specific to the exchange API endpoint
231
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
232
- */
233
- await this.loadMarkets();
234
- if (symbols !== undefined) {
235
- symbols = this.marketSymbols(symbols);
236
- }
237
- const response = await this.publicGetOtcV1MarketPair(params);
238
- const data = this.safeDict(response, 'data', {});
239
- const pairs = this.safeList(data, 'pairs', []);
240
- // filter symbols from pairs
241
- const filteredPairs = [];
242
- for (let i = 0; i < pairs.length; i++) {
243
- const pair = pairs[i];
244
- const pairId = this.safeString(pair, 'pair');
245
- const symbol = this.safeSymbol(pairId);
246
- if (symbols.includes(symbol)) {
247
- filteredPairs.push(pair);
248
- }
249
- }
250
- const result = {};
251
- for (let i = 0; i < filteredPairs.length; i++) {
252
- const pairData = filteredPairs[i];
253
- const pairId = this.safeString(pairData, 'pair');
254
- // Fetch BUY price
255
- const request = {
256
- 'pair': pairId,
257
- 'side': 'BUY',
258
- 'basedOn': 'BASE',
259
- 'amount': 1,
260
- };
261
- const priceResponse = await this.publicGetOtcV1MarketOrderPairPrice(request);
262
- const priceData = this.safeDict(priceResponse, 'data', {});
263
- const price = this.safeFloat(priceData, 'price', 0);
264
- pairData['price'] = price;
265
- const ticker = this.parseTicker(pairData);
266
- const symbol = ticker['symbol'];
267
- result[symbol] = ticker;
268
- }
269
- return this.filterByArrayTickers(result, 'symbol', symbols);
270
- }
271
- async fetchTicker(symbol, params = {}) {
272
- /**
273
- * @method
274
- * @name tehran_exchange#fetchTicker
275
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
276
- * @see https://otc-api.tehran.exchange/otc/v1/market/pair
277
- * @param {string} symbol unified symbol of the market to fetch the ticker for
278
- * @param {object} [params] extra parameters specific to the exchange API endpoint
279
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
280
- */
281
- const ticker = await this.fetchTickers([symbol]);
282
- return ticker[this.safeSymbol(symbol)];
283
- }
284
- parseTicker(ticker, market = undefined) {
285
- // {
286
- // "id": 6054,
287
- // "pair": "HBAR_USDT",
288
- // "status": "TRADABLE",
289
- // "tradable": true,
290
- // "baseSymbol": "HBAR",
291
- // "quoteSymbol": "USDT",
292
- // ...
293
- // "price": 12345,
294
- // }
295
- const marketType = 'spot';
296
- const baseSymbol = this.safeString(ticker, 'baseSymbol');
297
- const quoteSymbol = this.safeString(ticker, 'quoteSymbol');
298
- const marketId = baseSymbol + '/' + quoteSymbol;
299
- const symbol = this.safeSymbol(marketId, market, undefined, marketType);
300
- const price = this.safeFloat(ticker, 'price');
301
- return this.safeTicker({
302
- 'symbol': symbol,
303
- 'timestamp': undefined,
304
- 'datetime': undefined,
305
- 'high': undefined,
306
- 'low': undefined,
307
- 'bid': price,
308
- 'bidVolume': undefined,
309
- 'ask': price,
310
- 'askVolume': undefined,
311
- 'open': undefined,
312
- 'close': price,
313
- 'last': price,
314
- 'previousClose': undefined,
315
- 'change': undefined,
316
- 'percentage': undefined,
317
- 'average': undefined,
318
- 'baseVolume': undefined,
319
- 'quoteVolume': undefined,
320
- 'info': ticker,
321
- }, market);
322
- }
323
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
324
- const query = this.omit(params, this.extractParams(path));
325
- let url = this.urls['api']['public'] + '/' + path;
326
- if (Object.keys(query).length) {
327
- url += '?' + this.urlencode(query);
328
- }
329
- headers = { 'Content-Type': 'application/json' };
330
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
331
- }
8
+ // ---------------------------------------------------------------------------
9
+ /**
10
+ * @class tehran_exchange
11
+ * @augments Exchange
12
+ * @description Set rateLimit to 1000 if fully verified
13
+ */
14
+ class tehran_exchange extends tehran_exchange$1["default"] {
15
+ describe() {
16
+ return this.deepExtend(super.describe(), {
17
+ 'id': 'tehran_exchange',
18
+ 'name': 'Tehran Exchange',
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
+ 'fetchLedger': false,
60
+ 'fetchLedgerEntry': false,
61
+ 'fetchLeverageTiers': false,
62
+ 'fetchMarkets': true,
63
+ 'fetchMarkOHLCV': false,
64
+ 'fetchMyTrades': false,
65
+ 'fetchOHLCV': false,
66
+ 'fetchOpenInterestHistory': false,
67
+ 'fetchOpenOrders': false,
68
+ 'fetchOrder': false,
69
+ 'fetchOrderBook': false,
70
+ 'fetchOrders': false,
71
+ 'fetchOrderTrades': 'emulated',
72
+ 'fetchPositions': false,
73
+ 'fetchPremiumIndexOHLCV': false,
74
+ 'fetchTicker': true,
75
+ 'fetchTickers': true,
76
+ 'fetchTime': false,
77
+ 'fetchTrades': false,
78
+ 'fetchTradingFee': false,
79
+ 'fetchTradingFees': false,
80
+ 'fetchWithdrawals': false,
81
+ 'setLeverage': false,
82
+ 'setMarginMode': false,
83
+ 'transfer': false,
84
+ 'withdraw': false,
85
+ },
86
+ 'comment': 'This comment is optional',
87
+ 'urls': {
88
+ 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/tehran_exchange/64x64.png',
89
+ 'api': {
90
+ 'public': 'https://otc-api.tehran.exchange',
91
+ },
92
+ 'www': 'https://tehran.exchange',
93
+ 'doc': [
94
+ 'https://tehran.exchange',
95
+ ],
96
+ },
97
+ 'api': {
98
+ 'public': {
99
+ 'get': {
100
+ 'otc/v1/market/pair': 1,
101
+ 'otc/v1/market/order/pair/price': 1,
102
+ },
103
+ },
104
+ },
105
+ 'fees': {
106
+ 'trading': {
107
+ 'tierBased': false,
108
+ 'percentage': true,
109
+ 'maker': this.parseNumber('0.0025'),
110
+ 'taker': this.parseNumber('0.0025'),
111
+ },
112
+ },
113
+ });
114
+ }
115
+ async fetchMarkets(params = {}) {
116
+ /**
117
+ * @method
118
+ * @name tehran_exchange#fetchMarkets
119
+ * @description retrieves data on all markets for tehran_exchange
120
+ * @see https://otc-api.tehran.exchange/otc/v1/market/pair
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.publicGetOtcV1MarketPair(params);
125
+ const data = this.safeDict(response, 'data', {});
126
+ const pairs = this.safeList(data, 'pairs', []);
127
+ const result = [];
128
+ for (let i = 0; i < pairs.length; i++) {
129
+ const market = this.parseMarket(pairs[i]);
130
+ result.push(market);
131
+ }
132
+ return result;
133
+ }
134
+ parseMarket(market) {
135
+ // {
136
+ // "id": 6054,
137
+ // "pair": "HBAR_USDT",
138
+ // "status": "TRADABLE",
139
+ // "tradable": true,
140
+ // "fiatOrder": false,
141
+ // "quoteName": "Tether",
142
+ // "baseName": "Hedera",
143
+ // "quoteNameFa": "تتر",
144
+ // "baseNameFa": "هدرا هش گراف ",
145
+ // "quoteImageUrl": "https://s3-dev.tehranex.com/asset/coin_icon/64/usdt.png",
146
+ // "baseImageUrl": "https://s3-dev.tehranex.com/asset/coin_icon/64/hbar.png",
147
+ // "quoteSymbol": "USDT",
148
+ // "baseSymbol": "HBAR",
149
+ // "amountPrecision": 2,
150
+ // "feePercentage": 0.25,
151
+ // "providerFeePercentage": 0.05,
152
+ // "maxQuoteAmount": 600000,
153
+ // "minBaseAmount": 0.01,
154
+ // "minQuoteAmount": 1,
155
+ // "pricePrecision": 5,
156
+ // "baseVirtualCurrencyId": 989,
157
+ // "quoteVirtualCurrencyId": 1
158
+ // }
159
+ const id = this.safeString(market, 'pair');
160
+ const baseId = this.safeString(market, 'baseSymbol');
161
+ const quoteId = this.safeString(market, 'quoteSymbol');
162
+ const base = this.safeCurrencyCode(baseId);
163
+ const quote = this.safeCurrencyCode(quoteId);
164
+ const status = this.safeString(market, 'status');
165
+ const tradable = this.safeBool(market, 'tradable', false);
166
+ const active = (status === 'TRADABLE') && tradable;
167
+ const amountPrecision = this.safeInteger(market, 'amountPrecision');
168
+ const pricePrecision = this.safeInteger(market, 'pricePrecision');
169
+ const minBaseAmount = this.safeString(market, 'minBaseAmount');
170
+ const minQuoteAmount = this.safeString(market, 'minQuoteAmount');
171
+ const maxQuoteAmount = this.safeString(market, 'maxQuoteAmount');
172
+ return {
173
+ 'id': id,
174
+ 'symbol': base + '/' + quote,
175
+ 'base': base,
176
+ 'quote': quote,
177
+ 'settle': undefined,
178
+ 'baseId': baseId,
179
+ 'quoteId': quoteId,
180
+ 'settleId': undefined,
181
+ 'type': 'spot',
182
+ 'spot': true,
183
+ 'margin': false,
184
+ 'swap': false,
185
+ 'future': false,
186
+ 'option': false,
187
+ 'active': active,
188
+ 'contract': false,
189
+ 'linear': undefined,
190
+ 'inverse': undefined,
191
+ 'contractSize': undefined,
192
+ 'expiry': undefined,
193
+ 'expiryDatetime': undefined,
194
+ 'strike': undefined,
195
+ 'optionType': undefined,
196
+ 'precision': {
197
+ 'amount': amountPrecision,
198
+ 'price': pricePrecision,
199
+ },
200
+ 'limits': {
201
+ 'leverage': {
202
+ 'min': undefined,
203
+ 'max': undefined,
204
+ },
205
+ 'amount': {
206
+ 'min': this.parseNumber(minBaseAmount),
207
+ 'max': undefined,
208
+ },
209
+ 'price': {
210
+ 'min': undefined,
211
+ 'max': undefined,
212
+ },
213
+ 'cost': {
214
+ 'min': this.parseNumber(minQuoteAmount),
215
+ 'max': this.parseNumber(maxQuoteAmount),
216
+ },
217
+ },
218
+ 'created': undefined,
219
+ 'info': market,
220
+ };
221
+ }
222
+ async fetchTickers(symbols = undefined, params = {}) {
223
+ /**
224
+ * @method
225
+ * @name tehran_exchange#fetchTickers
226
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
227
+ * @see https://otc-api.tehran.exchange/otc/v1/market/pair
228
+ * @see https://otc-api.tehran.exchange/otc/v1/market/order/pair/price
229
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
230
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
231
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
232
+ */
233
+ await this.loadMarkets();
234
+ if (symbols !== undefined) {
235
+ symbols = this.marketSymbols(symbols);
236
+ }
237
+ const response = await this.publicGetOtcV1MarketPair(params);
238
+ const data = this.safeDict(response, 'data', {});
239
+ const pairs = this.safeList(data, 'pairs', []);
240
+ // filter symbols from pairs
241
+ const filteredPairs = [];
242
+ for (let i = 0; i < pairs.length; i++) {
243
+ const pair = pairs[i];
244
+ const pairId = this.safeString(pair, 'pair');
245
+ const symbol = this.safeSymbol(pairId);
246
+ if (symbols.includes(symbol)) {
247
+ filteredPairs.push(pair);
248
+ }
249
+ }
250
+ const result = {};
251
+ for (let i = 0; i < filteredPairs.length; i++) {
252
+ const pairData = filteredPairs[i];
253
+ const pairId = this.safeString(pairData, 'pair');
254
+ // Fetch BUY price
255
+ const request = {
256
+ 'pair': pairId,
257
+ 'side': 'BUY',
258
+ 'basedOn': 'BASE',
259
+ 'amount': 1,
260
+ };
261
+ const priceResponse = await this.publicGetOtcV1MarketOrderPairPrice(request);
262
+ const priceData = this.safeDict(priceResponse, 'data', {});
263
+ const price = this.safeFloat(priceData, 'price', 0);
264
+ pairData['price'] = price;
265
+ const ticker = this.parseTicker(pairData);
266
+ const symbol = ticker['symbol'];
267
+ result[symbol] = ticker;
268
+ }
269
+ return this.filterByArrayTickers(result, 'symbol', symbols);
270
+ }
271
+ async fetchTicker(symbol, params = {}) {
272
+ /**
273
+ * @method
274
+ * @name tehran_exchange#fetchTicker
275
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
276
+ * @see https://otc-api.tehran.exchange/otc/v1/market/pair
277
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
278
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
279
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
280
+ */
281
+ const ticker = await this.fetchTickers([symbol]);
282
+ return ticker[this.safeSymbol(symbol)];
283
+ }
284
+ parseTicker(ticker, market = undefined) {
285
+ // {
286
+ // "id": 6054,
287
+ // "pair": "HBAR_USDT",
288
+ // "status": "TRADABLE",
289
+ // "tradable": true,
290
+ // "baseSymbol": "HBAR",
291
+ // "quoteSymbol": "USDT",
292
+ // ...
293
+ // "price": 12345,
294
+ // }
295
+ const marketType = 'spot';
296
+ const baseSymbol = this.safeString(ticker, 'baseSymbol');
297
+ const quoteSymbol = this.safeString(ticker, 'quoteSymbol');
298
+ const marketId = baseSymbol + '/' + quoteSymbol;
299
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
300
+ const price = this.safeFloat(ticker, 'price');
301
+ return this.safeTicker({
302
+ 'symbol': symbol,
303
+ 'timestamp': undefined,
304
+ 'datetime': undefined,
305
+ 'high': undefined,
306
+ 'low': undefined,
307
+ 'bid': price,
308
+ 'bidVolume': undefined,
309
+ 'ask': price,
310
+ 'askVolume': undefined,
311
+ 'open': undefined,
312
+ 'close': price,
313
+ 'last': price,
314
+ 'previousClose': undefined,
315
+ 'change': undefined,
316
+ 'percentage': undefined,
317
+ 'average': undefined,
318
+ 'baseVolume': undefined,
319
+ 'quoteVolume': undefined,
320
+ 'info': ticker,
321
+ }, market);
322
+ }
323
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
324
+ const query = this.omit(params, this.extractParams(path));
325
+ let url = this.urls['api']['public'] + '/' + path;
326
+ if (Object.keys(query).length) {
327
+ url += '?' + this.urlencode(query);
328
+ }
329
+ headers = { 'Content-Type': 'application/json' };
330
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
331
+ }
332
332
  }
333
333
 
334
334
  exports["default"] = tehran_exchange;