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,447 @@
1
+ // ----------------------------------------------------------------------------
2
+
3
+ // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+ // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
+
7
+ // ---------------------------------------------------------------------------
8
+ import Exchange from './abstract/pingi.js';
9
+ // ---------------------------------------------------------------------------
10
+ /**
11
+ * @class pingi
12
+ * @augments Exchange
13
+ * @description Pingi OTC exchange implementation
14
+ */
15
+ export default class pingi extends Exchange {
16
+ describe() {
17
+ return this.deepExtend(super.describe(), {
18
+ 'id': 'pingi',
19
+ 'name': 'Pingi',
20
+ 'countries': ['IR'],
21
+ 'rateLimit': 1000,
22
+ 'version': '1',
23
+ 'certified': false,
24
+ 'pro': false,
25
+ 'has': {
26
+ 'CORS': undefined,
27
+ 'spot': false,
28
+ 'margin': false,
29
+ 'swap': false,
30
+ 'future': false,
31
+ 'option': false,
32
+ 'addMargin': false,
33
+ 'cancelAllOrders': false,
34
+ 'cancelOrder': false,
35
+ 'cancelOrders': false,
36
+ 'createDepositAddress': false,
37
+ 'createOrder': false,
38
+ 'createStopLimitOrder': false,
39
+ 'createStopMarketOrder': false,
40
+ 'createStopOrder': false,
41
+ 'editOrder': false,
42
+ 'fetchBalance': false,
43
+ 'fetchBorrowInterest': false,
44
+ 'fetchBorrowRateHistories': false,
45
+ 'fetchBorrowRateHistory': false,
46
+ 'fetchClosedOrders': false,
47
+ 'fetchCrossBorrowRate': false,
48
+ 'fetchCrossBorrowRates': false,
49
+ 'fetchCurrencies': false,
50
+ 'fetchDepositAddress': false,
51
+ 'fetchDeposits': false,
52
+ 'fetchFundingHistory': false,
53
+ 'fetchFundingRate': false,
54
+ 'fetchFundingRateHistory': false,
55
+ 'fetchFundingRates': false,
56
+ 'fetchIndexOHLCV': false,
57
+ 'fetchIsolatedBorrowRate': false,
58
+ 'fetchIsolatedBorrowRates': false,
59
+ 'fetchL2OrderBook': false,
60
+ 'fetchL3OrderBook': false,
61
+ 'fetchLedger': false,
62
+ 'fetchLedgerEntry': false,
63
+ 'fetchLeverageTiers': false,
64
+ 'fetchMarkets': true,
65
+ 'fetchMarkOHLCV': false,
66
+ 'fetchMyTrades': false,
67
+ 'fetchOHLCV': true,
68
+ 'fetchOpenInterestHistory': false,
69
+ 'fetchOpenOrders': false,
70
+ 'fetchOrder': false,
71
+ 'fetchOrderBook': false,
72
+ 'fetchOrders': false,
73
+ 'fetchOrderTrades': 'emulated',
74
+ 'fetchPositions': false,
75
+ 'fetchPremiumIndexOHLCV': false,
76
+ 'fetchTicker': true,
77
+ 'fetchTickers': true,
78
+ 'fetchTime': false,
79
+ 'fetchTrades': false,
80
+ 'fetchTradingFee': false,
81
+ 'fetchTradingFees': false,
82
+ 'fetchWithdrawals': false,
83
+ 'otc': true,
84
+ 'setLeverage': false,
85
+ 'setMarginMode': false,
86
+ 'transfer': false,
87
+ 'withdraw': false,
88
+ },
89
+ 'comment': 'Pingi OTC Exchange',
90
+ 'urls': {
91
+ 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/pingi/64x64.png',
92
+ 'api': {
93
+ 'public': 'https://api5.pingi.co/trading',
94
+ },
95
+ 'www': 'https://pingi.co',
96
+ 'doc': [
97
+ 'https://pingi.co',
98
+ ],
99
+ },
100
+ 'timeframes': {
101
+ '1m': '1',
102
+ '5m': '5',
103
+ '15m': '15',
104
+ '30m': '30',
105
+ '1h': '60',
106
+ '4h': '240',
107
+ '1d': '1D',
108
+ '1w': '1W',
109
+ },
110
+ 'api': {
111
+ 'public': {
112
+ 'get': {
113
+ 'market/prices': 1,
114
+ 'udf/history': 1,
115
+ },
116
+ },
117
+ },
118
+ 'fees': {
119
+ 'trading': {
120
+ 'tierBased': false,
121
+ 'percentage': true,
122
+ 'maker': this.parseNumber('0.001'),
123
+ 'taker': this.parseNumber('0.001'),
124
+ },
125
+ },
126
+ });
127
+ }
128
+ async fetchMarkets(params = {}) {
129
+ /**
130
+ * @method
131
+ * @name pingi#fetchMarkets
132
+ * @description retrieves data on all markets for pingi
133
+ * @see https://api5.pingi.co/trading/market/prices/
134
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
135
+ * @returns {object[]} an array of objects representing market data
136
+ */
137
+ const response = await this.publicGetMarketPrices(params);
138
+ // Response structure:
139
+ // {
140
+ // "statusCode": 200,
141
+ // "ok": true,
142
+ // "data": {
143
+ // "ETH_USDT": {
144
+ // "market": "ETH_USDT",
145
+ // "marketId": 6,
146
+ // "marketVolume": "128889.02937760774364521500000000",
147
+ // "currentPrice": "4083.7744580000000",
148
+ // "maxPrice": "4218.0241700000000",
149
+ // "minPrice": "3786.9124050000000",
150
+ // "startPrice": "3830.5800220000000",
151
+ // "marketPlatform": 0
152
+ // },
153
+ // "BTC_IRT": {
154
+ // "market": "BTC_IRT",
155
+ // "marketId": 8,
156
+ // "marketVolume": "27140908320.17800246693400000000000000",
157
+ // "currentPrice": "12909088630.0000000000000",
158
+ // "maxPrice": "13213902170.0000000000000",
159
+ // "minPrice": "12000000000.0000000000000",
160
+ // "startPrice": "12752332240.0000000000000",
161
+ // "marketPlatform": 0
162
+ // },
163
+ // ...
164
+ // }
165
+ // }
166
+ const data = this.safeDict(response, 'data', {});
167
+ const marketKeys = Object.keys(data);
168
+ const result = [];
169
+ for (let i = 0; i < marketKeys.length; i++) {
170
+ const marketId = marketKeys[i];
171
+ const marketData = data[marketId];
172
+ const market = this.parseMarket(marketData);
173
+ result.push(market);
174
+ }
175
+ return result;
176
+ }
177
+ parseMarket(market) {
178
+ // {
179
+ // "market": "BTC_IRT",
180
+ // "marketId": 8,
181
+ // "marketVolume": "27140908320.17800246693400000000000000",
182
+ // "currentPrice": "12909088630.0000000000000",
183
+ // "maxPrice": "13213902170.0000000000000",
184
+ // "minPrice": "12000000000.0000000000000",
185
+ // "startPrice": "12752332240.0000000000000",
186
+ // "marketPlatform": 0
187
+ // }
188
+ const id = this.safeString(market, 'market');
189
+ const parts = id.split('_');
190
+ let baseId = this.safeString(parts, 0);
191
+ let quoteId = this.safeString(parts, 1);
192
+ const base = this.safeCurrencyCode(baseId);
193
+ const quote = this.safeCurrencyCode(quoteId);
194
+ baseId = baseId.toLowerCase();
195
+ quoteId = quoteId.toLowerCase();
196
+ return {
197
+ 'id': id,
198
+ 'symbol': base + '/' + quote,
199
+ 'base': base,
200
+ 'quote': quote,
201
+ 'settle': undefined,
202
+ 'baseId': baseId,
203
+ 'quoteId': quoteId,
204
+ 'settleId': undefined,
205
+ 'type': 'otc',
206
+ 'spot': false,
207
+ 'margin': false,
208
+ 'swap': false,
209
+ 'future': false,
210
+ 'option': false,
211
+ 'active': true,
212
+ 'contract': false,
213
+ 'linear': undefined,
214
+ 'inverse': undefined,
215
+ 'contractSize': undefined,
216
+ 'expiry': undefined,
217
+ 'expiryDatetime': undefined,
218
+ 'strike': undefined,
219
+ 'optionType': undefined,
220
+ 'precision': {
221
+ 'amount': undefined,
222
+ 'price': undefined,
223
+ },
224
+ 'limits': {
225
+ 'leverage': {
226
+ 'min': undefined,
227
+ 'max': undefined,
228
+ },
229
+ 'amount': {
230
+ 'min': undefined,
231
+ 'max': undefined,
232
+ },
233
+ 'price': {
234
+ 'min': undefined,
235
+ 'max': undefined,
236
+ },
237
+ 'cost': {
238
+ 'min': undefined,
239
+ 'max': undefined,
240
+ },
241
+ },
242
+ 'created': undefined,
243
+ 'info': market,
244
+ };
245
+ }
246
+ async fetchTickers(symbols = undefined, params = {}) {
247
+ /**
248
+ * @method
249
+ * @name pingi#fetchTickers
250
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
251
+ * @see https://api5.pingi.co/trading/market/prices/
252
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
253
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
254
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
255
+ */
256
+ await this.loadMarkets();
257
+ if (symbols !== undefined) {
258
+ symbols = this.marketSymbols(symbols);
259
+ }
260
+ const response = await this.publicGetMarketPrices(params);
261
+ // Response structure:
262
+ // {
263
+ // "statusCode": 200,
264
+ // "ok": true,
265
+ // "data": {
266
+ // "ETH_USDT": {
267
+ // "market": "ETH_USDT",
268
+ // "marketId": 6,
269
+ // "marketVolume": "128889.02937760774364521500000000",
270
+ // "currentPrice": "4083.7744580000000",
271
+ // "maxPrice": "4218.0241700000000",
272
+ // "minPrice": "3786.9124050000000",
273
+ // "startPrice": "3830.5800220000000",
274
+ // "marketPlatform": 0
275
+ // },
276
+ // ...
277
+ // }
278
+ // }
279
+ const data = this.safeDict(response, 'data', {});
280
+ const marketKeys = Object.keys(data);
281
+ const result = {};
282
+ for (let i = 0; i < marketKeys.length; i++) {
283
+ const marketId = marketKeys[i];
284
+ const marketData = data[marketId];
285
+ const ticker = this.parseTicker(marketData);
286
+ const symbol = ticker['symbol'];
287
+ result[symbol] = ticker;
288
+ }
289
+ return this.filterByArrayTickers(result, 'symbol', symbols);
290
+ }
291
+ async fetchTicker(symbol, params = {}) {
292
+ /**
293
+ * @method
294
+ * @name pingi#fetchTicker
295
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
296
+ * @see https://api5.pingi.co/trading/market/prices/
297
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
298
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
299
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
300
+ */
301
+ await this.loadMarkets();
302
+ const market = this.market(symbol);
303
+ const response = await this.publicGetMarketPrices(params);
304
+ // Response structure:
305
+ // {
306
+ // "statusCode": 200,
307
+ // "ok": true,
308
+ // "data": {
309
+ // "BTC_IRT": {
310
+ // "market": "BTC_IRT",
311
+ // "marketId": 8,
312
+ // "marketVolume": "27140908320.17800246693400000000000000",
313
+ // "currentPrice": "12909088630.0000000000000",
314
+ // "maxPrice": "13213902170.0000000000000",
315
+ // "minPrice": "12000000000.0000000000000",
316
+ // "startPrice": "12752332240.0000000000000",
317
+ // "marketPlatform": 0
318
+ // },
319
+ // ...
320
+ // }
321
+ // }
322
+ const data = this.safeDict(response, 'data', {});
323
+ const tickerData = this.safeDict(data, market['id']);
324
+ return this.parseTicker(tickerData, market);
325
+ }
326
+ parseTicker(ticker, market = undefined) {
327
+ // {
328
+ // "market": "BTC_IRT",
329
+ // "marketId": 8,
330
+ // "marketVolume": "27140908320.17800246693400000000000000",
331
+ // "currentPrice": "12909088630.0000000000000",
332
+ // "maxPrice": "13213902170.0000000000000",
333
+ // "minPrice": "12000000000.0000000000000",
334
+ // "startPrice": "12752332240.0000000000000",
335
+ // "marketPlatform": 0
336
+ // }
337
+ const marketType = 'otc';
338
+ const marketId = this.safeString(ticker, 'market');
339
+ const symbol = this.safeSymbol(marketId, market, '_', marketType);
340
+ const last = this.safeString(ticker, 'currentPrice');
341
+ const high = this.safeString(ticker, 'maxPrice');
342
+ const low = this.safeString(ticker, 'minPrice');
343
+ const open = this.safeString(ticker, 'startPrice');
344
+ const baseVolume = this.safeString(ticker, 'marketVolume');
345
+ // Calculate change and percentage
346
+ let change = undefined;
347
+ let percentage = undefined;
348
+ if (open !== undefined && last !== undefined) {
349
+ const openNum = this.parseNumber(open);
350
+ const lastNum = this.parseNumber(last);
351
+ if (openNum !== undefined && lastNum !== undefined && openNum > 0) {
352
+ change = this.parseNumber(this.numberToString(lastNum - openNum));
353
+ percentage = this.parseNumber(this.numberToString((lastNum - openNum) / openNum * 100));
354
+ }
355
+ }
356
+ return this.safeTicker({
357
+ 'symbol': symbol,
358
+ 'timestamp': undefined,
359
+ 'datetime': undefined,
360
+ 'high': high,
361
+ 'low': low,
362
+ 'bid': undefined,
363
+ 'bidVolume': undefined,
364
+ 'ask': undefined,
365
+ 'askVolume': undefined,
366
+ 'vwap': undefined,
367
+ 'open': open,
368
+ 'close': last,
369
+ 'last': last,
370
+ 'previousClose': undefined,
371
+ 'change': change,
372
+ 'percentage': percentage,
373
+ 'average': undefined,
374
+ 'baseVolume': baseVolume,
375
+ 'quoteVolume': undefined,
376
+ 'info': ticker,
377
+ }, market);
378
+ }
379
+ async fetchOHLCV(symbol, timeframe = '1d', since = undefined, limit = undefined, params = {}) {
380
+ /**
381
+ * @method
382
+ * @name pingi#fetchOHLCV
383
+ * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
384
+ * @see https://api5.pingi.co/trading/udf/history/
385
+ * @param {string} symbol unified symbol of the market to fetch OHLCV data for
386
+ * @param {string} timeframe the length of time each candle represents
387
+ * @param {int} [since] timestamp in ms of the earliest candle to fetch
388
+ * @param {int} [limit] the maximum amount of candles to fetch
389
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
390
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
391
+ */
392
+ await this.loadMarkets();
393
+ const market = this.market(symbol);
394
+ const endTime = Date.now();
395
+ const request = {
396
+ 'symbol': market['base'] + '/' + market['quote'],
397
+ 'resolution': this.safeString(this.timeframes, timeframe, timeframe),
398
+ 'from': (endTime / 1000) - (30 * 24 * 60 * 60),
399
+ 'to': endTime / 1000,
400
+ };
401
+ if (since !== undefined) {
402
+ request['from'] = since / 1000;
403
+ }
404
+ request['from'] = this.safeInteger(request, 'from');
405
+ request['to'] = this.safeInteger(request, 'to');
406
+ const response = await this.publicGetUdfHistory(request);
407
+ // Response structure:
408
+ // {
409
+ // "c": [12710726290.0, 12732737270.0, ...], // close prices
410
+ // "v": [0.015461630724, 0.024055443184, ...], // volumes
411
+ // "l": [12702815580.0, 12689256670.0, ...], // low prices
412
+ // "h": [12723701120.0, 12752332240.0, ...], // high prices
413
+ // "o": [12752332240.0, 12710726290.0, ...], // open prices
414
+ // "t": [1760271600, 1760272500, ...] // timestamps
415
+ // }
416
+ const closeList = this.safeList(response, 'c', []);
417
+ const volumeList = this.safeList(response, 'v', []);
418
+ const lowList = this.safeList(response, 'l', []);
419
+ const highList = this.safeList(response, 'h', []);
420
+ const openList = this.safeList(response, 'o', []);
421
+ const timestampList = this.safeList(response, 't', []);
422
+ const ohlcvs = [];
423
+ for (let i = 0; i < openList.length; i++) {
424
+ ohlcvs.push([
425
+ this.safeTimestamp(timestampList, i),
426
+ this.safeNumber(openList, i),
427
+ this.safeNumber(highList, i),
428
+ this.safeNumber(lowList, i),
429
+ this.safeNumber(closeList, i),
430
+ this.safeNumber(volumeList, i),
431
+ ]);
432
+ }
433
+ return this.parseOHLCVs(ohlcvs, market, timeframe, since, limit);
434
+ }
435
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
436
+ const query = this.omit(params, this.extractParams(path));
437
+ let url = this.urls['api']['public'] + '/' + path;
438
+ if (path === 'market/prices') {
439
+ url = url + '/';
440
+ }
441
+ if (path === 'udf/history') {
442
+ url = url + '/?' + this.urlencode(query);
443
+ }
444
+ headers = { 'Content-Type': 'application/json' };
445
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
446
+ }
447
+ }
@@ -0,0 +1,21 @@
1
+ import Exchange from './abstract/pooleno.js';
2
+ import { Market, Strings, Ticker, Tickers } from './base/types.js';
3
+ /**
4
+ * @class pooleno
5
+ * @augments Exchange
6
+ * @description Set rateLimit to 1000 if fully verified
7
+ */
8
+ export default class pooleno extends Exchange {
9
+ describe(): any;
10
+ fetchMarkets(params?: {}): Promise<Market[]>;
11
+ parseMarket(market: any): Market;
12
+ fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
13
+ fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
14
+ parseTicker(ticker: any, market?: Market): Ticker;
15
+ sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
16
+ url: string;
17
+ method: string;
18
+ body: any;
19
+ headers: any;
20
+ };
21
+ }