sp500-companies-as-json
v0.9.0
Published
A library and command line program that returns up-to-date S&P 500 constituent companies as an array of JSON objects
Downloads
5
Readme
S&P 500 Index Companies
Main repo: https://github.com/huned/nodejs-sp500-companies
Returns an up-to-date list of S&P 500 constituent companies and metadata as a useful JSON array. The actual data is from Wikipedia's List of S&P 500 Companies
Command Line Usage
$ npm install --g sp500-companies-as-json
$ sp500co | jq
[
{
"ticker": "MMM",
"exchange": "NYSE",
"name": "3M",
"gics": {
"sector": "Industrials",
"subIndustry": "Industrial Conglomerates"
},
...
]
Node.js Usage
```bash
$ npm install sp500-companies-as-json --save
```
```js
import sp500CompaniesAsJSON from 'sp500-companies-as-json'
const companies = await sp500CompaniesAsJSON()
console.log(companies.length)
// 505
console.log(companies[0])
// {
// ticker: 'MMM',
// exchange: 'NYSE',
// name: '3M',
// gics: {
/ sector: 'Industrials',
// subIndustry: 'Industrial Conglomerates'
// },
// dateAdded: '1976-08-09',
// cik: '0000066740',
// yearFounded: '1902'
// }
```
TODOs
- [x] cli
- [x] move nock to dev dependencies
- [ ] bump version; git tag; npm publish
Contributing
PRs are welcome so long as quality and speed aren't compromised.
- Fork repo
- Create a branch
- Make your changes and add tests (
npm test
) - Submit PR
Author(s)
License
MIT