ccxt-ir 4.9.22 → 4.9.25

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.
@@ -0,0 +1,399 @@
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/iranexchange.js';
9
+ // ---------------------------------------------------------------------------
10
+ /**
11
+ * @class iranexchange
12
+ * @augments Exchange
13
+ * @description Set rateLimit to 1000 if fully verified
14
+ */
15
+ export default class iranexchange extends Exchange {
16
+ describe() {
17
+ return this.deepExtend(super.describe(), {
18
+ 'id': 'iranexchange',
19
+ 'name': 'Iran Exchange',
20
+ 'countries': ['IR'],
21
+ 'rateLimit': 1000,
22
+ 'version': '1',
23
+ 'certified': false,
24
+ 'pro': false,
25
+ 'timeout': 30000,
26
+ 'has': {
27
+ 'CORS': undefined,
28
+ 'spot': false,
29
+ 'margin': false,
30
+ 'swap': false,
31
+ 'future': false,
32
+ 'option': false,
33
+ 'addMargin': false,
34
+ 'cancelAllOrders': false,
35
+ 'cancelOrder': false,
36
+ 'cancelOrders': false,
37
+ 'createDepositAddress': false,
38
+ 'createOrder': false,
39
+ 'createStopLimitOrder': false,
40
+ 'createStopMarketOrder': false,
41
+ 'createStopOrder': false,
42
+ 'editOrder': false,
43
+ 'fetchBalance': false,
44
+ 'fetchBorrowInterest': false,
45
+ 'fetchBorrowRateHistories': false,
46
+ 'fetchBorrowRateHistory': false,
47
+ 'fetchClosedOrders': false,
48
+ 'fetchCrossBorrowRate': false,
49
+ 'fetchCrossBorrowRates': false,
50
+ 'fetchCurrencies': false,
51
+ 'fetchDepositAddress': false,
52
+ 'fetchDeposits': false,
53
+ 'fetchFundingHistory': false,
54
+ 'fetchFundingRate': false,
55
+ 'fetchFundingRateHistory': false,
56
+ 'fetchFundingRates': false,
57
+ 'fetchIndexOHLCV': false,
58
+ 'fetchIsolatedBorrowRate': false,
59
+ 'fetchIsolatedBorrowRates': false,
60
+ 'fetchL2OrderBook': false,
61
+ 'fetchLedger': false,
62
+ 'fetchLedgerEntry': false,
63
+ 'fetchLeverageTiers': false,
64
+ 'fetchMarkets': true,
65
+ 'fetchMarkOHLCV': false,
66
+ 'fetchMyTrades': false,
67
+ 'fetchOHLCV': false,
68
+ 'fetchOpenInterestHistory': false,
69
+ 'fetchOpenOrders': false,
70
+ 'fetchOrder': false,
71
+ 'fetchOrderBook': false,
72
+ 'fetchOrders': false,
73
+ 'fetchOrderTrades': 'emulated',
74
+ 'fetchPositions': false,
75
+ 'fetchPremiumIndexOHLCV': false,
76
+ 'fetchTicker': true,
77
+ 'fetchTickers': true,
78
+ 'fetchTime': false,
79
+ 'fetchTrades': false,
80
+ 'fetchTradingFee': false,
81
+ 'fetchTradingFees': false,
82
+ 'fetchWithdrawals': false,
83
+ 'otc': true,
84
+ 'setLeverage': false,
85
+ 'setMarginMode': false,
86
+ 'transfer': false,
87
+ 'withdraw': false,
88
+ },
89
+ 'comment': 'This comment is optional',
90
+ 'urls': {
91
+ 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/iran-exchange/64x64.png',
92
+ 'api': {
93
+ 'public': 'https://api.iranexchange.com/api/public/modules/crypto',
94
+ },
95
+ 'www': 'https://iranexchange.com/',
96
+ 'doc': [
97
+ 'https://iranexchange.com/',
98
+ ],
99
+ },
100
+ 'api': {
101
+ 'public': {
102
+ 'get': {
103
+ 'v1/client/listProduct': 1,
104
+ 'v1/client/getBySymbol': 1,
105
+ },
106
+ },
107
+ },
108
+ 'fees': {
109
+ 'trading': {
110
+ 'tierBased': false,
111
+ 'percentage': true,
112
+ 'maker': this.parseNumber('0.001'),
113
+ 'taker': this.parseNumber('0.001'),
114
+ },
115
+ },
116
+ });
117
+ }
118
+ async fetchMarkets(params = {}) {
119
+ /**
120
+ * @method
121
+ * @name iranexchange#fetchMarkets
122
+ * @description retrieves data on all markets for iranexchange
123
+ * @see https://iranexchange.co/
124
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
125
+ * @returns {object[]} an array of objects representing market data
126
+ */
127
+ const response = await this.publicGetV1ClientListProduct();
128
+ const markets = this.safeList(response, 'data');
129
+ const result = [];
130
+ for (let i = 0; i < markets.length; i++) {
131
+ const market = this.parseMarket(markets[i]);
132
+ result.push(market);
133
+ }
134
+ return result;
135
+ }
136
+ parseMarket(market) {
137
+ // {
138
+ // _id: "60b08a57b202353abb592032",
139
+ // name: "Bitcoin",
140
+ // fa_name: "بیت کوین",
141
+ // symbol: "BTC",
142
+ // slug: "bitcoin",
143
+ // is_sell_to_customer_active: 1,
144
+ // is_fast_sell_to_customer_active: 1,
145
+ // is_buy_from_customer_active: 1,
146
+ // logo: "https://iranexchange.com/strapi/media/BTC_78d99b9d12.png",
147
+ // dollar_price: 89240.18,
148
+ // sell_to_iranicard_currency_price: 1234526,
149
+ // buy_from_iranicard_currency_price: 1239474,
150
+ // fast_sell_to_iranicard_currency_price: 1234526,
151
+ // buy_from_iranicard_network_list: [
152
+ // {
153
+ // network: "BTC",
154
+ // name: "Bitcoin",
155
+ // addressRegex: "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[(bc1q)|(bc1p)][0-9A-Za-z]{37,62}$",
156
+ // coin: "BTC",
157
+ // withdrawEnable: true,
158
+ // depositEnable: true,
159
+ // withdrawMin: "0.000100000",
160
+ // withdrawMax: null,
161
+ // withdrawFee: "0.000100000",
162
+ // sameAddress: false,
163
+ // memoRegex: null,
164
+ // tradeEnable: true
165
+ // }
166
+ // ],
167
+ // sell_to_iranicard_network_list: [
168
+ // {
169
+ // network: "BTC",
170
+ // name: "Bitcoin",
171
+ // addressRegex: "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[(bc1q)|(bc1p)][0-9A-Za-z]{37,62}$",
172
+ // coin: "BTC",
173
+ // withdrawEnable: true,
174
+ // depositEnable: true,
175
+ // withdrawMin: "0.000100000",
176
+ // withdrawMax: null,
177
+ // withdrawFee: "0.000100000",
178
+ // sameAddress: false,
179
+ // memoRegex: null,
180
+ // tradeEnable: true
181
+ // }
182
+ // ],
183
+ // is_price_maker_active: 1,
184
+ // quotation: {
185
+ // maxPrice: "90199.99",
186
+ // minPrice: "88925",
187
+ // dailyChangePercent: "-0.26"
188
+ // },
189
+ // dailyChangePercent: -0.26,
190
+ // order: 0,
191
+ // stock_status: "in_stock",
192
+ // stock_label: null,
193
+ // stock_description: null
194
+ // },
195
+ const id = this.safeString(market, 'symbol') + '_' + 'IRT';
196
+ let baseId = this.safeString(market, 'symbol');
197
+ let quoteId = 'IRT';
198
+ const base = this.safeCurrencyCode(baseId);
199
+ const quote = this.safeCurrencyCode(quoteId);
200
+ baseId = baseId.toLowerCase();
201
+ quoteId = quoteId.toLowerCase();
202
+ return {
203
+ 'id': id,
204
+ 'symbol': base + '/' + quote,
205
+ 'base': base,
206
+ 'quote': quote,
207
+ 'settle': undefined,
208
+ 'baseId': baseId,
209
+ 'quoteId': quoteId,
210
+ 'settleId': undefined,
211
+ 'type': 'otc',
212
+ 'spot': false,
213
+ 'margin': false,
214
+ 'swap': false,
215
+ 'future': false,
216
+ 'option': false,
217
+ 'active': true,
218
+ 'contract': false,
219
+ 'linear': undefined,
220
+ 'inverse': undefined,
221
+ 'contractSize': undefined,
222
+ 'expiry': undefined,
223
+ 'expiryDatetime': undefined,
224
+ 'strike': undefined,
225
+ 'optionType': undefined,
226
+ 'precision': {
227
+ 'amount': undefined,
228
+ 'price': undefined,
229
+ },
230
+ 'limits': {
231
+ 'leverage': {
232
+ 'min': undefined,
233
+ 'max': undefined,
234
+ },
235
+ 'amount': {
236
+ 'min': undefined,
237
+ 'max': undefined,
238
+ },
239
+ 'price': {
240
+ 'min': undefined,
241
+ 'max': undefined,
242
+ },
243
+ 'cost': {
244
+ 'min': undefined,
245
+ 'max': undefined,
246
+ },
247
+ },
248
+ 'created': undefined,
249
+ 'info': market,
250
+ };
251
+ }
252
+ async fetchTickers(symbols = undefined, params = {}) {
253
+ /**
254
+ * @method
255
+ * @name iranexchange#fetchTickers
256
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
257
+ * @see https://iranexchange.co/
258
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
259
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
260
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
261
+ */
262
+ await this.loadMarkets();
263
+ if (symbols !== undefined) {
264
+ symbols = this.marketSymbols(symbols);
265
+ }
266
+ const response = await this.publicGetV1ClientListProduct();
267
+ const markets = this.safeList(response, 'data');
268
+ const result = {};
269
+ for (let i = 0; i < markets.length; i++) {
270
+ const ticker = this.parseTicker(markets[i]);
271
+ const symbol = ticker['symbol'];
272
+ result[symbol] = ticker;
273
+ }
274
+ return this.filterByArrayTickers(result, 'symbol', symbols);
275
+ }
276
+ async fetchTicker(symbol, params = {}) {
277
+ /**
278
+ * @method
279
+ * @name iranexchange#fetchTicker
280
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
281
+ * @see https://iranexchange.co/
282
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
283
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
284
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
285
+ */
286
+ await this.loadMarkets();
287
+ const market = this.market(symbol);
288
+ const request = {
289
+ 'id': market['base'],
290
+ };
291
+ const response = await this.publicGetV1ClientGetBySymbol(request);
292
+ const marketData = this.safeDict(response, 'data');
293
+ const ticker = this.parseTicker(marketData);
294
+ return ticker;
295
+ }
296
+ parseTicker(ticker, market = undefined) {
297
+ // {
298
+ // _id: "60b08a57b202353abb592032",
299
+ // name: "Bitcoin",
300
+ // fa_name: "بیت کوین",
301
+ // symbol: "BTC",
302
+ // slug: "bitcoin",
303
+ // is_sell_to_customer_active: 1,
304
+ // is_fast_sell_to_customer_active: 1,
305
+ // is_buy_from_customer_active: 1,
306
+ // logo: "https://iranexchange.com/strapi/media/BTC_78d99b9d12.png",
307
+ // dollar_price: 89240.18,
308
+ // sell_to_iranicard_currency_price: 1234526,
309
+ // buy_from_iranicard_currency_price: 1239474,
310
+ // fast_sell_to_iranicard_currency_price: 1234526,
311
+ // buy_from_iranicard_network_list: [
312
+ // {
313
+ // network: "BTC",
314
+ // name: "Bitcoin",
315
+ // addressRegex: "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[(bc1q)|(bc1p)][0-9A-Za-z]{37,62}$",
316
+ // coin: "BTC",
317
+ // withdrawEnable: true,
318
+ // depositEnable: true,
319
+ // withdrawMin: "0.000100000",
320
+ // withdrawMax: null,
321
+ // withdrawFee: "0.000100000",
322
+ // sameAddress: false,
323
+ // memoRegex: null,
324
+ // tradeEnable: true
325
+ // }
326
+ // ],
327
+ // sell_to_iranicard_network_list: [
328
+ // {
329
+ // network: "BTC",
330
+ // name: "Bitcoin",
331
+ // addressRegex: "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[(bc1q)|(bc1p)][0-9A-Za-z]{37,62}$",
332
+ // coin: "BTC",
333
+ // withdrawEnable: true,
334
+ // depositEnable: true,
335
+ // withdrawMin: "0.000100000",
336
+ // withdrawMax: null,
337
+ // withdrawFee: "0.000100000",
338
+ // sameAddress: false,
339
+ // memoRegex: null,
340
+ // tradeEnable: true
341
+ // }
342
+ // ],
343
+ // is_price_maker_active: 1,
344
+ // quotation: {
345
+ // maxPrice: "90199.99",
346
+ // minPrice: "88925",
347
+ // dailyChangePercent: "-0.26"
348
+ // },
349
+ // dailyChangePercent: -0.26,
350
+ // order: 0,
351
+ // stock_status: "in_stock",
352
+ // stock_label: null,
353
+ // stock_description: null
354
+ // }
355
+ const marketType = 'otc';
356
+ const marketId = this.safeString(ticker, 'symbol') + '_' + 'IRT';
357
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
358
+ const quotation = this.safeValue(ticker, 'quotation', {});
359
+ const dollar_price = this.safeFloat(ticker, 'dollar_price', 0);
360
+ const high = this.safeFloat(quotation, 'maxPrice', 0) * dollar_price;
361
+ const low = this.safeFloat(quotation, 'minPrice', 0) * dollar_price;
362
+ const bid = this.safeFloat(ticker, 'sell_to_iranicard_currency_price', 0) * dollar_price;
363
+ const ask = this.safeFloat(ticker, 'buy_from_iranicard_currency_price', 0) * dollar_price;
364
+ const last = this.safeFloat(ticker, 'sell_to_iranicard_currency_price', 0) * dollar_price;
365
+ const change = this.safeFloat(quotation, 'dailyChangePercent', 0);
366
+ return this.safeTicker({
367
+ 'symbol': symbol,
368
+ 'timestamp': undefined,
369
+ 'datetime': undefined,
370
+ 'high': high,
371
+ 'low': low,
372
+ 'bid': bid,
373
+ 'bidVolume': undefined,
374
+ 'ask': ask,
375
+ 'askVolume': undefined,
376
+ 'vwap': undefined,
377
+ 'open': last,
378
+ 'close': last,
379
+ 'last': last,
380
+ 'previousClose': undefined,
381
+ 'change': change,
382
+ 'percentage': change,
383
+ 'average': undefined,
384
+ 'baseVolume': undefined,
385
+ 'quoteVolume': undefined,
386
+ 'info': ticker,
387
+ }, market);
388
+ }
389
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
390
+ const query = this.omit(params, this.extractParams(path));
391
+ let url = this.urls['api']['public'] + '/' + path + '?' + this.urlencode(query);
392
+ const pair_id = this.safeString(params, 'id');
393
+ if (pair_id !== undefined) {
394
+ url = this.urls['api']['public'] + '/' + path + '/' + pair_id;
395
+ }
396
+ headers = { 'Content-Type': 'application/json' };
397
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
398
+ }
399
+ }
@@ -1,8 +1,2 @@
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
1
  export = $root;
8
2
  declare var $root: {};
@@ -5,7 +5,7 @@ export function deflate(data: any, opts: any, cb: any): () => void;
5
5
  * @param opts The compression options
6
6
  * @returns The deflated version of the data
7
7
  */
8
- export function deflateSync(data: any, opts: any): Uint8Array | Uint16Array | Uint32Array;
8
+ export function deflateSync(data: any, opts: any): Uint8Array | Uint32Array | Uint16Array;
9
9
  export function inflate(data: any, opts: any, cb: any): () => void;
10
10
  /**
11
11
  * Expands DEFLATE data with no wrapper
@@ -21,7 +21,7 @@ export function gzip(data: any, opts: any, cb: any): () => void;
21
21
  * @param opts The compression options
22
22
  * @returns The gzipped version of the data
23
23
  */
24
- export function gzipSync(data: any, opts: any): Uint8Array | Uint16Array | Uint32Array;
24
+ export function gzipSync(data: any, opts: any): Uint8Array | Uint32Array | Uint16Array;
25
25
  export function gunzip(data: any, opts: any, cb: any): () => void;
26
26
  /**
27
27
  * Expands GZIP data
@@ -37,7 +37,7 @@ export function zlib(data: any, opts: any, cb: any): () => void;
37
37
  * @param opts The compression options
38
38
  * @returns The zlib-compressed version of the data
39
39
  */
40
- export function zlibSync(data: any, opts: any): Uint8Array | Uint16Array | Uint32Array;
40
+ export function zlibSync(data: any, opts: any): Uint8Array | Uint32Array | Uint16Array;
41
41
  export function unzlib(data: any, opts: any, cb: any): () => void;
42
42
  /**
43
43
  * Expands Zlib data
@@ -61,7 +61,7 @@ export function decompressSync(data: any, out: any): any;
61
61
  * not need to be true unless decoding a binary string.
62
62
  * @returns The string encoded in UTF-8/Latin-1 binary
63
63
  */
64
- export function strToU8(str: any, latin1: any): Uint8Array | Uint16Array | Uint32Array;
64
+ export function strToU8(str: any, latin1: any): Uint8Array | Uint32Array | Uint16Array;
65
65
  /**
66
66
  * Converts a Uint8Array to a string
67
67
  * @param dat The data to decode to string
@@ -69,7 +69,7 @@ export function strToU8(str: any, latin1: any): Uint8Array | Uint16Array | Uint3
69
69
  * not need to be true unless encoding to binary string.
70
70
  * @returns The original UTF-8/Latin-1 string
71
71
  */
72
- export function strFromU8(dat: any, latin1: any): string | Uint8Array | Uint16Array | Uint32Array;
72
+ export function strFromU8(dat: any, latin1: any): string | Uint8Array | Uint32Array | Uint16Array;
73
73
  export function zip(data: any, opts: any, cb: any): () => void;
74
74
  /**
75
75
  * Synchronously creates a ZIP file. Prefer using `zip` for better performance
@@ -1,9 +1,3 @@
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
1
  declare const _default: string;
8
2
  export declare namespace formatters {
9
3
  function RFC1738(value: any): string;
@@ -1,9 +1,3 @@
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
1
  import formats = require("./formats.cjs");
8
2
  import parse = require("./parse.cjs");
9
3
  import stringify = require("./stringify.cjs");
@@ -1,8 +1,2 @@
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
1
  declare function _exports(str: any, opts: any): any;
8
2
  export = _exports;
@@ -1,8 +1,2 @@
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
1
  declare function _exports(object: any, opts: any): string;
8
2
  export = _exports;
@@ -1,9 +1,3 @@
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
1
  export function arrayToObject(source: any, options: any): any;
8
2
  export function assign(target: any, source: any): any;
9
3
  export function combine(a: any, b: any): any[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt-ir",
3
- "version": "4.9.22",
3
+ "version": "4.9.25",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.min.js",
6
6
  "type": "module",