0.3.4 • Published 3 years ago

@stoqey/finnhub v0.3.4

Weekly downloads
22
License
MIT
Repository
github
Last release
3 years ago

Finnhub - NodeJS Wrapper

Features

  • Candles
  • Tick
  • Quote
  • Real-time price updates
  • Company Profile2
  • Recommendation Trends
  • Peers

Install

npm i @stoqey/finnhub

or

yarn add @stoqey/finnhub

Initialize

Set env variable FINNHUB_KEY with the token you get from Finnhub.

or simply assign it from the constructors

import FinnhubAPI, { FinnhubWS } from '@stoqey/finnhub';

// For API
const finnhubAPI = new FinnhubAPI(finnHubKey);

// For Websockets
const finnhubWs = new FinnhubWS(finnHubKey); // or leave finnHubKey blank if process.env.FINNHUB_KEY is set

Get Candles

const candles = await finnhubAPI.getCandles(symbol, startDate, endDate, '1');

Get Ticks

const ticks = await finnhubAPI.getTick(symbol, date);

Get Quote

const quote = await finnhubAPI.getQuote(symbol);

Get Company Profile2

const companyProfile = await finnhubAPI.getCompanyProfile2(symbol);

Get Recommendation Trends

const recommendations = await finnhubAPI.GetRecommendationTrends(symbol);

Get Peers

const peers = await finnhubAPI.getPeers(symbol);

Real-time price updates

finnhubWs.on("onReady", async () => {
        console.log('WS is ready');
});

finnhubWs.on("onData", async (data: TickData) => {
        console.log('WS onData', data);
});

// Add symbol to streaming list
finnhubWs.addSymbol("AAPL");

// Stop streaming symbol
finnhubWs.removeSymbol("AAPL");

Set process.env.DEBUG = "finnhub*" to see all logs

0.3.4

3 years ago

0.3.3

3 years ago

0.2.9

3 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.1

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago