iex-luxcium-api
v0.5.11
Published
Unofficial SDK for using the IEX API by Luxcium.
Downloads
10
Readme
IEX API by Luxcium DEPRECATED
Luxcium : ™Scientia is lux principium
An unofficial SDK fork by Luxcium for using the free IEX API. You will be able to 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). Please make sure to open a GitHub issues for anything problematic to help us during the development phase of this project.
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
Breaking changes may happen on a daily basis at the minor version level util we get to version 1.x
Regarless please make sure to open a GitHub issue for anything problematic to help us during the development phase of this project.Considere our project is curently unstable(work-in-progress) until version 1.0
Installation
npm install --save iex-luxcium-api
Usage
In Web Browsers and React Native
import { IEXClient } from 'iex-luxcium-api';
const iex = new IEXClient(fetch);
iex.stockCompany('AAPL').then(company => console.log(company));
// {
// 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 fetch-ponyfill
import fetchPonyfill from 'fetch-ponyfill';
import { IEXClient, StockSymbol } from 'iex-luxcium-api';
const fetcher = fetchPonyfill().fetch;
const iexClient = new IEXClient(fetcher);
iexClient.symbols().then((symbols: StockSymbol[]) => console.log(symbols[1000]));
// {
// symbol: 'BRC',
// name: 'Brady Corporation',
// date: '2019-03-08',
// isEnabled: true,
// type: 'cs',
// iexId: '883'
// }
npm install --save isomorphic-fetch
npm install --save-dev @types/isomorphic-fetch # If using TypeScript
import { CompanyResponse, IEXClient } from 'iex-luxcium-api';
import isomorphicFetch from 'isomorphic-fetch';
const iex = new IEXClient(isomorphicFetch);
iex.stockCompany('AAPL').then((company: CompanyResponse) => console.log(company));
// { 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',
// tags:
// [ 'Technology', 'Consumer Electronics', 'Computer Hardware' ] }
Subscribe to a topic (NodeJS Only)
The following code demostrates how to subscribe to an IEX reltime feed via NodeJS. IEX curretnly does not support subscribing from other platforms.
import { IEXClientRT } from 'iex-luxcium-api';
const iexRT = new IEXClientRT();
iexRT.observe('TWLO', 'MSFT').subscribe(update => console.log(update));
Or using promises
import { IEXClientRT } from 'iex-luxcium-api';
import { take, toArray } from 'rxjs/operator';
const iexRT = new IEXClientRT();
iexRT
.observe('TWLO', 'MSFT')
.pipe(
take(5),
toArray()
)
.toPromise()
.then(values => console.log(values));
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
- Stocks
- 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
The iex-luxcium-api is based on
Work originaly made by Bilal Quadri © 2017 Bilal Quadri github.com/bilalq/iex-api
And with contributions originaly commited by
@Bilalq @Kekekevin @Hcnguyen5 @Dwatring @Netogallo @DoubleUTF @Arieldf @Onwsk8r @Luxcium
MIT License
© 2019 LUXCIUM ™ (Benjamin Vincent Kasapoglu) and others...
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Data provided for free by IEX
IEX does not maintain this unofficial SDK
Please review IEX terms of service before using the iex-luxcium-api.
IEX Terms Of Service More about the free data by IEX