ccxt-ir 4.9.13 → 4.9.15

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 (99) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +232 -229
  4. package/dist/cjs/package.json +1 -1
  5. package/dist/cjs/src/abantether.js +344 -344
  6. package/dist/cjs/src/abstract/bitbarg.js +1 -1
  7. package/dist/cjs/src/abstract/bitunix.js +1 -1
  8. package/dist/cjs/src/abstract/bydfi.js +1 -1
  9. package/dist/cjs/src/abstract/cafearz.js +1 -1
  10. package/dist/cjs/src/abstract/hamtapay.js +1 -1
  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 +11 -0
  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 +291 -291
  23. package/dist/cjs/src/kcex.js +326 -326
  24. package/dist/cjs/src/kifpoolme.js +401 -401
  25. package/dist/cjs/src/mazdax.js +525 -526
  26. package/dist/cjs/src/pingi.js +437 -438
  27. package/dist/cjs/src/pooleno.js +338 -338
  28. package/dist/cjs/src/tehran_exchange.js +334 -0
  29. package/dist/cjs/src/tetherland.js +358 -358
  30. package/dist/cjs/src/twox.js +362 -362
  31. package/dist/cjs/src/xt.js +5171 -5171
  32. package/js/ccxt.d.ts +676 -673
  33. package/js/ccxt.js +493 -491
  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/bitunix.d.ts +9 -9
  40. package/js/src/abstract/bitunix.js +5 -5
  41. package/js/src/abstract/bydfi.d.ts +11 -11
  42. package/js/src/abstract/bydfi.js +5 -5
  43. package/js/src/abstract/cafearz.d.ts +8 -8
  44. package/js/src/abstract/cafearz.js +5 -5
  45. package/js/src/abstract/hamtapay.d.ts +9 -9
  46. package/js/src/abstract/hamtapay.js +5 -5
  47. package/js/src/abstract/kcex.d.ts +10 -10
  48. package/js/src/abstract/kifpoolme.d.ts +9 -9
  49. package/js/src/abstract/kifpoolme.js +5 -5
  50. package/js/src/abstract/mazdax.d.ts +11 -11
  51. package/js/src/abstract/mazdax.js +5 -5
  52. package/js/src/abstract/pingi.d.ts +9 -9
  53. package/js/src/abstract/pingi.js +5 -5
  54. package/js/src/abstract/pooleno.d.ts +8 -8
  55. package/js/src/abstract/pooleno.js +5 -5
  56. package/js/src/abstract/tehran_exchange.d.ts +9 -0
  57. package/js/src/abstract/tehran_exchange.js +11 -0
  58. package/js/src/afratether.js +350 -350
  59. package/js/src/arzplus.d.ts +26 -26
  60. package/js/src/arzplus.js +575 -575
  61. package/js/src/base/Exchange.d.ts +926 -926
  62. package/js/src/base/types.d.ts +586 -586
  63. package/js/src/bitbarg.d.ts +21 -21
  64. package/js/src/bitbarg.js +306 -306
  65. package/js/src/bitunix.d.ts +21 -21
  66. package/js/src/bitunix.js +320 -320
  67. package/js/src/bydfi.d.ts +23 -23
  68. package/js/src/bydfi.js +428 -428
  69. package/js/src/cafearz.d.ts +21 -21
  70. package/js/src/cafearz.js +340 -340
  71. package/js/src/coinbaseexchange.d.ts +334 -334
  72. package/js/src/hamtapay.d.ts +21 -21
  73. package/js/src/hamtapay.js +294 -294
  74. package/js/src/kcex.d.ts +21 -21
  75. package/js/src/kcex.js +329 -329
  76. package/js/src/kifpoolme.d.ts +23 -23
  77. package/js/src/kifpoolme.js +404 -404
  78. package/js/src/mazdax.d.ts +23 -23
  79. package/js/src/mazdax.js +528 -529
  80. package/js/src/pingi.d.ts +22 -22
  81. package/js/src/pingi.js +440 -441
  82. package/js/src/pooleno.d.ts +21 -21
  83. package/js/src/pooleno.js +341 -341
  84. package/js/src/protobuf/mexc/compiled.d.cts +2 -2
  85. package/js/src/static_dependencies/fflake/browser.d.ts +222 -222
  86. package/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.d.ts +51 -51
  87. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +101 -101
  88. package/js/src/static_dependencies/qs/formats.d.cts +8 -8
  89. package/js/src/static_dependencies/qs/index.d.cts +4 -4
  90. package/js/src/static_dependencies/qs/parse.d.cts +2 -2
  91. package/js/src/static_dependencies/qs/stringify.d.cts +2 -2
  92. package/js/src/static_dependencies/qs/utils.d.cts +9 -9
  93. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -5
  94. package/js/src/tehran_exchange.d.ts +21 -0
  95. package/js/src/tehran_exchange.js +333 -0
  96. package/js/src/tetherland.js +361 -361
  97. package/js/src/twox.js +365 -365
  98. package/js/src/xt.js +5178 -5178
  99. package/package.json +1 -1
package/js/src/arzplus.js CHANGED
@@ -4,578 +4,578 @@
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/arzplus.js';
9
- // ---------------------------------------------------------------------------
10
- /**
11
- * @class arzplus
12
- * @augments Exchange
13
- * @description Set rateLimit to 1000 if fully verified
14
- */
15
- export default class arzplus extends Exchange {
16
- describe() {
17
- return this.deepExtend(super.describe(), {
18
- 'id': 'arzplus',
19
- 'name': 'Arzplus',
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
- 'fetchLedger': false,
61
- 'fetchLedgerEntry': false,
62
- 'fetchLeverageTiers': false,
63
- 'fetchMarkets': true,
64
- 'fetchMarkOHLCV': false,
65
- 'fetchMyTrades': false,
66
- 'fetchOHLCV': true,
67
- 'fetchOpenInterestHistory': false,
68
- 'fetchOpenOrders': false,
69
- 'fetchOrder': false,
70
- 'fetchOrderBook': true,
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/arzplus/64x64.png',
90
- 'api': {
91
- 'public': 'https://api.arzplus.net',
92
- },
93
- 'www': 'https://arzplus.net',
94
- 'doc': [
95
- 'https://arzplus.net',
96
- ],
97
- },
98
- 'timeframes': {
99
- '1h': '60',
100
- '1d': '1D',
101
- },
102
- 'api': {
103
- 'public': {
104
- 'get': {
105
- 'api/v1/market/symbols': 1,
106
- 'api/v1/market/tradingview/ohlcv': 1,
107
- 'api/v1/market/depth': 1,
108
- 'api/v1/market/irt/info': 1,
109
- },
110
- },
111
- },
112
- 'fees': {
113
- 'trading': {
114
- 'tierBased': false,
115
- 'percentage': true,
116
- 'maker': this.parseNumber('0.001'),
117
- 'taker': this.parseNumber('0.001'),
118
- },
119
- },
120
- });
121
- }
122
- async fetchMarkets(params = {}) {
123
- /**
124
- * @method
125
- * @name arzplus#fetchMarkets
126
- * @description retrieves data on all markets for arzplus
127
- * @see https://api.arzplus.net/
128
- * @param {object} [params] extra parameters specific to the exchange API endpoint
129
- * @returns {object[]} an array of objects representing market data
130
- */
131
- const request = {
132
- 'stats': '1',
133
- 'enable': 'true',
134
- };
135
- const typedRequest = this.safeString(params, 'type', 'spot');
136
- let response = [];
137
- let otcMarkets = [];
138
- if (typedRequest === 'otc') {
139
- otcMarkets = await this.publicGetApiV1MarketIrtInfo(request);
140
- }
141
- else {
142
- response = await this.publicGetApiV1MarketSymbols(request);
143
- }
144
- const result = [];
145
- for (let i = 0; i < response.length; i++) {
146
- const market = this.parseMarket(response[i]);
147
- result.push(market);
148
- }
149
- for (let i = 0; i < otcMarkets.length; i++) {
150
- const marketdata = otcMarkets[i];
151
- marketdata['quote'] = 'IRT';
152
- marketdata['id'] = 'OTC_' + marketdata['symbol'] + marketdata['quote'];
153
- const parsedMarket = this.parseOTCMarkets(marketdata);
154
- result.push(parsedMarket);
155
- }
156
- return result;
157
- }
158
- parseMarket(market, type = 'spot') {
159
- if (type === 'otc') {
160
- return this.parseOTCMarkets(market);
161
- }
162
- return this.parseSpotMarket(market);
163
- }
164
- parseSpotMarket(market) {
165
- // {
166
- // 'name': 'USDTIRT',
167
- // 'asset': {
168
- // 'id': 2,
169
- // 'symbol': 'USDT',
170
- // 'precision': 8,
171
- // 'step_size': 8,
172
- // 'name': 'tether',
173
- // 'name_fa': 'تتر',
174
- // 'logo': 'https://cdn.arzplus.net/core-static/coins/USDT.png',
175
- // 'original_symbol': 'USDT',
176
- // 'original_name_fa': 'تتر',
177
- // 'trading_view_symbol': '',
178
- // },
179
- // 'base_asset': {
180
- // 'id': 1,
181
- // 'symbol': 'IRT',
182
- // 'precision': 0,
183
- // 'step_size': 8,
184
- // 'name': 'toman',
185
- // 'name_fa': 'تومان',
186
- // 'logo': 'https://cdn.arzplus.net/core-static/coins/IRT.png',
187
- // 'original_symbol': 'IRT',
188
- // 'original_name_fa': 'تومان',
189
- // 'trading_view_symbol': '',
190
- // },
191
- // 'enable': true,
192
- // 'price': '59165',
193
- // 'change': '-246',
194
- // 'change_percent': '-0.41',
195
- // 'high': '59619',
196
- // 'low': '58750',
197
- // 'volume': '215768.82',
198
- // 'base_volume': '12757163742',
199
- // 'bookmark': true,
200
- // };
201
- const id = this.safeString(market, 'name');
202
- const baseAsset = this.safeDict(market, 'asset');
203
- const quoteAsset = this.safeDict(market, 'base_asset');
204
- let baseId = this.safeString(baseAsset, 'symbol');
205
- let quoteId = this.safeString(quoteAsset, 'symbol');
206
- const base = this.safeCurrencyCode(baseId);
207
- const quote = this.safeCurrencyCode(quoteId);
208
- baseId = baseId.toLowerCase();
209
- quoteId = quoteId.toLowerCase();
210
- return {
211
- 'id': id,
212
- 'symbol': base + '/' + quote,
213
- 'base': base,
214
- 'quote': quote,
215
- 'settle': undefined,
216
- 'baseId': baseId,
217
- 'quoteId': quoteId,
218
- 'settleId': undefined,
219
- 'type': 'spot',
220
- 'spot': true,
221
- 'margin': false,
222
- 'swap': false,
223
- 'future': false,
224
- 'option': false,
225
- 'active': true,
226
- 'contract': false,
227
- 'linear': undefined,
228
- 'inverse': undefined,
229
- 'contractSize': undefined,
230
- 'expiry': undefined,
231
- 'expiryDatetime': undefined,
232
- 'strike': undefined,
233
- 'optionType': undefined,
234
- 'precision': {
235
- 'amount': undefined,
236
- 'price': undefined,
237
- },
238
- 'limits': {
239
- 'leverage': {
240
- 'min': undefined,
241
- 'max': undefined,
242
- },
243
- 'amount': {
244
- 'min': undefined,
245
- 'max': undefined,
246
- },
247
- 'price': {
248
- 'min': undefined,
249
- 'max': undefined,
250
- },
251
- 'cost': {
252
- 'min': undefined,
253
- 'max': undefined,
254
- },
255
- },
256
- 'created': undefined,
257
- 'info': market,
258
- };
259
- }
260
- parseOTCMarkets(market) {
261
- // {
262
- // symbol: "BTC",
263
- // ask: "13877900000",
264
- // bid: "13860999995",
265
- // name: "bitcoin"
266
- // qoute: "IRT",
267
- // id: "OTC_BTCIRT"
268
- // },
269
- const baseAsset = this.safeString(market, 'symbol');
270
- const quoteAsset = this.safeString(market, 'quote');
271
- const baseId = baseAsset;
272
- const quoteId = quoteAsset;
273
- const base = this.safeCurrencyCode(baseId);
274
- const quote = this.safeCurrencyCode(quoteId);
275
- const id = this.safeString(market, 'id');
276
- return {
277
- 'id': id,
278
- 'symbol': base + '/' + quote,
279
- 'base': base,
280
- 'quote': quote,
281
- 'settle': undefined,
282
- 'baseId': baseId,
283
- 'quoteId': quoteId,
284
- 'settleId': undefined,
285
- 'type': 'otc',
286
- 'spot': false,
287
- 'margin': false,
288
- 'swap': false,
289
- 'future': false,
290
- 'option': false,
291
- 'active': true,
292
- 'contract': false,
293
- 'linear': undefined,
294
- 'inverse': undefined,
295
- 'contractSize': undefined,
296
- 'expiry': undefined,
297
- 'expiryDatetime': undefined,
298
- 'strike': undefined,
299
- 'optionType': undefined,
300
- 'precision': {
301
- 'amount': undefined,
302
- 'price': undefined,
303
- },
304
- 'limits': {
305
- 'leverage': {
306
- 'min': undefined,
307
- 'max': undefined,
308
- },
309
- 'amount': {
310
- 'min': undefined,
311
- 'max': undefined,
312
- },
313
- 'price': {
314
- 'min': undefined,
315
- 'max': undefined,
316
- },
317
- 'cost': {
318
- 'min': undefined,
319
- 'max': undefined,
320
- },
321
- },
322
- 'created': undefined,
323
- 'info': market,
324
- };
325
- }
326
- async fetchTickers(symbols = undefined, params = {}) {
327
- /**
328
- * @method
329
- * @name arzplus#fetchTickers
330
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
331
- * @see https://api.arzplus.net/
332
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
333
- * @param {object} [params] extra parameters specific to the exchange API endpoint
334
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
335
- */
336
- const marketType = this.safeString(params, 'type', 'spot');
337
- await this.loadMarkets(false, { 'type': marketType });
338
- if (symbols !== undefined) {
339
- symbols = this.marketSymbols(symbols);
340
- }
341
- const result = {};
342
- if (marketType === 'otc') {
343
- const otcMarkets = await this.publicGetApiV1MarketIrtInfo(params);
344
- for (let i = 0; i < otcMarkets.length; i++) {
345
- const marketdata = otcMarkets[i];
346
- marketdata['quote'] = 'IRT';
347
- marketdata['id'] = 'OTC_' + marketdata['symbol'] + marketdata['quote'];
348
- const parsedMarket = this.parseOTCTicker(marketdata);
349
- const symbol = parsedMarket['symbol'];
350
- result[symbol] = parsedMarket;
351
- }
352
- return this.filterByArrayTickers(result, 'symbol', symbols);
353
- }
354
- const response = await this.publicGetApiV1MarketSymbols(params);
355
- for (let i = 0; i < response.length; i++) {
356
- const request = {
357
- 'symbol': response[i]['name'],
358
- };
359
- const assetDetails = await this.publicGetApiV1MarketSymbols(request);
360
- const ticker = this.parseTicker(assetDetails);
361
- const symbol = ticker['symbol'];
362
- result[symbol] = ticker;
363
- }
364
- return this.filterByArrayTickers(result, 'symbol', symbols);
365
- }
366
- async fetchTicker(symbol, params = {}) {
367
- /**
368
- * @method
369
- * @name arzplus#fetchTicker
370
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
371
- * @see https://api.arzplus.net/
372
- * @param {string} symbol unified symbol of the market to fetch the ticker for
373
- * @param {object} [params] extra parameters specific to the exchange API endpoint
374
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
375
- */
376
- const marketType = this.safeString(params, 'type', 'spot');
377
- if (marketType === 'otc') {
378
- throw new Error('OTC markets are not supported');
379
- }
380
- await this.loadMarkets(false, { 'type': marketType });
381
- const market = this.market(symbol);
382
- const request = {
383
- 'symbol': market['id'],
384
- };
385
- const response = await this.publicGetApiV1MarketSymbols(request);
386
- const ticker = this.parseTicker(response);
387
- return ticker;
388
- }
389
- parseTicker(ticker, market = undefined) {
390
- // {
391
- // 'name': 'USDTIRT',
392
- // 'asset': {
393
- // 'id': 2,
394
- // 'symbol': 'USDT',
395
- // 'precision': 8,
396
- // 'step_size': 8,
397
- // 'name': 'tether',
398
- // 'name_fa': 'تتر',
399
- // 'logo': 'https://cdn.arzplus.net/core-static/coins/USDT.png',
400
- // 'original_symbol': 'USDT',
401
- // 'original_name_fa': 'تتر',
402
- // 'trading_view_symbol': '',
403
- // },
404
- // 'base_asset': {
405
- // 'id': 1,
406
- // 'symbol': 'IRT',
407
- // 'precision': 0,
408
- // 'step_size': 8,
409
- // 'name': 'toman',
410
- // 'name_fa': 'تومان',
411
- // 'logo': 'https://cdn.arzplus.net/core-static/coins/IRT.png',
412
- // 'original_symbol': 'IRT',
413
- // 'original_name_fa': 'تومان',
414
- // 'trading_view_symbol': '',
415
- // },
416
- // 'enable': true,
417
- // 'price': '59165',
418
- // 'change': '-246',
419
- // 'change_percent': '-0.41',
420
- // 'high': '59619',
421
- // 'low': '58750',
422
- // 'volume': '215768.82',
423
- // 'base_volume': '12757163742',
424
- // 'bookmark': true,
425
- // };
426
- const marketType = 'spot';
427
- const marketId = this.safeString(ticker, 'name');
428
- const symbol = this.safeSymbol(marketId, market, undefined, marketType);
429
- const high = this.safeFloat(ticker, 'high', 0);
430
- const low = this.safeFloat(ticker, 'low', 0);
431
- const last = this.safeFloat(ticker, 'price', 0);
432
- const change = this.safeFloat(ticker, 'change_percent', 0);
433
- const baseVolume = this.safeFloat(ticker, 'volume', 0);
434
- const quoteVolume = this.safeFloat(ticker, 'base_volume', 0);
435
- return this.safeTicker({
436
- 'symbol': symbol,
437
- 'timestamp': undefined,
438
- 'datetime': undefined,
439
- 'high': high,
440
- 'low': low,
441
- 'bid': undefined,
442
- 'bidVolume': undefined,
443
- 'ask': undefined,
444
- 'askVolume': undefined,
445
- 'vwap': undefined,
446
- 'open': last,
447
- 'close': last,
448
- 'last': last,
449
- 'previousClose': undefined,
450
- 'change': change,
451
- 'percentage': undefined,
452
- 'average': undefined,
453
- 'baseVolume': baseVolume,
454
- 'quoteVolume': quoteVolume,
455
- 'info': ticker,
456
- }, market);
457
- }
458
- parseOTCTicker(ticker, market = undefined) {
459
- // {
460
- // id: "BTCUSDT",
461
- // symbol: "BTC",
462
- // ask: "13877900000",
463
- // bid: "13860999995",
464
- // name: "bitcoin"
465
- // quote: "IRT"
466
- // }
467
- const marketType = 'otc';
468
- const marketId = this.safeString(ticker, 'id');
469
- const symbol = this.safeSymbol(marketId, market, undefined, marketType);
470
- const bid = this.safeFloat(ticker, 'bid', 0);
471
- const ask = this.safeFloat(ticker, 'ask', 0);
472
- const last = this.safeFloat(ticker, 'ask', 0);
473
- return this.safeTicker({
474
- 'symbol': symbol,
475
- 'timestamp': undefined,
476
- 'datetime': undefined,
477
- 'high': undefined,
478
- 'low': undefined,
479
- 'bid': bid,
480
- 'bidVolume': undefined,
481
- 'ask': ask,
482
- 'askVolume': undefined,
483
- 'vwap': undefined,
484
- 'open': last,
485
- 'close': last,
486
- 'last': last,
487
- 'previousClose': undefined,
488
- 'change': undefined,
489
- 'percentage': undefined,
490
- 'average': undefined,
491
- 'baseVolume': undefined,
492
- 'quoteVolume': undefined,
493
- 'info': ticker,
494
- }, market);
495
- }
496
- async fetchOHLCV(symbol, timeframe = '1h', since = undefined, limit = undefined, params = {}) {
497
- /**
498
- * @method
499
- * @name arzplus#fetchOHLCV
500
- * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
501
- * @see https://api.arzplus.net/
502
- * @param {string} symbol unified symbol of the market to fetch OHLCV data for
503
- * @param {string} timeframe the length of time each candle represents
504
- * @param {int} [since] timestamp in ms of the earliest candle to fetch
505
- * @param {int} [limit] the maximum amount of candles to fetch
506
- * @param {object} [params] extra parameters specific to the exchange API endpoint
507
- * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
508
- */
509
- await this.loadMarkets(false, { 'type': 'otc' });
510
- const market = this.market(symbol);
511
- const endTime = Date.now();
512
- const request = {
513
- 'symbol': market['id'],
514
- 'from': (endTime / 1000) - (24 * 60 * 60),
515
- 'to': endTime / 1000,
516
- 'resolution': this.safeString(this.timeframes, timeframe, timeframe),
517
- 'countBack': 300,
518
- };
519
- if (since !== undefined) {
520
- request['from'] = since / 1000;
521
- }
522
- if (limit !== undefined) {
523
- request['countBack'] = limit;
524
- }
525
- if (timeframe !== undefined) {
526
- request['resolution'] = this.safeString(this.timeframes, timeframe, timeframe);
527
- }
528
- request['from'] = this.safeInteger(request, 'from');
529
- request['to'] = this.safeInteger(request, 'to');
530
- const response = await this.publicGetApiV1MarketTradingviewOhlcv(request);
531
- const ohlcvs = [];
532
- for (let i = 0; i < response.length; i++) {
533
- ohlcvs.push([
534
- this.safeValue(response[i], 'time'),
535
- this.safeValue(response[i], 'open'),
536
- this.safeValue(response[i], 'high'),
537
- this.safeValue(response[i], 'low'),
538
- this.safeValue(response[i], 'close'),
539
- this.safeValue(response[i], 'volume'),
540
- ]);
541
- }
542
- return this.parseOHLCVs(ohlcvs, market, timeframe, since, limit);
543
- }
544
- async fetchOrderBook(symbol, limit = undefined, params = {}) {
545
- /**
546
- * @method
547
- * @name arzplus#fetchOrderBooks
548
- * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data for multiple markets
549
- * @see https://api.arzplus.net/
550
- * @param {string[]|undefined} symbols list of unified market symbols, all symbols fetched if undefined, default is undefined
551
- * @param {int} [limit] max number of entries per orderbook to return, default is undefined
552
- * @param {object} [params] extra parameters specific to the exchange API endpoint
553
- * @returns {object} a dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbol
554
- */
555
- await this.loadMarkets(false, { 'type': 'otc' });
556
- const market = this.market(symbol);
557
- const request = {
558
- 'symbol': market['id'],
559
- };
560
- const orderBook = await this.publicGetApiV1MarketDepth(request);
561
- const timestamp = Date.now();
562
- return this.parseOrderBook(orderBook, symbol, timestamp, 'bids', 'asks', 'price', 'amount');
563
- }
564
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
565
- const query = this.omit(params, this.extractParams(path));
566
- let url = this.urls['api']['public'] + '/' + path;
567
- const symbol = this.safeString(params, 'symbol');
568
- const stats = this.safeValue(params, 'stats');
569
- if (stats !== undefined) {
570
- url = url + '?' + this.urlencode(query);
571
- }
572
- if (path === 'api/v1/market/tradingview/ohlcv') {
573
- url = url + '?' + this.urlencode(query);
574
- }
575
- else if (symbol !== undefined) {
576
- url = url + '/' + symbol;
577
- }
578
- headers = { 'Content-Type': 'application/json' };
579
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
580
- }
581
- }
7
+ // ---------------------------------------------------------------------------
8
+ import Exchange from './abstract/arzplus.js';
9
+ // ---------------------------------------------------------------------------
10
+ /**
11
+ * @class arzplus
12
+ * @augments Exchange
13
+ * @description Set rateLimit to 1000 if fully verified
14
+ */
15
+ export default class arzplus extends Exchange {
16
+ describe() {
17
+ return this.deepExtend(super.describe(), {
18
+ 'id': 'arzplus',
19
+ 'name': 'Arzplus',
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
+ 'fetchLedger': false,
61
+ 'fetchLedgerEntry': false,
62
+ 'fetchLeverageTiers': false,
63
+ 'fetchMarkets': true,
64
+ 'fetchMarkOHLCV': false,
65
+ 'fetchMyTrades': false,
66
+ 'fetchOHLCV': true,
67
+ 'fetchOpenInterestHistory': false,
68
+ 'fetchOpenOrders': false,
69
+ 'fetchOrder': false,
70
+ 'fetchOrderBook': true,
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/arzplus/64x64.png',
90
+ 'api': {
91
+ 'public': 'https://api.arzplus.net',
92
+ },
93
+ 'www': 'https://arzplus.net',
94
+ 'doc': [
95
+ 'https://arzplus.net',
96
+ ],
97
+ },
98
+ 'timeframes': {
99
+ '1h': '60',
100
+ '1d': '1D',
101
+ },
102
+ 'api': {
103
+ 'public': {
104
+ 'get': {
105
+ 'api/v1/market/symbols': 1,
106
+ 'api/v1/market/tradingview/ohlcv': 1,
107
+ 'api/v1/market/depth': 1,
108
+ 'api/v1/market/irt/info': 1,
109
+ },
110
+ },
111
+ },
112
+ 'fees': {
113
+ 'trading': {
114
+ 'tierBased': false,
115
+ 'percentage': true,
116
+ 'maker': this.parseNumber('0.001'),
117
+ 'taker': this.parseNumber('0.001'),
118
+ },
119
+ },
120
+ });
121
+ }
122
+ async fetchMarkets(params = {}) {
123
+ /**
124
+ * @method
125
+ * @name arzplus#fetchMarkets
126
+ * @description retrieves data on all markets for arzplus
127
+ * @see https://api.arzplus.net/
128
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
129
+ * @returns {object[]} an array of objects representing market data
130
+ */
131
+ const request = {
132
+ 'stats': '1',
133
+ 'enable': 'true',
134
+ };
135
+ const typedRequest = this.safeString(params, 'type', 'spot');
136
+ let response = [];
137
+ let otcMarkets = [];
138
+ if (typedRequest === 'otc') {
139
+ otcMarkets = await this.publicGetApiV1MarketIrtInfo(request);
140
+ }
141
+ else {
142
+ response = await this.publicGetApiV1MarketSymbols(request);
143
+ }
144
+ const result = [];
145
+ for (let i = 0; i < response.length; i++) {
146
+ const market = this.parseMarket(response[i]);
147
+ result.push(market);
148
+ }
149
+ for (let i = 0; i < otcMarkets.length; i++) {
150
+ const marketdata = otcMarkets[i];
151
+ marketdata['quote'] = 'IRT';
152
+ marketdata['id'] = 'OTC_' + marketdata['symbol'] + marketdata['quote'];
153
+ const parsedMarket = this.parseOTCMarkets(marketdata);
154
+ result.push(parsedMarket);
155
+ }
156
+ return result;
157
+ }
158
+ parseMarket(market, type = 'spot') {
159
+ if (type === 'otc') {
160
+ return this.parseOTCMarkets(market);
161
+ }
162
+ return this.parseSpotMarket(market);
163
+ }
164
+ parseSpotMarket(market) {
165
+ // {
166
+ // 'name': 'USDTIRT',
167
+ // 'asset': {
168
+ // 'id': 2,
169
+ // 'symbol': 'USDT',
170
+ // 'precision': 8,
171
+ // 'step_size': 8,
172
+ // 'name': 'tether',
173
+ // 'name_fa': 'تتر',
174
+ // 'logo': 'https://cdn.arzplus.net/core-static/coins/USDT.png',
175
+ // 'original_symbol': 'USDT',
176
+ // 'original_name_fa': 'تتر',
177
+ // 'trading_view_symbol': '',
178
+ // },
179
+ // 'base_asset': {
180
+ // 'id': 1,
181
+ // 'symbol': 'IRT',
182
+ // 'precision': 0,
183
+ // 'step_size': 8,
184
+ // 'name': 'toman',
185
+ // 'name_fa': 'تومان',
186
+ // 'logo': 'https://cdn.arzplus.net/core-static/coins/IRT.png',
187
+ // 'original_symbol': 'IRT',
188
+ // 'original_name_fa': 'تومان',
189
+ // 'trading_view_symbol': '',
190
+ // },
191
+ // 'enable': true,
192
+ // 'price': '59165',
193
+ // 'change': '-246',
194
+ // 'change_percent': '-0.41',
195
+ // 'high': '59619',
196
+ // 'low': '58750',
197
+ // 'volume': '215768.82',
198
+ // 'base_volume': '12757163742',
199
+ // 'bookmark': true,
200
+ // };
201
+ const id = this.safeString(market, 'name');
202
+ const baseAsset = this.safeDict(market, 'asset');
203
+ const quoteAsset = this.safeDict(market, 'base_asset');
204
+ let baseId = this.safeString(baseAsset, 'symbol');
205
+ let quoteId = this.safeString(quoteAsset, 'symbol');
206
+ const base = this.safeCurrencyCode(baseId);
207
+ const quote = this.safeCurrencyCode(quoteId);
208
+ baseId = baseId.toLowerCase();
209
+ quoteId = quoteId.toLowerCase();
210
+ return {
211
+ 'id': id,
212
+ 'symbol': base + '/' + quote,
213
+ 'base': base,
214
+ 'quote': quote,
215
+ 'settle': undefined,
216
+ 'baseId': baseId,
217
+ 'quoteId': quoteId,
218
+ 'settleId': undefined,
219
+ 'type': 'spot',
220
+ 'spot': true,
221
+ 'margin': false,
222
+ 'swap': false,
223
+ 'future': false,
224
+ 'option': false,
225
+ 'active': true,
226
+ 'contract': false,
227
+ 'linear': undefined,
228
+ 'inverse': undefined,
229
+ 'contractSize': undefined,
230
+ 'expiry': undefined,
231
+ 'expiryDatetime': undefined,
232
+ 'strike': undefined,
233
+ 'optionType': undefined,
234
+ 'precision': {
235
+ 'amount': undefined,
236
+ 'price': undefined,
237
+ },
238
+ 'limits': {
239
+ 'leverage': {
240
+ 'min': undefined,
241
+ 'max': undefined,
242
+ },
243
+ 'amount': {
244
+ 'min': undefined,
245
+ 'max': undefined,
246
+ },
247
+ 'price': {
248
+ 'min': undefined,
249
+ 'max': undefined,
250
+ },
251
+ 'cost': {
252
+ 'min': undefined,
253
+ 'max': undefined,
254
+ },
255
+ },
256
+ 'created': undefined,
257
+ 'info': market,
258
+ };
259
+ }
260
+ parseOTCMarkets(market) {
261
+ // {
262
+ // symbol: "BTC",
263
+ // ask: "13877900000",
264
+ // bid: "13860999995",
265
+ // name: "bitcoin"
266
+ // qoute: "IRT",
267
+ // id: "OTC_BTCIRT"
268
+ // },
269
+ const baseAsset = this.safeString(market, 'symbol');
270
+ const quoteAsset = this.safeString(market, 'quote');
271
+ const baseId = baseAsset;
272
+ const quoteId = quoteAsset;
273
+ const base = this.safeCurrencyCode(baseId);
274
+ const quote = this.safeCurrencyCode(quoteId);
275
+ const id = this.safeString(market, 'id');
276
+ return {
277
+ 'id': id,
278
+ 'symbol': base + '/' + quote,
279
+ 'base': base,
280
+ 'quote': quote,
281
+ 'settle': undefined,
282
+ 'baseId': baseId,
283
+ 'quoteId': quoteId,
284
+ 'settleId': undefined,
285
+ 'type': 'otc',
286
+ 'spot': false,
287
+ 'margin': false,
288
+ 'swap': false,
289
+ 'future': false,
290
+ 'option': false,
291
+ 'active': true,
292
+ 'contract': false,
293
+ 'linear': undefined,
294
+ 'inverse': undefined,
295
+ 'contractSize': undefined,
296
+ 'expiry': undefined,
297
+ 'expiryDatetime': undefined,
298
+ 'strike': undefined,
299
+ 'optionType': undefined,
300
+ 'precision': {
301
+ 'amount': undefined,
302
+ 'price': undefined,
303
+ },
304
+ 'limits': {
305
+ 'leverage': {
306
+ 'min': undefined,
307
+ 'max': undefined,
308
+ },
309
+ 'amount': {
310
+ 'min': undefined,
311
+ 'max': undefined,
312
+ },
313
+ 'price': {
314
+ 'min': undefined,
315
+ 'max': undefined,
316
+ },
317
+ 'cost': {
318
+ 'min': undefined,
319
+ 'max': undefined,
320
+ },
321
+ },
322
+ 'created': undefined,
323
+ 'info': market,
324
+ };
325
+ }
326
+ async fetchTickers(symbols = undefined, params = {}) {
327
+ /**
328
+ * @method
329
+ * @name arzplus#fetchTickers
330
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
331
+ * @see https://api.arzplus.net/
332
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
333
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
334
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
335
+ */
336
+ const marketType = this.safeString(params, 'type', 'spot');
337
+ await this.loadMarkets(false, { 'type': marketType });
338
+ if (symbols !== undefined) {
339
+ symbols = this.marketSymbols(symbols);
340
+ }
341
+ const result = {};
342
+ if (marketType === 'otc') {
343
+ const otcMarkets = await this.publicGetApiV1MarketIrtInfo(params);
344
+ for (let i = 0; i < otcMarkets.length; i++) {
345
+ const marketdata = otcMarkets[i];
346
+ marketdata['quote'] = 'IRT';
347
+ marketdata['id'] = 'OTC_' + marketdata['symbol'] + marketdata['quote'];
348
+ const parsedMarket = this.parseOTCTicker(marketdata);
349
+ const symbol = parsedMarket['symbol'];
350
+ result[symbol] = parsedMarket;
351
+ }
352
+ return this.filterByArrayTickers(result, 'symbol', symbols);
353
+ }
354
+ const response = await this.publicGetApiV1MarketSymbols(params);
355
+ for (let i = 0; i < response.length; i++) {
356
+ const request = {
357
+ 'symbol': response[i]['name'],
358
+ };
359
+ const assetDetails = await this.publicGetApiV1MarketSymbols(request);
360
+ const ticker = this.parseTicker(assetDetails);
361
+ const symbol = ticker['symbol'];
362
+ result[symbol] = ticker;
363
+ }
364
+ return this.filterByArrayTickers(result, 'symbol', symbols);
365
+ }
366
+ async fetchTicker(symbol, params = {}) {
367
+ /**
368
+ * @method
369
+ * @name arzplus#fetchTicker
370
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
371
+ * @see https://api.arzplus.net/
372
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
373
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
374
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
375
+ */
376
+ const marketType = this.safeString(params, 'type', 'spot');
377
+ if (marketType === 'otc') {
378
+ throw new Error('OTC markets are not supported');
379
+ }
380
+ await this.loadMarkets(false, { 'type': marketType });
381
+ const market = this.market(symbol);
382
+ const request = {
383
+ 'symbol': market['id'],
384
+ };
385
+ const response = await this.publicGetApiV1MarketSymbols(request);
386
+ const ticker = this.parseTicker(response);
387
+ return ticker;
388
+ }
389
+ parseTicker(ticker, market = undefined) {
390
+ // {
391
+ // 'name': 'USDTIRT',
392
+ // 'asset': {
393
+ // 'id': 2,
394
+ // 'symbol': 'USDT',
395
+ // 'precision': 8,
396
+ // 'step_size': 8,
397
+ // 'name': 'tether',
398
+ // 'name_fa': 'تتر',
399
+ // 'logo': 'https://cdn.arzplus.net/core-static/coins/USDT.png',
400
+ // 'original_symbol': 'USDT',
401
+ // 'original_name_fa': 'تتر',
402
+ // 'trading_view_symbol': '',
403
+ // },
404
+ // 'base_asset': {
405
+ // 'id': 1,
406
+ // 'symbol': 'IRT',
407
+ // 'precision': 0,
408
+ // 'step_size': 8,
409
+ // 'name': 'toman',
410
+ // 'name_fa': 'تومان',
411
+ // 'logo': 'https://cdn.arzplus.net/core-static/coins/IRT.png',
412
+ // 'original_symbol': 'IRT',
413
+ // 'original_name_fa': 'تومان',
414
+ // 'trading_view_symbol': '',
415
+ // },
416
+ // 'enable': true,
417
+ // 'price': '59165',
418
+ // 'change': '-246',
419
+ // 'change_percent': '-0.41',
420
+ // 'high': '59619',
421
+ // 'low': '58750',
422
+ // 'volume': '215768.82',
423
+ // 'base_volume': '12757163742',
424
+ // 'bookmark': true,
425
+ // };
426
+ const marketType = 'spot';
427
+ const marketId = this.safeString(ticker, 'name');
428
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
429
+ const high = this.safeFloat(ticker, 'high', 0);
430
+ const low = this.safeFloat(ticker, 'low', 0);
431
+ const last = this.safeFloat(ticker, 'price', 0);
432
+ const change = this.safeFloat(ticker, 'change_percent', 0);
433
+ const baseVolume = this.safeFloat(ticker, 'volume', 0);
434
+ const quoteVolume = this.safeFloat(ticker, 'base_volume', 0);
435
+ return this.safeTicker({
436
+ 'symbol': symbol,
437
+ 'timestamp': undefined,
438
+ 'datetime': undefined,
439
+ 'high': high,
440
+ 'low': low,
441
+ 'bid': undefined,
442
+ 'bidVolume': undefined,
443
+ 'ask': undefined,
444
+ 'askVolume': undefined,
445
+ 'vwap': undefined,
446
+ 'open': last,
447
+ 'close': last,
448
+ 'last': last,
449
+ 'previousClose': undefined,
450
+ 'change': change,
451
+ 'percentage': undefined,
452
+ 'average': undefined,
453
+ 'baseVolume': baseVolume,
454
+ 'quoteVolume': quoteVolume,
455
+ 'info': ticker,
456
+ }, market);
457
+ }
458
+ parseOTCTicker(ticker, market = undefined) {
459
+ // {
460
+ // id: "BTCUSDT",
461
+ // symbol: "BTC",
462
+ // ask: "13877900000",
463
+ // bid: "13860999995",
464
+ // name: "bitcoin"
465
+ // quote: "IRT"
466
+ // }
467
+ const marketType = 'otc';
468
+ const marketId = this.safeString(ticker, 'id');
469
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
470
+ const bid = this.safeFloat(ticker, 'bid', 0);
471
+ const ask = this.safeFloat(ticker, 'ask', 0);
472
+ const last = this.safeFloat(ticker, 'ask', 0);
473
+ return this.safeTicker({
474
+ 'symbol': symbol,
475
+ 'timestamp': undefined,
476
+ 'datetime': undefined,
477
+ 'high': undefined,
478
+ 'low': undefined,
479
+ 'bid': bid,
480
+ 'bidVolume': undefined,
481
+ 'ask': ask,
482
+ 'askVolume': undefined,
483
+ 'vwap': undefined,
484
+ 'open': last,
485
+ 'close': last,
486
+ 'last': last,
487
+ 'previousClose': undefined,
488
+ 'change': undefined,
489
+ 'percentage': undefined,
490
+ 'average': undefined,
491
+ 'baseVolume': undefined,
492
+ 'quoteVolume': undefined,
493
+ 'info': ticker,
494
+ }, market);
495
+ }
496
+ async fetchOHLCV(symbol, timeframe = '1h', since = undefined, limit = undefined, params = {}) {
497
+ /**
498
+ * @method
499
+ * @name arzplus#fetchOHLCV
500
+ * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
501
+ * @see https://api.arzplus.net/
502
+ * @param {string} symbol unified symbol of the market to fetch OHLCV data for
503
+ * @param {string} timeframe the length of time each candle represents
504
+ * @param {int} [since] timestamp in ms of the earliest candle to fetch
505
+ * @param {int} [limit] the maximum amount of candles to fetch
506
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
507
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
508
+ */
509
+ await this.loadMarkets(false, { 'type': 'otc' });
510
+ const market = this.market(symbol);
511
+ const endTime = Date.now();
512
+ const request = {
513
+ 'symbol': market['id'],
514
+ 'from': (endTime / 1000) - (24 * 60 * 60),
515
+ 'to': endTime / 1000,
516
+ 'resolution': this.safeString(this.timeframes, timeframe, timeframe),
517
+ 'countBack': 300,
518
+ };
519
+ if (since !== undefined) {
520
+ request['from'] = since / 1000;
521
+ }
522
+ if (limit !== undefined) {
523
+ request['countBack'] = limit;
524
+ }
525
+ if (timeframe !== undefined) {
526
+ request['resolution'] = this.safeString(this.timeframes, timeframe, timeframe);
527
+ }
528
+ request['from'] = this.safeInteger(request, 'from');
529
+ request['to'] = this.safeInteger(request, 'to');
530
+ const response = await this.publicGetApiV1MarketTradingviewOhlcv(request);
531
+ const ohlcvs = [];
532
+ for (let i = 0; i < response.length; i++) {
533
+ ohlcvs.push([
534
+ this.safeValue(response[i], 'time'),
535
+ this.safeValue(response[i], 'open'),
536
+ this.safeValue(response[i], 'high'),
537
+ this.safeValue(response[i], 'low'),
538
+ this.safeValue(response[i], 'close'),
539
+ this.safeValue(response[i], 'volume'),
540
+ ]);
541
+ }
542
+ return this.parseOHLCVs(ohlcvs, market, timeframe, since, limit);
543
+ }
544
+ async fetchOrderBook(symbol, limit = undefined, params = {}) {
545
+ /**
546
+ * @method
547
+ * @name arzplus#fetchOrderBooks
548
+ * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data for multiple markets
549
+ * @see https://api.arzplus.net/
550
+ * @param {string[]|undefined} symbols list of unified market symbols, all symbols fetched if undefined, default is undefined
551
+ * @param {int} [limit] max number of entries per orderbook to return, default is undefined
552
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
553
+ * @returns {object} a dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbol
554
+ */
555
+ await this.loadMarkets(false, { 'type': 'otc' });
556
+ const market = this.market(symbol);
557
+ const request = {
558
+ 'symbol': market['id'],
559
+ };
560
+ const orderBook = await this.publicGetApiV1MarketDepth(request);
561
+ const timestamp = Date.now();
562
+ return this.parseOrderBook(orderBook, symbol, timestamp, 'bids', 'asks', 'price', 'amount');
563
+ }
564
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
565
+ const query = this.omit(params, this.extractParams(path));
566
+ let url = this.urls['api']['public'] + '/' + path;
567
+ const symbol = this.safeString(params, 'symbol');
568
+ const stats = this.safeValue(params, 'stats');
569
+ if (stats !== undefined) {
570
+ url = url + '?' + this.urlencode(query);
571
+ }
572
+ if (path === 'api/v1/market/tradingview/ohlcv') {
573
+ url = url + '?' + this.urlencode(query);
574
+ }
575
+ else if (symbol !== undefined) {
576
+ url = url + '/' + symbol;
577
+ }
578
+ headers = { 'Content-Type': 'application/json' };
579
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
580
+ }
581
+ }