iex.js JavaScript Library#
iex.js (iexjs) is a client library for querying IEX Cloud data and operating on Apperate resources, such as data, datasets, data sources, and more. The easy-to-use JavaScript methods wrap requests to Apperate endpoints and IEX Cloud legacy endpoints, so you can tap into Core Financial Data and permissioned datasets, and operate on Apperate resources.
Important
Write and Read Data demonstrates using apperate.write().
Installation#
Use npm to install iexjs.
npm i @apperate/iexjs
Note
iexjs can also run in the browser via native fetch and eventsource, or from node via cross-fetch and eventsource.
Examples#
The iexjs Client
object stores your API token (API key) and IEX Cloud API version (e.g., v1
) for convenience.
Tip
The iexjs client automatically picks up tokens from the environment variable IEX_TOKEN.
Here are some examples.
Get a real-time stock quote:
const {Client} = require("@apperate/iexjs")
const client = new Client({api_token: "TOKEN", version: "VERSION"});
client.quote({symbol: "AAPL"}).then((res) => {
console.log(res);
});
See also
iex.js Core Financial Data Methods has information on all the methods.
Get Apple’s latest cash flow details:
const {Client} = require("@apperate/iexjs")
const client = new Client({api_token: "TOKEN", version: "VERSION"});
client.apperate.queryData({key: "AAPL", workspace: "CORE", id: "CASH_FLOW"}).then((res) => {
console.log(res);
});
The client’s apperate
object (shown above) has wrapper methods to Apperate APIs, including the Data API. The queryData
method retrieves data from a dataset via the dataset id
. You can retrieve data from a CORE
dataset or any workspace dataset you have access to.
See also
Querying Datasets with iex.js provides details on searching datasets.
Open Source Project#
The iex.js package is an open source project available at https://www.npmjs.com/package/@apperate/iexjs.
What’s Next#
Querying Datasets with iex.js demonstrates getting data from a dataset.
iex.js Core Financial Data Methods provides a reference to Core Financial Data available for current plans and legacy plans.
iex.js Apperate CRUD Methods lists methods for invoking Apperate CRUD operations on data, datasets, and more.