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