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