ccxt-ir 4.18.0 → 4.18.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.
Files changed (98) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +257 -257
  4. package/dist/cjs/package.json +1 -1
  5. package/dist/cjs/src/baazar.js +150 -150
  6. package/dist/cjs/src/base/Exchange.js +7364 -7364
  7. package/dist/cjs/src/daric.js +171 -171
  8. package/dist/cjs/src/digikalagold.js +167 -167
  9. package/dist/cjs/src/goldika.js +153 -153
  10. package/dist/cjs/src/goldis.js +147 -147
  11. package/dist/cjs/src/hamrahgold.js +161 -161
  12. package/dist/cjs/src/iranexchange.js +390 -390
  13. package/dist/cjs/src/melligold.js +210 -210
  14. package/dist/cjs/src/milligold.js +146 -146
  15. package/dist/cjs/src/talaavan.js +155 -0
  16. package/dist/cjs/src/talapp.js +146 -146
  17. package/dist/cjs/src/technogold.js +143 -143
  18. package/dist/cjs/src/wallgold.js +154 -154
  19. package/dist/cjs/src/zarafza.js +149 -149
  20. package/dist/cjs/src/zarminex.js +152 -152
  21. package/dist/cjs/src/zarniv.js +168 -168
  22. package/js/ccxt.d.ts +751 -751
  23. package/js/ccxt.js +543 -543
  24. package/js/src/abstract/baazar.d.ts +8 -8
  25. package/js/src/abstract/baazar.js +5 -5
  26. package/js/src/abstract/daric.d.ts +8 -8
  27. package/js/src/abstract/daric.js +5 -5
  28. package/js/src/abstract/digikalagold.d.ts +8 -8
  29. package/js/src/abstract/digikalagold.js +5 -5
  30. package/js/src/abstract/goldika.d.ts +8 -8
  31. package/js/src/abstract/goldika.js +5 -5
  32. package/js/src/abstract/goldis.d.ts +8 -8
  33. package/js/src/abstract/goldis.js +5 -5
  34. package/js/src/abstract/hamrahgold.d.ts +8 -8
  35. package/js/src/abstract/hamrahgold.js +5 -5
  36. package/js/src/abstract/melligold.d.ts +8 -8
  37. package/js/src/abstract/melligold.js +5 -5
  38. package/js/src/abstract/milligold.d.ts +8 -8
  39. package/js/src/abstract/milligold.js +5 -5
  40. package/js/src/abstract/talaavan.d.ts +8 -0
  41. package/js/src/abstract/talaavan.js +11 -0
  42. package/js/src/abstract/talapp.d.ts +8 -8
  43. package/js/src/abstract/talapp.js +5 -5
  44. package/js/src/abstract/technogold.d.ts +8 -8
  45. package/js/src/abstract/technogold.js +5 -5
  46. package/js/src/abstract/wallgold.d.ts +8 -8
  47. package/js/src/abstract/wallgold.js +5 -5
  48. package/js/src/abstract/zarafza.d.ts +8 -8
  49. package/js/src/abstract/zarafza.js +5 -5
  50. package/js/src/abstract/zarminex.d.ts +8 -8
  51. package/js/src/abstract/zarminex.js +5 -5
  52. package/js/src/abstract/zarniv.d.ts +9 -9
  53. package/js/src/abstract/zarniv.js +5 -5
  54. package/js/src/baazar.d.ts +20 -20
  55. package/js/src/baazar.js +153 -153
  56. package/js/src/base/Exchange.d.ts +926 -926
  57. package/js/src/base/Exchange.js +7397 -7397
  58. package/js/src/coinbaseexchange.d.ts +334 -334
  59. package/js/src/daric.d.ts +22 -22
  60. package/js/src/daric.js +174 -174
  61. package/js/src/digikalagold.d.ts +21 -21
  62. package/js/src/digikalagold.js +171 -171
  63. package/js/src/goldika.d.ts +20 -20
  64. package/js/src/goldika.js +156 -156
  65. package/js/src/goldis.d.ts +21 -21
  66. package/js/src/goldis.js +150 -150
  67. package/js/src/hamrahgold.d.ts +21 -21
  68. package/js/src/hamrahgold.js +164 -164
  69. package/js/src/iranexchange.js +393 -393
  70. package/js/src/melligold.d.ts +21 -21
  71. package/js/src/melligold.js +214 -214
  72. package/js/src/milligold.d.ts +20 -20
  73. package/js/src/milligold.js +149 -149
  74. package/js/src/protobuf/mexc/compiled.d.cts +2 -2
  75. package/js/src/static_dependencies/fflake/browser.d.ts +222 -222
  76. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +101 -101
  77. package/js/src/static_dependencies/qs/formats.d.cts +8 -8
  78. package/js/src/static_dependencies/qs/index.d.cts +4 -4
  79. package/js/src/static_dependencies/qs/parse.d.cts +2 -2
  80. package/js/src/static_dependencies/qs/stringify.d.cts +2 -2
  81. package/js/src/static_dependencies/qs/utils.d.cts +9 -9
  82. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -5
  83. package/js/src/{goldcore.d.ts → talaavan.d.ts} +20 -20
  84. package/js/src/{goldcore.js → talaavan.js} +148 -148
  85. package/js/src/talapp.d.ts +20 -20
  86. package/js/src/talapp.js +149 -149
  87. package/js/src/technogold.d.ts +20 -20
  88. package/js/src/technogold.js +146 -146
  89. package/js/src/wallgold.d.ts +21 -21
  90. package/js/src/wallgold.js +157 -157
  91. package/js/src/zarafza.d.ts +20 -20
  92. package/js/src/zarafza.js +152 -152
  93. package/js/src/zarminex.d.ts +20 -20
  94. package/js/src/zarminex.js +155 -155
  95. package/js/src/zarniv.d.ts +21 -21
  96. package/js/src/zarniv.js +171 -171
  97. package/js/test.js +61 -68
  98. package/package.json +1 -1
@@ -5,158 +5,158 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var Exchange = require('./base/Exchange.js');
6
6
 
7
7
  // ----------------------------------------------------------------------------
8
- // ---------------------------------------------------------------------------
9
- /**
10
- * @class zarminex
11
- * @augments Exchange
12
- */
13
- class zarminex extends Exchange["default"] {
14
- describe() {
15
- return this.deepExtend(super.describe(), {
16
- 'id': 'zarminex',
17
- 'name': 'Zarminex',
18
- 'countries': ['IR'],
19
- 'rateLimit': 1000,
20
- 'version': '1',
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.zarminex.ir',
41
- },
42
- 'www': 'https://zarminex.ir',
43
- 'doc': 'https://api.zarminex.ir/function_url/',
44
- },
45
- 'api': {
46
- 'public': {
47
- 'get': {
48
- 'function_url': 1,
49
- },
50
- },
51
- },
52
- });
53
- }
54
- async fetchMarkets(params = {}) {
55
- const response = await this.publicGetFunctionUrl(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.safeNumber(response, 'cached_price') !== undefined,
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.publicGetFunctionUrl(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.publicGetFunctionUrl(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
- let bid = this.safeNumber(response, 'sell');
117
- let ask = this.safeNumber(response, 'buy');
118
- let last = this.safeNumber(response, 'cached_price');
119
- if (bid !== undefined) {
120
- bid = bid / 10;
121
- }
122
- if (ask !== undefined) {
123
- ask = ask / 10;
124
- }
125
- if (last !== undefined) {
126
- last = last / 10;
127
- }
128
- return this.safeTicker({
129
- 'symbol': market['symbol'],
130
- 'timestamp': undefined,
131
- 'datetime': undefined,
132
- 'high': undefined,
133
- 'low': undefined,
134
- 'bid': bid,
135
- 'bidVolume': undefined,
136
- 'ask': ask,
137
- 'askVolume': undefined,
138
- 'vwap': undefined,
139
- 'open': undefined,
140
- 'close': last,
141
- 'last': last,
142
- 'previousClose': undefined,
143
- 'change': undefined,
144
- 'percentage': undefined,
145
- 'average': undefined,
146
- 'baseVolume': undefined,
147
- 'quoteVolume': undefined,
148
- 'info': response,
149
- }, market);
150
- }
151
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
152
- let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
153
- const query = this.omit(params, this.extractParams(path));
154
- if (Object.keys(query).length) {
155
- url += '?' + this.urlencode(query);
156
- }
157
- headers = { 'Accept': 'application/json' };
158
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
159
- }
8
+ // ---------------------------------------------------------------------------
9
+ /**
10
+ * @class zarminex
11
+ * @augments Exchange
12
+ */
13
+ class zarminex extends Exchange["default"] {
14
+ describe() {
15
+ return this.deepExtend(super.describe(), {
16
+ 'id': 'zarminex',
17
+ 'name': 'Zarminex',
18
+ 'countries': ['IR'],
19
+ 'rateLimit': 1000,
20
+ 'version': '1',
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.zarminex.ir',
41
+ },
42
+ 'www': 'https://zarminex.ir',
43
+ 'doc': 'https://api.zarminex.ir/function_url/',
44
+ },
45
+ 'api': {
46
+ 'public': {
47
+ 'get': {
48
+ 'function_url': 1,
49
+ },
50
+ },
51
+ },
52
+ });
53
+ }
54
+ async fetchMarkets(params = {}) {
55
+ const response = await this.publicGetFunctionUrl(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.safeNumber(response, 'cached_price') !== undefined,
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.publicGetFunctionUrl(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.publicGetFunctionUrl(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
+ let bid = this.safeNumber(response, 'sell');
117
+ let ask = this.safeNumber(response, 'buy');
118
+ let last = this.safeNumber(response, 'cached_price');
119
+ if (bid !== undefined) {
120
+ bid = bid / 10;
121
+ }
122
+ if (ask !== undefined) {
123
+ ask = ask / 10;
124
+ }
125
+ if (last !== undefined) {
126
+ last = last / 10;
127
+ }
128
+ return this.safeTicker({
129
+ 'symbol': market['symbol'],
130
+ 'timestamp': undefined,
131
+ 'datetime': undefined,
132
+ 'high': undefined,
133
+ 'low': undefined,
134
+ 'bid': bid,
135
+ 'bidVolume': undefined,
136
+ 'ask': ask,
137
+ 'askVolume': undefined,
138
+ 'vwap': undefined,
139
+ 'open': undefined,
140
+ 'close': last,
141
+ 'last': last,
142
+ 'previousClose': undefined,
143
+ 'change': undefined,
144
+ 'percentage': undefined,
145
+ 'average': undefined,
146
+ 'baseVolume': undefined,
147
+ 'quoteVolume': undefined,
148
+ 'info': response,
149
+ }, market);
150
+ }
151
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
152
+ let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
153
+ const query = this.omit(params, this.extractParams(path));
154
+ if (Object.keys(query).length) {
155
+ url += '?' + this.urlencode(query);
156
+ }
157
+ headers = { 'Accept': 'application/json' };
158
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
159
+ }
160
160
  }
161
161
 
162
162
  exports["default"] = zarminex;
@@ -5,174 +5,174 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var Exchange = require('./base/Exchange.js');
6
6
 
7
7
  // ----------------------------------------------------------------------------
8
- // ---------------------------------------------------------------------------
9
- /**
10
- * @class zarniv
11
- * @augments Exchange
12
- */
13
- class zarniv extends Exchange["default"] {
14
- describe() {
15
- return this.deepExtend(super.describe(), {
16
- 'id': 'zarniv',
17
- 'name': 'Zarniv',
18
- 'countries': ['IR'],
19
- 'rateLimit': 1000,
20
- 'version': '1',
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://zarniv.ir',
41
- },
42
- 'www': 'https://zarniv.ir',
43
- 'doc': 'https://zarniv.ir/user/get_gold_price/',
44
- },
45
- 'api': {
46
- 'public': {
47
- 'get': {
48
- 'user/get_gold_price': 1,
49
- 'user/get_silver_price': 1,
50
- },
51
- },
52
- },
53
- });
54
- }
55
- fetchPrice(metal, params = {}) {
56
- if (metal === 'gold') {
57
- return this.publicGetUserGetGoldPrice(params);
58
- }
59
- return this.publicGetUserGetSilverPrice(params);
60
- }
61
- async fetchMarkets(params = {}) {
62
- const goldResponse = await this.fetchPrice('gold', params);
63
- const silverResponse = await this.fetchPrice('silver', params);
64
- return [
65
- this.parseMarketEntry(goldResponse, 'gold'),
66
- this.parseMarketEntry(silverResponse, 'silver'),
67
- ];
68
- }
69
- parseMarketEntry(response, metal) {
70
- let base = 'XAG';
71
- if (metal === 'gold') {
72
- base = 'XAU18';
73
- }
74
- const quote = 'IRT';
75
- return {
76
- 'id': base + quote,
77
- 'symbol': base + '/' + quote,
78
- 'base': base,
79
- 'quote': quote,
80
- 'settle': undefined,
81
- 'baseId': metal,
82
- 'quoteId': quote,
83
- 'settleId': undefined,
84
- 'type': 'otc',
85
- 'spot': false,
86
- 'margin': false,
87
- 'swap': false,
88
- 'future': false,
89
- 'option': false,
90
- 'active': this.safeNumber(response, 'base_price_per_gram') !== undefined,
91
- 'contract': false,
92
- 'linear': undefined,
93
- 'inverse': undefined,
94
- 'contractSize': undefined,
95
- 'expiry': undefined,
96
- 'expiryDatetime': undefined,
97
- 'strike': undefined,
98
- 'optionType': undefined,
99
- 'precision': {
100
- 'amount': undefined,
101
- 'price': undefined,
102
- },
103
- 'limits': {
104
- 'leverage': { 'min': undefined, 'max': undefined },
105
- 'amount': { 'min': undefined, 'max': undefined },
106
- 'price': { 'min': undefined, 'max': undefined },
107
- 'cost': { 'min': undefined, 'max': undefined },
108
- },
109
- 'created': undefined,
110
- 'info': response,
111
- };
112
- }
113
- async fetchTicker(symbol, params = {}) {
114
- await this.loadMarkets();
115
- const market = this.market(symbol);
116
- const response = await this.fetchPrice(market['baseId'], params);
117
- return this.parseTicker(response, market);
118
- }
119
- async fetchTickers(symbols = undefined, params = {}) {
120
- await this.loadMarkets();
121
- if (symbols !== undefined) {
122
- symbols = this.marketSymbols(symbols);
123
- }
124
- const goldResponse = await this.fetchPrice('gold', params);
125
- const silverResponse = await this.fetchPrice('silver', params);
126
- const goldMarket = this.market('XAU18/IRT');
127
- const silverMarket = this.market('XAG/IRT');
128
- const goldTicker = this.parseTicker(goldResponse, goldMarket);
129
- const silverTicker = this.parseTicker(silverResponse, silverMarket);
130
- const result = {};
131
- result[goldTicker['symbol']] = goldTicker;
132
- result[silverTicker['symbol']] = silverTicker;
133
- return this.filterByArrayTickers(result, 'symbol', symbols);
134
- }
135
- parseTicker(response, market = undefined) {
136
- const serverTime = this.safeString(response, 'server_time');
137
- let timestamp = undefined;
138
- if (serverTime !== undefined) {
139
- timestamp = this.parse8601(serverTime + '+03:30');
140
- }
141
- const bid = this.safeNumber(response, 'sell_price_per_gram');
142
- const ask = this.safeNumber(response, 'buy_price_per_gram');
143
- const last = this.safeNumber(response, 'base_price_per_gram');
144
- return this.safeTicker({
145
- 'symbol': market['symbol'],
146
- 'timestamp': timestamp,
147
- 'datetime': undefined,
148
- 'high': undefined,
149
- 'low': undefined,
150
- 'bid': bid,
151
- 'bidVolume': undefined,
152
- 'ask': ask,
153
- 'askVolume': undefined,
154
- 'vwap': undefined,
155
- 'open': undefined,
156
- 'close': last,
157
- 'last': last,
158
- 'previousClose': undefined,
159
- 'change': undefined,
160
- 'percentage': undefined,
161
- 'average': undefined,
162
- 'baseVolume': undefined,
163
- 'quoteVolume': undefined,
164
- 'info': response,
165
- }, market);
166
- }
167
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
168
- let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
169
- const query = this.omit(params, this.extractParams(path));
170
- if (Object.keys(query).length) {
171
- url += '?' + this.urlencode(query);
172
- }
173
- headers = { 'Accept': 'application/json' };
174
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
175
- }
8
+ // ---------------------------------------------------------------------------
9
+ /**
10
+ * @class zarniv
11
+ * @augments Exchange
12
+ */
13
+ class zarniv extends Exchange["default"] {
14
+ describe() {
15
+ return this.deepExtend(super.describe(), {
16
+ 'id': 'zarniv',
17
+ 'name': 'Zarniv',
18
+ 'countries': ['IR'],
19
+ 'rateLimit': 1000,
20
+ 'version': '1',
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://zarniv.ir',
41
+ },
42
+ 'www': 'https://zarniv.ir',
43
+ 'doc': 'https://zarniv.ir/user/get_gold_price/',
44
+ },
45
+ 'api': {
46
+ 'public': {
47
+ 'get': {
48
+ 'user/get_gold_price': 1,
49
+ 'user/get_silver_price': 1,
50
+ },
51
+ },
52
+ },
53
+ });
54
+ }
55
+ fetchPrice(metal, params = {}) {
56
+ if (metal === 'gold') {
57
+ return this.publicGetUserGetGoldPrice(params);
58
+ }
59
+ return this.publicGetUserGetSilverPrice(params);
60
+ }
61
+ async fetchMarkets(params = {}) {
62
+ const goldResponse = await this.fetchPrice('gold', params);
63
+ const silverResponse = await this.fetchPrice('silver', params);
64
+ return [
65
+ this.parseMarketEntry(goldResponse, 'gold'),
66
+ this.parseMarketEntry(silverResponse, 'silver'),
67
+ ];
68
+ }
69
+ parseMarketEntry(response, metal) {
70
+ let base = 'XAG';
71
+ if (metal === 'gold') {
72
+ base = 'XAU18';
73
+ }
74
+ const quote = 'IRT';
75
+ return {
76
+ 'id': base + quote,
77
+ 'symbol': base + '/' + quote,
78
+ 'base': base,
79
+ 'quote': quote,
80
+ 'settle': undefined,
81
+ 'baseId': metal,
82
+ 'quoteId': quote,
83
+ 'settleId': undefined,
84
+ 'type': 'otc',
85
+ 'spot': false,
86
+ 'margin': false,
87
+ 'swap': false,
88
+ 'future': false,
89
+ 'option': false,
90
+ 'active': this.safeNumber(response, 'base_price_per_gram') !== undefined,
91
+ 'contract': false,
92
+ 'linear': undefined,
93
+ 'inverse': undefined,
94
+ 'contractSize': undefined,
95
+ 'expiry': undefined,
96
+ 'expiryDatetime': undefined,
97
+ 'strike': undefined,
98
+ 'optionType': undefined,
99
+ 'precision': {
100
+ 'amount': undefined,
101
+ 'price': undefined,
102
+ },
103
+ 'limits': {
104
+ 'leverage': { 'min': undefined, 'max': undefined },
105
+ 'amount': { 'min': undefined, 'max': undefined },
106
+ 'price': { 'min': undefined, 'max': undefined },
107
+ 'cost': { 'min': undefined, 'max': undefined },
108
+ },
109
+ 'created': undefined,
110
+ 'info': response,
111
+ };
112
+ }
113
+ async fetchTicker(symbol, params = {}) {
114
+ await this.loadMarkets();
115
+ const market = this.market(symbol);
116
+ const response = await this.fetchPrice(market['baseId'], params);
117
+ return this.parseTicker(response, market);
118
+ }
119
+ async fetchTickers(symbols = undefined, params = {}) {
120
+ await this.loadMarkets();
121
+ if (symbols !== undefined) {
122
+ symbols = this.marketSymbols(symbols);
123
+ }
124
+ const goldResponse = await this.fetchPrice('gold', params);
125
+ const silverResponse = await this.fetchPrice('silver', params);
126
+ const goldMarket = this.market('XAU18/IRT');
127
+ const silverMarket = this.market('XAG/IRT');
128
+ const goldTicker = this.parseTicker(goldResponse, goldMarket);
129
+ const silverTicker = this.parseTicker(silverResponse, silverMarket);
130
+ const result = {};
131
+ result[goldTicker['symbol']] = goldTicker;
132
+ result[silverTicker['symbol']] = silverTicker;
133
+ return this.filterByArrayTickers(result, 'symbol', symbols);
134
+ }
135
+ parseTicker(response, market = undefined) {
136
+ const serverTime = this.safeString(response, 'server_time');
137
+ let timestamp = undefined;
138
+ if (serverTime !== undefined) {
139
+ timestamp = this.parse8601(serverTime + '+03:30');
140
+ }
141
+ const bid = this.safeNumber(response, 'sell_price_per_gram');
142
+ const ask = this.safeNumber(response, 'buy_price_per_gram');
143
+ const last = this.safeNumber(response, 'base_price_per_gram');
144
+ return this.safeTicker({
145
+ 'symbol': market['symbol'],
146
+ 'timestamp': timestamp,
147
+ 'datetime': undefined,
148
+ 'high': undefined,
149
+ 'low': undefined,
150
+ 'bid': bid,
151
+ 'bidVolume': undefined,
152
+ 'ask': ask,
153
+ 'askVolume': undefined,
154
+ 'vwap': undefined,
155
+ 'open': undefined,
156
+ 'close': last,
157
+ 'last': last,
158
+ 'previousClose': undefined,
159
+ 'change': undefined,
160
+ 'percentage': undefined,
161
+ 'average': undefined,
162
+ 'baseVolume': undefined,
163
+ 'quoteVolume': undefined,
164
+ 'info': response,
165
+ }, market);
166
+ }
167
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
168
+ let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
169
+ const query = this.omit(params, this.extractParams(path));
170
+ if (Object.keys(query).length) {
171
+ url += '?' + this.urlencode(query);
172
+ }
173
+ headers = { 'Accept': 'application/json' };
174
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
175
+ }
176
176
  }
177
177
 
178
178
  exports["default"] = zarniv;