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,152 @@
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 technogold
12
+ * @augments Exchange
13
+ */
14
+ export default class technogold extends Exchange {
15
+ describe() {
16
+ return this.deepExtend(super.describe(), {
17
+ 'id': 'technogold',
18
+ 'name': 'Techno 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://api2.technogold.gold',
42
+ },
43
+ 'www': 'https://technogold.gold',
44
+ 'doc': 'https://technogold.gold',
45
+ },
46
+ 'api': {
47
+ 'public': {
48
+ 'get': {
49
+ 'customer/tradeables/only-price/1': 1,
50
+ },
51
+ },
52
+ },
53
+ });
54
+ }
55
+ async fetchMarkets(params = {}) {
56
+ const response = await this.publicGetCustomerTradeablesOnlyPrice1(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.safeBool(response, 'succeed', true),
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.publicGetCustomerTradeablesOnlyPrice1(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.publicGetCustomerTradeablesOnlyPrice1(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 prices = this.safeDict(response, 'results', {});
118
+ const buy = this.safeNumber(prices, 'buy_price');
119
+ const sell = this.safeNumber(prices, 'sell_price');
120
+ return this.safeTicker({
121
+ 'symbol': market['symbol'],
122
+ 'timestamp': undefined,
123
+ 'datetime': undefined,
124
+ 'high': undefined,
125
+ 'low': undefined,
126
+ 'bid': sell,
127
+ 'bidVolume': undefined,
128
+ 'ask': buy,
129
+ 'askVolume': undefined,
130
+ 'vwap': undefined,
131
+ 'open': undefined,
132
+ 'close': buy,
133
+ 'last': buy,
134
+ 'previousClose': undefined,
135
+ 'change': undefined,
136
+ 'percentage': undefined,
137
+ 'average': undefined,
138
+ 'baseVolume': undefined,
139
+ 'quoteVolume': undefined,
140
+ 'info': response,
141
+ }, market);
142
+ }
143
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
144
+ let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
145
+ const query = this.omit(params, this.extractParams(path));
146
+ if (Object.keys(query).length) {
147
+ url += '?' + this.urlencode(query);
148
+ }
149
+ headers = { 'Content-Type': 'application/json' };
150
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
151
+ }
152
+ }
@@ -0,0 +1,21 @@
1
+ import Exchange from './base/Exchange.js';
2
+ import { Market, Strings, Ticker, Tickers } from './base/types.js';
3
+ /**
4
+ * @class wallgold
5
+ * @augments Exchange
6
+ */
7
+ export default class wallgold extends Exchange {
8
+ describe(): any;
9
+ fetchMarkets(params?: {}): Promise<Market[]>;
10
+ fetchPrice(side: string, params?: {}): any;
11
+ parseMarket(response: any): Market;
12
+ fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
13
+ fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
14
+ parseTicker(buyResponse: any, market?: Market, sellResponse?: any): 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,163 @@
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 wallgold
12
+ * @augments Exchange
13
+ */
14
+ export default class wallgold extends Exchange {
15
+ describe() {
16
+ return this.deepExtend(super.describe(), {
17
+ 'id': 'wallgold',
18
+ 'name': 'WallGold',
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://api.wallgold.ir',
42
+ },
43
+ 'www': 'https://wallgold.ir',
44
+ 'doc': 'https://wallgold.ir',
45
+ },
46
+ 'api': {
47
+ 'public': {
48
+ 'get': {
49
+ 'api/v1/price': 1,
50
+ },
51
+ },
52
+ },
53
+ });
54
+ }
55
+ async fetchMarkets(params = {}) {
56
+ const response = await this.fetchPrice('buy', params);
57
+ return [this.parseMarket(response)];
58
+ }
59
+ fetchPrice(side, params = {}) {
60
+ return this.publicGetApiV1Price(this.extend({
61
+ 'side': side,
62
+ 'symbol': 'GLD_18C_750TMN',
63
+ }, params));
64
+ }
65
+ parseMarket(response) {
66
+ return {
67
+ 'id': 'XAU18IRT',
68
+ 'symbol': 'XAU18/IRT',
69
+ 'base': 'XAU18',
70
+ 'quote': 'IRT',
71
+ 'settle': undefined,
72
+ 'baseId': 'XAU18',
73
+ 'quoteId': 'IRT',
74
+ 'settleId': undefined,
75
+ 'type': 'otc',
76
+ 'spot': false,
77
+ 'margin': false,
78
+ 'swap': false,
79
+ 'future': false,
80
+ 'option': false,
81
+ 'active': this.safeBool(response, 'success', true),
82
+ 'contract': false,
83
+ 'linear': undefined,
84
+ 'inverse': undefined,
85
+ 'contractSize': undefined,
86
+ 'expiry': undefined,
87
+ 'expiryDatetime': undefined,
88
+ 'strike': undefined,
89
+ 'optionType': undefined,
90
+ 'precision': {
91
+ 'amount': undefined,
92
+ 'price': undefined,
93
+ },
94
+ 'limits': {
95
+ 'leverage': { 'min': undefined, 'max': undefined },
96
+ 'amount': { 'min': undefined, 'max': undefined },
97
+ 'price': { 'min': undefined, 'max': undefined },
98
+ 'cost': { 'min': undefined, 'max': undefined },
99
+ },
100
+ 'created': undefined,
101
+ 'info': response,
102
+ };
103
+ }
104
+ async fetchTicker(symbol, params = {}) {
105
+ await this.loadMarkets();
106
+ const market = this.market(symbol);
107
+ const buyResponse = await this.fetchPrice('buy', params);
108
+ const sellResponse = await this.fetchPrice('sell', params);
109
+ return this.parseTicker(buyResponse, market, sellResponse);
110
+ }
111
+ async fetchTickers(symbols = undefined, params = {}) {
112
+ await this.loadMarkets();
113
+ if (symbols !== undefined) {
114
+ symbols = this.marketSymbols(symbols);
115
+ }
116
+ const market = this.market('XAU18/IRT');
117
+ const buyResponse = await this.fetchPrice('buy', params);
118
+ const sellResponse = await this.fetchPrice('sell', params);
119
+ const ticker = this.parseTicker(buyResponse, market, sellResponse);
120
+ const result = {};
121
+ result[ticker['symbol']] = ticker;
122
+ return this.filterByArrayTickers(result, 'symbol', symbols);
123
+ }
124
+ parseTicker(buyResponse, market = undefined, sellResponse = undefined) {
125
+ const buyResult = this.safeDict(buyResponse, 'result', {});
126
+ const sellResult = this.safeDict(sellResponse, 'result', buyResult);
127
+ const bid = this.safeNumber(buyResult, 'price');
128
+ const ask = this.safeNumber(sellResult, 'price');
129
+ const currentTime = this.safeString(buyResult, 'currentTime');
130
+ const timestamp = currentTime ? this.parse8601(currentTime) : undefined;
131
+ return this.safeTicker({
132
+ 'symbol': market['symbol'],
133
+ 'timestamp': timestamp,
134
+ 'datetime': undefined,
135
+ 'high': undefined,
136
+ 'low': undefined,
137
+ 'bid': bid,
138
+ 'bidVolume': undefined,
139
+ 'ask': ask,
140
+ 'askVolume': undefined,
141
+ 'vwap': undefined,
142
+ 'open': undefined,
143
+ 'close': ask,
144
+ 'last': ask,
145
+ 'previousClose': undefined,
146
+ 'change': undefined,
147
+ 'percentage': undefined,
148
+ 'average': undefined,
149
+ 'baseVolume': undefined,
150
+ 'quoteVolume': undefined,
151
+ 'info': { 'buy': buyResponse, 'sell': sellResponse },
152
+ }, market);
153
+ }
154
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
155
+ let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
156
+ const query = this.omit(params, this.extractParams(path));
157
+ if (Object.keys(query).length) {
158
+ url += '?' + this.urlencode(query);
159
+ }
160
+ headers = { 'Content-Type': 'application/json' };
161
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
162
+ }
163
+ }
package/js/test.js CHANGED
@@ -4,82 +4,64 @@
4
4
  // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
  // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
6
 
7
- import raastin from './src/raastin.js';
8
- async function main() {
9
- const exchange = new raastin({
10
- enableRateLimit: true,
11
- timeout: 30000,
12
- });
7
+ import talasea from './src/talasea.js';
8
+ import melligold from './src/melligold.js';
9
+ import technogold from './src/technogold.js';
10
+ import wallgold from './src/wallgold.js';
11
+ import milligold from './src/milligold.js';
12
+ const exchanges = [
13
+ { id: 'talasea', create: () => new talasea({ enableRateLimit: true, timeout: 30000 }) },
14
+ { id: 'melligold', create: () => new melligold({ enableRateLimit: true, timeout: 30000 }) },
15
+ { id: 'technogold', create: () => new technogold({ enableRateLimit: true, timeout: 30000 }) },
16
+ { id: 'wallgold', create: () => new wallgold({ enableRateLimit: true, timeout: 30000 }) },
17
+ { id: 'milligold', create: () => new milligold({ enableRateLimit: true, timeout: 30000 }) },
18
+ ];
19
+ async function testExchange(id, create) {
20
+ const exchange = create();
13
21
  try {
14
- const spotMarkets = await exchange.loadMarkets(true, { 'type': 'spot' });
15
- const spotSymbols = [];
16
- const preferredSymbols = ['USDT/IRT', 'BTC/IRT', 'ETH/IRT'];
17
- for (let i = 0; i < preferredSymbols.length; i++) {
18
- const symbol = preferredSymbols[i];
19
- if (symbol in spotMarkets) {
20
- spotSymbols.push(symbol);
21
- }
22
+ const markets = await exchange.loadMarkets();
23
+ const symbols = Object.keys(markets);
24
+ if (symbols.length === 0) {
25
+ throw new Error('No OTC markets returned');
26
+ }
27
+ const symbol = symbols[0];
28
+ const ticker = await exchange.fetchTicker(symbol, { 'type': 'otc' });
29
+ const tickers = await exchange.fetchTickers(symbols, { 'type': 'otc' });
30
+ if (ticker['symbol'] !== symbol) {
31
+ throw new Error(`fetchTicker returned ${ticker['symbol']} instead of ${symbol}`);
22
32
  }
23
- if (spotSymbols.length === 0) {
24
- const marketSymbols = Object.keys(spotMarkets);
25
- for (let i = 0; i < marketSymbols.length; i++) {
26
- const symbol = marketSymbols[i];
27
- const market = spotMarkets[symbol];
28
- if (market['type'] === 'spot') {
29
- spotSymbols.push(symbol);
30
- }
31
- if (spotSymbols.length >= 3) {
32
- break;
33
- }
34
- }
33
+ if (!(symbol in tickers)) {
34
+ throw new Error(`fetchTickers did not return ${symbol}`);
35
35
  }
36
- console.log('spot symbols:', spotSymbols);
37
- const spotTickers = await exchange.fetchTickers(spotSymbols);
38
- console.log('spot tickers:');
39
- for (let i = 0; i < spotSymbols.length; i++) {
40
- const symbol = spotSymbols[i];
41
- const ticker = spotTickers[symbol];
42
- console.log({
36
+ console.log(id, {
37
+ markets: symbols,
38
+ ticker: {
43
39
  symbol: ticker['symbol'],
40
+ bid: ticker['bid'],
41
+ ask: ticker['ask'],
44
42
  last: ticker['last'],
45
- high: ticker['high'],
46
- low: ticker['low'],
47
- change: ticker['change'],
48
- percentage: ticker['percentage'],
49
- baseVolume: ticker['baseVolume'],
50
- quoteVolume: ticker['quoteVolume'],
51
- });
52
- }
53
- const singleSpotSymbol = spotSymbols[0];
54
- if (singleSpotSymbol !== undefined) {
55
- const singleSpotTicker = await exchange.fetchTicker(singleSpotSymbol);
56
- console.log('single spot ticker:', {
57
- symbol: singleSpotTicker['symbol'],
58
- last: singleSpotTicker['last'],
59
- change: singleSpotTicker['change'],
60
- percentage: singleSpotTicker['percentage'],
61
- });
43
+ timestamp: ticker['timestamp'],
44
+ },
45
+ });
46
+ }
47
+ finally {
48
+ await exchange.close();
49
+ }
50
+ }
51
+ async function main() {
52
+ let failed = false;
53
+ for (let i = 0; i < exchanges.length; i++) {
54
+ const exchange = exchanges[i];
55
+ try {
56
+ await testExchange(exchange.id, exchange.create);
62
57
  }
63
- const otcMarkets = await exchange.loadMarkets(true, { 'type': 'otc' });
64
- console.log('otc markets:', otcMarkets);
65
- const otcSymbols = Object.keys(otcMarkets);
66
- const otcSymbol = otcSymbols[0];
67
- if (otcSymbol !== undefined) {
68
- const otcTicker = await exchange.fetchTicker(otcSymbol, { 'type': 'otc' });
69
- console.log('single otc ticker:', {
70
- symbol: otcTicker['symbol'],
71
- last: otcTicker['last'],
72
- bid: otcTicker['bid'],
73
- ask: otcTicker['ask'],
74
- });
58
+ catch (error) {
59
+ failed = true;
60
+ console.error(`${exchange.id} test failed:`, error);
75
61
  }
76
62
  }
77
- catch (error) {
78
- console.error('Raastin ticker test failed:', error);
63
+ if (failed) {
79
64
  process.exitCode = 1;
80
65
  }
81
- finally {
82
- await exchange.close();
83
- }
84
66
  }
85
67
  void main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt-ir",
3
- "version": "4.16.3",
3
+ "version": "4.17.0",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.min.js",
6
6
  "type": "module",