ccxt-ir 4.19.0 → 4.20.1

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.
package/js/test.js CHANGED
@@ -4,30 +4,66 @@
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
- import zarpin from './src/zarpin.js';
8
- async function main() {
9
- const exchange = new zarpin({
7
+ import gerami from './src/gerami.js';
8
+ import melligold from './src/melligold.js';
9
+ const exchanges = [
10
+ // { 'id': 'technogold', 'Exchange': technogold },
11
+ // { 'id': 'baazar', 'Exchange': baazar },
12
+ // { 'id': 'hamrahgold', 'Exchange': hamrahgold },
13
+ // { 'id': 'zarniv', 'Exchange': zarniv },
14
+ // { 'id': 'zarminex', 'Exchange': zarminex },
15
+ // { 'id': 'zarafza', 'Exchange': zarafza },
16
+ // { 'id': 'daric', 'Exchange': daric },
17
+ // { 'id': 'digikalagold', 'Exchange': digikalagold },
18
+ { 'id': 'gerami', 'Exchange': gerami },
19
+ // { 'id': 'goldika', 'Exchange': goldika },
20
+ // { 'id': 'goldis', 'Exchange': goldis },
21
+ { 'id': 'melligold', 'Exchange': melligold },
22
+ // { 'id': 'milligold', 'Exchange': milligold },
23
+ // { 'id': 'ramzinex', 'Exchange': ramzinex },
24
+ // { 'id': 'wallgold', 'Exchange': wallgold },
25
+ // { 'id': 'talapp', 'Exchange': talapp },
26
+ // { 'id': 'talaavan', 'Exchange': talaavan },
27
+ // { 'id': 'talasea', 'Exchange': talasea },
28
+ // { 'id': 'zarpin', 'Exchange': zarpin },
29
+ ];
30
+ async function testExchange(id, ExchangeClass) {
31
+ const exchange = new ExchangeClass({
10
32
  'enableRateLimit': true,
11
33
  'timeout': 20000,
12
34
  });
13
35
  try {
14
36
  const tickers = await exchange.fetchTickers();
15
- const gold = tickers['XAU18/IRT'];
16
- const silver = tickers['XAG-1G/IRT'];
17
- if (gold === undefined || gold.last === undefined) {
18
- throw new Error('XAU18/IRT has no valid last price');
19
- }
20
- if (silver === undefined || silver.last === undefined) {
21
- throw new Error('XAG-1G/IRT has no valid last price');
37
+ const symbols = Object.keys(tickers);
38
+ for (let i = 0; i < symbols.length; i++) {
39
+ const symbol = symbols[i];
40
+ const ticker = tickers[symbol];
41
+ const bid = ticker['bid'];
42
+ const ask = ticker['ask'];
43
+ const last = ticker['last'];
44
+ if (bid !== undefined || ask !== undefined) {
45
+ let expectedLast = bid;
46
+ if (ask !== undefined && (expectedLast === undefined || ask > expectedLast)) {
47
+ expectedLast = ask;
48
+ }
49
+ if (last !== expectedLast) {
50
+ throw new Error(symbol + ' last=' + last + ', expected=' + expectedLast);
51
+ }
52
+ }
53
+ console.log(id + ' ' + symbol + ' bid=' + bid + ' ask=' + ask + ' last=' + last + ' OK');
22
54
  }
23
- console.log('Zarpin gold last price: ' + gold.last + ' IRT');
24
- console.log('Zarpin silver last price: ' + silver.last + ' IRT');
25
55
  }
26
56
  finally {
27
57
  await exchange.close();
28
58
  }
29
59
  }
60
+ async function main() {
61
+ for (let i = 0; i < exchanges.length; i++) {
62
+ const entry = exchanges[i];
63
+ await testExchange(entry['id'], entry['Exchange']);
64
+ }
65
+ }
30
66
  main().catch((error) => {
31
- console.error('Zarpin ticker test failed:', error);
67
+ console.error('Gold platform price test failed:', error);
32
68
  process.exitCode = 1;
33
69
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt-ir",
3
- "version": "4.19.0",
3
+ "version": "4.20.1",
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",