ccxt-ir 4.16.3 → 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 (104) 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 +46 -1
  6. package/dist/cjs/src/asacoine.js +359 -359
  7. package/dist/cjs/src/baazar.js +160 -0
  8. package/dist/cjs/src/base/Exchange.js +7364 -7360
  9. package/dist/cjs/src/bitpin.js +478 -478
  10. package/dist/cjs/src/daric.js +181 -0
  11. package/dist/cjs/src/digikalagold.js +178 -0
  12. package/dist/cjs/src/goldcore.js +155 -0
  13. package/dist/cjs/src/goldika.js +163 -0
  14. package/dist/cjs/src/goldis.js +157 -0
  15. package/dist/cjs/src/hamrahgold.js +171 -0
  16. package/dist/cjs/src/iranexchange.js +390 -390
  17. package/dist/cjs/src/melligold.js +221 -0
  18. package/dist/cjs/src/milligold.js +156 -0
  19. package/dist/cjs/src/talapp.js +156 -0
  20. package/dist/cjs/src/technogold.js +153 -0
  21. package/dist/cjs/src/wallgold.js +164 -0
  22. package/dist/cjs/src/zarafza.js +159 -0
  23. package/dist/cjs/src/zarminex.js +162 -0
  24. package/dist/cjs/src/zarniv.js +178 -0
  25. package/js/ccxt.d.ts +47 -2
  26. package/js/ccxt.js +32 -2
  27. package/js/src/abstract/baazar.d.ts +8 -0
  28. package/js/src/abstract/baazar.js +11 -0
  29. package/js/src/abstract/daric.d.ts +8 -0
  30. package/js/src/abstract/daric.js +11 -0
  31. package/js/src/abstract/digikalagold.d.ts +8 -0
  32. package/js/src/abstract/digikalagold.js +11 -0
  33. package/js/src/abstract/goldcore.d.ts +8 -0
  34. package/js/src/abstract/goldcore.js +11 -0
  35. package/js/src/abstract/goldika.d.ts +8 -0
  36. package/js/src/abstract/goldika.js +11 -0
  37. package/js/src/abstract/goldis.d.ts +8 -0
  38. package/js/src/abstract/goldis.js +11 -0
  39. package/js/src/abstract/hamrahgold.d.ts +8 -0
  40. package/js/src/abstract/hamrahgold.js +11 -0
  41. package/js/src/abstract/melligold.d.ts +8 -0
  42. package/js/src/abstract/melligold.js +11 -0
  43. package/js/src/abstract/milligold.d.ts +8 -0
  44. package/js/src/abstract/milligold.js +11 -0
  45. package/js/src/abstract/talapp.d.ts +8 -0
  46. package/js/src/abstract/talapp.js +11 -0
  47. package/js/src/abstract/technogold.d.ts +8 -0
  48. package/js/src/abstract/technogold.js +11 -0
  49. package/js/src/abstract/wallgold.d.ts +8 -0
  50. package/js/src/abstract/wallgold.js +11 -0
  51. package/js/src/abstract/zarafza.d.ts +8 -0
  52. package/js/src/abstract/zarafza.js +11 -0
  53. package/js/src/abstract/zarminex.d.ts +8 -0
  54. package/js/src/abstract/zarminex.js +11 -0
  55. package/js/src/abstract/zarniv.d.ts +9 -0
  56. package/js/src/abstract/zarniv.js +11 -0
  57. package/js/src/asacoine.d.ts +23 -23
  58. package/js/src/asacoine.js +363 -363
  59. package/js/src/baazar.d.ts +20 -0
  60. package/js/src/baazar.js +159 -0
  61. package/js/src/base/Exchange.d.ts +2 -2
  62. package/js/src/base/Exchange.js +7397 -7393
  63. package/js/src/bitpin.js +481 -481
  64. package/js/src/coinbaseexchange.d.ts +1 -1
  65. package/js/src/daric.d.ts +22 -0
  66. package/js/src/daric.js +180 -0
  67. package/js/src/digikalagold.d.ts +21 -0
  68. package/js/src/digikalagold.js +177 -0
  69. package/js/src/goldcore.d.ts +20 -0
  70. package/js/src/goldcore.js +154 -0
  71. package/js/src/goldika.d.ts +20 -0
  72. package/js/src/goldika.js +162 -0
  73. package/js/src/goldis.d.ts +21 -0
  74. package/js/src/goldis.js +156 -0
  75. package/js/src/hamrahgold.d.ts +21 -0
  76. package/js/src/hamrahgold.js +170 -0
  77. package/js/src/iranexchange.js +393 -393
  78. package/js/src/melligold.d.ts +21 -0
  79. package/js/src/melligold.js +220 -0
  80. package/js/src/milligold.d.ts +20 -0
  81. package/js/src/milligold.js +155 -0
  82. package/js/src/protobuf/mexc/compiled.d.cts +0 -6
  83. package/js/src/static_dependencies/fflake/browser.d.ts +5 -5
  84. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
  85. package/js/src/static_dependencies/qs/formats.d.cts +0 -6
  86. package/js/src/static_dependencies/qs/index.d.cts +0 -6
  87. package/js/src/static_dependencies/qs/parse.d.cts +0 -6
  88. package/js/src/static_dependencies/qs/stringify.d.cts +0 -6
  89. package/js/src/static_dependencies/qs/utils.d.cts +0 -6
  90. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +1 -1
  91. package/js/src/talapp.d.ts +20 -0
  92. package/js/src/talapp.js +155 -0
  93. package/js/src/technogold.d.ts +20 -0
  94. package/js/src/technogold.js +152 -0
  95. package/js/src/wallgold.d.ts +21 -0
  96. package/js/src/wallgold.js +163 -0
  97. package/js/src/zarafza.d.ts +20 -0
  98. package/js/src/zarafza.js +158 -0
  99. package/js/src/zarminex.d.ts +20 -0
  100. package/js/src/zarminex.js +161 -0
  101. package/js/src/zarniv.d.ts +21 -0
  102. package/js/src/zarniv.js +177 -0
  103. package/js/test.js +60 -71
  104. 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,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 talapp
11
+ * @augments Exchange
12
+ */
13
+ class talapp extends Exchange["default"] {
14
+ describe() {
15
+ return this.deepExtend(super.describe(), {
16
+ 'id': 'talapp',
17
+ 'name': 'Talapp',
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://talapp.ir',
41
+ },
42
+ 'www': 'https://talapp.ir',
43
+ 'doc': 'https://talapp.ir/wp-json/talapp/v1/gold-prices',
44
+ },
45
+ 'api': {
46
+ 'public': {
47
+ 'get': {
48
+ 'wp-json/talapp/v1/gold-prices': 1,
49
+ },
50
+ },
51
+ },
52
+ });
53
+ }
54
+ async fetchMarkets(params = {}) {
55
+ const response = await this.publicGetWpJsonTalappV1GoldPrices(params);
56
+ return [this.parseMarket(response)];
57
+ }
58
+ parseMarket(response) {
59
+ const stale = this.safeBool(response, 'stale', false);
60
+ return {
61
+ 'id': 'XAU18IRT',
62
+ 'symbol': 'XAU18/IRT',
63
+ 'base': 'XAU18',
64
+ 'quote': 'IRT',
65
+ 'settle': undefined,
66
+ 'baseId': 'XAU18',
67
+ 'quoteId': 'IRT',
68
+ 'settleId': undefined,
69
+ 'type': 'otc',
70
+ 'spot': false,
71
+ 'margin': false,
72
+ 'swap': false,
73
+ 'future': false,
74
+ 'option': false,
75
+ 'active': !stale,
76
+ 'contract': false,
77
+ 'linear': undefined,
78
+ 'inverse': undefined,
79
+ 'contractSize': undefined,
80
+ 'expiry': undefined,
81
+ 'expiryDatetime': undefined,
82
+ 'strike': undefined,
83
+ 'optionType': undefined,
84
+ 'precision': {
85
+ 'amount': undefined,
86
+ 'price': undefined,
87
+ },
88
+ 'limits': {
89
+ 'leverage': { 'min': undefined, 'max': undefined },
90
+ 'amount': { 'min': undefined, 'max': undefined },
91
+ 'price': { 'min': undefined, 'max': undefined },
92
+ 'cost': { 'min': undefined, 'max': undefined },
93
+ },
94
+ 'created': undefined,
95
+ 'info': response,
96
+ };
97
+ }
98
+ async fetchTicker(symbol, params = {}) {
99
+ await this.loadMarkets();
100
+ const market = this.market(symbol);
101
+ const response = await this.publicGetWpJsonTalappV1GoldPrices(params);
102
+ return this.parseTicker(response, market);
103
+ }
104
+ async fetchTickers(symbols = undefined, params = {}) {
105
+ await this.loadMarkets();
106
+ if (symbols !== undefined) {
107
+ symbols = this.marketSymbols(symbols);
108
+ }
109
+ const response = await this.publicGetWpJsonTalappV1GoldPrices(params);
110
+ const market = this.market('XAU18/IRT');
111
+ const ticker = this.parseTicker(response, market);
112
+ const result = {};
113
+ result[ticker['symbol']] = ticker;
114
+ return this.filterByArrayTickers(result, 'symbol', symbols);
115
+ }
116
+ parseTicker(response, market = undefined) {
117
+ const fetchedAt = this.safeString(response, 'fetched_at');
118
+ let timestamp = undefined;
119
+ if (fetchedAt !== undefined) {
120
+ timestamp = this.parse8601(fetchedAt.replace(' ', 'T') + '+03:30');
121
+ }
122
+ return this.safeTicker({
123
+ 'symbol': market['symbol'],
124
+ 'timestamp': timestamp,
125
+ 'datetime': undefined,
126
+ 'high': undefined,
127
+ 'low': undefined,
128
+ 'bid': this.safeNumber(response, 'buy_gold'),
129
+ 'bidVolume': undefined,
130
+ 'ask': this.safeNumber(response, 'sell_gold'),
131
+ 'askVolume': undefined,
132
+ 'vwap': undefined,
133
+ 'open': undefined,
134
+ 'close': this.safeNumber(response, 'sell_gold'),
135
+ 'last': this.safeNumber(response, 'sell_gold'),
136
+ 'previousClose': undefined,
137
+ 'change': undefined,
138
+ 'percentage': this.safeNumber(response, 'sell_diff'),
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 = { 'Accept': 'application/json' };
152
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
153
+ }
154
+ }
155
+
156
+ exports["default"] = talapp;
@@ -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;