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

yahoo-finserve

v1.0.3

Published

It is a package which fetches data of a specific instrument or indices.

Downloads

3

Readme

yahoo-finserve

It is a package which fetches data of a specific instrument or indices.

Installation

Install yahoo-finserve with npm

  npm install yahoo-finserve

Usage/Examples

  • Getting info of a stock
let yf = require("yahoo-finserve")

let tesla = new yf("tsla");

tesla.info().then((res) => {
    console.log(res)
}).catch((err) => {
    console.log(err)
})

Output

{
  currency: 'USD',
  symbol: 'TSLA',
  exchangeName: 'NMS',
  instrumentType: 'EQUITY',
  firstTradeDate: 1277818200,
  timezone: 'EDT',
  exchangeTimezoneName: 'America/New_York',
  regularMarketPrice: 720.2,
  chartPreviousClose: 714.94,
  previousClose: 714.94
}
  • Getting historical data of previous 1 month in 5 day interval
    • Valid periods: 1d,5d,1mo,3mo,6mo,1y,2y,5y,10y,ytd,max
    • Valid intervals: 1m,2m,5m,15m,30m,60m,90m,1h,1d,5d,1wk,1mo,3mo
let yf = require("yahoo-finserve")

let tesla = new yf("tsla");

tesla.history_period("1mo", "5d").then((res) => {
    console.log(res)
}).catch((err) => {
    console.log(err)
})

Output

[
  {
    timestamp: '16/6/2022, 7:00:00 pm',
    volume: 35796900,
    open: 668.2100219726562,
    high: 675.5,
    low: 626.0800170898438,
    close: 639.2999877929688
  },
  {
    timestamp: '21/6/2022, 7:00:00 pm',
    volume: 40931000,
    open: 673.8099975585938,
    high: 730.72998046875,
    low: 673,
    close: 711.1099853515625
  },
  .
  .
  .
  .
]
  • Getting historical data from 2021-07-05 to 2022-07-05 in 1 month timeframe

    • Valid date formate: YYYY-MM-DD
    • Always assign 0 for single digit date or month
    • For example: Don't write 2016-4-2 , instead write 2016-04-02
    • Valid intervals: 1m,2m,5m,15m,30m,60m,90m,1h,1d,5d,1wk,1mo,3mo
let yf = require("yahoo-finserve")

let tesla = new yf("tsla");

tesla.history_between("2021-07-05", "2022-07-05", "1mo").then((res) => {
    console.log(res)
}).catch((err) => {
    console.log(err)
})

Output

[
  {
    timestamp: '1/8/2021, 9:30:00 am',
    volume: 381324900,
    open: 700,
    high: 740.3900146484375,
    low: 648.8400268554688,
    close: 735.719970703125
  },
  {
    timestamp: '1/9/2021, 9:30:00 am',
    volume: 390171300,
    open: 734.0800170898438,
    high: 799,
    low: 708.8499755859375,
    close: 775.47998046875
  }
  .
  .
  .
  .
  .
]

Author

🚀 About Me

A self-motivated and hardworking individual constantly involved in self-improvement. I was curious about how technology works from childhood, which is why I am in tech. I tried many languages but my interest inclined towards Javascript which is why I have chosen Mern Stack development. I am a full-stack developer currently working on the MERN stack.

🔗 Links

linkedin