google-finance-quote 2.0.2 → 2.0.4

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 CHANGED
@@ -1,48 +1,50 @@
1
- # google-finance-quote
2
- Node Google Finance API wrapper for free.
3
- No API key is required!
4
- > Note: This results may vary by up to 20 minutes.
5
- ## Usage
6
- ### Get Started
7
- ```js
8
- const { Finance, symbols } = require("google-finance-quote");
9
-
10
- console.log(symbols); // Returns available symbols.
11
-
12
- const finance = new Finance(); // You can use this: new Finance({ from 'USD', to: 'JPY' });
13
- // You can use http(s) proxies.
14
- /*
15
- const proxy = {
16
- host: 'example.com',
17
- port: 2000,
18
- protocol: 'http'
19
- }
20
- const finance = new Finance({ proxy });
21
- */
22
-
23
- finance
24
- .setFrom('USD');
25
- .setTo('JPY');
26
-
27
- (async () => {
28
- console.log(await finance.quote()); // { success: true, rate: 150.94225699999998 }
29
- })();
30
- ```
31
- ### Class
32
- <strong>Finance({ from?:string, to?:string, proxy?:object })</strong>
33
-
34
- ### Functions
35
- - <strong>.setFrom(from: string)</strong>
36
- Set the parameter of from.
37
-
38
- - <strong>.setTo(to: string)</strong>
39
- Set the parameter of to.
40
-
41
- - <strong>.getParam(): object</strong>
42
- Returns the current param.
43
-
44
- - <strong>.quote(amount?: number): Promise<{ success: boolean, rate: number }></strong>
45
- Returns the converted amount based on the exchange rate.
46
- > Note: If the current rate cannot be obtained due to rate limits or network errors, success: false is returned.
47
- ## Get Support
48
- <a href="https://discord.gg/yKW8wWKCnS"><img src="https://discordapp.com/api/guilds/1005287561582878800/widget.png?style=banner4" alt="Discord Banner"/></a>
1
+ # google-finance-quote
2
+ Node Google Finance API wrapper for free.
3
+ No API key is required!
4
+ > Note: This results may vary by up to 20 minutes.
5
+ ## Usage
6
+ ### Get Started
7
+ ```js
8
+ const { Finance, symbols, currencyCodesSymbols, cryptoCurrencyCodesSymbols } = require("google-finance-quote");
9
+
10
+ console.log(symbols); // Returns available symbols.
11
+ console.log(currencyCodesSymbols); // Returns available currency codes symbols.
12
+ console.log(cryptoCurrencyCodesSymbols); // Returns available crypto currency codes symbols.
13
+
14
+ const finance = new Finance(); // You can use this: new Finance({ from 'USD', to: 'JPY' });
15
+ // You can use http(s) proxies.
16
+ /*
17
+ const proxy = {
18
+ host: 'example.com',
19
+ port: 2000,
20
+ protocol: 'http'
21
+ }
22
+ const finance = new Finance({ proxy });
23
+ */
24
+
25
+ finance
26
+ .setFrom('USD');
27
+ .setTo('JPY');
28
+
29
+ (async () => {
30
+ console.log(await finance.quote()); // { success: true, rate: 150.94225699999998 }
31
+ })();
32
+ ```
33
+ ### Class
34
+ <strong>Finance({ from?:string, to?:string, proxy?:object })</strong>
35
+
36
+ ### Functions
37
+ - <strong>.setFrom(from: string)</strong>
38
+ Set the parameter of from.
39
+
40
+ - <strong>.setTo(to: string)</strong>
41
+ Set the parameter of to.
42
+
43
+ - <strong>.getParam(): object</strong>
44
+ Returns the current param.
45
+
46
+ - <strong>.quote(amount?: number): Promise<{ success: boolean, rate: number }></strong>
47
+ Returns the converted amount based on the exchange rate.
48
+ > Note: If the current rate cannot be obtained due to rate limits or network errors, success: false is returned.
49
+ ## Get Support
50
+ <a href="https://discord.gg/yKW8wWKCnS"><img src="https://discordapp.com/api/guilds/1005287561582878800/widget.png?style=banner4" alt="Discord Banner"/></a>
package/index.d.ts CHANGED
@@ -1,72 +1,72 @@
1
- declare module 'google-finance-quote' {
2
- /**
3
- * @interface Proxy
4
- * @description Interface for proxy parameters.
5
- * @property {string} host - Proxy host name.
6
- * @property {number | undefined} - Proxy port number.
7
- * @property {'http' | 'https'} protocol - Proxy protocol type.
8
- */
9
- interface Proxy {
10
- host: string;
11
- port?: number,
12
- protocol: 'http' | 'https';
13
- }
14
-
15
- /**
16
- * @interface FinanceParams
17
- * @description Interface for Finance class constructor parameters.
18
- * @property {string} from - The original currency symbol.
19
- * @property {string} to - The desired currency symbol.
20
- * @property {Proxy | undefined} proxy - Proxy options.
21
- */
22
- interface FinanceParams {
23
- from: string;
24
- to: string;
25
- proxy?: Proxy;
26
- }
27
-
28
- /**
29
- * @class Finance
30
- * @description The Finance class is designed to easily check the exchange rate.
31
- * @param {FinanceParams | undefined} p - The parameters, including p.from and p.to.
32
- */
33
- class Finance {
34
- private param: FinanceParams;
35
-
36
- constructor(p?: FinanceParams);
37
-
38
- /**
39
- * @function setFrom
40
- * @description Set the parameter of from.
41
- * @param {string} from - The original currency symbol.
42
- * @returns {Finance} Returns the instance of Finance for chaining.
43
- */
44
- setFrom(from: string): Finance;
45
-
46
- /**
47
- * @function setTo
48
- * @description Set the parameter of to.
49
- * @param {string} to - The desired currency symbol.
50
- * @returns {Finance} Returns the instance of Finance for chaining.
51
- */
52
- setTo(to: string): Finance;
53
-
54
- /**
55
- * @function getParam
56
- * @description Returns the current param.
57
- * @returns {FinanceParams} Returns the current param.
58
- */
59
- getParam(): FinanceParams;
60
-
61
- /**
62
- * @async
63
- * @function quote
64
- * @description Returns the current finance rate.
65
- * @param {number} [amount=1] - The amount to convert.
66
- * @returns {Promise<{ success: boolean; rate: number }>} Returns the converted amount based on the exchange rate.
67
- */
68
- quote(amount?: number): Promise<{ success: boolean; rate: number }>;
69
- }
70
-
71
- export = Finance;
72
- }
1
+ declare module 'google-finance-quote' {
2
+ /**
3
+ * @interface Proxy
4
+ * @description Interface for proxy parameters.
5
+ * @property {string} host - Proxy host name.
6
+ * @property {number | undefined} - Proxy port number.
7
+ * @property {'http' | 'https'} protocol - Proxy protocol type.
8
+ */
9
+ interface Proxy {
10
+ host: string;
11
+ port?: number,
12
+ protocol: 'http' | 'https';
13
+ }
14
+
15
+ /**
16
+ * @interface FinanceParams
17
+ * @description Interface for Finance class constructor parameters.
18
+ * @property {string} from - The original currency symbol.
19
+ * @property {string} to - The desired currency symbol.
20
+ * @property {Proxy | undefined} proxy - Proxy options.
21
+ */
22
+ interface FinanceParams {
23
+ from: string;
24
+ to: string;
25
+ proxy?: Proxy;
26
+ }
27
+
28
+ /**
29
+ * @class Finance
30
+ * @description The Finance class is designed to easily check the exchange rate.
31
+ * @param {FinanceParams | undefined} p - The parameters, including p.from and p.to.
32
+ */
33
+ class Finance {
34
+ private param: FinanceParams;
35
+
36
+ constructor(p?: FinanceParams);
37
+
38
+ /**
39
+ * @function setFrom
40
+ * @description Set the parameter of from.
41
+ * @param {string} from - The original currency symbol.
42
+ * @returns {Finance} Returns the instance of Finance for chaining.
43
+ */
44
+ setFrom(from: string): Finance;
45
+
46
+ /**
47
+ * @function setTo
48
+ * @description Set the parameter of to.
49
+ * @param {string} to - The desired currency symbol.
50
+ * @returns {Finance} Returns the instance of Finance for chaining.
51
+ */
52
+ setTo(to: string): Finance;
53
+
54
+ /**
55
+ * @function getParam
56
+ * @description Returns the current param.
57
+ * @returns {FinanceParams} Returns the current param.
58
+ */
59
+ getParam(): FinanceParams;
60
+
61
+ /**
62
+ * @async
63
+ * @function quote
64
+ * @description Returns the current finance rate.
65
+ * @param {number} [amount=1] - The amount to convert.
66
+ * @returns {Promise<{ success: boolean; rate: number }>} Returns the converted amount based on the exchange rate.
67
+ */
68
+ quote(amount?: number): Promise<{ success: boolean; rate: number }>;
69
+ }
70
+
71
+ export = Finance;
72
+ }
package/index.js CHANGED
@@ -1,138 +1,142 @@
1
- const axios = require('axios');
2
- const HttpsProxyAgent = require('https-proxy-agent');
3
- const { API_URL } = require('./lib/config');
4
- const symbols = require('./lib/symbols');
5
-
6
- /**
7
- * @class Finance
8
- * @description The Finance class is designed to easily check the exchange rate.
9
- * @param {Object} p - The param includes p.from and p.to.
10
- * @param {string} p.from - The original currency symbol.
11
- * @param {string} p.to - The desired currency symbol.
12
- * @param {object | undefined} p.proxy - Proxy options.
13
- */
14
- class Finance {
15
- constructor(p) {
16
- if (
17
- typeof p === 'object' &&
18
- (
19
- symbols.includes(p.from?.toUpperCase()) ||
20
- symbols.includes(p.to?.toUpperCase())
21
- )
22
- ) {
23
- this.param = {
24
- from: p.from?.toUpperCase() || null,
25
- to: p.to?.toUpperCase() || null
26
- };
27
- } else if (typeof p === 'undefined') {
28
- this.param = {
29
- from: null,
30
- to: null
31
- };
32
- } else throw new Error('Invalid parameters.');
33
-
34
- this.proxy = {};
35
- if (typeof p?.proxy === 'object') {
36
- if (
37
- typeof p.proxy?.host === 'string' &&
38
- (
39
- p.proxy.protocol === 'http' ||
40
- p.proxy.protocol === 'https'
41
- )
42
- ) {
43
- this.proxy.host = p.proxy.host;
44
- if (typeof p.proxy?.port === 'number') this.proxy.port = p.proxy.port;
45
- this.proxy.protocol = p.proxy.protocol;
46
- }
47
- }
48
- }
49
-
50
- /**
51
- * @function setFrom
52
- * @description Set the parameter of from.
53
- * @param {string} from - The original currency symbol.
54
- * @returns {Finance} Returns the instance of Finance for chaining.
55
- */
56
- setFrom(from) {
57
- if (!symbols.includes(from?.toUpperCase())) throw new Error('invalid from.');
58
- this.param.from = from.toUpperCase();
59
- return this;
60
- }
61
-
62
- /**
63
- * @function setTo
64
- * @description Set the parameter of to.
65
- * @param {string} to - The desired currency symbol.
66
- * @returns {Finance} Returns the instance of Finance for chaining.
67
- */
68
- setTo(to) {
69
- if (!symbols.includes(to?.toUpperCase())) throw new Error('invalid to.');
70
- this.param.to = to.toUpperCase();
71
- return this;
72
- }
73
-
74
- /**
75
- * @function getParam
76
- * @description Returns the current param.
77
- * @returns Returns the current param.
78
- */
79
- getParam() {
80
- return this.param;
81
- }
82
-
83
- /**
84
- * @async
85
- * @function quote
86
- * @description Returns the current finance.
87
- * @param {number} [amount=1] - The amount to convert.
88
- * @returns Returns the current finance.
89
- */
90
- async quote(amount = 1) {
91
- const result = { success: false, rate: 0 };
92
- try {
93
- if (typeof amount !== 'number') throw new Error('amount must be number.');
94
- const from = this.param.from, to = this.param.to;
95
- if (!symbols?.includes(from) || !symbols?.includes(to)) throw new Error('from and/or to are invalid.');
96
-
97
- const url = `${API_URL}${from}-${to}`;
98
-
99
- let response;
100
- if (this.proxy) {
101
- const axiosConfig = {};
102
- if (this.proxy.protocol === 'http') {
103
- axiosConfig.proxy = {
104
- host: this.proxy.host,
105
- }
106
- if (this.proxy.port) axiosConfig.proxy.port = this.proxy.port;
107
- } else if (this.proxy.protocol === 'https') {
108
- const proxyUrl = `http://${this.proxy.host}${this.proxy.port ? `:${this.proxy.port}` : ''}`;
109
- const agent = new HttpsProxyAgent(proxyUrl);
110
- axiosConfig.httpsAgent = agent;
111
- axiosConfig.proxy = false;
112
- }
113
- response = await axios.get(url, axiosConfig);
114
- } else {
115
- response = await axios.get(url);
116
- }
117
-
118
- const html = response.data;
119
- const startIndex =
120
- html.indexOf(
121
- `data-source="${from}" data-target="${to}" data-last-price="`
122
- ) +
123
- `data-source="${from}" data-target="${to}" data-last-price="`.length;
124
- const endIndex = html.indexOf('"', startIndex);
125
- const rate = Number(html.substring(startIndex, endIndex));
126
- if (isNaN(rate)) throw new Error('Failed to get the current finance.');
127
-
128
- result.success = true;
129
- result.rate = rate * amount;
130
- return result;
131
- } catch {
132
- return result;
133
- }
134
- }
135
- }
136
-
137
- module.exports.Finance = Finance;
138
- module.exports.symbols = symbols;
1
+ const axios = require('axios');
2
+ const HttpsProxyAgent = require('https-proxy-agent');
3
+ const { API_URL } = require('./lib/config');
4
+ const symbols = require('./lib/symbols');
5
+
6
+ /**
7
+ * @class Finance
8
+ * @description The Finance class is designed to easily check the exchange rate.
9
+ * @param {Object} p - The param includes p.from and p.to.
10
+ * @param {string} p.from - The original currency symbol.
11
+ * @param {string} p.to - The desired currency symbol.
12
+ * @param {object | undefined} p.proxy - Proxy options.
13
+ */
14
+ class Finance {
15
+ constructor(p) {
16
+ if (
17
+ typeof p === 'object' &&
18
+ (
19
+ symbols.includes(p.from?.toUpperCase()) ||
20
+ symbols.includes(p.to?.toUpperCase())
21
+ )
22
+ ) {
23
+ this.param = {
24
+ from: p.from?.toUpperCase() || null,
25
+ to: p.to?.toUpperCase() || null
26
+ };
27
+ } else if (typeof p === 'undefined') {
28
+ this.param = {
29
+ from: null,
30
+ to: null
31
+ };
32
+ } else throw new Error('Invalid parameters.');
33
+
34
+ this.proxy = {};
35
+ if (typeof p?.proxy === 'object') {
36
+ if (
37
+ typeof p.proxy?.host === 'string' &&
38
+ (
39
+ p.proxy.protocol === 'http' ||
40
+ p.proxy.protocol === 'https'
41
+ )
42
+ ) {
43
+ this.proxy.host = p.proxy.host;
44
+ if (typeof p.proxy?.port === 'number') this.proxy.port = p.proxy.port;
45
+ this.proxy.protocol = p.proxy.protocol;
46
+ }
47
+ }
48
+ }
49
+
50
+ /**
51
+ * @function setFrom
52
+ * @description Set the parameter of from.
53
+ * @param {string} from - The original currency symbol.
54
+ * @returns {Finance} Returns the instance of Finance for chaining.
55
+ */
56
+ setFrom(from) {
57
+ if (!symbols.includes(from?.toUpperCase())) throw new Error('invalid from.');
58
+ this.param.from = from.toUpperCase();
59
+ return this;
60
+ }
61
+
62
+ /**
63
+ * @function setTo
64
+ * @description Set the parameter of to.
65
+ * @param {string} to - The desired currency symbol.
66
+ * @returns {Finance} Returns the instance of Finance for chaining.
67
+ */
68
+ setTo(to) {
69
+ if (!symbols.includes(to?.toUpperCase())) throw new Error('invalid to.');
70
+ this.param.to = to.toUpperCase();
71
+ return this;
72
+ }
73
+
74
+ /**
75
+ * @function getParam
76
+ * @description Returns the current param.
77
+ * @returns Returns the current param.
78
+ */
79
+ getParam() {
80
+ return this.param;
81
+ }
82
+
83
+ /**
84
+ * @async
85
+ * @function quote
86
+ * @description Returns the current finance.
87
+ * @param {number} [amount=1] - The amount to convert.
88
+ * @returns Returns the current finance.
89
+ */
90
+ async quote(amount = 1) {
91
+ const result = { success: false, rate: 0 };
92
+ try {
93
+ if (typeof amount !== 'number') throw new Error('amount must be number.');
94
+ const from = this.param.from, to = this.param.to;
95
+ if (!symbols?.includes(from) || !symbols?.includes(to)) throw new Error('from and/or to are invalid.');
96
+
97
+ const url = `${API_URL}${from}-${to}`;
98
+
99
+ let response;
100
+ if (this.proxy) {
101
+ const axiosConfig = {};
102
+ if (this.proxy.protocol === 'http') {
103
+ axiosConfig.proxy = {
104
+ host: this.proxy.host,
105
+ }
106
+ if (this.proxy.port) axiosConfig.proxy.port = this.proxy.port;
107
+ } else if (this.proxy.protocol === 'https') {
108
+ const proxyUrl = `http://${this.proxy.host}${this.proxy.port ? `:${this.proxy.port}` : ''}`;
109
+ const agent = new HttpsProxyAgent(proxyUrl);
110
+ axiosConfig.httpsAgent = agent;
111
+ axiosConfig.proxy = false;
112
+ }
113
+ response = await axios.get(url, axiosConfig);
114
+ } else {
115
+ response = await axios.get(url);
116
+ }
117
+
118
+ const html = response.data;
119
+ const startIndex =
120
+ html.indexOf(
121
+ `data-source="${from}" data-target="${to}" data-last-price="`
122
+ ) +
123
+ `data-source="${from}" data-target="${to}" data-last-price="`.length;
124
+ const endIndex = html.indexOf('"', startIndex);
125
+ const rate = Number(html.substring(startIndex, endIndex));
126
+ if (isNaN(rate)) throw new Error('Failed to get the current finance.');
127
+
128
+ result.success = true;
129
+ result.rate = rate * amount;
130
+ return result;
131
+ } catch {
132
+ return result;
133
+ }
134
+ }
135
+ }
136
+
137
+ module.exports = {
138
+ Finance,
139
+ symbols,
140
+ currencyCodesSymbols: require('./lib/currencyCodesSymbols'),
141
+ cryptocurrencyCodesSymbols: require('./lib/cryptoCurrencyCodesSymbols')
142
+ };
package/lib/config.js CHANGED
@@ -1,3 +1,3 @@
1
- module.exports = {
2
- API_URL: 'https://www.google.com/finance/quote/'
3
- };
1
+ module.exports = {
2
+ API_URL: 'https://www.google.com/finance/quote/'
3
+ };
@@ -0,0 +1,93 @@
1
+ /**
2
+ * A list of crypto currency codes.
3
+ *
4
+ * @type {string[]}
5
+ */
6
+ const cryptocurrencyCodesSymbols = [
7
+ // Cryptocurrency Codes
8
+ 'BTC',
9
+ 'ETH',
10
+ 'ADA',
11
+ 'BNB',
12
+ 'USDT',
13
+ 'XRP',
14
+ 'DOGE',
15
+ 'LINK',
16
+ 'LTC',
17
+ 'BCH',
18
+ 'XLM',
19
+ 'TRX',
20
+ 'ETC',
21
+ 'XMR',
22
+ 'EOS',
23
+ 'NEO',
24
+ 'WAVES',
25
+ 'DASH',
26
+ 'OMG',
27
+ 'DCR',
28
+ 'XEM',
29
+ 'MANA',
30
+ 'ICX',
31
+ 'QTUM',
32
+ 'ZIL',
33
+ 'BAT',
34
+ 'BTG',
35
+ 'BNT',
36
+ 'ZRX',
37
+ 'SC',
38
+ 'ONT',
39
+ 'DGB',
40
+ 'NANO',
41
+ 'LSK',
42
+ 'GNO',
43
+ 'XVG',
44
+ 'ARDR',
45
+ 'SNT',
46
+ 'MAID',
47
+ 'REP',
48
+ 'ARK',
49
+ 'FUN',
50
+ 'STEEM',
51
+ 'SYS',
52
+ 'BTS',
53
+ 'KMD',
54
+ 'MONA',
55
+ 'GAS',
56
+ 'RDD',
57
+ 'BTM',
58
+ 'WTC',
59
+ 'AION',
60
+ 'GRS',
61
+ 'BCN',
62
+ 'VERI',
63
+ 'DGD',
64
+ 'PIVX',
65
+ 'NXS',
66
+ 'PPT',
67
+ 'QASH',
68
+ 'NEBL',
69
+ 'SALT',
70
+ 'GAME',
71
+ 'FCT',
72
+ 'NXT',
73
+ 'PAY',
74
+ 'XDN',
75
+ 'SUB',
76
+ 'KNC',
77
+ 'GNT',
78
+ 'REQ',
79
+ 'VGX',
80
+ 'TNB',
81
+ 'ZCL',
82
+ 'HSR',
83
+ 'ICN',
84
+ 'POWR',
85
+ 'ENG',
86
+ 'SAN',
87
+ 'ELF',
88
+ 'STRAT',
89
+ 'QSP',
90
+ 'RDN'
91
+ ];
92
+
93
+ module.exports = cryptocurrencyCodesSymbols;
@@ -0,0 +1,130 @@
1
+ /**
2
+ * A list of currency codes.
3
+ *
4
+ * @type {string[]}
5
+ */
6
+ const currencyCodesSymbols = [
7
+ // Currency Codes
8
+ 'AED',
9
+ 'AFN',
10
+ 'ALL',
11
+ 'AMD',
12
+ 'ANG',
13
+ 'ARS',
14
+ 'AUD',
15
+ 'AWG',
16
+ 'AZN',
17
+ 'BAM',
18
+ 'BDT',
19
+ 'BGN',
20
+ 'BHD',
21
+ 'BND',
22
+ 'BOB',
23
+ 'BRL',
24
+ 'BTN',
25
+ 'BWP',
26
+ 'BYN',
27
+ 'BZD',
28
+ 'CAD',
29
+ 'CHF',
30
+ 'CLP',
31
+ 'CNY',
32
+ 'COP',
33
+ 'CRC',
34
+ 'CSD',
35
+ 'CZK',
36
+ 'CVE',
37
+ 'DEM',
38
+ 'DKK',
39
+ 'DOP',
40
+ 'DZD',
41
+ 'EEK',
42
+ 'EGP',
43
+ 'EUR',
44
+ 'FJD',
45
+ 'FRF',
46
+ 'GBP',
47
+ 'GEL',
48
+ 'GHS',
49
+ 'HKD',
50
+ 'HNL',
51
+ 'HRK',
52
+ 'HUF',
53
+ 'IDR',
54
+ 'ILS',
55
+ 'INR',
56
+ 'IQD',
57
+ 'ISK',
58
+ 'JMD',
59
+ 'JOD',
60
+ 'JPY',
61
+ 'KES',
62
+ 'KGS',
63
+ 'KRW',
64
+ 'KWD',
65
+ 'KYD',
66
+ 'KZT',
67
+ 'LAK',
68
+ 'LBP',
69
+ 'LKR',
70
+ 'LTL',
71
+ 'MAD',
72
+ 'MDL',
73
+ 'MKD',
74
+ 'MMK',
75
+ 'MOP',
76
+ 'MTL',
77
+ 'MUR',
78
+ 'MVR',
79
+ 'MXN',
80
+ 'MYR',
81
+ 'NAD',
82
+ 'NGN',
83
+ 'NIO',
84
+ 'NOK',
85
+ 'NPR',
86
+ 'NZD',
87
+ 'OMR',
88
+ 'PAB',
89
+ 'PEN',
90
+ 'PHP',
91
+ 'PKR',
92
+ 'PLN',
93
+ 'PYG',
94
+ 'QAR',
95
+ 'RON',
96
+ 'ROL',
97
+ 'RSD',
98
+ 'RUB',
99
+ 'SAR',
100
+ 'SCR',
101
+ 'SEK',
102
+ 'SGD',
103
+ 'SIT',
104
+ 'SKK',
105
+ 'SVC',
106
+ 'THB',
107
+ 'TND',
108
+ 'TRL',
109
+ 'TRY',
110
+ 'TTD',
111
+ 'TWD',
112
+ 'TZS',
113
+ 'UAH',
114
+ 'UGX',
115
+ 'USD',
116
+ 'UYU',
117
+ 'UZS',
118
+ 'VEB',
119
+ 'VEF',
120
+ 'VES',
121
+ 'VND',
122
+ 'WST',
123
+ 'XCD',
124
+ 'XOF',
125
+ 'XPF',
126
+ 'YER',
127
+ 'ZAR'
128
+ ];
129
+
130
+ module.exports = currencyCodesSymbols;
package/lib/symbols.js CHANGED
@@ -1,209 +1,214 @@
1
- const symbols = [
2
- // Currency Codes
3
- 'AED',
4
- 'AFN',
5
- 'ALL',
6
- 'AMD',
7
- 'ANG',
8
- 'ARS',
9
- 'AUD',
10
- 'AWG',
11
- 'AZN',
12
- 'BAM',
13
- 'BDT',
14
- 'BGN',
15
- 'BHD',
16
- 'BND',
17
- 'BOB',
18
- 'BRL',
19
- 'BTN',
20
- 'BWP',
21
- 'BYN',
22
- 'BZD',
23
- 'CAD',
24
- 'CHF',
25
- 'CLP',
26
- 'CNY',
27
- 'COP',
28
- 'CRC',
29
- 'CSD',
30
- 'CZK',
31
- 'CVE',
32
- 'DEM',
33
- 'DKK',
34
- 'DOP',
35
- 'DZD',
36
- 'EEK',
37
- 'EGP',
38
- 'EUR',
39
- 'FJD',
40
- 'FRF',
41
- 'GBP',
42
- 'GEL',
43
- 'GHS',
44
- 'HKD',
45
- 'HNL',
46
- 'HRK',
47
- 'HUF',
48
- 'IDR',
49
- 'ILS',
50
- 'INR',
51
- 'IQD',
52
- 'ISK',
53
- 'JMD',
54
- 'JOD',
55
- 'JPY',
56
- 'KES',
57
- 'KGS',
58
- 'KRW',
59
- 'KWD',
60
- 'KYD',
61
- 'KZT',
62
- 'LAK',
63
- 'LBP',
64
- 'LKR',
65
- 'LTL',
66
- 'MAD',
67
- 'MDL',
68
- 'MKD',
69
- 'MMK',
70
- 'MOP',
71
- 'MTL',
72
- 'MUR',
73
- 'MVR',
74
- 'MXN',
75
- 'MYR',
76
- 'NAD',
77
- 'NGN',
78
- 'NIO',
79
- 'NOK',
80
- 'NPR',
81
- 'NZD',
82
- 'OMR',
83
- 'PAB',
84
- 'PEN',
85
- 'PHP',
86
- 'PKR',
87
- 'PLN',
88
- 'PYG',
89
- 'QAR',
90
- 'RON',
91
- 'ROL',
92
- 'RSD',
93
- 'RUB',
94
- 'SAR',
95
- 'SCR',
96
- 'SEK',
97
- 'SGD',
98
- 'SIT',
99
- 'SKK',
100
- 'SVC',
101
- 'THB',
102
- 'TND',
103
- 'TRL',
104
- 'TRY',
105
- 'TTD',
106
- 'TWD',
107
- 'TZS',
108
- 'UAH',
109
- 'UGX',
110
- 'USD',
111
- 'UYU',
112
- 'UZS',
113
- 'VEB',
114
- 'VEF',
115
- 'VES',
116
- 'VND',
117
- 'WST',
118
- 'XCD',
119
- 'XOF',
120
- 'XPF',
121
- 'YER',
122
- 'ZAR',
123
- // Cryptocurrency Codes
124
- 'BTC',
125
- 'ETH',
126
- 'ADA',
127
- 'BNB',
128
- 'USDT',
129
- 'XRP',
130
- 'DOGE',
131
- 'LINK',
132
- 'LTC',
133
- 'BCH',
134
- 'XLM',
135
- 'TRX',
136
- 'ETC',
137
- 'XMR',
138
- 'EOS',
139
- 'NEO',
140
- 'WAVES',
141
- 'DASH',
142
- 'OMG',
143
- 'DCR',
144
- 'XEM',
145
- 'MANA',
146
- 'ICX',
147
- 'QTUM',
148
- 'ZIL',
149
- 'BAT',
150
- 'BTG',
151
- 'BNT',
152
- 'ZRX',
153
- 'SC',
154
- 'ONT',
155
- 'DGB',
156
- 'NANO',
157
- 'LSK',
158
- 'GNO',
159
- 'XVG',
160
- 'ARDR',
161
- 'SNT',
162
- 'MAID',
163
- 'REP',
164
- 'ARK',
165
- 'FUN',
166
- 'STEEM',
167
- 'SYS',
168
- 'BTS',
169
- 'KMD',
170
- 'MONA',
171
- 'GAS',
172
- 'RDD',
173
- 'BTM',
174
- 'WTC',
175
- 'AION',
176
- 'GRS',
177
- 'BCN',
178
- 'VERI',
179
- 'DGD',
180
- 'PIVX',
181
- 'NXS',
182
- 'PPT',
183
- 'QASH',
184
- 'NEBL',
185
- 'SALT',
186
- 'GAME',
187
- 'FCT',
188
- 'NXT',
189
- 'PAY',
190
- 'XDN',
191
- 'SUB',
192
- 'KNC',
193
- 'GNT',
194
- 'REQ',
195
- 'VGX',
196
- 'TNB',
197
- 'ZCL',
198
- 'HSR',
199
- 'ICN',
200
- 'POWR',
201
- 'ENG',
202
- 'SAN',
203
- 'ELF',
204
- 'STRAT',
205
- 'QSP',
206
- 'RDN'
207
- ];
208
-
209
- module.exports = symbols;
1
+ /**
2
+ * A list of currency and crypto currency codes.
3
+ *
4
+ * @type {string[]}
5
+ */
6
+ const symbols = [
7
+ // Currency Codes
8
+ 'AED',
9
+ 'AFN',
10
+ 'ALL',
11
+ 'AMD',
12
+ 'ANG',
13
+ 'ARS',
14
+ 'AUD',
15
+ 'AWG',
16
+ 'AZN',
17
+ 'BAM',
18
+ 'BDT',
19
+ 'BGN',
20
+ 'BHD',
21
+ 'BND',
22
+ 'BOB',
23
+ 'BRL',
24
+ 'BTN',
25
+ 'BWP',
26
+ 'BYN',
27
+ 'BZD',
28
+ 'CAD',
29
+ 'CHF',
30
+ 'CLP',
31
+ 'CNY',
32
+ 'COP',
33
+ 'CRC',
34
+ 'CSD',
35
+ 'CZK',
36
+ 'CVE',
37
+ 'DEM',
38
+ 'DKK',
39
+ 'DOP',
40
+ 'DZD',
41
+ 'EEK',
42
+ 'EGP',
43
+ 'EUR',
44
+ 'FJD',
45
+ 'FRF',
46
+ 'GBP',
47
+ 'GEL',
48
+ 'GHS',
49
+ 'HKD',
50
+ 'HNL',
51
+ 'HRK',
52
+ 'HUF',
53
+ 'IDR',
54
+ 'ILS',
55
+ 'INR',
56
+ 'IQD',
57
+ 'ISK',
58
+ 'JMD',
59
+ 'JOD',
60
+ 'JPY',
61
+ 'KES',
62
+ 'KGS',
63
+ 'KRW',
64
+ 'KWD',
65
+ 'KYD',
66
+ 'KZT',
67
+ 'LAK',
68
+ 'LBP',
69
+ 'LKR',
70
+ 'LTL',
71
+ 'MAD',
72
+ 'MDL',
73
+ 'MKD',
74
+ 'MMK',
75
+ 'MOP',
76
+ 'MTL',
77
+ 'MUR',
78
+ 'MVR',
79
+ 'MXN',
80
+ 'MYR',
81
+ 'NAD',
82
+ 'NGN',
83
+ 'NIO',
84
+ 'NOK',
85
+ 'NPR',
86
+ 'NZD',
87
+ 'OMR',
88
+ 'PAB',
89
+ 'PEN',
90
+ 'PHP',
91
+ 'PKR',
92
+ 'PLN',
93
+ 'PYG',
94
+ 'QAR',
95
+ 'RON',
96
+ 'ROL',
97
+ 'RSD',
98
+ 'RUB',
99
+ 'SAR',
100
+ 'SCR',
101
+ 'SEK',
102
+ 'SGD',
103
+ 'SIT',
104
+ 'SKK',
105
+ 'SVC',
106
+ 'THB',
107
+ 'TND',
108
+ 'TRL',
109
+ 'TRY',
110
+ 'TTD',
111
+ 'TWD',
112
+ 'TZS',
113
+ 'UAH',
114
+ 'UGX',
115
+ 'USD',
116
+ 'UYU',
117
+ 'UZS',
118
+ 'VEB',
119
+ 'VEF',
120
+ 'VES',
121
+ 'VND',
122
+ 'WST',
123
+ 'XCD',
124
+ 'XOF',
125
+ 'XPF',
126
+ 'YER',
127
+ 'ZAR',
128
+ // Cryptocurrency Codes
129
+ 'BTC',
130
+ 'ETH',
131
+ 'ADA',
132
+ 'BNB',
133
+ 'USDT',
134
+ 'XRP',
135
+ 'DOGE',
136
+ 'LINK',
137
+ 'LTC',
138
+ 'BCH',
139
+ 'XLM',
140
+ 'TRX',
141
+ 'ETC',
142
+ 'XMR',
143
+ 'EOS',
144
+ 'NEO',
145
+ 'WAVES',
146
+ 'DASH',
147
+ 'OMG',
148
+ 'DCR',
149
+ 'XEM',
150
+ 'MANA',
151
+ 'ICX',
152
+ 'QTUM',
153
+ 'ZIL',
154
+ 'BAT',
155
+ 'BTG',
156
+ 'BNT',
157
+ 'ZRX',
158
+ 'SC',
159
+ 'ONT',
160
+ 'DGB',
161
+ 'NANO',
162
+ 'LSK',
163
+ 'GNO',
164
+ 'XVG',
165
+ 'ARDR',
166
+ 'SNT',
167
+ 'MAID',
168
+ 'REP',
169
+ 'ARK',
170
+ 'FUN',
171
+ 'STEEM',
172
+ 'SYS',
173
+ 'BTS',
174
+ 'KMD',
175
+ 'MONA',
176
+ 'GAS',
177
+ 'RDD',
178
+ 'BTM',
179
+ 'WTC',
180
+ 'AION',
181
+ 'GRS',
182
+ 'BCN',
183
+ 'VERI',
184
+ 'DGD',
185
+ 'PIVX',
186
+ 'NXS',
187
+ 'PPT',
188
+ 'QASH',
189
+ 'NEBL',
190
+ 'SALT',
191
+ 'GAME',
192
+ 'FCT',
193
+ 'NXT',
194
+ 'PAY',
195
+ 'XDN',
196
+ 'SUB',
197
+ 'KNC',
198
+ 'GNT',
199
+ 'REQ',
200
+ 'VGX',
201
+ 'TNB',
202
+ 'ZCL',
203
+ 'HSR',
204
+ 'ICN',
205
+ 'POWR',
206
+ 'ENG',
207
+ 'SAN',
208
+ 'ELF',
209
+ 'STRAT',
210
+ 'QSP',
211
+ 'RDN'
212
+ ];
213
+
214
+ module.exports = symbols;
package/package.json CHANGED
@@ -1,40 +1,43 @@
1
- {
2
- "name": "google-finance-quote",
3
- "version": "2.0.2",
4
- "description": "Node Google Finance API wrapper for free. No API key is required!",
5
- "main": "index.js",
6
- "types": "index.d.ts",
7
- "scripts": {
8
- "test": "echo \"Error: no test specified\" && exit 1"
9
- },
10
- "repository": {
11
- "type": "git",
12
- "url": "git+https://github.com/otoneko1102/google-finance-quote.git"
13
- },
14
- "keywords": [
15
- "google",
16
- "api",
17
- "finance",
18
- "exchange",
19
- "rate",
20
- "quote",
21
- "wrapper",
22
- "free",
23
- "proxy"
24
- ],
25
- "author": "otoneko.",
26
- "license": "ISC",
27
- "bugs": {
28
- "url": "https://github.com/otoneko1102/google-finance-quote/issues"
29
- },
30
- "homepage": "https://github.com/otoneko1102/google-finance-quote#readme",
31
- "dependencies": {
32
- "axios": "^1.7.7",
33
- "https-proxy-agent": "^7.0.5"
34
- },
35
- "directories": {
36
- "lib": "lib",
37
- "test": "tests"
38
- },
39
- "devDependencies": {}
40
- }
1
+ {
2
+ "name": "google-finance-quote",
3
+ "version": "2.0.4",
4
+ "description": "Node Google Finance API wrapper for free. No API key is required!",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/otoneko1102/google-finance-quote.git"
13
+ },
14
+ "keywords": [
15
+ "google",
16
+ "api",
17
+ "finance",
18
+ "exchange",
19
+ "rate",
20
+ "quote",
21
+ "wrapper",
22
+ "money",
23
+ "code",
24
+ "codes",
25
+ "data",
26
+ "lib",
27
+ "free",
28
+ "proxy"
29
+ ],
30
+ "author": "otoneko.",
31
+ "license": "ISC",
32
+ "bugs": {
33
+ "url": "https://github.com/otoneko1102/google-finance-quote/issues"
34
+ },
35
+ "homepage": "https://github.com/otoneko1102/google-finance-quote#readme",
36
+ "dependencies": {
37
+ "axios": "^1.7.9",
38
+ "https-proxy-agent": "^7.0.6"
39
+ },
40
+ "devDependencies": {
41
+ "@types/node": "^22.13.2"
42
+ }
43
+ }