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

finage

v1.0.5

Published

A simple NodeJS library for interfacing with the Finage financial data API.

Downloads

13

Readme

node-finage example workflow

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()