TS-JS Finance Stock Info Library
Module to retrieve current stock information from Alpha Vantage API.
Installation
- Sign up for your own API Key on Rapid API
- Install it:
npm i finance-stock-info
Link to npm library
Usage
const { StockInfo } = require('finance-stock-info');
const myApiKey = '<MYAPIKEY>';
const stock = new StockInfo(myApiKey);
stock.getStockInfo('tsla').then((info) => console.log(info));
stock.getPrice('tsla').then((price) => console.log(price));
stock.getTotalValue('tsla', 3).then((value) => console.log(value));
stock.getChangePercent('twtr').then((percent) => console.log(percent));
stock.getTradeVolume('twtr').then((volume) => console.log(volume));
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
Testing
To run tests:
- Include your API key in the
tests/test.js
file. Then run:
npm test
To check code test coverage:
npx jest --coverage
License
MIT