ccxt-ir 4.16.3 → 4.17.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 (48) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +13 -1
  4. package/dist/cjs/package.json +1 -1
  5. package/dist/cjs/src/asacoine.js +359 -359
  6. package/dist/cjs/src/base/Exchange.js +7364 -7360
  7. package/dist/cjs/src/bitpin.js +478 -478
  8. package/dist/cjs/src/iranexchange.js +390 -390
  9. package/dist/cjs/src/melligold.js +221 -0
  10. package/dist/cjs/src/milligold.js +156 -0
  11. package/dist/cjs/src/technogold.js +153 -0
  12. package/dist/cjs/src/wallgold.js +164 -0
  13. package/js/ccxt.d.ts +14 -2
  14. package/js/ccxt.js +10 -2
  15. package/js/src/abstract/melligold.d.ts +8 -0
  16. package/js/src/abstract/melligold.js +11 -0
  17. package/js/src/abstract/milligold.d.ts +8 -0
  18. package/js/src/abstract/milligold.js +11 -0
  19. package/js/src/abstract/technogold.d.ts +8 -0
  20. package/js/src/abstract/technogold.js +11 -0
  21. package/js/src/abstract/wallgold.d.ts +8 -0
  22. package/js/src/abstract/wallgold.js +11 -0
  23. package/js/src/asacoine.d.ts +23 -23
  24. package/js/src/asacoine.js +363 -363
  25. package/js/src/base/Exchange.d.ts +2 -2
  26. package/js/src/base/Exchange.js +7397 -7393
  27. package/js/src/bitpin.js +481 -481
  28. package/js/src/coinbaseexchange.d.ts +1 -1
  29. package/js/src/iranexchange.js +393 -393
  30. package/js/src/melligold.d.ts +21 -0
  31. package/js/src/melligold.js +220 -0
  32. package/js/src/milligold.d.ts +20 -0
  33. package/js/src/milligold.js +155 -0
  34. package/js/src/protobuf/mexc/compiled.d.cts +0 -6
  35. package/js/src/static_dependencies/fflake/browser.d.ts +5 -5
  36. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
  37. package/js/src/static_dependencies/qs/formats.d.cts +0 -6
  38. package/js/src/static_dependencies/qs/index.d.cts +0 -6
  39. package/js/src/static_dependencies/qs/parse.d.cts +0 -6
  40. package/js/src/static_dependencies/qs/stringify.d.cts +0 -6
  41. package/js/src/static_dependencies/qs/utils.d.cts +0 -6
  42. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +1 -1
  43. package/js/src/technogold.d.ts +20 -0
  44. package/js/src/technogold.js +152 -0
  45. package/js/src/wallgold.d.ts +21 -0
  46. package/js/src/wallgold.js +163 -0
  47. package/js/test.js +49 -67
  48. package/package.json +1 -1
@@ -0,0 +1,221 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var Exchange = require('./base/Exchange.js');
6
+ var errors = require('./base/errors.js');
7
+
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
+ }
219
+ }
220
+
221
+ exports["default"] = melligold;
@@ -0,0 +1,156 @@
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 milligold
11
+ * @augments Exchange
12
+ */
13
+ class milligold extends Exchange["default"] {
14
+ describe() {
15
+ return this.deepExtend(super.describe(), {
16
+ 'id': 'milligold',
17
+ 'name': 'Milli Gold',
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://milli.gold',
41
+ },
42
+ 'www': 'https://milli.gold',
43
+ 'doc': 'https://milli.gold',
44
+ },
45
+ 'api': {
46
+ 'public': {
47
+ 'get': {
48
+ 'api/v1/public/milli-price/external': 1,
49
+ },
50
+ },
51
+ },
52
+ });
53
+ }
54
+ async fetchMarkets(params = {}) {
55
+ const response = await this.publicGetApiV1PublicMilliPriceExternal(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.safeInteger(response, 'code') === 0,
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.publicGetApiV1PublicMilliPriceExternal(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 market = this.market('XAU18/IRT');
109
+ const response = await this.publicGetApiV1PublicMilliPriceExternal(params);
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
+ const price = this.safeNumber(data, 'price18');
118
+ const date = this.safeString(data, 'date');
119
+ const timestamp = date ? this.parse8601(date) : undefined;
120
+ // The endpoint returns the price of 0.01g; normalize to the 1g XAU18 market price.
121
+ const pricePerGram = price * 100;
122
+ return this.safeTicker({
123
+ 'symbol': market['symbol'],
124
+ 'timestamp': timestamp,
125
+ 'datetime': undefined,
126
+ 'high': undefined,
127
+ 'low': undefined,
128
+ 'bid': pricePerGram,
129
+ 'bidVolume': undefined,
130
+ 'ask': pricePerGram,
131
+ 'askVolume': undefined,
132
+ 'vwap': undefined,
133
+ 'open': undefined,
134
+ 'close': pricePerGram,
135
+ 'last': pricePerGram,
136
+ 'previousClose': undefined,
137
+ 'change': undefined,
138
+ 'percentage': undefined,
139
+ 'average': undefined,
140
+ 'baseVolume': undefined,
141
+ 'quoteVolume': undefined,
142
+ 'info': response,
143
+ }, market);
144
+ }
145
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
146
+ let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
147
+ const query = this.omit(params, this.extractParams(path));
148
+ if (Object.keys(query).length) {
149
+ url += '?' + this.urlencode(query);
150
+ }
151
+ headers = { 'Content-Type': 'application/json' };
152
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
153
+ }
154
+ }
155
+
156
+ exports["default"] = milligold;
@@ -0,0 +1,153 @@
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 technogold
11
+ * @augments Exchange
12
+ */
13
+ class technogold extends Exchange["default"] {
14
+ describe() {
15
+ return this.deepExtend(super.describe(), {
16
+ 'id': 'technogold',
17
+ 'name': 'Techno Gold',
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://api2.technogold.gold',
41
+ },
42
+ 'www': 'https://technogold.gold',
43
+ 'doc': 'https://technogold.gold',
44
+ },
45
+ 'api': {
46
+ 'public': {
47
+ 'get': {
48
+ 'customer/tradeables/only-price/1': 1,
49
+ },
50
+ },
51
+ },
52
+ });
53
+ }
54
+ async fetchMarkets(params = {}) {
55
+ const response = await this.publicGetCustomerTradeablesOnlyPrice1(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, 'succeed', true),
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.publicGetCustomerTradeablesOnlyPrice1(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 market = this.market('XAU18/IRT');
109
+ const response = await this.publicGetCustomerTradeablesOnlyPrice1(params);
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 prices = this.safeDict(response, 'results', {});
117
+ const buy = this.safeNumber(prices, 'buy_price');
118
+ const sell = this.safeNumber(prices, 'sell_price');
119
+ return this.safeTicker({
120
+ 'symbol': market['symbol'],
121
+ 'timestamp': undefined,
122
+ 'datetime': undefined,
123
+ 'high': undefined,
124
+ 'low': undefined,
125
+ 'bid': sell,
126
+ 'bidVolume': undefined,
127
+ 'ask': buy,
128
+ 'askVolume': undefined,
129
+ 'vwap': undefined,
130
+ 'open': undefined,
131
+ 'close': buy,
132
+ 'last': buy,
133
+ 'previousClose': undefined,
134
+ 'change': undefined,
135
+ 'percentage': undefined,
136
+ 'average': undefined,
137
+ 'baseVolume': undefined,
138
+ 'quoteVolume': undefined,
139
+ 'info': response,
140
+ }, market);
141
+ }
142
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
143
+ let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
144
+ const query = this.omit(params, this.extractParams(path));
145
+ if (Object.keys(query).length) {
146
+ url += '?' + this.urlencode(query);
147
+ }
148
+ headers = { 'Content-Type': 'application/json' };
149
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
150
+ }
151
+ }
152
+
153
+ exports["default"] = technogold;
@@ -0,0 +1,164 @@
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 wallgold
11
+ * @augments Exchange
12
+ */
13
+ class wallgold extends Exchange["default"] {
14
+ describe() {
15
+ return this.deepExtend(super.describe(), {
16
+ 'id': 'wallgold',
17
+ 'name': 'WallGold',
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.wallgold.ir',
41
+ },
42
+ 'www': 'https://wallgold.ir',
43
+ 'doc': 'https://wallgold.ir',
44
+ },
45
+ 'api': {
46
+ 'public': {
47
+ 'get': {
48
+ 'api/v1/price': 1,
49
+ },
50
+ },
51
+ },
52
+ });
53
+ }
54
+ async fetchMarkets(params = {}) {
55
+ const response = await this.fetchPrice('buy', params);
56
+ return [this.parseMarket(response)];
57
+ }
58
+ fetchPrice(side, params = {}) {
59
+ return this.publicGetApiV1Price(this.extend({
60
+ 'side': side,
61
+ 'symbol': 'GLD_18C_750TMN',
62
+ }, params));
63
+ }
64
+ parseMarket(response) {
65
+ return {
66
+ 'id': 'XAU18IRT',
67
+ 'symbol': 'XAU18/IRT',
68
+ 'base': 'XAU18',
69
+ 'quote': 'IRT',
70
+ 'settle': undefined,
71
+ 'baseId': 'XAU18',
72
+ 'quoteId': 'IRT',
73
+ 'settleId': undefined,
74
+ 'type': 'otc',
75
+ 'spot': false,
76
+ 'margin': false,
77
+ 'swap': false,
78
+ 'future': false,
79
+ 'option': false,
80
+ 'active': this.safeBool(response, 'success', true),
81
+ 'contract': false,
82
+ 'linear': undefined,
83
+ 'inverse': undefined,
84
+ 'contractSize': undefined,
85
+ 'expiry': undefined,
86
+ 'expiryDatetime': undefined,
87
+ 'strike': undefined,
88
+ 'optionType': undefined,
89
+ 'precision': {
90
+ 'amount': undefined,
91
+ 'price': undefined,
92
+ },
93
+ 'limits': {
94
+ 'leverage': { 'min': undefined, 'max': undefined },
95
+ 'amount': { 'min': undefined, 'max': undefined },
96
+ 'price': { 'min': undefined, 'max': undefined },
97
+ 'cost': { 'min': undefined, 'max': undefined },
98
+ },
99
+ 'created': undefined,
100
+ 'info': response,
101
+ };
102
+ }
103
+ async fetchTicker(symbol, params = {}) {
104
+ await this.loadMarkets();
105
+ const market = this.market(symbol);
106
+ const buyResponse = await this.fetchPrice('buy', params);
107
+ const sellResponse = await this.fetchPrice('sell', params);
108
+ return this.parseTicker(buyResponse, market, sellResponse);
109
+ }
110
+ async fetchTickers(symbols = undefined, params = {}) {
111
+ await this.loadMarkets();
112
+ if (symbols !== undefined) {
113
+ symbols = this.marketSymbols(symbols);
114
+ }
115
+ const market = this.market('XAU18/IRT');
116
+ const buyResponse = await this.fetchPrice('buy', params);
117
+ const sellResponse = await this.fetchPrice('sell', params);
118
+ const ticker = this.parseTicker(buyResponse, market, sellResponse);
119
+ const result = {};
120
+ result[ticker['symbol']] = ticker;
121
+ return this.filterByArrayTickers(result, 'symbol', symbols);
122
+ }
123
+ parseTicker(buyResponse, market = undefined, sellResponse = undefined) {
124
+ const buyResult = this.safeDict(buyResponse, 'result', {});
125
+ const sellResult = this.safeDict(sellResponse, 'result', buyResult);
126
+ const bid = this.safeNumber(buyResult, 'price');
127
+ const ask = this.safeNumber(sellResult, 'price');
128
+ const currentTime = this.safeString(buyResult, 'currentTime');
129
+ const timestamp = currentTime ? this.parse8601(currentTime) : undefined;
130
+ return this.safeTicker({
131
+ 'symbol': market['symbol'],
132
+ 'timestamp': timestamp,
133
+ 'datetime': undefined,
134
+ 'high': undefined,
135
+ 'low': undefined,
136
+ 'bid': bid,
137
+ 'bidVolume': undefined,
138
+ 'ask': ask,
139
+ 'askVolume': undefined,
140
+ 'vwap': undefined,
141
+ 'open': undefined,
142
+ 'close': ask,
143
+ 'last': ask,
144
+ 'previousClose': undefined,
145
+ 'change': undefined,
146
+ 'percentage': undefined,
147
+ 'average': undefined,
148
+ 'baseVolume': undefined,
149
+ 'quoteVolume': undefined,
150
+ 'info': { 'buy': buyResponse, 'sell': sellResponse },
151
+ }, market);
152
+ }
153
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
154
+ let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
155
+ const query = this.omit(params, this.extractParams(path));
156
+ if (Object.keys(query).length) {
157
+ url += '?' + this.urlencode(query);
158
+ }
159
+ headers = { 'Content-Type': 'application/json' };
160
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
161
+ }
162
+ }
163
+
164
+ exports["default"] = wallgold;