Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
yahoo-stock-api
Advanced tools
Readme
💰 NPM package to get stock and historical price from finance.yahoo.com
npm i yahoo-stock-api
or yarn add yahoo-stock-api
if you use yarn.
Everything in this API will return Promise so remember to use async/await
or callback
getHistoricalPrices: async function({ startDate, endDate, symbol, frequency })
Return Promise
const yahooStockAPI = require('yahoo-stock-api').default;
const yahoo = new yahooStockAPI();
const startDate = new Date('08/21/2020');
const endDate = new Date('08/26/2020');
yahoo.getHistoricalPrices({ startDate, endDate, symbol: 'AAPL', frequency: '1d' }).then(console.log);
{
error: false,
currency: 'USD',
response: [
{
date: 1598418000,
open: 126.18,
high: 126.99,
low: 125.08,
close: 126.52,
adjClose: 124.81,
volume: 163022400
},
{
date: 1598331600,
open: 124.7,
high: 125.18,
low: 123.05,
close: 124.82,
adjClose: 123.13,
volume: 211495600
},
{
date: 1598245200,
open: 128.7,
high: 128.79,
low: 123.94,
close: 125.86,
adjClose: 124.15,
volume: 345937600
},
{
date: 1597986000,
open: 119.26,
high: 124.87,
low: 119.25,
close: 124.37,
adjClose: 122.68,
volume: 338054800
}
]
}
getSymbol({ symbol })
Return Promise
const yahooStockAPI = require('yahoo-stock-api').default;
const yahoo = new yahooStockAPI();
yahoo.getSymbol({ symbol: 'AAPL' }).then(console.log);
{
error: false,
currency: 'USD',
response: {
updated: 1673486286910,
previousClose: 130.73,
open: 131.25,
bid: { value: 133.42, shares: 900 },
ask: { value: 133.47, shares: 1000 },
dayRange: { low: 130.46, high: 133.49 },
fiftyTwoWeekRange: { low: 124.17, high: 179.61 },
volume: 69458949,
avgVolume: 83633004,
marketCap: 2124000000000,
beta: 1.27,
peRatio: 21.85,
eps: 6.11,
earningsDate: { start: 1675317600, end: undefined },
forwardDividend: 0.92,
forwardYield: 0.71,
exDividendDate: 1667538000,
oneYearTargetEst: 173.25
}
}
Thanks goes to these wonderful people (emoji key):
Duy Pham Le 💻 | Rajat 🤔 | Tommy Tang 💻 🐛 | keiichi 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!
FAQs
Simple package to get stock price from yahoo finance
The npm package yahoo-stock-api receives a total of 39 weekly downloads. As such, yahoo-stock-api popularity was classified as not popular.
We found that yahoo-stock-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.