Socket
Socket
Sign inDemoInstall

yahoo-finance-data

Package Overview
Dependencies
58
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    yahoo-finance-data

A node wrapper to call the various yahoo finance API's


Version published
Weekly downloads
4
increased by100%
Maintainers
1
Install size
6.37 MB
Created
Weekly downloads
 

Readme

Source

Build Status

npm version

NPM

yahoo-finance

A node wrapper to call the various Yahoo! Finance API's.

Some services have been deprecated by Yahoo! as of May 18th, 2017. Please see API docs below.

Prerequisites

This module requires a Yahoo! API key. More info here.

Install

npm install yahoo-finance-data

Getting started

const YahooFinanceAPI = require('yahoo-finance-data');

const api = new YahooFinanceAPI({
  key: 'mylongyahooapikey',
  secret: 'mylongyahooapisecret'
});

API

getQuotes(symbolList)

DEPRECATED AS OF 3.2

getReatimeQuotes(symbolList)

Retrieves realtime quote data for one or more securities.

ParamTypeDesc
symbolListStringthe ticker list, comma-separated
api
  .getRealtimeQuotes('YHOO,MSFT,AAPL')
  .then(data => console.log(data))
  .catch(err => console.log(err));

getHistoricalData(symbol, [interval, range])

UPDATED IN v3!

Retrieves historical data for a given security.

ParamTypeDesc
symbolStringthe ticker
intervalStringOPTIONAL interval between data points (default: 1d)
rangeStringOPTIONAL data range (default: 1y)

Valid ranges: ["1d","5d","1mo","3mo","6mo","1y","2y","5y","10y","ytd","max"]

api
  .getHistoricalData('AAPL', '1d', '1y')
  .then(data => console.log(data))
  .catch(err => console.log(err));

getForexData(exchanges)

UPDATED IN v3.2 !

Retrieves forex data for one or multiple currency pairs.

ParamTypeDesc
exchangesStringthe list of currency pairs, comma-separated
api
  .getForexData('eurusd,gbpusd,cadusd')
  .then(data => console.log(data))
  .catch(err => console.log(err));

getHeadlinesByTicker(ticker)

Retrieves news headlines for a given security.

ParamTypeDesc
tickerStringthe ticker
api
  .getHeadlinesByTicker('AAPL')
  .then(data => console.log(data))
  .catch(err => console.log(err));

getIntradayChartData(ticker, [interval, prePostData])

UPDATED IN v3!

Retrieves intraday chart data for a given security.

ParamTypeDesc
tickerStringthe ticker
intervalStringOPTIONAL time interval for data points (default: 2m)
prePostDataBooleanOPTIONAL add pre/post data (default: true)
api
  .getIntradayChartData('AAPL', '2m', true)
  .then(data => console.log(data))
  .catch(err => console.log(err));

tickerSearch(searchTerm, [region, lang])

Retrieves matches for a given search term.

ParamTypeDesc
searchTermStringthe search query
regionStringOPTIONAL the region (default: US)
langStringOPTIONAL the language (default: en-US)
api
  .tickerSearch('Apple Inc.', 'US', 'en-US')
  .then(data => console.log(data))
  .catch(err => console.log(err));

quoteSummary(ticker)

NEW IN v3!

Retrieves company information based on its ticker.

ParamTypeDesc
tickerStringthe ticker
api
  .quoteSummary('AAPL')
  .then(data => console.log(data))
  .catch(err => console.log(err));

optionChain(ticker)

NEW IN v3!

Retrieves option chain for a given ticker.

ParamTypeDesc
tickerStringthe ticker
api
  .optionChain('AAPL')
  .then(data => console.log(data))
  .catch(err => console.log(err));

recommendations(ticker)

NEW IN v3!

Retrieves securities recommendations based on a given ticker.

ParamTypeDesc
tickerStringthe ticker
api
  .recommendations('AAPL')
  .then(data => console.log(data))
  .catch(err => console.log(err));

futures(market, [range, interval, prePostData])

NEW in v3.1!

Retrieves futures data for a given market.

ParamTypeDesc
marketStringthe market symbol
rangeStringOPTIONAL the amount of days (default: 5d)
intervalStringOPTIONAL time interval for data points (default: 1d)
prePostDataBooleanOPTIONAL add pre/post data (default: false)
api
  .futures('NQ=F')
  .then(data => console.log(data))
  .catch(err => console.log(err));

commodities(commodities, [range, interval, prePostData])

NEW in v3.1!

Retrieves one or more commodities futures data.

ParamTypeDesc
commoditiesStringthe list of commodities (comma-separated)
rangeStringOPTIONAL the amount of days (default: 1d)
intervalStringOPTIONAL time interval for data points (default: 5m)
prePostDataBooleanOPTIONAL add pre/post data (default: false)
api
  .commodities('GC=F,SI=F,PL=F,HG=F')
  .then(data => console.log(data))
  .catch(err => console.log(err));

FAQs

Last updated on 27 Aug 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc