Code Monkey home page Code Monkey logo

finnhub's Introduction

Finnhub - NodeJS Wrapper

NPM

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

finnhub's People

Contributors

ceddybi avatar natanel-ziv avatar tsopic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

finnhub's Issues

Prints data to console

Probably its my bad, but it seems ondata event, there is a console.log with the closing price received.

Update Readme

Need to update Readme with the latest available APIs and to give it some more information about the usage of the package

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.