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
@@ -5,300 +5,300 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var hamtapay$1 = require('./abstract/hamtapay.js');
6
6
 
7
7
  // ----------------------------------------------------------------------------
8
- // ---------------------------------------------------------------------------
9
- /**
10
- * @class hamtapay
11
- * @augments Exchange
12
- * @description Set rateLimit to 1000 if fully verified
13
- */
14
- class hamtapay extends hamtapay$1["default"] {
15
- describe() {
16
- return this.deepExtend(super.describe(), {
17
- 'id': 'hamtapay',
18
- 'name': 'Hamtapay',
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/hamtapay/64x64.png',
90
- 'api': {
91
- 'public': 'https://api.hamtapay.org',
92
- },
93
- 'www': 'https://hamtapay.net/',
94
- 'doc': [
95
- 'https://hamtapay.net/',
96
- ],
97
- },
98
- 'api': {
99
- 'public': {
100
- 'get': {
101
- '/financial/api/market': 1,
102
- '/financial/api/vitrin/prices': 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 hamtapay#fetchMarkets
120
- * @description retrieves data on all markets for hamtapay
121
- * @see https://api.hamtapay.org/financial/api/market
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.publicGetFinancialApiMarket(params);
126
- const result = [];
127
- const marketData = this.safeList(response, 'data', []);
128
- for (let i = 0; i < marketData.length; i++) {
129
- const market = this.parseMarket(marketData[i]);
130
- result.push(market);
131
- }
132
- return result;
133
- }
134
- parseMarket(market) {
135
- // {
136
- // "symbol": "USDT-IRT",
137
- // "base": "USDT",
138
- // "quote": "IRT",
139
- // "base_currency_decimals": 3,
140
- // "quote_currency_decimals": 0,
141
- // "amount_decimals": 0,
142
- // "price_decimals": 0
143
- // }
144
- const baseId = this.safeString(market, 'base');
145
- const quoteId = this.safeString(market, 'quote');
146
- const base = this.safeCurrencyCode(baseId);
147
- const quote = this.safeCurrencyCode(quoteId);
148
- const id = this.safeString(market, 'symbol');
149
- return {
150
- 'id': id,
151
- 'symbol': base + '/' + quote,
152
- 'base': base,
153
- 'quote': quote,
154
- 'settle': undefined,
155
- 'baseId': baseId,
156
- 'quoteId': quoteId,
157
- 'settleId': undefined,
158
- 'type': 'otc',
159
- 'spot': false,
160
- 'margin': false,
161
- 'swap': false,
162
- 'future': false,
163
- 'option': false,
164
- 'active': true,
165
- 'contract': false,
166
- 'linear': undefined,
167
- 'inverse': undefined,
168
- 'contractSize': undefined,
169
- 'expiry': undefined,
170
- 'expiryDatetime': undefined,
171
- 'strike': undefined,
172
- 'optionType': undefined,
173
- 'precision': {
174
- 'amount': undefined,
175
- 'price': undefined,
176
- },
177
- 'limits': {
178
- 'leverage': {
179
- 'min': undefined,
180
- 'max': undefined,
181
- },
182
- 'amount': {
183
- 'min': undefined,
184
- 'max': undefined,
185
- },
186
- 'price': {
187
- 'min': undefined,
188
- 'max': undefined,
189
- },
190
- 'cost': {
191
- 'min': undefined,
192
- 'max': undefined,
193
- },
194
- },
195
- 'created': undefined,
196
- 'info': market,
197
- };
198
- }
199
- async fetchTickers(symbols = undefined, params = {}) {
200
- /**
201
- * @method
202
- * @name hamtapay#fetchTickers
203
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
204
- * @see https://api.hamtapay.org/financial/api/vitrin/prices
205
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
206
- * @param {object} [params] extra parameters specific to the exchange API endpoint
207
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
208
- */
209
- await this.loadMarkets();
210
- if (symbols !== undefined) {
211
- symbols = this.marketSymbols(symbols);
212
- }
213
- const response = await this.publicGetFinancialApiVitrinPrices(params);
214
- const data = this.safeDict(response, 'data', {});
215
- const result = {};
216
- const quotes = ['IRT', 'USDT'];
217
- for (let i = 0; i < quotes.length; i++) {
218
- const current_qoute = quotes[i];
219
- const corresponding_data = this.safeDict(data, current_qoute, {});
220
- const baseSymbols = Object.keys(corresponding_data);
221
- for (let j = 0; j < baseSymbols.length; j++) {
222
- const current_base = baseSymbols[j];
223
- const current_ticker = corresponding_data[current_base];
224
- current_ticker['base'] = current_base;
225
- current_ticker['quote'] = current_qoute;
226
- current_ticker['symbol'] = current_base + '/' + current_qoute;
227
- current_ticker['id'] = current_base + '-' + current_qoute;
228
- result[current_ticker['symbol']] = this.parseTicker(current_ticker);
229
- }
230
- }
231
- return this.filterByArrayTickers(result, 'symbol', symbols);
232
- }
233
- async fetchTicker(symbol, params = {}) {
234
- /**
235
- * @method
236
- * @name hamtapay#fetchTicker
237
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
238
- * @see https://hamtapay.com/management/all-coins/?format=json
239
- * @param {string} symbol unified symbol of the market to fetch the ticker for
240
- * @param {object} [params] extra parameters specific to the exchange API endpoint
241
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
242
- */
243
- const ticker = await this.fetchTickers([symbol]);
244
- return ticker[symbol];
245
- }
246
- parseTicker(ticker, market = undefined) {
247
- // {
248
- // "id": "USDT-IRT",
249
- // "symbol": "USDT/IRT",
250
- // "base": "USDT",
251
- // "quote": "IRT",
252
- // "min_price_24h": "111702",
253
- // "max_price_24h": "115872",
254
- // "market_price": "115942",
255
- // "buy_price": "117101",
256
- // "sell_price": "114782",
257
- // "change_rate_24h": 3.29,
258
- // "amount_decimals": 0,
259
- // "price_decimals": 0,
260
- // "status": "ACTIVE"
261
- // }
262
- const marketType = 'otc';
263
- const marketId = this.safeString(ticker, 'id');
264
- const symbol = this.safeSymbol(marketId, market, undefined, marketType);
265
- const last = this.safeFloat(ticker, 'buy_price', 0);
266
- const change = this.safeFloat(ticker, 'change_rate_24h', 0);
267
- const ask = this.safeFloat(ticker, 'buy_price', 0);
268
- const bid = this.safeFloat(ticker, 'sell_price', 0);
269
- const high = this.safeFloat(ticker, 'max_price_24h', 0);
270
- const low = this.safeFloat(ticker, 'min_price_24h', 0);
271
- return this.safeTicker({
272
- 'symbol': symbol,
273
- 'timestamp': undefined,
274
- 'datetime': undefined,
275
- 'high': high,
276
- 'low': low,
277
- 'bid': bid,
278
- 'bidVolume': undefined,
279
- 'ask': ask,
280
- 'askVolume': undefined,
281
- 'vwap': undefined,
282
- 'open': undefined,
283
- 'close': last,
284
- 'last': last,
285
- 'previousClose': undefined,
286
- 'change': undefined,
287
- 'percentage': change,
288
- 'average': undefined,
289
- 'baseVolume': undefined,
290
- 'quoteVolume': undefined,
291
- 'info': ticker,
292
- }, market);
293
- }
294
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
295
- const url = this.urls['api']['public'] + '/' + path;
296
- headers = {
297
- 'Content-Type': 'application/json',
298
- 'Origin': 'https://hamtapay.net',
299
- };
300
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
301
- }
8
+ // ---------------------------------------------------------------------------
9
+ /**
10
+ * @class hamtapay
11
+ * @augments Exchange
12
+ * @description Set rateLimit to 1000 if fully verified
13
+ */
14
+ class hamtapay extends hamtapay$1["default"] {
15
+ describe() {
16
+ return this.deepExtend(super.describe(), {
17
+ 'id': 'hamtapay',
18
+ 'name': 'Hamtapay',
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/hamtapay/64x64.png',
90
+ 'api': {
91
+ 'public': 'https://api.hamtapay.org',
92
+ },
93
+ 'www': 'https://hamtapay.net/',
94
+ 'doc': [
95
+ 'https://hamtapay.net/',
96
+ ],
97
+ },
98
+ 'api': {
99
+ 'public': {
100
+ 'get': {
101
+ '/financial/api/market': 1,
102
+ '/financial/api/vitrin/prices': 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 hamtapay#fetchMarkets
120
+ * @description retrieves data on all markets for hamtapay
121
+ * @see https://api.hamtapay.org/financial/api/market
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.publicGetFinancialApiMarket(params);
126
+ const result = [];
127
+ const marketData = this.safeList(response, 'data', []);
128
+ for (let i = 0; i < marketData.length; i++) {
129
+ const market = this.parseMarket(marketData[i]);
130
+ result.push(market);
131
+ }
132
+ return result;
133
+ }
134
+ parseMarket(market) {
135
+ // {
136
+ // "symbol": "USDT-IRT",
137
+ // "base": "USDT",
138
+ // "quote": "IRT",
139
+ // "base_currency_decimals": 3,
140
+ // "quote_currency_decimals": 0,
141
+ // "amount_decimals": 0,
142
+ // "price_decimals": 0
143
+ // }
144
+ const baseId = this.safeString(market, 'base');
145
+ const quoteId = this.safeString(market, 'quote');
146
+ const base = this.safeCurrencyCode(baseId);
147
+ const quote = this.safeCurrencyCode(quoteId);
148
+ const id = this.safeString(market, 'symbol');
149
+ return {
150
+ 'id': id,
151
+ 'symbol': base + '/' + quote,
152
+ 'base': base,
153
+ 'quote': quote,
154
+ 'settle': undefined,
155
+ 'baseId': baseId,
156
+ 'quoteId': quoteId,
157
+ 'settleId': undefined,
158
+ 'type': 'otc',
159
+ 'spot': false,
160
+ 'margin': false,
161
+ 'swap': false,
162
+ 'future': false,
163
+ 'option': false,
164
+ 'active': true,
165
+ 'contract': false,
166
+ 'linear': undefined,
167
+ 'inverse': undefined,
168
+ 'contractSize': undefined,
169
+ 'expiry': undefined,
170
+ 'expiryDatetime': undefined,
171
+ 'strike': undefined,
172
+ 'optionType': undefined,
173
+ 'precision': {
174
+ 'amount': undefined,
175
+ 'price': undefined,
176
+ },
177
+ 'limits': {
178
+ 'leverage': {
179
+ 'min': undefined,
180
+ 'max': undefined,
181
+ },
182
+ 'amount': {
183
+ 'min': undefined,
184
+ 'max': undefined,
185
+ },
186
+ 'price': {
187
+ 'min': undefined,
188
+ 'max': undefined,
189
+ },
190
+ 'cost': {
191
+ 'min': undefined,
192
+ 'max': undefined,
193
+ },
194
+ },
195
+ 'created': undefined,
196
+ 'info': market,
197
+ };
198
+ }
199
+ async fetchTickers(symbols = undefined, params = {}) {
200
+ /**
201
+ * @method
202
+ * @name hamtapay#fetchTickers
203
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
204
+ * @see https://api.hamtapay.org/financial/api/vitrin/prices
205
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
206
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
207
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
208
+ */
209
+ await this.loadMarkets();
210
+ if (symbols !== undefined) {
211
+ symbols = this.marketSymbols(symbols);
212
+ }
213
+ const response = await this.publicGetFinancialApiVitrinPrices(params);
214
+ const data = this.safeDict(response, 'data', {});
215
+ const result = {};
216
+ const quotes = ['IRT', 'USDT'];
217
+ for (let i = 0; i < quotes.length; i++) {
218
+ const current_qoute = quotes[i];
219
+ const corresponding_data = this.safeDict(data, current_qoute, {});
220
+ const baseSymbols = Object.keys(corresponding_data);
221
+ for (let j = 0; j < baseSymbols.length; j++) {
222
+ const current_base = baseSymbols[j];
223
+ const current_ticker = corresponding_data[current_base];
224
+ current_ticker['base'] = current_base;
225
+ current_ticker['quote'] = current_qoute;
226
+ current_ticker['symbol'] = current_base + '/' + current_qoute;
227
+ current_ticker['id'] = current_base + '-' + current_qoute;
228
+ result[current_ticker['symbol']] = this.parseTicker(current_ticker);
229
+ }
230
+ }
231
+ return this.filterByArrayTickers(result, 'symbol', symbols);
232
+ }
233
+ async fetchTicker(symbol, params = {}) {
234
+ /**
235
+ * @method
236
+ * @name hamtapay#fetchTicker
237
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
238
+ * @see https://hamtapay.com/management/all-coins/?format=json
239
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
240
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
241
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
242
+ */
243
+ const ticker = await this.fetchTickers([symbol]);
244
+ return ticker[symbol];
245
+ }
246
+ parseTicker(ticker, market = undefined) {
247
+ // {
248
+ // "id": "USDT-IRT",
249
+ // "symbol": "USDT/IRT",
250
+ // "base": "USDT",
251
+ // "quote": "IRT",
252
+ // "min_price_24h": "111702",
253
+ // "max_price_24h": "115872",
254
+ // "market_price": "115942",
255
+ // "buy_price": "117101",
256
+ // "sell_price": "114782",
257
+ // "change_rate_24h": 3.29,
258
+ // "amount_decimals": 0,
259
+ // "price_decimals": 0,
260
+ // "status": "ACTIVE"
261
+ // }
262
+ const marketType = 'otc';
263
+ const marketId = this.safeString(ticker, 'id');
264
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
265
+ const last = this.safeFloat(ticker, 'buy_price', 0);
266
+ const change = this.safeFloat(ticker, 'change_rate_24h', 0);
267
+ const ask = this.safeFloat(ticker, 'buy_price', 0);
268
+ const bid = this.safeFloat(ticker, 'sell_price', 0);
269
+ const high = this.safeFloat(ticker, 'max_price_24h', 0);
270
+ const low = this.safeFloat(ticker, 'min_price_24h', 0);
271
+ return this.safeTicker({
272
+ 'symbol': symbol,
273
+ 'timestamp': undefined,
274
+ 'datetime': undefined,
275
+ 'high': high,
276
+ 'low': low,
277
+ 'bid': bid,
278
+ 'bidVolume': undefined,
279
+ 'ask': ask,
280
+ 'askVolume': undefined,
281
+ 'vwap': undefined,
282
+ 'open': undefined,
283
+ 'close': last,
284
+ 'last': last,
285
+ 'previousClose': undefined,
286
+ 'change': undefined,
287
+ 'percentage': change,
288
+ 'average': undefined,
289
+ 'baseVolume': undefined,
290
+ 'quoteVolume': undefined,
291
+ 'info': ticker,
292
+ }, market);
293
+ }
294
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
295
+ const url = this.urls['api']['public'] + '/' + path;
296
+ headers = {
297
+ 'Content-Type': 'application/json',
298
+ 'Origin': 'https://hamtapay.net',
299
+ };
300
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
301
+ }
302
302
  }
303
303
 
304
304
  exports["default"] = hamtapay;