sp500-companies-as-json

A library and command line program that returns up-to-date S&P 500 constituent companies as an array of JSON objects

Usage no npm install needed!

<script type="module">
  import sp500CompaniesAsJson from 'https://cdn.skypack.dev/sp500-companies-as-json';
</script>

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

  • cli
  • move nock to dev dependencies
  • bump version; git tag; npm publish

Contributing

PRs are welcome so long as quality and speed aren't compromised.

  1. Fork repo
  2. Create a branch
  3. Make your changes and add tests (npm test)
  4. Submit PR

Author(s)

License

MIT