Socket
Book a DemoInstallSign in
Socket

google-stock-realtime

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-stock-realtime

Real time stock information from trusted google source

1.1.2
latest
npmnpm
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

google-stock-realtime

Google Realtime Stock Data API for real-time stock quotes from Google Finance.

We fetch information from the results posted in Google search page.

Install

$ npm install google-stock-realtime --save

Usage

var realtimeStock = require("google-stock-realtime");

realtimeStock.getStockOverview("AAPL")
  .then(data => console.log(JSON.stringify(data, null, 2)))
  .catch(err => console.error(err.stack ? err.stack : err));

/*
Output:
{
  "symbol": "AAPL",
  "open": 149.13,
  "high": 149.87,
  "low": 147.29,
  "marketCap": null,
  "peRatio": 24.34,
  "yield": 0.62,
  "cdpScore": "A-",
  "high52week": 182.94,
  "low52week": 129.04
}
*/

realtimeStock.getStockLastPrice("AAPL")
  .then(data => console.log(JSON.stringify(data, null, 2)))
  .catch(err => console.error(err.stack ? err.stack : err));

/*
Output:
{
  "symbol": "AAPL",
  "realtimePrice": "$150.72",
  "profitLossPercentage": "1.30%",
  "profitLossToday": "+1.93 Today"
}
*/

realtimeStock.getMultipleStockLastPrice(["AAPL","TSLA","MSFT","NVDA"])
  .then(data => console.log(JSON.stringify(data, null, 2)))
  .catch(err => console.error(err.stack ? err.stack : err));

/*
Output:
{
  "AAPL": {
    "stock": "AAPL",
    "realtimePrice": "$150.72",
    "profitLossPercentage": "1.30%",
    "profitLossToday": "+1.93 Today"
  },
  "TSLA": {
    "stock": "TSLA",
    "realtimePrice": "$183.17",
    "profitLossPercentage": "2.01%",
    "profitLossToday": "-3.75 Today"
  },
  "MSFT": {
    "stock": "MSFT",
    "realtimePrice": "$241.68",
    "profitLossPercentage": "0.021%",
    "profitLossToday": "-0.050 Today"
  },
  "NVDA": {
    "stock": "NVDA",
    "realtimePrice": "$156.77",
    "profitLossPercentage": "1.46%",
    "profitLossToday": "-2.33 Today"
  }
}
*/

License

MIT license; see LICENSE.

Keywords

Google Stocks

FAQs

Package last updated on 30 Nov 2022

Did you know?

Socket

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.