Disclaimer: This package fetch the result from finance.yahoo.com using web scrapping. Owner will not be responsible for any misuse of this package. This is solely for the purpose of learning.
This package can be installed using npm
npm install nodejs-stock-info
or, yarn
yarn add nodejs-stock-info
Import stock-info
.
const SI = require('nodejs-stock-info')
Then instantiate with either the empty constructor
let stockInfo = new SI()
Or, with a string or list of strings corresponding to the stock e.g. "amzn"
or ["amzn", "aapl"]
let stockInfo = new SI("amzn")
// or
let stockInfo = new SI(["amzn", "aapl"])
The getStockInfo
method will return the latest stock information and can be used as a promise.
stockInfo.getStockInfo().then((response) => {
console.log(response) //or do something else
})
Chaining is also supported.
stockInfo.setStocks("tsla").getStockInfo().then((response) => {
console.log(response) //or do something else
})
If any issues are found, they can be reported here.
This project is licensed under the MIT license.