google-finance-quote 4.0.0 → 5.0.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/.github/FUNDING.yml +3 -0
- package/.github/dependabot.yml +14 -0
- package/.github/workflows/publish.yml +45 -0
- package/README.md +50 -50
- package/package.json +57 -57
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
|
3
|
+
# Please see the documentation for all configuration options:
|
|
4
|
+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
|
5
|
+
|
|
6
|
+
version: 2
|
|
7
|
+
updates:
|
|
8
|
+
- package-ecosystem: "npm" # See documentation for possible values
|
|
9
|
+
directory: "/" # Location of package manifests
|
|
10
|
+
schedule:
|
|
11
|
+
interval: "weekly"
|
|
12
|
+
versioning-strategy: "increase"
|
|
13
|
+
allow:
|
|
14
|
+
- dependency-type: "direct"
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
publish:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
permissions:
|
|
10
|
+
contents: write
|
|
11
|
+
id-token: write
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Setup Node.js
|
|
18
|
+
uses: actions/setup-node@v4
|
|
19
|
+
with:
|
|
20
|
+
node-version: '20'
|
|
21
|
+
registry-url: 'https://registry.npmjs.org'
|
|
22
|
+
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
run: npm ci
|
|
25
|
+
|
|
26
|
+
- name: Build
|
|
27
|
+
run: npm run build
|
|
28
|
+
|
|
29
|
+
- name: Publish to npm
|
|
30
|
+
run: npm publish --access public --provenance
|
|
31
|
+
env:
|
|
32
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
33
|
+
|
|
34
|
+
- name: Get version
|
|
35
|
+
id: pkg
|
|
36
|
+
run: echo "version=$(node -p "require('./package.json').version")" >> "$GITHUB_OUTPUT"
|
|
37
|
+
|
|
38
|
+
- name: Create tag and GitHub Release
|
|
39
|
+
uses: softprops/action-gh-release@v2
|
|
40
|
+
with:
|
|
41
|
+
tag_name: v${{ steps.pkg.outputs.version }}
|
|
42
|
+
name: v${{ steps.pkg.outputs.version }}
|
|
43
|
+
generate_release_notes: true
|
|
44
|
+
env:
|
|
45
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
package/README.md
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
# google-finance-quote
|
|
2
|
-
|
|
3
|
-
Node Google Finance API wrapper for free.
|
|
4
|
-
No API key is required!
|
|
5
|
-
|
|
6
|
-
> !
|
|
7
|
-
> This results may vary by up to 20 minutes.
|
|
8
|
-
|
|
9
|
-
> !
|
|
10
|
-
> `3.0.0 <= x` doesn't support proxies.
|
|
11
|
-
|
|
12
|
-
## Usage
|
|
13
|
-
|
|
14
|
-
### Get Started
|
|
15
|
-
|
|
16
|
-
```js
|
|
17
|
-
// ESM
|
|
18
|
-
import { Finance, symbols, currencyCodesSymbols, cryptoCurrencyCodesSymbols } from "google-finance-quote";
|
|
19
|
-
// CJS
|
|
20
|
-
const { Finance, symbols, currencyCodesSymbols, cryptoCurrencyCodesSymbols } = require("google-finance-quote");
|
|
21
|
-
|
|
22
|
-
console.log(symbols); // Returns available symbols.
|
|
23
|
-
console.log(currencyCodesSymbols); // Returns available currency codes symbols.
|
|
24
|
-
console.log(cryptoCurrencyCodesSymbols); // Returns available crypto currency codes symbols.
|
|
25
|
-
|
|
26
|
-
const finance = new Finance(); // You can use this: new Finance({ from 'USD', to: 'JPY' });
|
|
27
|
-
|
|
28
|
-
finance
|
|
29
|
-
.setFrom('USD')
|
|
30
|
-
.setTo('JPY');
|
|
31
|
-
|
|
32
|
-
(async () => {
|
|
33
|
-
console.log(await finance.quote()); // { success: true, rate: 150.94225699999998 }
|
|
34
|
-
})();
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### Class
|
|
38
|
-
|
|
39
|
-
- **Finance({ from?: string, to?: string })**
|
|
40
|
-
|
|
41
|
-
- **.setFrom(from: string)**
|
|
42
|
-
Set the parameter of from.
|
|
43
|
-
- **.setTo(to: string)**
|
|
44
|
-
Set the parameter of to.
|
|
45
|
-
- **.getParam(): object**
|
|
46
|
-
Returns the current param.
|
|
47
|
-
- **.quote(amount?: number): Promise<{ success: boolean, rate: number }>**
|
|
48
|
-
Returns the converted amount based on the exchange rate.
|
|
49
|
-
|
|
50
|
-
> Note: If the current rate cannot be obtained due to rate limits or network errors, success: false is returned.
|
|
1
|
+
# google-finance-quote
|
|
2
|
+
|
|
3
|
+
Node Google Finance API wrapper for free.
|
|
4
|
+
No API key is required!
|
|
5
|
+
|
|
6
|
+
> [!NOTE]
|
|
7
|
+
> This results may vary by up to 20 minutes.
|
|
8
|
+
|
|
9
|
+
> [!NOTE]
|
|
10
|
+
> `3.0.0 <= x` doesn't support proxies.
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
### Get Started
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
// ESM
|
|
18
|
+
import { Finance, symbols, currencyCodesSymbols, cryptoCurrencyCodesSymbols } from "google-finance-quote";
|
|
19
|
+
// CJS
|
|
20
|
+
const { Finance, symbols, currencyCodesSymbols, cryptoCurrencyCodesSymbols } = require("google-finance-quote");
|
|
21
|
+
|
|
22
|
+
console.log(symbols); // Returns available symbols.
|
|
23
|
+
console.log(currencyCodesSymbols); // Returns available currency codes symbols.
|
|
24
|
+
console.log(cryptoCurrencyCodesSymbols); // Returns available crypto currency codes symbols.
|
|
25
|
+
|
|
26
|
+
const finance = new Finance(); // You can use this: new Finance({ from 'USD', to: 'JPY' });
|
|
27
|
+
|
|
28
|
+
finance
|
|
29
|
+
.setFrom('USD')
|
|
30
|
+
.setTo('JPY');
|
|
31
|
+
|
|
32
|
+
(async () => {
|
|
33
|
+
console.log(await finance.quote()); // { success: true, rate: 150.94225699999998 }
|
|
34
|
+
})();
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Class
|
|
38
|
+
|
|
39
|
+
- **Finance({ from?: string, to?: string })**
|
|
40
|
+
|
|
41
|
+
- **.setFrom(from: string)**
|
|
42
|
+
Set the parameter of from.
|
|
43
|
+
- **.setTo(to: string)**
|
|
44
|
+
Set the parameter of to.
|
|
45
|
+
- **.getParam(): object**
|
|
46
|
+
Returns the current param.
|
|
47
|
+
- **.quote(amount?: number): Promise<{ success: boolean, rate: number }>**
|
|
48
|
+
Returns the converted amount based on the exchange rate.
|
|
49
|
+
|
|
50
|
+
> Note: If the current rate cannot be obtained due to rate limits or network errors, success: false is returned.
|
package/package.json
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "google-finance-quote",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Node Google Finance API wrapper for free. No API key is required!",
|
|
5
|
-
"main": "dist/cjs/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": {
|
|
9
|
-
"import": "./dist/esm/index.mjs",
|
|
10
|
-
"require": "./dist/cjs/index.js"
|
|
11
|
-
},
|
|
12
|
-
"./package.json": "./package.json"
|
|
13
|
-
},
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
16
|
-
"build:esm": "tsc -p tsconfig.esm.json",
|
|
17
|
-
"build:post": "node ./build/copy-types.js && node ./build/rename-esm.js",
|
|
18
|
-
"build": "npm run build:cjs && npm run build:esm && npm run build:post",
|
|
19
|
-
"prepublishOnly": "npm run build",
|
|
20
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
21
|
-
"format": "prettier --write ./src/ ./build/"
|
|
22
|
-
},
|
|
23
|
-
"repository": {
|
|
24
|
-
"type": "git",
|
|
25
|
-
"url": "git+https://github.com/otoneko1102/google-finance-quote.git"
|
|
26
|
-
},
|
|
27
|
-
"keywords": [
|
|
28
|
-
"google",
|
|
29
|
-
"api",
|
|
30
|
-
"finance",
|
|
31
|
-
"exchange",
|
|
32
|
-
"rate",
|
|
33
|
-
"quote",
|
|
34
|
-
"wrapper",
|
|
35
|
-
"money",
|
|
36
|
-
"code",
|
|
37
|
-
"codes",
|
|
38
|
-
"data",
|
|
39
|
-
"lib",
|
|
40
|
-
"free"
|
|
41
|
-
],
|
|
42
|
-
"author": "otoneko.",
|
|
43
|
-
"license": "ISC",
|
|
44
|
-
"bugs": {
|
|
45
|
-
"url": "https://github.com/otoneko1102/google-finance-quote/issues"
|
|
46
|
-
},
|
|
47
|
-
"homepage": "https://github.com/otoneko1102/google-finance-quote#readme",
|
|
48
|
-
"dependencies": {
|
|
49
|
-
"axios": "^1.13.
|
|
50
|
-
},
|
|
51
|
-
"devDependencies": {
|
|
52
|
-
"@types/axios": "^0.14.4",
|
|
53
|
-
"@types/node": "^25.0
|
|
54
|
-
"prettier": "^3.8.0",
|
|
55
|
-
"typescript": "^5.9.3"
|
|
56
|
-
}
|
|
57
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "google-finance-quote",
|
|
3
|
+
"version": "5.0.0",
|
|
4
|
+
"description": "Node Google Finance API wrapper for free. No API key is required!",
|
|
5
|
+
"main": "dist/cjs/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/esm/index.mjs",
|
|
10
|
+
"require": "./dist/cjs/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./package.json": "./package.json"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
16
|
+
"build:esm": "tsc -p tsconfig.esm.json",
|
|
17
|
+
"build:post": "node ./build/copy-types.js && node ./build/rename-esm.js",
|
|
18
|
+
"build": "npm run build:cjs && npm run build:esm && npm run build:post",
|
|
19
|
+
"prepublishOnly": "npm run build",
|
|
20
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
21
|
+
"format": "prettier --write ./src/ ./build/"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/otoneko1102/google-finance-quote.git"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"google",
|
|
29
|
+
"api",
|
|
30
|
+
"finance",
|
|
31
|
+
"exchange",
|
|
32
|
+
"rate",
|
|
33
|
+
"quote",
|
|
34
|
+
"wrapper",
|
|
35
|
+
"money",
|
|
36
|
+
"code",
|
|
37
|
+
"codes",
|
|
38
|
+
"data",
|
|
39
|
+
"lib",
|
|
40
|
+
"free"
|
|
41
|
+
],
|
|
42
|
+
"author": "otoneko.",
|
|
43
|
+
"license": "ISC",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/otoneko1102/google-finance-quote/issues"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://github.com/otoneko1102/google-finance-quote#readme",
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"axios": "^1.13.6"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/axios": "^0.14.4",
|
|
53
|
+
"@types/node": "^25.3.0",
|
|
54
|
+
"prettier": "^3.8.0",
|
|
55
|
+
"typescript": "^5.9.3"
|
|
56
|
+
}
|
|
57
|
+
}
|