Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stock-info

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stock-info

Module to retrieve stock information from Yahoo Finance API

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
decreased by-9.09%
Maintainers
1
Weekly downloads
 
Created
Source

stock-info

The Stock Info library retrieves current stock information from Yahoo Finance API.

Installation

Using npm:

npm install --save stock-info

Usage

import si from "stock-info";
// or
const si = require("stock-info");

getSingleStockInfo

Retrieves information about a single stock symbol

Input

A string that represents a stock symbol

Output

A Promise that resolves to a stock objects

Example
const si = require("stock-info");
si.getSingleStockInfo("GOOG").then(console.log);
//Prints the stock object to console

getStocksInfo

Retrieves information about a list of stock symbols

Note: This function will be removed in a future version. Just make your own list of promises using getSingleStockInfo.

Input

An array of strings where each element is a stock symbol.

Output

A Promise that resolves to an array of stock objects

Example
const si = require("stock-info");
const stocks = ["AMZN", "NFLIX"];
si.getStocksInfo(stocks).then(console.log);
//Prints an array of stock objects to console

Stock Object

The stock object has the following interface:

interface Stock {
  maxAge: number;
  preMarketChangePercent: NumberWrapper;
  preMarketChange: NumberWrapper;
  preMarketTime: number;
  preMarketPrice: NumberWrapper;
  preMarketSource: string;
  postMarketChange: UnknownEmptyObject;
  postMarketPrice: UnknownEmptyObject;
  regularMarketChangePercent: NumberWrapper;
  regularMarketChange: NumberWrapper;
  regularMarketTime: number;
  priceHint: NumberWrapperLongFormat;
  regularMarketPrice: NumberWrapper;
  regularMarketDayHigh: NumberWrapper;
  regularMarketDayLow: NumberWrapper;
  regularMarketVolume: NumberWrapperLongFormat;
  averageDailyVolume10Day: UnknownEmptyObject;
  averageDailyVolume3Month: UnknownEmptyObject;
  regularMarketPreviousClose: NumberWrapper;
  regularMarketSource: string;
  regularMarketOpen: NumberWrapper;
  strikePrice: UnknownEmptyObject;
  openInterest: UnknownEmptyObject;
  exchange: string;
  exchangeName: string;
  exchangeDataDelayedBy: number;
  marketState: string;
  quoteType: string;
  symbol: string;
  underlyingSymbol: null;
  shortName: string;
  longName: string;
  currency: string;
  quoteSourceName: string;
  currencySymbol: string;
  fromCurrency: null;
  toCurrency: null;
  lastMarket: null;
  volume24Hr: UnknownEmptyObject;
  volumeAllCurrencies: UnknownEmptyObject;
  circulatingSupply: UnknownEmptyObject;
  marketCap: NumberWrapperLongFormat;
}

interface UnknownEmptyObject {}

interface NumberWrapperLongFormat {
  raw: number;
  fmt: string;
  longFmt: string;
}

Keywords

FAQs

Package last updated on 15 May 2023

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

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc