ccxt-ir 4.17.0 → 4.18.0

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 (65) hide show
  1. package/README.md +4 -4
  2. package/dist/373.ccxt.browser.js +1 -1
  3. package/dist/373.ccxt.browser.min.js +1 -1
  4. package/dist/ccxt.browser.min.js +15 -15
  5. package/dist/cjs/ccxt.js +34 -1
  6. package/dist/cjs/package.json +1 -1
  7. package/dist/cjs/src/baazar.js +160 -0
  8. package/dist/cjs/src/daric.js +181 -0
  9. package/dist/cjs/src/digikalagold.js +178 -0
  10. package/dist/cjs/src/goldcore.js +155 -0
  11. package/dist/cjs/src/goldika.js +163 -0
  12. package/dist/cjs/src/goldis.js +157 -0
  13. package/dist/cjs/src/hamrahgold.js +171 -0
  14. package/dist/cjs/src/talapp.js +156 -0
  15. package/dist/cjs/src/zarafza.js +159 -0
  16. package/dist/cjs/src/zarminex.js +162 -0
  17. package/dist/cjs/src/zarniv.js +178 -0
  18. package/js/ccxt.d.ts +35 -2
  19. package/js/ccxt.js +24 -2
  20. package/js/src/abstract/baazar.d.ts +8 -0
  21. package/js/src/abstract/baazar.js +11 -0
  22. package/js/src/abstract/daric.d.ts +8 -0
  23. package/js/src/abstract/daric.js +11 -0
  24. package/js/src/abstract/digikalagold.d.ts +8 -0
  25. package/js/src/abstract/digikalagold.js +11 -0
  26. package/js/src/abstract/goldcore.d.ts +8 -0
  27. package/js/src/abstract/goldcore.js +11 -0
  28. package/js/src/abstract/goldika.d.ts +8 -0
  29. package/js/src/abstract/goldika.js +11 -0
  30. package/js/src/abstract/goldis.d.ts +8 -0
  31. package/js/src/abstract/goldis.js +11 -0
  32. package/js/src/abstract/hamrahgold.d.ts +8 -0
  33. package/js/src/abstract/hamrahgold.js +11 -0
  34. package/js/src/abstract/talapp.d.ts +8 -0
  35. package/js/src/abstract/talapp.js +11 -0
  36. package/js/src/abstract/zarafza.d.ts +8 -0
  37. package/js/src/abstract/zarafza.js +11 -0
  38. package/js/src/abstract/zarminex.d.ts +8 -0
  39. package/js/src/abstract/zarminex.js +11 -0
  40. package/js/src/abstract/zarniv.d.ts +9 -0
  41. package/js/src/abstract/zarniv.js +11 -0
  42. package/js/src/baazar.d.ts +20 -0
  43. package/js/src/baazar.js +159 -0
  44. package/js/src/daric.d.ts +22 -0
  45. package/js/src/daric.js +180 -0
  46. package/js/src/digikalagold.d.ts +21 -0
  47. package/js/src/digikalagold.js +177 -0
  48. package/js/src/goldcore.d.ts +20 -0
  49. package/js/src/goldcore.js +154 -0
  50. package/js/src/goldika.d.ts +20 -0
  51. package/js/src/goldika.js +162 -0
  52. package/js/src/goldis.d.ts +21 -0
  53. package/js/src/goldis.js +156 -0
  54. package/js/src/hamrahgold.d.ts +21 -0
  55. package/js/src/hamrahgold.js +170 -0
  56. package/js/src/talapp.d.ts +20 -0
  57. package/js/src/talapp.js +155 -0
  58. package/js/src/zarafza.d.ts +20 -0
  59. package/js/src/zarafza.js +158 -0
  60. package/js/src/zarminex.d.ts +20 -0
  61. package/js/src/zarminex.js +161 -0
  62. package/js/src/zarniv.d.ts +21 -0
  63. package/js/src/zarniv.js +177 -0
  64. package/js/test.js +50 -43
  65. package/package.json +1 -1
@@ -0,0 +1,155 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var Exchange = require('./base/Exchange.js');
6
+
7
+ // ----------------------------------------------------------------------------
8
+ // ---------------------------------------------------------------------------
9
+ /**
10
+ * @class goldcore
11
+ * @augments Exchange
12
+ */
13
+ class goldcore extends Exchange["default"] {
14
+ describe() {
15
+ return this.deepExtend(super.describe(), {
16
+ 'id': 'goldcore',
17
+ 'name': 'Goldcore',
18
+ 'countries': ['IR'],
19
+ 'rateLimit': 1000,
20
+ 'version': 'v1',
21
+ 'certified': false,
22
+ 'pro': false,
23
+ 'has': {
24
+ 'CORS': undefined,
25
+ 'spot': false,
26
+ 'margin': false,
27
+ 'swap': false,
28
+ 'future': false,
29
+ 'option': false,
30
+ 'fetchMarkets': true,
31
+ 'fetchTicker': true,
32
+ 'fetchTickers': true,
33
+ 'otc': true,
34
+ },
35
+ 'options': {
36
+ 'defaultType': 'otc',
37
+ },
38
+ 'urls': {
39
+ 'api': {
40
+ 'public': 'https://goldcore.talaavan.com',
41
+ },
42
+ 'www': 'https://goldcore.talaavan.com',
43
+ 'doc': 'https://goldcore.talaavan.com/v1/price',
44
+ },
45
+ 'api': {
46
+ 'public': {
47
+ 'get': {
48
+ 'v1/price': 1,
49
+ },
50
+ },
51
+ },
52
+ });
53
+ }
54
+ async fetchMarkets(params = {}) {
55
+ const response = await this.publicGetV1Price(params);
56
+ return [this.parseMarket(response)];
57
+ }
58
+ parseMarket(response) {
59
+ return {
60
+ 'id': 'XAU18IRT',
61
+ 'symbol': 'XAU18/IRT',
62
+ 'base': 'XAU18',
63
+ 'quote': 'IRT',
64
+ 'settle': undefined,
65
+ 'baseId': 'XAU18',
66
+ 'quoteId': 'IRT',
67
+ 'settleId': undefined,
68
+ 'type': 'otc',
69
+ 'spot': false,
70
+ 'margin': false,
71
+ 'swap': false,
72
+ 'future': false,
73
+ 'option': false,
74
+ 'active': this.safeBool(response, 'status', false),
75
+ 'contract': false,
76
+ 'linear': undefined,
77
+ 'inverse': undefined,
78
+ 'contractSize': undefined,
79
+ 'expiry': undefined,
80
+ 'expiryDatetime': undefined,
81
+ 'strike': undefined,
82
+ 'optionType': undefined,
83
+ 'precision': {
84
+ 'amount': undefined,
85
+ 'price': undefined,
86
+ },
87
+ 'limits': {
88
+ 'leverage': { 'min': undefined, 'max': undefined },
89
+ 'amount': { 'min': undefined, 'max': undefined },
90
+ 'price': { 'min': undefined, 'max': undefined },
91
+ 'cost': { 'min': undefined, 'max': undefined },
92
+ },
93
+ 'created': undefined,
94
+ 'info': response,
95
+ };
96
+ }
97
+ async fetchTicker(symbol, params = {}) {
98
+ await this.loadMarkets();
99
+ const market = this.market(symbol);
100
+ const response = await this.publicGetV1Price(params);
101
+ return this.parseTicker(response, market);
102
+ }
103
+ async fetchTickers(symbols = undefined, params = {}) {
104
+ await this.loadMarkets();
105
+ if (symbols !== undefined) {
106
+ symbols = this.marketSymbols(symbols);
107
+ }
108
+ const response = await this.publicGetV1Price(params);
109
+ const market = this.market('XAU18/IRT');
110
+ const ticker = this.parseTicker(response, market);
111
+ const result = {};
112
+ result[ticker['symbol']] = ticker;
113
+ return this.filterByArrayTickers(result, 'symbol', symbols);
114
+ }
115
+ parseTicker(response, market = undefined) {
116
+ const data = this.safeDict(response, 'data', {});
117
+ let price = this.safeNumber(data, 'rate');
118
+ if (price !== undefined) {
119
+ price = price / 10;
120
+ }
121
+ return this.safeTicker({
122
+ 'symbol': market['symbol'],
123
+ 'timestamp': this.parse8601(this.safeString(data, 'date')),
124
+ 'datetime': undefined,
125
+ 'high': undefined,
126
+ 'low': undefined,
127
+ 'bid': price,
128
+ 'bidVolume': undefined,
129
+ 'ask': price,
130
+ 'askVolume': undefined,
131
+ 'vwap': undefined,
132
+ 'open': undefined,
133
+ 'close': price,
134
+ 'last': price,
135
+ 'previousClose': undefined,
136
+ 'change': undefined,
137
+ 'percentage': undefined,
138
+ 'average': undefined,
139
+ 'baseVolume': undefined,
140
+ 'quoteVolume': undefined,
141
+ 'info': data,
142
+ }, market);
143
+ }
144
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
145
+ let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
146
+ const query = this.omit(params, this.extractParams(path));
147
+ if (Object.keys(query).length) {
148
+ url += '?' + this.urlencode(query);
149
+ }
150
+ headers = { 'Accept': 'application/json' };
151
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
152
+ }
153
+ }
154
+
155
+ exports["default"] = goldcore;
@@ -0,0 +1,163 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var Exchange = require('./base/Exchange.js');
6
+
7
+ // ----------------------------------------------------------------------------
8
+ // ---------------------------------------------------------------------------
9
+ /**
10
+ * @class goldika
11
+ * @augments Exchange
12
+ */
13
+ class goldika extends Exchange["default"] {
14
+ describe() {
15
+ return this.deepExtend(super.describe(), {
16
+ 'id': 'goldika',
17
+ 'name': 'Goldika',
18
+ 'countries': ['IR'],
19
+ 'rateLimit': 1000,
20
+ 'version': 'v2',
21
+ 'certified': false,
22
+ 'pro': false,
23
+ 'has': {
24
+ 'CORS': undefined,
25
+ 'spot': false,
26
+ 'margin': false,
27
+ 'swap': false,
28
+ 'future': false,
29
+ 'option': false,
30
+ 'fetchMarkets': true,
31
+ 'fetchTicker': true,
32
+ 'fetchTickers': true,
33
+ 'otc': true,
34
+ },
35
+ 'options': {
36
+ 'defaultType': 'otc',
37
+ },
38
+ 'urls': {
39
+ 'api': {
40
+ 'public': 'https://api.goldika.ir',
41
+ },
42
+ 'www': 'https://goldika.ir',
43
+ 'doc': 'https://api.goldika.ir/api/v2/public/price',
44
+ },
45
+ 'api': {
46
+ 'public': {
47
+ 'get': {
48
+ 'api/v2/public/price': 1,
49
+ },
50
+ },
51
+ },
52
+ });
53
+ }
54
+ async fetchMarkets(params = {}) {
55
+ const response = await this.publicGetApiV2PublicPrice(params);
56
+ return [this.parseMarket(response)];
57
+ }
58
+ parseMarket(response) {
59
+ const data = this.safeDict(response, 'data', {});
60
+ const oldPrice = this.safeDict(data, 'old_price', {});
61
+ return {
62
+ 'id': 'XAU18IRT',
63
+ 'symbol': 'XAU18/IRT',
64
+ 'base': 'XAU18',
65
+ 'quote': 'IRT',
66
+ 'settle': undefined,
67
+ 'baseId': 'XAU18',
68
+ 'quoteId': 'IRT',
69
+ 'settleId': undefined,
70
+ 'type': 'otc',
71
+ 'spot': false,
72
+ 'margin': false,
73
+ 'swap': false,
74
+ 'future': false,
75
+ 'option': false,
76
+ 'active': true,
77
+ 'contract': false,
78
+ 'linear': undefined,
79
+ 'inverse': undefined,
80
+ 'contractSize': undefined,
81
+ 'expiry': undefined,
82
+ 'expiryDatetime': undefined,
83
+ 'strike': undefined,
84
+ 'optionType': undefined,
85
+ 'precision': {
86
+ 'amount': undefined,
87
+ 'price': undefined,
88
+ },
89
+ 'limits': {
90
+ 'leverage': { 'min': undefined, 'max': undefined },
91
+ 'amount': { 'min': undefined, 'max': undefined },
92
+ 'price': { 'min': undefined, 'max': undefined },
93
+ 'cost': { 'min': undefined, 'max': undefined },
94
+ },
95
+ 'created': undefined,
96
+ 'info': oldPrice,
97
+ };
98
+ }
99
+ async fetchTicker(symbol, params = {}) {
100
+ await this.loadMarkets();
101
+ const market = this.market(symbol);
102
+ const response = await this.publicGetApiV2PublicPrice(params);
103
+ return this.parseTicker(response, market);
104
+ }
105
+ async fetchTickers(symbols = undefined, params = {}) {
106
+ await this.loadMarkets();
107
+ if (symbols !== undefined) {
108
+ symbols = this.marketSymbols(symbols);
109
+ }
110
+ const response = await this.publicGetApiV2PublicPrice(params);
111
+ const market = this.market('XAU18/IRT');
112
+ const ticker = this.parseTicker(response, market);
113
+ const result = {};
114
+ result[ticker['symbol']] = ticker;
115
+ return this.filterByArrayTickers(result, 'symbol', symbols);
116
+ }
117
+ parseTicker(response, market = undefined) {
118
+ const data = this.safeDict(response, 'data', {});
119
+ const oldPrice = this.safeDict(data, 'old_price', {});
120
+ const timestamp = this.parse8601(this.safeString(oldPrice, 'created_at'));
121
+ let bid = this.safeNumber(oldPrice, 'buy');
122
+ let ask = this.safeNumber(oldPrice, 'sell');
123
+ if (bid !== undefined) {
124
+ bid = bid / 10;
125
+ }
126
+ if (ask !== undefined) {
127
+ ask = ask / 10;
128
+ }
129
+ return this.safeTicker({
130
+ 'symbol': market['symbol'],
131
+ 'timestamp': timestamp,
132
+ 'datetime': undefined,
133
+ 'high': undefined,
134
+ 'low': undefined,
135
+ 'bid': bid,
136
+ 'bidVolume': undefined,
137
+ 'ask': ask,
138
+ 'askVolume': undefined,
139
+ 'vwap': undefined,
140
+ 'open': undefined,
141
+ 'close': ask,
142
+ 'last': ask,
143
+ 'previousClose': undefined,
144
+ 'change': undefined,
145
+ 'percentage': this.safeNumber(data, 'daily_change_percent'),
146
+ 'average': undefined,
147
+ 'baseVolume': undefined,
148
+ 'quoteVolume': undefined,
149
+ 'info': oldPrice,
150
+ }, market);
151
+ }
152
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
153
+ let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
154
+ const query = this.omit(params, this.extractParams(path));
155
+ if (Object.keys(query).length) {
156
+ url += '?' + this.urlencode(query);
157
+ }
158
+ headers = { 'Accept': 'application/json' };
159
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
160
+ }
161
+ }
162
+
163
+ exports["default"] = goldika;
@@ -0,0 +1,157 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var Exchange = require('./base/Exchange.js');
6
+
7
+ // ----------------------------------------------------------------------------
8
+ // ---------------------------------------------------------------------------
9
+ /**
10
+ * @class goldis
11
+ * @augments Exchange
12
+ */
13
+ class goldis extends Exchange["default"] {
14
+ describe() {
15
+ return this.deepExtend(super.describe(), {
16
+ 'id': 'goldis',
17
+ 'name': 'Goldis',
18
+ 'countries': ['IR'],
19
+ 'rateLimit': 1000,
20
+ 'version': 'v1',
21
+ 'certified': false,
22
+ 'pro': false,
23
+ 'has': {
24
+ 'CORS': undefined,
25
+ 'spot': false,
26
+ 'margin': false,
27
+ 'swap': false,
28
+ 'future': false,
29
+ 'option': false,
30
+ 'fetchMarkets': true,
31
+ 'fetchTicker': true,
32
+ 'fetchTickers': true,
33
+ 'otc': true,
34
+ },
35
+ 'options': {
36
+ 'defaultType': 'otc',
37
+ },
38
+ 'urls': {
39
+ 'api': {
40
+ 'public': 'https://goldis.ir',
41
+ },
42
+ 'www': 'https://goldis.ir',
43
+ 'doc': 'https://goldis.ir/backend/api/v1/pricing/spot?metal=gold',
44
+ },
45
+ 'api': {
46
+ 'public': {
47
+ 'get': {
48
+ 'backend/api/v1/pricing/spot': 1,
49
+ },
50
+ },
51
+ },
52
+ });
53
+ }
54
+ fetchPrice(params = {}) {
55
+ return this.publicGetBackendApiV1PricingSpot(this.extend({ 'metal': 'gold' }, params));
56
+ }
57
+ async fetchMarkets(params = {}) {
58
+ const response = await this.fetchPrice(params);
59
+ return [this.parseMarket(response)];
60
+ }
61
+ parseMarket(response) {
62
+ return {
63
+ 'id': 'XAU18IRT',
64
+ 'symbol': 'XAU18/IRT',
65
+ 'base': 'XAU18',
66
+ 'quote': 'IRT',
67
+ 'settle': undefined,
68
+ 'baseId': 'XAU18',
69
+ 'quoteId': 'IRT',
70
+ 'settleId': undefined,
71
+ 'type': 'otc',
72
+ 'spot': false,
73
+ 'margin': false,
74
+ 'swap': false,
75
+ 'future': false,
76
+ 'option': false,
77
+ 'active': this.safeNumber(response, 'price_per_gram_rial') !== undefined,
78
+ 'contract': false,
79
+ 'linear': undefined,
80
+ 'inverse': undefined,
81
+ 'contractSize': undefined,
82
+ 'expiry': undefined,
83
+ 'expiryDatetime': undefined,
84
+ 'strike': undefined,
85
+ 'optionType': undefined,
86
+ 'precision': {
87
+ 'amount': undefined,
88
+ 'price': undefined,
89
+ },
90
+ 'limits': {
91
+ 'leverage': { 'min': undefined, 'max': undefined },
92
+ 'amount': { 'min': undefined, 'max': undefined },
93
+ 'price': { 'min': undefined, 'max': undefined },
94
+ 'cost': { 'min': undefined, 'max': undefined },
95
+ },
96
+ 'created': undefined,
97
+ 'info': response,
98
+ };
99
+ }
100
+ async fetchTicker(symbol, params = {}) {
101
+ await this.loadMarkets();
102
+ const market = this.market(symbol);
103
+ const response = await this.fetchPrice(params);
104
+ return this.parseTicker(response, market);
105
+ }
106
+ async fetchTickers(symbols = undefined, params = {}) {
107
+ await this.loadMarkets();
108
+ if (symbols !== undefined) {
109
+ symbols = this.marketSymbols(symbols);
110
+ }
111
+ const response = await this.fetchPrice(params);
112
+ const market = this.market('XAU18/IRT');
113
+ const ticker = this.parseTicker(response, market);
114
+ const result = {};
115
+ result[ticker['symbol']] = ticker;
116
+ return this.filterByArrayTickers(result, 'symbol', symbols);
117
+ }
118
+ parseTicker(response, market = undefined) {
119
+ let price = this.safeNumber(response, 'price_per_gram_rial');
120
+ if (price !== undefined) {
121
+ price = price / 10;
122
+ }
123
+ return this.safeTicker({
124
+ 'symbol': market['symbol'],
125
+ 'timestamp': this.parse8601(this.safeString(response, 'as_of')),
126
+ 'datetime': undefined,
127
+ 'high': undefined,
128
+ 'low': undefined,
129
+ 'bid': price,
130
+ 'bidVolume': undefined,
131
+ 'ask': price,
132
+ 'askVolume': undefined,
133
+ 'vwap': undefined,
134
+ 'open': undefined,
135
+ 'close': price,
136
+ 'last': price,
137
+ 'previousClose': undefined,
138
+ 'change': undefined,
139
+ 'percentage': undefined,
140
+ 'average': undefined,
141
+ 'baseVolume': undefined,
142
+ 'quoteVolume': undefined,
143
+ 'info': response,
144
+ }, market);
145
+ }
146
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
147
+ let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
148
+ const query = this.omit(params, this.extractParams(path));
149
+ if (Object.keys(query).length) {
150
+ url += '?' + this.urlencode(query);
151
+ }
152
+ headers = { 'Accept': 'application/json' };
153
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
154
+ }
155
+ }
156
+
157
+ exports["default"] = goldis;
@@ -0,0 +1,171 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var Exchange = require('./base/Exchange.js');
6
+
7
+ // ----------------------------------------------------------------------------
8
+ // ---------------------------------------------------------------------------
9
+ /**
10
+ * @class hamrahgold
11
+ * @augments Exchange
12
+ */
13
+ class hamrahgold extends Exchange["default"] {
14
+ describe() {
15
+ return this.deepExtend(super.describe(), {
16
+ 'id': 'hamrahgold',
17
+ 'name': 'HamrahGold',
18
+ 'countries': ['IR'],
19
+ 'rateLimit': 1000,
20
+ 'version': 'v1',
21
+ 'certified': false,
22
+ 'pro': false,
23
+ 'has': {
24
+ 'CORS': undefined,
25
+ 'spot': false,
26
+ 'margin': false,
27
+ 'swap': false,
28
+ 'future': false,
29
+ 'option': false,
30
+ 'fetchMarkets': true,
31
+ 'fetchTicker': true,
32
+ 'fetchTickers': true,
33
+ 'otc': true,
34
+ },
35
+ 'options': {
36
+ 'defaultType': 'otc',
37
+ },
38
+ 'urls': {
39
+ 'api': {
40
+ 'public': 'https://pwa.hamrahgold.com',
41
+ },
42
+ 'www': 'https://hamrahgold.com',
43
+ 'doc': 'https://pwa.hamrahgold.com/api/v1/market/price/xau/changes?type=sell',
44
+ },
45
+ 'api': {
46
+ 'public': {
47
+ 'get': {
48
+ 'api/v1/market/price/xau/changes': 1,
49
+ },
50
+ },
51
+ },
52
+ });
53
+ }
54
+ fetchPrice(type, params = {}) {
55
+ return this.publicGetApiV1MarketPriceXauChanges(this.extend({ 'type': type }, params));
56
+ }
57
+ async fetchMarkets(params = {}) {
58
+ const response = await this.fetchPrice('sell', params);
59
+ return [this.parseMarket(response)];
60
+ }
61
+ parseMarket(response) {
62
+ return {
63
+ 'id': 'XAU18IRT',
64
+ 'symbol': 'XAU18/IRT',
65
+ 'base': 'XAU18',
66
+ 'quote': 'IRT',
67
+ 'settle': undefined,
68
+ 'baseId': 'XAU18',
69
+ 'quoteId': 'IRT',
70
+ 'settleId': undefined,
71
+ 'type': 'otc',
72
+ 'spot': false,
73
+ 'margin': false,
74
+ 'swap': false,
75
+ 'future': false,
76
+ 'option': false,
77
+ 'active': this.safeBool(response, 'success', false),
78
+ 'contract': false,
79
+ 'linear': undefined,
80
+ 'inverse': undefined,
81
+ 'contractSize': undefined,
82
+ 'expiry': undefined,
83
+ 'expiryDatetime': undefined,
84
+ 'strike': undefined,
85
+ 'optionType': undefined,
86
+ 'precision': {
87
+ 'amount': undefined,
88
+ 'price': undefined,
89
+ },
90
+ 'limits': {
91
+ 'leverage': { 'min': undefined, 'max': undefined },
92
+ 'amount': { 'min': undefined, 'max': undefined },
93
+ 'price': { 'min': undefined, 'max': undefined },
94
+ 'cost': { 'min': undefined, 'max': undefined },
95
+ },
96
+ 'created': undefined,
97
+ 'info': response,
98
+ };
99
+ }
100
+ async fetchTicker(symbol, params = {}) {
101
+ await this.loadMarkets();
102
+ const market = this.market(symbol);
103
+ const buyResponse = await this.fetchPrice('buy', params);
104
+ const sellResponse = await this.fetchPrice('sell', params);
105
+ return this.parseTicker(buyResponse, market, sellResponse);
106
+ }
107
+ async fetchTickers(symbols = undefined, params = {}) {
108
+ await this.loadMarkets();
109
+ if (symbols !== undefined) {
110
+ symbols = this.marketSymbols(symbols);
111
+ }
112
+ const buyResponse = await this.fetchPrice('buy', params);
113
+ const sellResponse = await this.fetchPrice('sell', params);
114
+ const market = this.market('XAU18/IRT');
115
+ const ticker = this.parseTicker(buyResponse, market, sellResponse);
116
+ const result = {};
117
+ result[ticker['symbol']] = ticker;
118
+ return this.filterByArrayTickers(result, 'symbol', symbols);
119
+ }
120
+ parseTicker(buyResponse, market = undefined, sellResponse = undefined) {
121
+ const buy = this.safeDict(buyResponse, 'data', {});
122
+ const sell = this.safeDict(sellResponse, 'data', {});
123
+ const changes = this.safeDict(sell, 'changes', {});
124
+ const dailyChange = this.safeDict(changes, '1d', {});
125
+ let bid = this.safeNumber(buy, 'current');
126
+ let ask = this.safeNumber(sell, 'current');
127
+ let previousClose = this.safeNumber(dailyChange, 'price');
128
+ if (bid !== undefined) {
129
+ bid = bid / 10;
130
+ }
131
+ if (ask !== undefined) {
132
+ ask = ask / 10;
133
+ }
134
+ if (previousClose !== undefined) {
135
+ previousClose = previousClose / 10;
136
+ }
137
+ return this.safeTicker({
138
+ 'symbol': market['symbol'],
139
+ 'timestamp': undefined,
140
+ 'datetime': undefined,
141
+ 'high': undefined,
142
+ 'low': undefined,
143
+ 'bid': bid,
144
+ 'bidVolume': undefined,
145
+ 'ask': ask,
146
+ 'askVolume': undefined,
147
+ 'vwap': undefined,
148
+ 'open': undefined,
149
+ 'close': ask,
150
+ 'last': ask,
151
+ 'previousClose': previousClose,
152
+ 'change': undefined,
153
+ 'percentage': this.safeNumber(dailyChange, 'percent'),
154
+ 'average': undefined,
155
+ 'baseVolume': undefined,
156
+ 'quoteVolume': undefined,
157
+ 'info': { 'buy': buyResponse, 'sell': sellResponse },
158
+ }, market);
159
+ }
160
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
161
+ let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
162
+ const query = this.omit(params, this.extractParams(path));
163
+ if (Object.keys(query).length) {
164
+ url += '?' + this.urlencode(query);
165
+ }
166
+ headers = { 'Accept': 'application/json' };
167
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
168
+ }
169
+ }
170
+
171
+ exports["default"] = hamrahgold;