npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

iex-api

v0.0.3

Published

Unofficial SDK for using the IEX API.

Downloads

20

Readme

iex-api

Currently still a work-in-progress, but it should already be quite usable.

An unofficial SDK for using the free IEX API. You can use this to get stock market information. This module is usable in Web Browsers, React Native, and NodeJS (though a polyfill/ponyfill for the fetch API is needed in NodeJS).

Features

  • Usable across all modern JS runtimes (with polyfills needed for fetch API where it's not available)
  • TypeScript support and accurate type definitions (with strict null checks)
  • Convenient object for getting API attribution information
  • Overridable API endpoint to allow for flexibility
  • Handles both JSON and CSV responses
  • Client that returns ES6 promises usable with async/await syntax

Installation

npm install --save iex-api

Usage

In Web Browsers and React Native

import { IEXClient } from 'iex-api'

const iex = new IEXClient(fetch)
iex.stockCompany('AAPL')
  .then(quote => console.log(quote))

  // {
  //   symbol: "AAPL",
  //   companyName: "Apple Inc.",
  //   exchange: "Nasdaq Global Select",
  //   industry: "Computer Hardware",
  //   website: "http://www.apple.com",
  //   description: "Apple Inc is designs, manufactures and markets mobile communication and media devices and personal computers, and sells a variety of related software, services, accessories, networking solutions and third-party digital content and applications.",
  //   CEO: "Timothy D. Cook",
  //   issueType: "cs",
  //   sector: "Technology"
  // }

In NodeJS

To use this in NodeJS and any other JS runtime that doesn't provide the fetch API, you will have to provide it through a polyfill or ponyfill. I recommend using fetch-ponyfill for this purpose, since it doesn't mess with the global context. You may find isomorphic-fetch easier to use, however.

npm install --save isomorphic-fetch
npm insatll --save-dev @types/isomorphic-fetch # If using TypeScript
import { IEXClient } from 'iex-api'
import * as _fetch from 'isomorphic-fetch'

const iex = new IEXClient(_fetch)
iex.stockCompany('AAPL')
  .then(quote => console.log(quote))

  // {
  //   symbol: "AAPL",
  //   companyName: "Apple Inc.",
  //   exchange: "Nasdaq Global Select",
  //   industry: "Computer Hardware",
  //   website: "http://www.apple.com",
  //   description: "Apple Inc is designs, manufactures and markets mobile communication and media devices and personal computers, and sells a variety of related software, services, accessories, networking solutions and third-party digital content and applications.",
  //   CEO: "Timothy D. Cook",
  //   issueType: "cs",
  //   sector: "Technology"
  // }

To Do:

  • Define types and definitions for specific API operations:

    • Stocks
      • ~~Quote~~
      • ~~Chart~~
      • Batch Requests
      • Book
      • ~~Open / Close~~
      • ~~Previous~~
      • ~~Company~~
      • ~~Key Stats~~
      • ~~Peers~~
      • ~~Relevant~~
      • ~~News~~
      • ~~Financials~~
      • ~~Earnings~~
      • ~~Dividends~~
      • ~~Splits~~
      • ~~Logo~~
      • ~~Price~~
      • ~~Delayed Quote~~
      • ~~List~~
      • ~~Effective Spread~~
      • ~~Volume by Venue~~
    • ~~Reference Data~~
      • ~~Symbols~~
    • IEX Market Data
      • TOPS
      • Last
      • HIST
      • DEEP
      • Book
      • Trades
      • System Event
      • Trading Status
      • Operational Halt Status
      • Short Sale Price Test Status
      • Security Event
      • Trade Break
      • Auction
    • IEX Stats
      • Intraday
      • Recent
      • Records
      • Historical Summary
      • Historical Daily
    • Markets
      • Market
  • Increase integration test coverage

  • Add documentation. In the meantime, the code is pretty well commented and should hopefully be easy to use thanks to type definitions.

  • Do runtime checks against each API endpoint with all possible inputs to discover possible enums, null responses,

  • Report discrepencies between docs and actual API responses to IEX