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