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

finnhub-ts

v1.0.7

Published

OpenAPI client for finnhub-ts

Downloads

294

Readme

Finnhub-ts

Q: Why? There is allready an existing one finnhub-js

A: Because it's not working in every enviroment

[email protected]

Environment

  • Node.js
  • Webpack
  • Browserify

Language level

  • ES6

Module system

  • CommonJS
  • ES6 module system

It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via package.json. (Reference)

Usage

Get your API-Key: https://finnhub.io/register

3rd party apps:

import { DefaultApi } from 'finnhub-ts'
const finnhubClient = new DefaultApi({
  apiKey: 'YOUR-API-KEY',
  isJsonMime: (input) => {
    try {
      JSON.parse(input)
      return true
    } catch (error) {}
    return false
  },
})

For React.js visit my other repo

react-finnhub

Usage with Axios interceptors

//@ts-ignore
finnhubClient.axios.interceptors.response.use(
  (response) => response,
  (error) => {
    switch (error.code) {
      case 'ERR_BAD_REQUEST':
        // API limit for example (30 calls/second)
        console.log(error.response.data.error)
        break

      default:
        console.log('error: ', error)
    }
  }
)

Example Usage

companyEarnings('AAPL').then((res) => {
  console.log(res.data)
})

Output:

[
  {
    "actual": 2.56,
    "estimate": 2.38,
    "period": "2019-03-31",
    "symbol": "AAPL"
  },
  {
    "actual": 4.21,
    "estimate": 4.15,
    "period": "2018-12-31",
    "symbol": "AAPL"
  },
  {
    "actual": 2.88,
    "estimate": 2.75,
    "period": "2018-09-30",
    "symbol": "AAPL"
  },
  {
    "actual": 2.32,
    "estimate": 2.11,
    "period": "2018-06-30",
    "symbol": "AAPL"
  }
]

All functions

Official Docs and API info

const {
  aggregateIndicator,
  bondPrice,
  bondProfile,
  companyBasicFinancials,
  companyEarnings,
  companyEarningsQualityScore,
  companyEbitEstimates,
  companyEbitdaEstimates,
  companyEpsEstimates,
  companyEsgScore,
  companyExecutive,
  companyNews,
  companyPeers,
  companyProfile,
  companyProfile2,
  companyRevenueEstimates,
  country,
  covid19,
  cryptoCandles,
  cryptoExchanges,
  cryptoProfile,
  cryptoSymbols,
  earningsCalendar,
  economicCalendar,
  economicCode,
  economicData,
  etfsCountryExposure,
  etfsHoldings,
  etfsProfile,
  etfsSectorExposure,
  fdaCommitteeMeetingCalendar,
  filings,
  filingsSentiment,
  financials,
  financialsReported,
  forexCandles,
  forexExchanges,
  forexRates,
  forexSymbols,
  fundOwnership,
  indicesConstituents,
  indicesHistoricalConstituents,
  insiderSentiment,
  insiderTransactions,
  internationalFilings,
  investmentThemes,
  ipoCalendar,
  marketNews,
  mutualFundCountryExposure,
  mutualFundHoldings,
  mutualFundProfile,
  mutualFundSectorExposure,
  newsSentiment,
  ownership,
  patternRecognition,
  pressReleases,
  priceTarget,
  quote,
  recommendationTrends,
  revenueBreakdown,
  similarityIndex,
  socialSentiment,
  stockBasicDividends,
  stockBidask,
  stockCandles,
  stockDividends,
  stockLobbying,
  stockNbbo,
  stockSplits,
  stockSymbols,
  stockTick,
  stockUsaSpending,
  stockUsptoPatent,
  stockVisaApplication,
  supplyChainRelationships,
  supportResistance,
  symbolSearch,
  technicalIndicator,
  transcripts,
  transcriptsList,
  upgradeDowngrade,
} = finnhubClient

Source and dev info

Swagger file: swagger.json

OpenAPI Client: openapi-generator-cli.jar

How generate new version:

  1. java -jar .\openapi-generator-cli.jar generate -i .\swagger.json -o .\ -g typescript-axios --skip-validate-spec -c .\openapi-generator.json
  2. update npm version
  3. push to npm