Skip to main content

Fundamental Analysis

The FA module provides programmatic access to the commands from within the OpenBB Terminal. To get the most out of these functions, we recommend obtaining API keys from:

  • AlphaVantage
  • EODHD (premium subscribers only)
  • Financial Modeling Prep
  • Polygon

View this page for a list of all API sources used across the platform.

The FA Module

A brief description below highlights the properties of the fa module.

PathDescription
openbb.stocks.fa.analysisAnalysis of SEC disclosure statements
openbb.stocks.fa.balanceCompany balance sheet
openbb.stocks.fa.calCalendar earnings and estimates
openbb.stocks.fa.cashCompany cash flows statements
openbb.stocks.fa.customerLists other public companies who are customers
openbb.stocks.fa.dcfcHistorical DCF Values for a ticker
openbb.stocks.fa.divsHistorical Dividends for a company
openbb.stocks.fa.divs_chartA chart for divs
openbb.stocks.fa.dupontDuPont ratios
openbb.stocks.fa.earningsEarnings data and EPS
openbb.stocks.fa.enterpriseCompany enterprise value
openbb.stocks.fa.epsfcForward EPS estimates
openbb.stocks.fa.fama_coeFama/French value for cost of equity
openbb.stocks.fa.fraudKey fraud ratios
openbb.stocks.fa.growthGrowth of financial statement ratios
openbb.stocks.fa.incomeCompany income statements
openbb.stocks.fa.keyCompany Key Metrics
openbb.stocks.fa.metricsKey Metrics Over Time
openbb.stocks.fa.mgmtCompany Management Team
openbb.stocks.fa.mktcapEstimated Market Cap
openbb.stocks.fa.mktcap_chartChart for mktcap
openbb.stocks.fa.overviewOverview of the company
openbb.stocks.fa.ptAnalyst price targets
openbb.stocks.fa.pt_chartChart for pt
openbb.stocks.fa.ratingHistorical buy/sell/hold ratings based on ratios
openbb.stocks.fa.ratiosHistorical financial statements ratios
openbb.stocks.fa.revfcForward revenue estimates
openbb.stocks.fa.scoreInvesting Score from Warren Buffet
openbb.stocks.fa.shrsMajor shareholders
openbb.stocks.fa.splitsStock Splits and Reverse Splits Since IPO
openbb.stocks.fa.splits_chartChart for splits
openbb.stocks.fa.supplierLists other public companies who are suppliers

This can be printed to the screen with:

help(openbb.stocks.fa)

Parameters for each function are displayed using the same syntax.

help(openbb.stocks.fa.balance)

Signature:
openbb.stocks.fa.balance(
symbol: str,
quarterly: bool = False,
ratios: bool = False,
source: str = 'YahooFinance',
limit: int = 10,
) -> pandas.core.frame.DataFrame
Call signature: openbb.stocks.fa.balance(*args: Any, **kwargs: Any) -> Any
Type: get_balance_sheet
String form: <openbb_terminal.stocks.fundamental_analysis.sdk_helpers.Operation object at 0x1684e8f70>
File: ~/GitHub/OpenBBTerminal/openbb_terminal/stocks/fundamental_analysis/sdk_helpers.py
Docstring:
Get balance sheet.

Parameters
----------
symbol : str
Symbol to get balance sheet for
source : str, optional
Data source for balance sheet, by default "YahooFinance"
Sources: YahooFinance, AlphaVantage, FinancialModelingPrep, Polygon, EODHD
quarterly : bool, optional
Flag to get quarterly data
ratios : bool, optional
Flag to return data as a percent change.
limit : int
Number of statements to return (free tiers may be limited to 5 years)

Returns
-------
pd.DataFrame
Dataframe of balance sheet

Examples
--------
>>> from openbb_terminal.sdk import openbb
>>> balance_sheet = openbb.stocks.fa.balance("AAPL", source="YahooFinance")

If you have a premium AlphaVantage key, you can use the quarterly flag to get quarterly statements
>>> quarterly_income_statement = openbb.stocks.fa.balance("AAPL", source="AlphaVantage", quarterly=True)

This information is also displayed in the contextual help window, when using Jupyter Lab or VS Code.

Examples

The examples provided below will assume that the following import block is included at the beginning of the Python script or Notebook file:

import pandas as pd
from openbb_terminal.sdk import openbb

Earnings

The openbb.stocks.fa.earnings function returns upcoming earnings dates and estimates for EPS. There are two data sources available - YahooFinance or AlphaVantage, both of which provide historical context.

openbb.stocks.fa.earnings('COST', quarterly = True)
Earnings DateEPS EstimateReported EPSSurprise(%)
2024-02-29---
2023-12-06---
2023-09-20---
2023-05-253.21--
2023-05-25---
2023-03-023.213.30.0288
2022-12-083.113.1-0.00451
2022-09-224.174.20.0084
2022-05-263.033.170.0449
2022-03-032.742.920.0647
2021-12-092.642.980.12890

Growth

openbb.stocks.fa.growth provides annualized financial ratios as growth metrics.

openbb.stocks.fa.growth('COST')

Note: This returns thirty-five ratios, the table below is truncated for illustrative purposes.

20182019202020212022
PeriodFYFYFYFYFY
Revenue growth0.0970.0790.0920.1750.158
Gross profit growth0.0750.0760.1010.1570.092
Ebitgrowth0.090-0.2360.1340.3060.203
Operating income growth0.090-0.2360.1340.3060.203

Analysis

The openbb.stocks.fa.analysis function scans 10K SEC filings with NLP to highlight risk factors and statements provided in the Discussion and Analysis sections. Summarizations by, elclect.us

openbb.stocks.fa.analysis('COST').head(1)
GroupGoodSentence
Risk factorsFalseDuring 2022, our international operations, including Canada, generated 27% and 32% of our net sales and operating income, respectively.
df = openbb.stocks.fa.analysis('COST')
hp = df["Group"].str.contains('Discussion')
df[hp].head(1)
GroupGoodSentence
Discussion and AnalysisTrueCash Flows from Operating ActivitiesNet cash provided by operating activities totaled 5,802inthefirsthalfof2023,comparedto5,802 in the first half of 2023, compared to 3,659 in the first half of 2022.

Key

Use openbb.stocks.fa.key for a small table of key statistics.

openbb.stocks.fa.key('COST')
Market capitalization219.440 B
EBITDA9.891 B
EPS13.62
PE ratio36.33
PEG ratio3.433
Price to book ratio10.39
Return on equity TTM0.284
Price to sales ratio TTM0.891
Dividend yield0.0083
50 day moving average491.41
Analyst target price547.64
Beta0.787

SHRS

The top 10 mutual funds holding the stock are retrieved with:

openbb.stocks.fa.shrs(symbol = 'COST', holder = 'mutualfund')
HolderSharesDate ReportedStakeValue
Vanguard Total Stock Market Index Fund13.453 M2022-12-30 00:00:003.03 %6.591 B
Vanguard 500 Index Fund10.232 M2022-12-30 00:00:002.31 %5.012 B
Invesco ETF Tr-Invesco QQQ Tr, Series 1 ETF5.834 M2023-03-30 00:00:001.32 %2.858 B
Fidelity 500 Index Fund4.852 M2023-02-27 00:00:001.09 %2.377 B
SPDR S&P 500 ETF Trust4.804 M2023-03-30 00:00:001.08 %2.353 B
iShares Core S&P 500 ETF3.950 M2023-02-27 00:00:000.89 %1.935 B
Vanguard Growth Index Fund3.736 M2022-12-30 00:00:000.84 %1.830 B
Select Sector SPDR Fund-Consumer Staples3.241 M2023-02-27 00:00:000.73 %1.588 B
Vanguard Institutional Index Fund-Institutional Index Fund3.102 M2022-12-30 00:00:000.70 %1.519 B
Vanguard Specialized-Dividend Appreciation Index Fund2.804 M2023-01-30 00:00:000.63 %1.374 B

Balance

Financial statement items can be displayed as their reported value or as a percent change.

openbb.stocks.fa.balance(symbol = 'COST', ratios=True)
Breakdown2022-08-312021-08-312020-08-31
Cash and cash equivalents-0.0937111-0.08300070.464337
Other short-term investments-0.0774264-0.107977-0.0301887
Total cash-0.0924846-0.08493050.408831
Net receivables0.2429280.1632260.00977199
Inventory0.2597260.1611660.0743308
Other current assets0.142530.282502-0.0792079
Total current assets0.1081510.04925320.19736
Gross property, plant and equipment0.05322090.08153960.149114
Accumulated depreciation0.07906250.09848010.0988412
Net property, plant and equipment0.0393450.0726570.177358
Other long-term assets0.197870.1900741.77171
Total non-current assets0.05735310.08481560.251928
Total assets0.08264160.06681550.2237
Current debt-0.9086367.41053-0.944085
Accounts payable0.09644920.1486030.21346
Accrued liabilities0.09217150.1526610.147383
Other current liabilities0.2302130.223444-0.0168776
Total current liabilities0.08685170.1850350.0691569
Long-term debt-0.0310819-0.1093960.466432
Other long-term liabilities0.0579710.2480620.329897
Total non-current liabilities-0.0194059-0.02148750.825049
Total liabilities0.05654290.1177440.235947
Common stock-0.500
Retained earnings0.335933-0.09418430.255508
Accumulated other comprehensive income0.608619-0.123362-0.0967967
Total stockholders' equity0.175245-0.03937870.199501
Total liabilities and stockholders' equity0.08264160.06681550.2237

Cashflow and Income statements are requested in the same way.

Cash

Get the company's cash statements.

openbb.stocks.fa.cash(symbol = 'COST').tail(4)
Breakdownttm2022-08-312021-08-312020-08-312019-08-31
Cash at end of period13136000.010203000.011258000.012277000.08384000.0
Operating cash flow9535000.07392000.08958000.08861000.06356000.0
Capital expenditure-4060000.0-3891000.0-3588000.0-2810000.0-2998000.0
Free cash flow5475000.03501000.05370000.06051000.03358000.0

Income

Get the company's income statements.

openbb.stocks.fa.income('COST').tail(4)
Breakdown2022-08-312021-08-312020-08-312019-08-31
Diluted EPS13.1411.279.028.26
Basic average shares443651.00443089.00442297.00439755.00
Diluted average shares444757.00444346.00443901.00442923.00
EBITDA7998000.006851000.005527000.004915000.00

Supplier

openbb.stocks.fa.supplier will return a list of suppliers for the compnay, that are also listed US stocks.

openbb.stocks.fa.supplier('COST').head(5)
TICKERCompany NameRevenueNet IncomeNet MarginCash Flow
BRKABerkshire Hathaway Inc781651832123.44 %-52307
ULVRUnilever Plc58737.37415.5212.62 %0
COSTCostco Wholesale Corp5443713642.51 %653
BUDAnheuser busch Inbev Sa54304611411.26 %0
DEODiageo Plc22448333814.87 %2749

EPSFC

Returns a DataFrame of forward EPS estimates consensus.

openbb.stocks.fa.epsfc('COST')
fiscalyearconsensus_meanchange %analystsactualconsensus_lowconsensus_high
202213.15118.69182013.2712.4313.43
202314.59.267913014.2215.18
202415.8018.9747820014.7517.09
202517.3379.7180710016.4718.92
202619.33211.50885017.5521.84
202721.40810.73875018.625.72
202823.62510.35592022.1925.06
202927.215.13231027.227.2
203029.68.823531029.629.6
203132.058.277031032.0532.05
203234.878.798751034.8734.87

SEC

openbb.stocks.fa.sec SEC forms filed by year and type.

openbb.stocks.fa.sec('COST').head(4)
FiledCompany NameReporting OwnerForm TypePeriodView
04/19/2023Costco Wholesale Corporation8-K04/19/2023https://app.quotemedia.com/data/downloadFiling...
04/13/2023Costco Wholesale Corporation404/11/2023https://app.quotemedia.com/data/downloadFiling...
03/15/2023Costco Wholesale CorporationJELINEK W CRAIG403/13/2022https://app.quotemedia.com/data/downloadFiling...
03/15/2023Costco Wholesale CorporationGALANTI RICHARD A403/14/2023https://app.quotemedia.com/data/downloadFiling...

PT

openbb.stocks.fa.pt returns historical ratings and price targets, by firm.

openbb.stocks.fa.pt('COST').tail(10)
DateCompanyRatingPrice Target
2023-02-08Barclays CapitalHOLD510
2023-02-27Telsey Advisory GroupBUY580
2023-03-03Baird Patrick & CoBUY535
2023-03-03Telsey Advisory GroupBUY540
2023-03-03Morgan StanleyBUY520
2023-03-07NorthcoastBUY560
2023-03-28Telsey Advisory GroupBUY540
2023-04-06Telsey Advisory GroupBUY540
2023-04-06Oppenheimer & Co. Inc.BUY550
2023-05-01Telsey Advisory GroupBUY540