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

google-finance2

v0.0.2

Published

Google Finance company news and historical quotes data downloader written in Node.js

Downloads

17

Readme

google-finance2

google-finance2 is fork by google-finance, is Google Finance company news and historical quotes data downloader written in Node.js.

The library handles fetching, parsing, and cleaning of CSV data and returns JSON result that is convenient and easy to work with. Both callback (last parameter) and promises (using Bluebird) styles are supported.

Also check out yahoo-finance.

Installation

$ npm install google-finance2

Usage

var googleFinance = require('google-finance2');

googleFinance.companyNews({
  symbol: 'NASDAQ:AAPL'
}, function (err, news) {
  //...
});

googleFinance.historical({
  symbol: 'NASDAQ:AAPL',
  from: '2014-01-01',
  to: '2014-12-31'
}, function (err, quotes) {
  //...
});

API

Download Company News Data (single symbol)

googleFinance.companyNews({
  symbol: SYMBOL,
  lang: 'en'
}, function (err, news) {
  /*
  [
    {
      "id": "52778621773856",
      "symbol": "NASDAQ:AAPL",
      "title": "After Apple Inc. dodged the iPhone 6 Plus BendGate bullet, detractors wounded ...",
      "description": "After Apple Inc. dodged the iPhone 6 Plus BendGate bullet, detractors wounded ...\n Apple Insider - Sep 27, 2014 \nWith new, larger iPhone 6 models now hitting the market, one Samsung executive reportedly acknowledged that \"the positive reaction from consumers to those two Apple devices\" forced the company to rush its Note 4 launch ahead of schedule, adding \"it's ...\nWill Apple's 'Bendgate' Give Samsung, BlackBerry An Opening? - Seeking Alpha (registration)",
      "summary": "After Apple Inc. dodged the iPhone 6 Plus BendGate bullet, detractors wounded ...\n Apple Insider - Sep 27, 2014 \nWith new, larger iPhone 6 models now hitting the market, one Samsung executive reportedly acknowledged that \"the positive reaction from consumers to those two Apple devices\" forced the company to rush its Note 4 launch ahead of schedule, adding \"it's ...\nWill Apple's 'Bendgate' Give Samsung, BlackBerry An Opening? - Seeking Alpha (registration)",
      "date": "2014-09-27T06:23:41.000Z",
      "link": "http://appleinsider.com/articles/14/09/27/after-apple-inc-dodged-the-iphone-6-plus-bendgate-bullet-detractors-wounded-by-ricochet"
    }
    ...
    {
      "id": "//www.fool.com/investing/general/2014/10/01/the-death-of-apple-incs-i.aspx",
      "symbol": "NASDAQ:AAPL",
      "title": "The Death of Apple, Inc's \"i\" Branding",
      "description": "The Death of Apple, Inc's \"i\" Branding\n Motley Fool - 27 minutes ago \nIn a recent blog post, he notes that neither of the two new products Apple unveiled earlier this month carried the iBranding, with the company instead opting for \"Apple Pay \"and \"Apple Watch.\" Segall believes that the only explanation for this is that ...",
      "summary": "The Death of Apple, Inc's \"i\" Branding\n Motley Fool - 27 minutes ago \nIn a recent blog post, he notes that neither of the two new products Apple unveiled earlier this month carried the iBranding, with the company instead opting for \"Apple Pay \"and \"Apple Watch.\" Segall believes that the only explanation for this is that ...",
      "date": "2014-10-01T21:45:00.000Z",
      "link": "http://www.fool.com/investing/general/2014/10/01/the-death-of-apple-incs-i.aspx"
    }
  ]
  */
});

Download Company News Data (multiple symbols)

googleFinance.companyNews({
  symbols: [SYMBOL1, SYMBOL2]
}, function (err, news) {
  /*
  {
    "NASDAQ:AAPL": [
      {
        "id": "52778621773856",
        "symbol": "NASDAQ:AAPL",
        "title": "After Apple Inc. dodged the iPhone 6 Plus BendGate bullet, detractors wounded ...",
        "description": "After Apple Inc. dodged the iPhone 6 Plus BendGate bullet, detractors wounded ...\n Apple Insider - Sep 27, 2014 \nWith new, larger iPhone 6 models now hitting the market, one Samsung executive reportedly acknowledged that \"the positive reaction from consumers to those two Apple devices\" forced the company to rush its Note 4 launch ahead of schedule, adding \"it's ...\nWill Apple's 'Bendgate' Give Samsung, BlackBerry An Opening? - Seeking Alpha (registration)",
        "summary": "After Apple Inc. dodged the iPhone 6 Plus BendGate bullet, detractors wounded ...\n Apple Insider - Sep 27, 2014 \nWith new, larger iPhone 6 models now hitting the market, one Samsung executive reportedly acknowledged that \"the positive reaction from consumers to those two Apple devices\" forced the company to rush its Note 4 launch ahead of schedule, adding \"it's ...\nWill Apple's 'Bendgate' Give Samsung, BlackBerry An Opening? - Seeking Alpha (registration)",
        "date": "2014-09-27T06:23:41.000Z",
        "link": "http://appleinsider.com/articles/14/09/27/after-apple-inc-dodged-the-iphone-6-plus-bendgate-bullet-detractors-wounded-by-ricochet"
      }
      ...
      {
        "id": "//www.fool.com/investing/general/2014/10/01/the-death-of-apple-incs-i.aspx",
        "symbol": "NASDAQ:AAPL",
        "title": "The Death of Apple, Inc's \"i\" Branding",
        "description": "The Death of Apple, Inc's \"i\" Branding\n Motley Fool - 29 minutes ago \nIn a recent blog post, he notes that neither of the two new products Apple unveiled earlier this month carried the iBranding, with the company instead opting for \"Apple Pay \"and \"Apple Watch.\" Segall believes that the only explanation for this is that ...",
        "summary": "The Death of Apple, Inc's \"i\" Branding\n Motley Fool - 29 minutes ago \nIn a recent blog post, he notes that neither of the two new products Apple unveiled earlier this month carried the iBranding, with the company instead opting for \"Apple Pay \"and \"Apple Watch.\" Segall believes that the only explanation for this is that ...",
        "date": "2014-10-01T21:45:00.000Z",
        "link": "http://www.fool.com/investing/general/2014/10/01/the-death-of-apple-incs-i.aspx"
      }
    ],
    "NYSE:TWTR": [
      {
        "id": "//www.benzinga.com/tech/14/09/4854209/why-is-twitter-inc-borrowing-more-money",
        "symbol": "NYSE:TWTR",
        "title": "Why Is Twitter Inc Borrowing More Money?",
        "description": "Why Is Twitter Inc Borrowing More Money?\n Benzinga - Sep 16, 2014 \nTwitter Inc (NYSE: TWTR) is borrowing $1.5 billion to expand the business, but is it wise for the company to take on new debt?",
        "summary": "Why Is Twitter Inc Borrowing More Money?\n Benzinga - Sep 16, 2014 \nTwitter Inc (NYSE: TWTR) is borrowing $1.5 billion to expand the business, but is it wise for the company to take on new debt?",
        "date": "2014-09-16T21:22:30.000Z",
        "link": "http://www.benzinga.com/tech/14/09/4854209/why-is-twitter-inc-borrowing-more-money"
      }
      ...
      {
        "id": "52778622630300",
        "symbol": "NYSE:TWTR",
        "title": "Making Twitter Inc (TWTR) A Friendly Place",
        "description": "Making Twitter Inc (TWTR) A Friendly Place\n ETF Daily News - 5 hours ago \ntwitter Discussing the problems Twitter Inc (NYSE:TWTR) faces within the social media network, with author of “Hatching Twitter” Nick Bilton.\nDrama at Twitter Inc (TWTR) Has Subsided Under The New Management: Nick ... - Insider Monkey (blog)",
        "summary": "Making Twitter Inc (TWTR) A Friendly Place\n ETF Daily News - 5 hours ago \ntwitter Discussing the problems Twitter Inc (NYSE:TWTR) faces within the social media network, with author of “Hatching Twitter” Nick Bilton.\nDrama at Twitter Inc (TWTR) Has Subsided Under The New Management: Nick ... - Insider Monkey (blog)",
        "date": "2014-10-01T16:18:45.000Z",
        "link": "http://etfdailynews.com/2014/10/01/making-twitter-inc-twtr-a-friendly-place/"
      }
    ]
  }
  */
});

Download Historical Data (single symbol)

googleFinance.historical({
  symbol: SYMBOL,
  from: START_DATE,
  to: END_DATE
}, function (err, quotes) {
  /*
  [
    {
      "date": "2014-01-02T05:00:00.000Z",
      "open": 79.38,
      "high": 79.58,
      "low": 78.86,
      "close": 79.02,
      "volume": 58791957,
      "symbol": "NASDAQ:AAPL"
    }
    ...
    {
      "date": "2014-10-01T04:00:00.000Z",
      "open": 100.59,
      "high": 100.69,
      "low": 98.7,
      "close": 99.18,
      "volume": 51304344,
      "symbol": "NASDAQ:AAPL"
    }
  ]
  */
});

Download Historical Data (multiple symbols)

googleFinance.historical({
  symbols: [SYMBOL1, SYMBOL2],
  from: START_DATE,
  to: END_DATE
}, function (err, result) {
  /*
  {
    "NASDAQ:GOOGL": [
      {
        "date": "2014-01-02T05:00:00.000Z",
        "open": 558.29,
        "high": 559.43,
        "low": 554.68,
        "close": 557.12,
        "volume": 1822719,
        "symbol": "NASDAQ:GOOGL"
      }
      ...
      {
        "date": "2014-10-01T04:00:00.000Z",
        "open": 586.8,
        "high": 588.72,
        "low": 578.02,
        "close": 579.63,
        "volume": 1444055,
        "symbol": "NASDAQ:GOOGL"
      }
    ],
    "NASDAQ:YHOO": [
      {
        "date": "2014-01-02T05:00:00.000Z",
        "open": 40.37,
        "high": 40.49,
        "low": 39.31,
        "close": 39.59,
        "volume": 21514650,
        "symbol": "NASDAQ:YHOO"
      }
      ...
      {
        "date": "2014-10-01T04:00:00.000Z",
        "open": 40.66,
        "high": 41.24,
        "low": 40.11,
        "close": 40.32,
        "volume": 35130364,
        "symbol": "NASDAQ:YHOO"
      }
    ],
    ...
  }
  */
});

Download prices Data (single symbol)

googleFinance.prices({
  symbol: 'TYO:6664',
  interval: 300,
  period: '1d'
}, function (err, quotes) {
  /*
  [
    {
      "time": 1495670700000,
      "date": "2017-05-25T09:05:00.000Z",
      "symbol": "TYO:6664",
      "close": 815,
      "high": 819,
      "low": 815,
      "open": 819,
      "volume": 36900
    }
    ...
    {
      "time": 1495692000000,
      "date": "2017-05-25T15:00:00.000Z",
      "symbol": "TYO:6664",
      "close": 890,
      "high": 890,
      "low": 882,
      "open": 884,
      "volume": 60100
    }
  ]
  */
});

Download prices Data (multiple symbols)

googleFinance.prices({
  symbols: ['SHA:600519','TYO:6664'],
  interval: 180,
  period: '1w'
}, function (err, result) {
  /*
  === SHA:600519 (81) ===                       
{                                             
  "time": 1495675980000,                      
  "date": "2017-05-25T10:33:00.000Z",         
  "symbol": "SHA:600519",                     
  "close": 449.88,                            
  "high": 450.5,                              
  "low": 448.74,                              
  "open": 448.74,                             
  "volume": 13459                             
}                                             
...                                           
{                                             
  "time": 1495695600000,                      
  "date": "2017-05-25T16:00:00.000Z",         
  "symbol": "SHA:600519",                     
  "close": 450.87,                            
  "high": 451.17,                             
  "low": 450.52,                              
  "open": 450.52,                             
  "volume": 13681                             
}                                             
=== TYO:6664 (100) ===                        
{                                             
  "time": 1495670580000,                      
  "date": "2017-05-25T09:03:00.000Z",         
  "symbol": "TYO:6664",                       
  "close": 815,                               
  "high": 819,                                
  "low": 815,                                 
  "open": 819,                                
  "volume": 35200                             
}                                             
...                                           
{                                             
  "time": 1495692000000,                      
  "date": "2017-05-25T15:00:00.000Z",         
  "symbol": "TYO:6664",                       
  "close": 890,                               
  "high": 890,                                
  "low": 882,                                 
  "open": 884,                                
  "volume": 55500                             
}                                             
  */
});

Specifying request options

Optionally request options (such as a proxy) can be specified by inserting an extra parameter just before the callback:

var httpRequestOptions = {
  proxy: 'http://localproxy.com'
};

googleFinance.companyNews({
  symbol: SYMBOL
}, httpRequestOptions, function (err, news) {
  // Result
});

googleFinance.historical({
  symbol: SYMBOL,
  from: START_DATE,
  to: END_DATE
}, httpRequestOptions, function (err, quotes) {
  // Result
});

Credits

See the contributors.

License

Analytics