ccxt-ir 4.9.4 → 4.9.12

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 (62) hide show
  1. package/README.md +157 -164
  2. package/dist/ccxt.browser.min.js +4 -4
  3. package/dist/cjs/ccxt.js +22 -1
  4. package/dist/cjs/src/abantether.js +88 -69
  5. package/dist/cjs/src/abstract/bitbarg.js +11 -0
  6. package/dist/cjs/src/abstract/bydfi.js +11 -0
  7. package/dist/cjs/src/abstract/cafearz.js +11 -0
  8. package/dist/cjs/src/abstract/kifpoolme.js +11 -0
  9. package/dist/cjs/src/abstract/mazdax.js +11 -0
  10. package/dist/cjs/src/abstract/pingi.js +11 -0
  11. package/dist/cjs/src/abstract/pooleno.js +11 -0
  12. package/dist/cjs/src/afratether.js +84 -36
  13. package/dist/cjs/src/arzplus.js +32 -15
  14. package/dist/cjs/src/bitbarg.js +313 -0
  15. package/dist/cjs/src/bydfi.js +435 -0
  16. package/dist/cjs/src/cafearz.js +347 -0
  17. package/dist/cjs/src/hamtapay.js +3 -2
  18. package/dist/cjs/src/kifpoolme.js +411 -0
  19. package/dist/cjs/src/mazdax.js +536 -0
  20. package/dist/cjs/src/pingi.js +448 -0
  21. package/dist/cjs/src/pooleno.js +348 -0
  22. package/dist/cjs/src/tetherland.js +5 -5
  23. package/dist/cjs/src/twox.js +56 -29
  24. package/js/ccxt.d.ts +23 -2
  25. package/js/ccxt.js +16 -2
  26. package/js/src/abantether.js +88 -69
  27. package/js/src/abstract/abantether.d.ts +1 -1
  28. package/js/src/abstract/bitbarg.d.ts +8 -0
  29. package/js/src/abstract/bitbarg.js +11 -0
  30. package/js/src/abstract/bydfi.d.ts +11 -0
  31. package/js/src/abstract/bydfi.js +11 -0
  32. package/js/src/abstract/cafearz.d.ts +8 -0
  33. package/js/src/abstract/cafearz.js +11 -0
  34. package/js/src/abstract/kifpoolme.d.ts +9 -0
  35. package/js/src/abstract/kifpoolme.js +11 -0
  36. package/js/src/abstract/mazdax.d.ts +11 -0
  37. package/js/src/abstract/mazdax.js +11 -0
  38. package/js/src/abstract/pingi.d.ts +9 -0
  39. package/js/src/abstract/pingi.js +11 -0
  40. package/js/src/abstract/pooleno.d.ts +8 -0
  41. package/js/src/abstract/pooleno.js +11 -0
  42. package/js/src/afratether.js +84 -36
  43. package/js/src/arzplus.d.ts +3 -2
  44. package/js/src/arzplus.js +32 -15
  45. package/js/src/bitbarg.d.ts +21 -0
  46. package/js/src/bitbarg.js +312 -0
  47. package/js/src/bydfi.d.ts +23 -0
  48. package/js/src/bydfi.js +434 -0
  49. package/js/src/cafearz.d.ts +21 -0
  50. package/js/src/cafearz.js +346 -0
  51. package/js/src/hamtapay.js +3 -2
  52. package/js/src/kifpoolme.d.ts +23 -0
  53. package/js/src/kifpoolme.js +410 -0
  54. package/js/src/mazdax.d.ts +23 -0
  55. package/js/src/mazdax.js +535 -0
  56. package/js/src/pingi.d.ts +22 -0
  57. package/js/src/pingi.js +447 -0
  58. package/js/src/pooleno.d.ts +21 -0
  59. package/js/src/pooleno.js +347 -0
  60. package/js/src/tetherland.js +5 -5
  61. package/js/src/twox.js +56 -29
  62. package/package.json +1 -1
@@ -0,0 +1,347 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var cafearz$1 = require('./abstract/cafearz.js');
6
+
7
+ // ----------------------------------------------------------------------------
8
+ // ---------------------------------------------------------------------------
9
+ /**
10
+ * @class cafearz
11
+ * @augments Exchange
12
+ * @description Set rateLimit to 1000 if fully verified
13
+ */
14
+ class cafearz extends cafearz$1["default"] {
15
+ describe() {
16
+ return this.deepExtend(super.describe(), {
17
+ 'id': 'cafearz',
18
+ 'name': 'Cafearz',
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/cafearz/64x64.png',
91
+ 'api': {
92
+ 'public': 'https://api2.cafearz.com',
93
+ },
94
+ 'www': 'https://cafearz.com/',
95
+ 'doc': [
96
+ 'https://cafearz.com/',
97
+ ],
98
+ },
99
+ 'api': {
100
+ 'public': {
101
+ 'get': {
102
+ '/api/client/v1/currencies/prices/digital': 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
+ parseMarket(market) {
117
+ // {
118
+ // "symbol": "BTC",
119
+ // "name": "Bitcoin",
120
+ // "title": "بیت کوین",
121
+ // "service_id": 14,
122
+ // "rank": 1,
123
+ // "price": {
124
+ // "buy": 12726581792.3999996185302734375,
125
+ // "sell": 12571941095.936672210693359375,
126
+ // "dollar": 110387.5599999999976716935634613037109375
127
+ // },
128
+ // "chart": {
129
+ // "changes": "down",
130
+ // "changes_percentage": 107.0799999999999982946974341757595539093017578125,
131
+ // "data": {
132
+ // "1404/07/05": "109643.46000000",
133
+ // "1404/07/06": "109635.85000000",
134
+ // "1404/07/07": "112163.95000000",
135
+ // "1404/07/08": "114311.96000000",
136
+ // "1404/07/09": "114048.93000000",
137
+ // "1404/07/10": "118594.99000000",
138
+ // "1404/07/11": "120529.35000000",
139
+ // "1404/07/12": "122232.00000000",
140
+ // "1404/07/13": "122391.00000000",
141
+ // "1404/07/14": "123482.31000000",
142
+ // "1404/07/15": "124658.54000000",
143
+ // "1404/07/16": "121332.95000000",
144
+ // "1404/07/17": "123306.00000000",
145
+ // "1404/07/18": "121662.40000000",
146
+ // "1404/07/19": "113613.18000000"
147
+ // }
148
+ // },
149
+ // "decimal_digit": "5",
150
+ // "market_cap": 2018807729876.182861328125,
151
+ // "volume_24h": 57479298399.76000213623046875,
152
+ // "percent_change_1h": 0.00643466000000000003244959856374407536350190639495849609375,
153
+ // "percent_change_24h": -3.013435680000000171929741554777137935161590576171875,
154
+ // "percent_change_7d": -3.848675339999999778228811919689178466796875,
155
+ // "base_icon": "https://api2.cafearz.com/assets/images/coins/1.png",
156
+ // "icon": "https://storage.cafearz.com/wp-content/uploads/coins/BTC.png"
157
+ // },
158
+ const baseId = this.safeString(market, 'symbol');
159
+ const quoteId = 'IRT';
160
+ const base = this.safeCurrencyCode(baseId);
161
+ const quote = this.safeCurrencyCode(quoteId);
162
+ const id = baseId + '/' + quoteId;
163
+ return {
164
+ 'id': id,
165
+ 'symbol': base + '/' + quote,
166
+ 'base': base,
167
+ 'quote': quote,
168
+ 'settle': undefined,
169
+ 'baseId': baseId,
170
+ 'quoteId': quoteId,
171
+ 'settleId': undefined,
172
+ 'type': 'otc',
173
+ 'spot': false,
174
+ 'margin': false,
175
+ 'swap': false,
176
+ 'future': false,
177
+ 'option': false,
178
+ 'active': true,
179
+ 'contract': false,
180
+ 'linear': undefined,
181
+ 'inverse': undefined,
182
+ 'contractSize': undefined,
183
+ 'expiry': undefined,
184
+ 'expiryDatetime': undefined,
185
+ 'strike': undefined,
186
+ 'optionType': undefined,
187
+ 'precision': {
188
+ 'amount': undefined,
189
+ 'price': undefined,
190
+ },
191
+ 'limits': {
192
+ 'leverage': {
193
+ 'min': undefined,
194
+ 'max': undefined,
195
+ },
196
+ 'amount': {
197
+ 'min': undefined,
198
+ 'max': undefined,
199
+ },
200
+ 'price': {
201
+ 'min': undefined,
202
+ 'max': undefined,
203
+ },
204
+ 'cost': {
205
+ 'min': undefined,
206
+ 'max': undefined,
207
+ },
208
+ },
209
+ 'created': undefined,
210
+ 'info': market,
211
+ };
212
+ }
213
+ async fetchMarkets(params = {}) {
214
+ /**
215
+ * @method
216
+ * @name cafearz#fetchMarkets
217
+ * @description retrieves data on all markets for cafearz
218
+ * @see https://api2.cafearz.com/api/client/v1/currencies/prices/digital
219
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
220
+ * @returns {object[]} an array of objects representing market data
221
+ */
222
+ const response = await this.publicGetApiClientV1CurrenciesPricesDigital(params);
223
+ const result = [];
224
+ const prices = this.safeDict(response, 'prices', {});
225
+ const symbols = Object.keys(prices);
226
+ // Create markets for each symbol with IRT quote
227
+ for (let i = 0; i < symbols.length; i++) {
228
+ const market = this.parseMarket(prices[symbols[i]]);
229
+ result.push(market);
230
+ }
231
+ return result;
232
+ }
233
+ async fetchTickers(symbols = undefined, params = {}) {
234
+ /**
235
+ * @method
236
+ * @name cafearz#fetchTickers
237
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
238
+ * @see https://api2.cafearz.com/api/client/v1/currencies/prices/digital
239
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
240
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
241
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
242
+ */
243
+ await this.loadMarkets();
244
+ if (symbols !== undefined) {
245
+ symbols = this.marketSymbols(symbols);
246
+ }
247
+ const response = await this.publicGetApiClientV1CurrenciesPricesDigital(params);
248
+ const prices = this.safeDict(response, 'prices', {});
249
+ const result = {};
250
+ const coinSymbols = Object.keys(prices);
251
+ for (let i = 0; i < coinSymbols.length; i++) {
252
+ const baseId = coinSymbols[i];
253
+ const coinData = prices[baseId];
254
+ // Create ticker for IRT quote
255
+ const quoteId = 'IRT';
256
+ const base = this.safeCurrencyCode(baseId);
257
+ const quote = this.safeCurrencyCode(quoteId);
258
+ const symbol = base + '/' + quote;
259
+ const ticker = this.extend({
260
+ 'symbol': symbol,
261
+ 'baseId': baseId,
262
+ 'quoteId': quoteId,
263
+ 'id': baseId + '/' + quoteId,
264
+ }, coinData);
265
+ result[symbol] = this.parseTicker(ticker);
266
+ }
267
+ return this.filterByArrayTickers(result, 'symbol', symbols);
268
+ }
269
+ async fetchTicker(symbol, params = {}) {
270
+ /**
271
+ * @method
272
+ * @name cafearz#fetchTicker
273
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
274
+ * @see https://api2.cafearz.com/api/client/v1/currencies/prices/digital
275
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
276
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
277
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
278
+ */
279
+ const ticker = await this.fetchTickers([symbol]);
280
+ return ticker[symbol];
281
+ }
282
+ parseTicker(ticker, market = undefined) {
283
+ // {
284
+ // "symbol": "BTC",
285
+ // "name": "Bitcoin",
286
+ // "title": "بیت کوین",
287
+ // "service_id": 14,
288
+ // "rank": 1,
289
+ // "price": {
290
+ // "buy": 13462469875.799999,
291
+ // "sell": 13298881860,
292
+ // "dollar": 117689.22
293
+ // },
294
+ // "chart": {
295
+ // "changes": "down",
296
+ // "changes_percentage": 101.33,
297
+ // "data": {...}
298
+ // },
299
+ // "decimal_digit": "5",
300
+ // "market_cap": 2018807729876.182861,
301
+ // "volume_24h": 57479298399.76,
302
+ // "percent_change_1h": 0.00643466,
303
+ // "percent_change_24h": -3.013435,
304
+ // "percent_change_7d": -3.848675,
305
+ // "base_icon": "...",
306
+ // "icon": "..."
307
+ // }
308
+ const marketType = 'otc';
309
+ const marketId = this.safeString(ticker, 'id');
310
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
311
+ const priceData = this.safeDict(ticker, 'price', {});
312
+ const last = this.safeFloat(priceData, 'buy', 0);
313
+ const bid = this.safeFloat(priceData, 'sell', 0);
314
+ const ask = this.safeFloat(priceData, 'buy', 0);
315
+ const percentage = this.safeFloat(ticker, 'percent_change_24h', 0);
316
+ const baseVolume = this.safeFloat(ticker, 'volume_24h');
317
+ return this.safeTicker({
318
+ 'symbol': symbol,
319
+ 'timestamp': undefined,
320
+ 'datetime': undefined,
321
+ 'high': undefined,
322
+ 'low': undefined,
323
+ 'bid': bid,
324
+ 'bidVolume': undefined,
325
+ 'ask': ask,
326
+ 'askVolume': undefined,
327
+ 'vwap': undefined,
328
+ 'open': undefined,
329
+ 'close': last,
330
+ 'last': last,
331
+ 'previousClose': undefined,
332
+ 'change': undefined,
333
+ 'percentage': percentage,
334
+ 'average': undefined,
335
+ 'baseVolume': baseVolume,
336
+ 'quoteVolume': undefined,
337
+ 'info': ticker,
338
+ }, market);
339
+ }
340
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
341
+ const url = this.urls['api']['public'] + path;
342
+ headers = { 'Content-Type': 'application/json' };
343
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
344
+ }
345
+ }
346
+
347
+ exports["default"] = cafearz;
@@ -217,8 +217,9 @@ class hamtapay extends hamtapay$1["default"] {
217
217
  for (let i = 0; i < quotes.length; i++) {
218
218
  const current_qoute = quotes[i];
219
219
  const corresponding_data = this.safeDict(data, current_qoute, {});
220
- for (let j = 0; j < Object.keys(corresponding_data).length; j++) {
221
- const current_base = Object.keys(corresponding_data)[j];
220
+ const baseSymbols = Object.keys(corresponding_data);
221
+ for (let j = 0; j < baseSymbols.length; j++) {
222
+ const current_base = baseSymbols[j];
222
223
  const current_ticker = corresponding_data[current_base];
223
224
  current_ticker['base'] = current_base;
224
225
  current_ticker['quote'] = current_qoute;