🧙📊 Finwiz
Get a company's financials and stock information using a simple and intuitive API.
Installation
Via npm:
npm install finwiz
Usage
The API is very simple and easy to use. The basic finwiz
function takes a string representing a company's stock ticker. It returns a company
object containing a variety of useful methods.
import finwiz from "finwiz";
finwiz("AAPL").then(company => {
})
Financials
Getting a company's stock performance metrics and other related financial metrics is very easy:
finwiz("AAPL").then(company => {
company.financials().then(data => {
console.log(data);
});
});
Example output of the above code is shown below:
{
index: 'djia s&p500',
pe: 17.5,
'eps_(ttm)': 11.67,
insider_own: 0.07,
shs_outstand: 4640000000,
perf_week: 2.25,
market_cap: 948320000000,
forward_pe: 16.19,
eps_next_y_estimate: 12.26,
eps_next_y: 10.36,
insider_trans: -4.02,
shs_float: 4600000000,
perf_month: 11.88,
income: 56070000000,
peg: 1.46,
eps_next_q: 2.1,
inst_own: 60.9,
short_float: 1.02,
perf_quarter: 4.36,
sales: 258490000000,
ps: 3.67,
eps_this_y: 32.6,
inst_trans: -2.89,
short_ratio: 1.7,
perf_half_y: 43.63,
booksh: 22.65,
pb: 9.02,
roa: 16,
target_price: 212.03,
perf_year: 11.04,
cashsh: 17.25,
pc: 11.84,
eps_next_5y: 12,
roe: 51.3,
'52w_high_price': 233.47,
'52w_low_price': 142,
perf_ytd: 29.47,
dividend: 3.08,
pfcf: 20.78,
eps_past_5y: 16.5,
roi: 26.6,
'52w_high': -12.52,
beta: 1.24,
dividend_percent: 1.51,
quick_ratio: 1.3,
sales_past_5y: 9.2,
gross_margin: 38.1,
'52w_low': 43.82,
atr: 3.54,
employees: 132000,
current_ratio: 1.3,
sales_qq: -5.1,
'oper._margin': 25.3,
'rsi_(14)': 63.02,
volatility_week: 1.19,
volatility_month: 1.57,
optionable: 'yes',
debteq: 1.06,
eps_qq: -9.8,
profit_margin: 22.1,
rel_volume: 0.62,
prev_close: 204.41,
shortable: 'yes',
lt_debteq: 0.85,
earnings: 'jul 30 amc',
payout: 24.4,
avg_volume: 27660000,
price: 204.23,
recom: 2.2,
sma20: 3.87,
sma50: 5.29,
sma200: 8.46,
volume: 17203128,
change: -0.09
}
Ratings
It is just as easy to get a company's latest analyst ratings:
finwiz("AAPL").then(company => {
company.ratings().then(data => {
console.log(data);
});
});
Example output is shown below:
[
{
date: '2019-06-06',
action: 'initiated',
org: 'Evercore ISI',
rating: { before: '', after: 'outperform' },
target: { before: '', after: 205 }
},
{
date: '2019-06-04',
action: 'reiterated',
org: 'Cowen',
rating: { before: '', after: 'outperform' },
target: { before: 245, after: 220 }
},
{
date: '2019-05-30',
action: 'reiterated',
org: 'Morgan Stanley',
rating: { before: '', after: 'overweight' },
target: { before: 240, after: 231 }
},
...
]
The "before" fields will only exist if data is available for them (e.g. in the event of a downgrade). The "after" fields will always contain a value.
News
It is also possible to get a company's latest news:
finwiz("AAPL").then(company => {
company.news().then(data => {
console.log(data);
});
});
Example output is shown below:
[
{
date: '2019-07-02',
news: [{
time: '17:32',
headline: 'UPDATE 1-Wall Street looks to earnings after strongest June in decades Reuters',
link: 'https://finance.yahoo.com/news/1-wall-street-looks-earnings-213215453.html'
},
{
time: '16:42',
headline: 'Dow Jones Today: More Trade Tiffs, But Its Not China This Time InvestorPlace',
link: 'https://finance.yahoo.com/news/dow-jones-today-more-trade-204224788.html'
}
...
]
},
...
]
Insider
Getting the latest insider transactions is just as easy:
finwiz("AAPL").then(company => {
company.insider().then(data => {
console.log(data);
});
});
Example output is shown below:
[
{
name: 'LEVINSON ARTHUR D',
relationship: 'Director',
date: '2019-08-02',
transaction: 'sale',
cost: 206.58,
shares: 20000,
value: 4131600,
shares_total: 1133283,
sec_filing_date: '2019-08-06',
sec_filing_link:
'http://www.sec.gov/Archives/edgar/data/320193/000032019318000103/xslF345X03/wf-form4_153359461891019.xml'
},
{
name: 'WILLIAMS JEFFREY E',
relationship: 'COO',
date: '2019-07-09',
transaction: 'sale',
cost: 190.18,
shares: 15652,
value: 2976664,
shares_total: 123737,
sec_filing_date: '2019-07-11',
sec_filing_link:
'http://www.sec.gov/Archives/edgar/data/320193/000032019318000095/xslF345X03/wf-form4_153134826427557.xml'
},
...
]
Where does the information come from?
Currently, all the information is sourced from finviz (yes, hence the name). Refer to their site for more information regarding each metric. This means data is not real-time -- it is delayed by around 15 minutes.
Contributing
Contributions are very welcome! To develop locally, all you'll have to do is run npm run build
and get to work in the /src
folder.