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

node-iex-cloud

v2.1.1

Published

SDK for iex cloud

Downloads

1,313

Readme

node-iex-cloud

Build status install size

See IEX API Documentation for more information.

Installation and Usage

npm i node-iex-cloud

ES6+

import IEXCloudClient from "node-iex-cloud";

import a promise based HTTP Client to use along side node-iex-cloud. Node-iex-cloud supports both node-fetch and axios

// import a promise base library
import fetch from "node-fetch";

common.js

const { IEXCloudClient } = require("node-iex-cloud");
// import a promise base library
const fetch = require("node-fetch");

Configuration and Setup

IEX Cloud uses a message weighting system to measure usage in message counts, make sure sandbox is enabled to true in development to avoid reaching data limits or overages. (Note: when enabling sandbox to true, the publishable key token is automatically prefixed with the letter T and doesn't require changing the existing token to access Test Data ) MAKE SURE PUBLIC KEY & NOT SECRET KEY IS BEING USED as it is prefixed with: "pk_"

import { IEXCloudClient } from "node-iex-cloud";
import fetch from "node-fetch";

const iex = new IEXCloudClient(fetch, {
  sandbox: true,
  publishable: "pk_21b4ffeccc6e3cnc1df07467a47231c6",
  version: "stable"
});

Examples

The first method takes in a company symbol (an abbreviation used to uniquely identify publicly traded shares). The subsequent method retreive the specfic IEX data type.

Stocks

// stock/google/financials?period=annual
iex
  .symbol("googl")
  .financials("quarterly")
  .then(res => console.log(res));
// stock/googl/ceo-compensation
iex
  .symbol("googl")
  .ceoCompensation()
  .then(res => console.log(res));
// stock/aapl/cash-flow
iex
  .symbol("aapl")
  .cashFlow("annual", 3)
  .then(res => console.log(res));
// stock/nflx/dividends
iex
  .symbol("nflx")
  .dividends("1mm")
  .then(res => console.log(res));
// Query Charts
iex
  .symbol("googl")
  .chart("dynamic", { chartCloseOnly: true })
  .then(res => console.log(res));

iex
  .symbol("aapl")
  .chart("6m", { chartCloseOnly: true, chartSimplify: true, chartInterval: 2 })
  .then(res => console.log(res));

// Query Charts by date
iex
  .symbol("vea")
  .chart("date", { date: "20190924", chartByDay: true })
  .then(res => console.log(res));

Crypto Currencies

Only quotes are available see Documentation for more info

// crypto/btcusd/quote
iex
  .crypto("btcusd")
  .quote()
  .then(res => console.log(res));

// crypto/ethusd/quote
iex
  .crypto("ethusd")
  .quote()
  .then(res => console.log(res));

Forex / Currencies

// stable/fx/convert?symbols=USDGPB,USDJPY&amount=2000&
iex
  .symbols("USDGPB", "USDJPY")
  .forex()
  .convert({ amount: 2000 })
  .then(res => console.log(res));

// stable/fx/historical?symbols=USDGPB,USDJPY&last=5
iex
  .symbols("USDGPB", "USDJPY")
  .forex()
  .historical({ last: 5 })
  .then(res => console.log(res));

Available Methods

Stock

  • balanceSheet(period?)
  • book
  • chart(range?: string, params?: object)
  • cashFlow(period?: string, last?: number)
  • ceoCompensation
  • company
  • delayedQuote
  • dividends(range?)
  • earnings(last, field)
  • estimates
  • financials(period?: string)
  • news(last?: number)
  • fundOwnership
  • income(period?: string, last?: number)
  • insiderRoster
  • insiderSummary
  • insiderTransactions
  • institutionalOwnership
  • intradayPrices(params?: object)
  • logo
  • largestTrades
  • options(expiration?: string, optionSide?: string)
  • peers
  • previous
  • price
  • priceTarget
  • ohlc
  • sentiment(type?: string, date?: string)
  • quote(field: string)
  • recommendationTrends
  • stats(stat?: string)
  • splits(range)
  • shortInterest(date?: string)
  • volumeByVenue

Search Companies

Only included with paid subscription plans

// search/microsoft
iex.search("microsoft").then(res => console.log(res));

// search/google
iex.search("google").then(res => console.log(res));

Advance Searching

Only included with paid subscription plans

To retreive a company's stock data using a company's full name, use the search method to search for the companyName then access the first index to grab the most relevant symbol

// search/facebook
iex
  .search("facebook")
  .then(res => res)
  .then(res => iex.symbol(res[0].symbol).company())
  .then(res => console.log(res));
// search/international%20business%20machines
iex
  .search("international business machines")
  // stock/ibm/company
  .then(res => iex.symbol(res[0].symbol).balanceSheet())
  .then(res => console.log(res));
);

Market

// stock/market/today-earnings
iex
  .market()
  .todayEarnings()
  .then(res => console.log(res));

// stock/market/sector-performance
iex
  .market()
  .sectorPerformance()
  .then(res => console.log(res));

Time Series

// time-series/advanced_distribution
iex
  .symbols("AAPL", "GOOGL")
  .timeSeries()
  .advancedDistribution()
  .then(res => console.log(res));

iex
  .symbols("AAPL", "GOOGL")
  .timeSeries()
  .advancedReturnOnCapital()
  .then(res => console.log(res));

Batch Symbols

Use method symbols instead of "symbol" to batch multiple stock symbols together, IEX allows only up to 10 symbols to be made per request.

// batch?symbols=googl,amzn,fb&types=company
iex
  .symbols("googl,amzn,fb")
  .company()
  .then(res => console.log(res));
// batch?symbols=googl,amzn,fb&types=price
iex
  .symbols("googl,amzn,fb,aapl")
  .price()
  .then(res => console.log(res));

Batch Types

Use the method batch to batch Request of multiple data types, all IEX types are supported. use the range method to return all request IEX allows only up to 10 types to be made per request.

// stock/googl/batch?types=stock,company,balance-sheet,cash-flow,estimates&range=1m&last=4
iex
  .symbol("googl")
  .batch()
  .company()
  .price()
  .balanceSheet()
  .cashFlow()
  .estimates()
  .range("1m", 4)
  .then(res => console.log(res));

Batch Symbols & Types

// batch?symbols=googl,amzn,fb,aapl&types=company,balance-sheet,cash-flow,estimates&range=1m&last=4
iex
  .symbols("googl,amzn,fb,aapl")
  .batch()
  .company()
  .price()
  .balanceSheet()
  .cashFlow()
  .estimates()
  .range("1m", 4)
  .then(res => console.log(res));

IEX Last

Last provides trade data for executions on IEX.

// tops/last?symbols=aapl,googl,amzn
iex.tops("aapl", "googl", "amzn").then(res => console.log(res));

IEX Stats

// stats/intraday
iex
  .stats()
  .intraday()
  .then(res => console.log(res));

// stats/historical
iex
  .stats()
  .historical()
  .then(res => console.log(res));

// stats/records
iex
  .stats()
  .records()
  .then(res => console.log(res));

IEX Market Info

// stable/stock/market/sector-performance
iex
  .market()
  .sectorPerformance()
  .then(res => console.log(res));

IEX Deep

DEEP is used to receive real-time depth of book quotations direct from IEX.

// deep/trading-status?symbols=msft
iex
  .symbol("msft")
  .deep()
  .tradingStatus()
  .then(res => console.log(res));

// deep/book?symbols=msft
iex
  .symbol("msft")
  .deep()
  .book()
  .then(res => console.log(res));

// deep/trades?symbols=msf
iex
  .symbol("msft")
  .deep()
  .trades()
  .then(res => console.log(res));

// deep/trade-breaks?symbols=msft
iex
  .symbol("msft")
  .deep()
  .tradeBreaks()
  .then(res => console.log(res));

SSE Streaming

Not Yet Supported

Web Sockets

Coming Soon