Package Exports
- finage
- finage/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (finage) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
node-finage 
Introduction
This is a simple Node package that facilitates interaction with Finage's financial data REST API. The library has full support for functionality across all financial data available via Finage, including:
- Stocks (US, LSE, MOEX and Canada)
- Funds (Indices and ETF)
- Crypto
- Forex
- Fundamentals
Dependencies
Library | Version |
---|---|
axios | ^0.24.0 |
Installation
For versions of npm ^5.0.0 run npm i finage
For other versions run npm i finage -S
Or else clone the repo and from the root directory and run npm i
Configuration
A valid Finage API key is required in order to set up the client.
This can be achieved with the following:
import Finage from 'finage';
const client = new Finage({ apiKey: 'API_KEY' });
It is advisable to store your api key as an environment variable and pass that to the Finage
constructor if you are going to share your code anywhere.
Using the Package
This package is in-line with the official Finage documentation. As such all methods, where necessary, require certain params
that must be passed for a successful request and optional queries
that alter how the data is presented. These must be passed as objects to a method when making a call.
For example, to get the last quote of the symbol AAPL with a nanosecond timestamp:
const res = await client.stocks.us.lastQuote({
params: { symbol: 'AAPL' }, queries: { ts: 'ns' }
})
PLEASE NOTE: When a method requires multiple params
, the order-of-insertion matters and must follow the order outlined in the official documentation. This is because the ordering of string-based keys is preserved since ES2015, and this is used to construct the URL for API endpoints.
Class Structure
Finage
│
└───bonds
│ │ lastRate()
│
└───crypto
│ │ lastTrade()
│ │ lastQuote()
│ │ aggregates()
│ │ prevClose()
│ │ marketDepth()
│ │ historicalMarketDepth()
│ │ priceChange()
│ │ marketCap()
│
└───forex
| | lastQuote()
| | lastTrade()
| | tickData()
| | aggregates()
| | prevClose()
| | converter()
|
└───funds
| |
| └───index
| | | lastPrice()
| | | aggregates
| | | prevClose()
| |
| └───etf
| | | lastPrice()
| | | aggregates
| | | prevClose()
|
└───fundamentals
| | symbols()
| | calendar()
| | stockMarketDetails()
| | indicators()
| | mostActiveUs()
| | topGainersUs()
| | topLosersUs()
| | sectorPerformance()
| |
| └───market
| | | status()
| | | search()
| |
| └───country
| | | status()
| | | search()
| |
| └───forex
| | | status()
| | | search()
| |
| └───crypto
| | | status()
| | | search()
| | | detailedLastPrice()
| |
| └───index
| | | status()
| |
| └───funds
| | |
| | └─── holders
| | | | institutional()
| | | | mutual()
| | | | etf()
| | |
| | | etfSectorWeightings()
| | | secRssFeed()
| |
| └───statements
| | | cashFlow()
| | | balanceSheet()
| | | income()
| |
| └───news
| | | market()
| | | forex()
| | | crypto()
|
└───stocks
| |
| └───us
| | | lastQuote()
| | | lastQuoteMulti()
| | | lastTrade()
| | | lastTradeMulti()
| | | endOfDay()
| | | orderBook()
| | | aggregates()
| | | prevClose()
| |
| └───lse
| | | lastPrice()
| | | aggregates()
| |
| └───canada
| | | lastPrice()
| | | aggregates()
| |
| └───moex
| | | lastPrice()
| | | aggregates()