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.
- package/README.md +4 -4
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +252 -240
- package/dist/cjs/src/asacoine.js +19 -7
- package/dist/cjs/src/base/Exchange.js +7364 -7360
- package/dist/cjs/src/bitpin.js +1 -1
- package/dist/cjs/src/iranexchange.js +390 -390
- package/dist/cjs/src/melligold.js +221 -0
- package/dist/cjs/src/milligold.js +156 -0
- package/dist/cjs/src/technogold.js +153 -0
- package/dist/cjs/src/wallgold.js +164 -0
- package/js/ccxt.d.ts +718 -706
- package/js/ccxt.js +521 -513
- package/js/src/abstract/melligold.d.ts +8 -0
- package/js/src/abstract/melligold.js +11 -0
- package/js/src/abstract/milligold.d.ts +8 -0
- package/js/src/abstract/milligold.js +11 -0
- package/js/src/abstract/technogold.d.ts +8 -0
- package/js/src/abstract/technogold.js +11 -0
- package/js/src/abstract/wallgold.d.ts +8 -0
- package/js/src/abstract/wallgold.js +11 -0
- package/js/src/asacoine.js +19 -7
- package/js/src/base/Exchange.d.ts +926 -926
- package/js/src/base/Exchange.js +7397 -7393
- package/js/src/bitpin.js +1 -1
- package/js/src/coinbaseexchange.d.ts +334 -334
- package/js/src/iranexchange.js +393 -393
- package/js/src/melligold.d.ts +21 -0
- package/js/src/melligold.js +220 -0
- package/js/src/milligold.d.ts +20 -0
- package/js/src/milligold.js +155 -0
- package/js/src/protobuf/mexc/compiled.d.cts +2 -2
- package/js/src/static_dependencies/fflake/browser.d.ts +222 -222
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +101 -101
- package/js/src/static_dependencies/qs/formats.d.cts +8 -8
- package/js/src/static_dependencies/qs/index.d.cts +4 -4
- package/js/src/static_dependencies/qs/parse.d.cts +2 -2
- package/js/src/static_dependencies/qs/stringify.d.cts +2 -2
- package/js/src/static_dependencies/qs/utils.d.cts +9 -9
- package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -5
- package/js/src/technogold.d.ts +20 -0
- package/js/src/technogold.js +152 -0
- package/js/src/wallgold.d.ts +21 -0
- package/js/src/wallgold.js +163 -0
- package/js/test.js +61 -79
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import formats = require("./formats.cjs");
|
|
2
|
-
import parse = require("./parse.cjs");
|
|
3
|
-
import stringify = require("./stringify.cjs");
|
|
4
|
-
export { formats, parse, stringify };
|
|
1
|
+
import formats = require("./formats.cjs");
|
|
2
|
+
import parse = require("./parse.cjs");
|
|
3
|
+
import stringify = require("./stringify.cjs");
|
|
4
|
+
export { formats, parse, stringify };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function _exports(str: any, opts: any): any;
|
|
2
|
-
export = _exports;
|
|
1
|
+
declare function _exports(str: any, opts: any): any;
|
|
2
|
+
export = _exports;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function _exports(object: any, opts: any): string;
|
|
2
|
-
export = _exports;
|
|
1
|
+
declare function _exports(object: any, opts: any): string;
|
|
2
|
+
export = _exports;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export function arrayToObject(source: any, options: any): any;
|
|
2
|
-
export function assign(target: any, source: any): any;
|
|
3
|
-
export function combine(a: any, b: any): any[];
|
|
4
|
-
export function compact(value: any): any;
|
|
5
|
-
export function decode(str: any, decoder: any, charset: any): any;
|
|
6
|
-
export function encode(str: any, defaultEncoder: any, charset: any): any;
|
|
7
|
-
export function isBuffer(obj: any): boolean;
|
|
8
|
-
export function isRegExp(obj: any): boolean;
|
|
9
|
-
export function merge(target: any, source: any, options: any): any;
|
|
1
|
+
export function arrayToObject(source: any, options: any): any;
|
|
2
|
+
export function assign(target: any, source: any): any;
|
|
3
|
+
export function combine(a: any, b: any): any[];
|
|
4
|
+
export function compact(value: any): any;
|
|
5
|
+
export function decode(str: any, decoder: any, charset: any): any;
|
|
6
|
+
export function encode(str: any, defaultEncoder: any, charset: any): any;
|
|
7
|
+
export function isBuffer(obj: any): boolean;
|
|
8
|
+
export function isRegExp(obj: any): boolean;
|
|
9
|
+
export function merge(target: any, source: any, options: any): any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Abi, FunctionAbi, RawArgs } from '../../../types/index.js';
|
|
2
|
-
import { AbiParserInterface } from './interface.js';
|
|
3
|
-
export declare function createAbiParser(abi: Abi): AbiParserInterface;
|
|
4
|
-
export declare function getAbiVersion(abi: Abi): 1 | 0 | 2;
|
|
5
|
-
export declare function isNoConstructorValid(method: string, argsCalldata: RawArgs, abiMethod?: FunctionAbi): boolean;
|
|
1
|
+
import { Abi, FunctionAbi, RawArgs } from '../../../types/index.js';
|
|
2
|
+
import { AbiParserInterface } from './interface.js';
|
|
3
|
+
export declare function createAbiParser(abi: Abi): AbiParserInterface;
|
|
4
|
+
export declare function getAbiVersion(abi: Abi): 1 | 0 | 2;
|
|
5
|
+
export declare function isNoConstructorValid(method: string, argsCalldata: RawArgs, abiMethod?: FunctionAbi): boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Exchange from './base/Exchange.js';
|
|
2
|
+
import { Market, Strings, Ticker, Tickers } from './base/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @class technogold
|
|
5
|
+
* @augments Exchange
|
|
6
|
+
*/
|
|
7
|
+
export default class technogold 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,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
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
console.log(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
catch (error) {
|
|
78
|
-
console.error('Raastin ticker test failed:', error);
|
|
79
|
-
process.exitCode = 1;
|
|
80
|
-
}
|
|
81
|
-
finally {
|
|
82
|
-
await exchange.close();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
void main();
|
|
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();
|
|
21
|
+
try {
|
|
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}`);
|
|
32
|
+
}
|
|
33
|
+
if (!(symbol in tickers)) {
|
|
34
|
+
throw new Error(`fetchTickers did not return ${symbol}`);
|
|
35
|
+
}
|
|
36
|
+
console.log(id, {
|
|
37
|
+
markets: symbols,
|
|
38
|
+
ticker: {
|
|
39
|
+
symbol: ticker['symbol'],
|
|
40
|
+
bid: ticker['bid'],
|
|
41
|
+
ask: ticker['ask'],
|
|
42
|
+
last: ticker['last'],
|
|
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);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
failed = true;
|
|
60
|
+
console.error(`${exchange.id} test failed:`, error);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (failed) {
|
|
64
|
+
process.exitCode = 1;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
void main();
|
package/package.json
CHANGED