ccxt-ir 4.18.0 → 4.19.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 (103) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +260 -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 +213 -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/dist/cjs/src/zarpin.js +185 -0
  23. package/js/ccxt.d.ts +754 -751
  24. package/js/ccxt.js +545 -543
  25. package/js/src/abstract/baazar.d.ts +8 -8
  26. package/js/src/abstract/baazar.js +5 -5
  27. package/js/src/abstract/daric.d.ts +8 -8
  28. package/js/src/abstract/daric.js +5 -5
  29. package/js/src/abstract/digikalagold.d.ts +8 -8
  30. package/js/src/abstract/digikalagold.js +5 -5
  31. package/js/src/abstract/goldika.d.ts +8 -8
  32. package/js/src/abstract/goldika.js +5 -5
  33. package/js/src/abstract/goldis.d.ts +8 -8
  34. package/js/src/abstract/goldis.js +5 -5
  35. package/js/src/abstract/hamrahgold.d.ts +8 -8
  36. package/js/src/abstract/hamrahgold.js +5 -5
  37. package/js/src/abstract/melligold.d.ts +8 -8
  38. package/js/src/abstract/melligold.js +5 -5
  39. package/js/src/abstract/milligold.d.ts +8 -8
  40. package/js/src/abstract/milligold.js +5 -5
  41. package/js/src/abstract/talaavan.d.ts +8 -0
  42. package/js/src/abstract/talaavan.js +11 -0
  43. package/js/src/abstract/talapp.d.ts +8 -8
  44. package/js/src/abstract/talapp.js +5 -5
  45. package/js/src/abstract/technogold.d.ts +8 -8
  46. package/js/src/abstract/technogold.js +5 -5
  47. package/js/src/abstract/wallgold.d.ts +8 -8
  48. package/js/src/abstract/wallgold.js +5 -5
  49. package/js/src/abstract/zarafza.d.ts +8 -8
  50. package/js/src/abstract/zarafza.js +5 -5
  51. package/js/src/abstract/zarminex.d.ts +8 -8
  52. package/js/src/abstract/zarminex.js +5 -5
  53. package/js/src/abstract/zarniv.d.ts +9 -9
  54. package/js/src/abstract/zarniv.js +5 -5
  55. package/js/src/abstract/zarpin.d.ts +8 -0
  56. package/js/src/abstract/zarpin.js +11 -0
  57. package/js/src/baazar.d.ts +20 -20
  58. package/js/src/baazar.js +153 -153
  59. package/js/src/base/Exchange.d.ts +926 -926
  60. package/js/src/base/Exchange.js +7397 -7397
  61. package/js/src/coinbaseexchange.d.ts +334 -334
  62. package/js/src/daric.d.ts +22 -22
  63. package/js/src/daric.js +174 -174
  64. package/js/src/digikalagold.d.ts +21 -21
  65. package/js/src/digikalagold.js +171 -171
  66. package/js/src/goldika.d.ts +20 -20
  67. package/js/src/goldika.js +156 -156
  68. package/js/src/goldis.d.ts +21 -21
  69. package/js/src/goldis.js +150 -150
  70. package/js/src/hamrahgold.d.ts +21 -21
  71. package/js/src/hamrahgold.js +164 -164
  72. package/js/src/iranexchange.js +393 -393
  73. package/js/src/melligold.d.ts +21 -21
  74. package/js/src/melligold.js +217 -214
  75. package/js/src/milligold.d.ts +20 -20
  76. package/js/src/milligold.js +149 -149
  77. package/js/src/protobuf/mexc/compiled.d.cts +2 -2
  78. package/js/src/static_dependencies/fflake/browser.d.ts +222 -222
  79. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +101 -101
  80. package/js/src/static_dependencies/qs/formats.d.cts +8 -8
  81. package/js/src/static_dependencies/qs/index.d.cts +4 -4
  82. package/js/src/static_dependencies/qs/parse.d.cts +2 -2
  83. package/js/src/static_dependencies/qs/stringify.d.cts +2 -2
  84. package/js/src/static_dependencies/qs/utils.d.cts +9 -9
  85. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -5
  86. package/js/src/{goldcore.d.ts → talaavan.d.ts} +20 -20
  87. package/js/src/{goldcore.js → talaavan.js} +148 -148
  88. package/js/src/talapp.d.ts +20 -20
  89. package/js/src/talapp.js +149 -149
  90. package/js/src/technogold.d.ts +20 -20
  91. package/js/src/technogold.js +146 -146
  92. package/js/src/wallgold.d.ts +21 -21
  93. package/js/src/wallgold.js +157 -157
  94. package/js/src/zarafza.d.ts +20 -20
  95. package/js/src/zarafza.js +152 -152
  96. package/js/src/zarminex.d.ts +20 -20
  97. package/js/src/zarminex.js +155 -155
  98. package/js/src/zarniv.d.ts +21 -21
  99. package/js/src/zarniv.js +171 -171
  100. package/js/src/zarpin.d.ts +21 -0
  101. package/js/src/zarpin.js +184 -0
  102. package/js/test.js +27 -68
  103. package/package.json +1 -1
@@ -6,216 +6,219 @@ var Exchange = require('./base/Exchange.js');
6
6
  var errors = require('./base/errors.js');
7
7
 
8
8
  // ----------------------------------------------------------------------------
9
- // ---------------------------------------------------------------------------
10
- /**
11
- * @class melligold
12
- * @augments Exchange
13
- */
14
- class melligold extends Exchange["default"] {
15
- describe() {
16
- return this.deepExtend(super.describe(), {
17
- 'id': 'melligold',
18
- 'name': 'MelliGold',
19
- 'countries': ['IR'],
20
- 'rateLimit': 1000,
21
- 'version': '1',
22
- 'certified': false,
23
- 'pro': false,
24
- 'has': {
25
- 'CORS': undefined,
26
- 'spot': false,
27
- 'margin': false,
28
- 'swap': false,
29
- 'future': false,
30
- 'option': false,
31
- 'fetchMarkets': true,
32
- 'fetchTicker': true,
33
- 'fetchTickers': true,
34
- 'otc': true,
35
- },
36
- 'options': {
37
- 'defaultType': 'otc',
38
- 'melligoldCookie': undefined,
39
- 'manualRedirect': true,
40
- },
41
- 'urls': {
42
- 'api': {
43
- 'public': 'https://melligold.com',
44
- },
45
- 'www': 'https://melligold.com',
46
- 'doc': 'https://melligold.com',
47
- },
48
- 'api': {
49
- 'public': {
50
- 'get': {
51
- 'api/v1/exchange/buy-sell-price/': 1,
52
- },
53
- },
54
- },
55
- });
56
- }
57
- async fetchMarkets(params = {}) {
58
- const symbols = ['XAU18', 'XAG'];
59
- const result = [];
60
- for (let i = 0; i < symbols.length; i++) {
61
- const response = await this.requestWithCookie(this.extend({
62
- 'symbol': symbols[i],
63
- 'format': 'json',
64
- }, params));
65
- result.push(this.parseMarket(response, symbols[i]));
66
- }
67
- return result;
68
- }
69
- async requestWithCookie(params = {}) {
70
- let response = undefined;
71
- let error = undefined;
72
- try {
73
- response = await this.publicGetApiV1ExchangeBuySellPrice(params);
74
- }
75
- catch (e) {
76
- error = e;
77
- }
78
- if (this.safeValue(response, 'data') !== undefined) {
79
- return response;
80
- }
81
- const responseHeaders = this.last_response_headers || {};
82
- const setCookie = this.safeString(responseHeaders, 'Set-Cookie');
83
- if (setCookie !== undefined) {
84
- const cookies = setCookie.split(', ');
85
- const values = [];
86
- for (let i = 0; i < cookies.length; i++) {
87
- values.push(cookies[i].split(';')[0]);
88
- }
89
- const cookie = values.join('; ');
90
- if (cookie !== '' && cookie !== this.options['melligoldCookie']) {
91
- this.options['melligoldCookie'] = cookie;
92
- response = await this.publicGetApiV1ExchangeBuySellPrice(params);
93
- if (this.safeValue(response, 'data') !== undefined) {
94
- return response;
95
- }
96
- }
97
- }
98
- if (error !== undefined) {
99
- throw error;
100
- }
101
- throw new errors.ExchangeError(this.id + ' returned an invalid response');
102
- }
103
- parseMarket(response, baseId = undefined) {
104
- const data = this.safeDict(response, 'data', {});
105
- const lowerAmounts = this.safeDict(data, 'lower_amounts', {});
106
- const base = this.safeCurrencyCode(baseId);
107
- const quote = 'IRT';
108
- return {
109
- 'id': base + quote,
110
- 'symbol': base + '/' + quote,
111
- 'base': base,
112
- 'quote': quote,
113
- 'settle': undefined,
114
- 'baseId': baseId,
115
- 'quoteId': quote,
116
- 'settleId': undefined,
117
- 'type': 'otc',
118
- 'spot': false,
119
- 'margin': false,
120
- 'swap': false,
121
- 'future': false,
122
- 'option': false,
123
- 'active': true,
124
- 'contract': false,
125
- 'linear': undefined,
126
- 'inverse': undefined,
127
- 'contractSize': undefined,
128
- 'expiry': undefined,
129
- 'expiryDatetime': undefined,
130
- 'strike': undefined,
131
- 'optionType': undefined,
132
- 'precision': {
133
- 'amount': undefined,
134
- 'price': undefined,
135
- },
136
- 'limits': {
137
- 'leverage': { 'min': undefined, 'max': undefined },
138
- 'amount': { 'min': undefined, 'max': undefined },
139
- 'price': { 'min': undefined, 'max': undefined },
140
- 'cost': {
141
- 'min': this.safeNumber(lowerAmounts, 'buy_toman'),
142
- 'max': undefined,
143
- },
144
- },
145
- 'created': undefined,
146
- 'info': response,
147
- };
148
- }
149
- async fetchTicker(symbol, params = {}) {
150
- await this.loadMarkets();
151
- const market = this.market(symbol);
152
- const response = await this.requestWithCookie(this.extend({
153
- 'symbol': market['baseId'],
154
- 'format': 'json',
155
- }, params));
156
- return this.parseTicker(response, market);
157
- }
158
- async fetchTickers(symbols = undefined, params = {}) {
159
- await this.loadMarkets();
160
- if (symbols !== undefined) {
161
- symbols = this.marketSymbols(symbols);
162
- }
163
- const result = {};
164
- const marketSymbols = ['XAU18/IRT', 'XAG/IRT'];
165
- for (let i = 0; i < marketSymbols.length; i++) {
166
- const market = this.market(marketSymbols[i]);
167
- const response = await this.requestWithCookie(this.extend({
168
- 'symbol': market['baseId'],
169
- 'format': 'json',
170
- }, params));
171
- const ticker = this.parseTicker(response, market);
172
- result[ticker['symbol']] = ticker;
173
- }
174
- return this.filterByArrayTickers(result, 'symbol', symbols);
175
- }
176
- parseTicker(response, market = undefined) {
177
- const data = this.safeDict(response, 'data', {});
178
- const buy = this.safeNumber(data, 'price_buy');
179
- const sell = this.safeNumber(data, 'price_sell');
180
- return this.safeTicker({
181
- 'symbol': market['symbol'],
182
- 'timestamp': this.safeTimestamp(data, 'timestamp'),
183
- 'datetime': undefined,
184
- 'high': undefined,
185
- 'low': undefined,
186
- 'bid': sell,
187
- 'bidVolume': undefined,
188
- 'ask': buy,
189
- 'askVolume': undefined,
190
- 'vwap': undefined,
191
- 'open': undefined,
192
- 'close': buy,
193
- 'last': buy,
194
- 'previousClose': undefined,
195
- 'change': undefined,
196
- 'percentage': undefined,
197
- 'average': undefined,
198
- 'baseVolume': undefined,
199
- 'quoteVolume': undefined,
200
- 'info': response,
201
- }, market);
202
- }
203
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
204
- let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
205
- const query = this.omit(params, this.extractParams(path));
206
- if (Object.keys(query).length) {
207
- url += '?' + this.urlencode(query);
208
- }
209
- headers = {
210
- 'Accept': 'application/json',
211
- 'Content-Type': 'application/json',
212
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36',
213
- };
214
- if (this.options['melligoldCookie'] !== undefined) {
215
- headers['Cookie'] = this.options['melligoldCookie'];
216
- }
217
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
218
- }
9
+ // ---------------------------------------------------------------------------
10
+ /**
11
+ * @class melligold
12
+ * @augments Exchange
13
+ */
14
+ class melligold extends Exchange["default"] {
15
+ describe() {
16
+ return this.deepExtend(super.describe(), {
17
+ 'id': 'melligold',
18
+ 'name': 'MelliGold',
19
+ 'countries': ['IR'],
20
+ 'rateLimit': 1000,
21
+ 'version': '1',
22
+ 'certified': false,
23
+ 'pro': false,
24
+ 'has': {
25
+ 'CORS': undefined,
26
+ 'spot': false,
27
+ 'margin': false,
28
+ 'swap': false,
29
+ 'future': false,
30
+ 'option': false,
31
+ 'fetchMarkets': true,
32
+ 'fetchTicker': true,
33
+ 'fetchTickers': true,
34
+ 'otc': true,
35
+ },
36
+ 'options': {
37
+ 'defaultType': 'otc',
38
+ 'melligoldCookie': undefined,
39
+ 'manualRedirect': true,
40
+ },
41
+ 'urls': {
42
+ 'api': {
43
+ 'public': 'https://melligold.com',
44
+ },
45
+ 'www': 'https://melligold.com',
46
+ 'doc': 'https://melligold.com',
47
+ },
48
+ 'api': {
49
+ 'public': {
50
+ 'get': {
51
+ 'api/v1/exchange/buy-sell-price/': 1,
52
+ },
53
+ },
54
+ },
55
+ });
56
+ }
57
+ async fetchMarkets(params = {}) {
58
+ const symbols = ['XAU18', 'XAG'];
59
+ const result = [];
60
+ for (let i = 0; i < symbols.length; i++) {
61
+ const response = await this.requestWithCookie(this.extend({
62
+ 'symbol': symbols[i],
63
+ 'format': 'json',
64
+ }, params));
65
+ result.push(this.parseMarket(response, symbols[i]));
66
+ }
67
+ return result;
68
+ }
69
+ async requestWithCookie(params = {}) {
70
+ let response = undefined;
71
+ let error = undefined;
72
+ try {
73
+ response = await this.publicGetApiV1ExchangeBuySellPrice(params);
74
+ }
75
+ catch (e) {
76
+ error = e;
77
+ }
78
+ if (this.safeValue(response, 'data') !== undefined) {
79
+ return response;
80
+ }
81
+ const responseHeaders = this.last_response_headers || {};
82
+ const setCookie = this.safeString(responseHeaders, 'Set-Cookie');
83
+ if (setCookie !== undefined) {
84
+ const cookies = setCookie.split(', ');
85
+ const values = [];
86
+ for (let i = 0; i < cookies.length; i++) {
87
+ values.push(cookies[i].split(';')[0]);
88
+ }
89
+ const cookie = values.join('; ');
90
+ if (cookie !== '' && cookie !== this.options['melligoldCookie']) {
91
+ this.options['melligoldCookie'] = cookie;
92
+ response = await this.publicGetApiV1ExchangeBuySellPrice(params);
93
+ if (this.safeValue(response, 'data') !== undefined) {
94
+ return response;
95
+ }
96
+ }
97
+ }
98
+ if (error !== undefined) {
99
+ throw error;
100
+ }
101
+ throw new errors.ExchangeError(this.id + ' returned an invalid response');
102
+ }
103
+ parseMarket(response, baseId = undefined) {
104
+ const data = this.safeDict(response, 'data', {});
105
+ const lowerAmounts = this.safeDict(data, 'lower_amounts', {});
106
+ let base = this.safeCurrencyCode(baseId);
107
+ if (base === 'XAG') {
108
+ base = 'XAG-1G';
109
+ }
110
+ const quote = 'IRT';
111
+ return {
112
+ 'id': base + quote,
113
+ 'symbol': base + '/' + quote,
114
+ 'base': base,
115
+ 'quote': quote,
116
+ 'settle': undefined,
117
+ 'baseId': baseId,
118
+ 'quoteId': quote,
119
+ 'settleId': undefined,
120
+ 'type': 'otc',
121
+ 'spot': false,
122
+ 'margin': false,
123
+ 'swap': false,
124
+ 'future': false,
125
+ 'option': false,
126
+ 'active': true,
127
+ 'contract': false,
128
+ 'linear': undefined,
129
+ 'inverse': undefined,
130
+ 'contractSize': undefined,
131
+ 'expiry': undefined,
132
+ 'expiryDatetime': undefined,
133
+ 'strike': undefined,
134
+ 'optionType': undefined,
135
+ 'precision': {
136
+ 'amount': undefined,
137
+ 'price': undefined,
138
+ },
139
+ 'limits': {
140
+ 'leverage': { 'min': undefined, 'max': undefined },
141
+ 'amount': { 'min': undefined, 'max': undefined },
142
+ 'price': { 'min': undefined, 'max': undefined },
143
+ 'cost': {
144
+ 'min': this.safeNumber(lowerAmounts, 'buy_toman'),
145
+ 'max': undefined,
146
+ },
147
+ },
148
+ 'created': undefined,
149
+ 'info': response,
150
+ };
151
+ }
152
+ async fetchTicker(symbol, params = {}) {
153
+ await this.loadMarkets();
154
+ const market = this.market(symbol);
155
+ const response = await this.requestWithCookie(this.extend({
156
+ 'symbol': market['baseId'],
157
+ 'format': 'json',
158
+ }, params));
159
+ return this.parseTicker(response, market);
160
+ }
161
+ async fetchTickers(symbols = undefined, params = {}) {
162
+ await this.loadMarkets();
163
+ if (symbols !== undefined) {
164
+ symbols = this.marketSymbols(symbols);
165
+ }
166
+ const result = {};
167
+ const marketSymbols = ['XAU18/IRT', 'XAG-1G/IRT'];
168
+ for (let i = 0; i < marketSymbols.length; i++) {
169
+ const market = this.market(marketSymbols[i]);
170
+ const response = await this.requestWithCookie(this.extend({
171
+ 'symbol': market['baseId'],
172
+ 'format': 'json',
173
+ }, params));
174
+ const ticker = this.parseTicker(response, market);
175
+ result[ticker['symbol']] = ticker;
176
+ }
177
+ return this.filterByArrayTickers(result, 'symbol', symbols);
178
+ }
179
+ parseTicker(response, market = undefined) {
180
+ const data = this.safeDict(response, 'data', {});
181
+ const buy = this.safeNumber(data, 'price_buy');
182
+ const sell = this.safeNumber(data, 'price_sell');
183
+ return this.safeTicker({
184
+ 'symbol': market['symbol'],
185
+ 'timestamp': this.safeTimestamp(data, 'timestamp'),
186
+ 'datetime': undefined,
187
+ 'high': undefined,
188
+ 'low': undefined,
189
+ 'bid': sell,
190
+ 'bidVolume': undefined,
191
+ 'ask': buy,
192
+ 'askVolume': undefined,
193
+ 'vwap': undefined,
194
+ 'open': undefined,
195
+ 'close': buy,
196
+ 'last': buy,
197
+ 'previousClose': undefined,
198
+ 'change': undefined,
199
+ 'percentage': undefined,
200
+ 'average': undefined,
201
+ 'baseVolume': undefined,
202
+ 'quoteVolume': undefined,
203
+ 'info': response,
204
+ }, market);
205
+ }
206
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
207
+ let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
208
+ const query = this.omit(params, this.extractParams(path));
209
+ if (Object.keys(query).length) {
210
+ url += '?' + this.urlencode(query);
211
+ }
212
+ headers = {
213
+ 'Accept': 'application/json',
214
+ 'Content-Type': 'application/json',
215
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36',
216
+ };
217
+ if (this.options['melligoldCookie'] !== undefined) {
218
+ headers['Cookie'] = this.options['melligoldCookie'];
219
+ }
220
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
221
+ }
219
222
  }
220
223
 
221
224
  exports["default"] = melligold;