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