How To Retrieve Corporate Fundamentals Data With The OpenBB Terminal
Tags: tutorial, python, opensource, 100daysofcode
Published: 2022-04-22 18:44:01

![wut phun-damentals?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ljr3bbmvnwzzyoxtn5h3.png)
 
Over the past few years there has been a thriving narrative that says stocks are detached from reality and they do not trade on fundamentals. Over the past three quarters that narrative has rapidly evolved from a violent sector rotation, through price multiples compression events, then nose-dived on the real economy just to circle back and choke on supply chain constraints. Like a hose wrapped in a knot.

A company's position as a cog in the global macro wheel will dictate their ability to withstand market forces beyond their control. Those maintaining pricing power stay in control of fundamentals, empowered by their balance sheet that offers flexibility in the use of debt, equity, and cash. If there is not a way to hedge against supplier price shocks, a business is not in control of its operating margins.

Like technical analysis, everyone has their own way to read the tea leaves; however, unlike technicals, the fundamental data shows up on financial statements, which do live in reality. There is an auditable and tangible value of assets and liabilities held by a company; office chairs are still worth money even when the company isn't.

If cash and cash-equivalents are greater than the market cap minus [debt + operating expenses], there is an argument to be made for shares being underpriced. Extra money laying around can only be used for specific purposes:

- Pay down debt
- Pay a dividend
- Buyback shares (increase equity ownership of shareholders)
- Remain on the balance sheet for the next year

A company does not have to report positive earnings-per-share in order to post a profit. Earnings are expressed as a multiple of the income against the share price before:

- Interest
- Taxes
- Debt
- Amortization

EBITDA

Adjustments made to the income statement will spit out a value for net income. The three financial statements flow in order:

1. Income statement - Money In

2. Balance sheet - Against Money Out

3. Cashflow statement - Is Net Equity To Shareholders


The bottom line of the first statement becomes the top line of the second, adding or subtracting until the net cash attributable to the tangible book value of a share is revealed. When you hear someone describing a company's fundamentals as being X% the share value in cash, they are talking about the balance sheet.

The cashflow statement shows how money moved in or out of the business in three ways:

1. Operations: Summation of costs, returns, and expenses.

2. Investments: Net balance of R&D, acquisitions, dispositions, property, derivatives, etc.

3. Financing:  Capital flows remaining for stakeholders - Bond issuances or payments, share offerings or buybacks, dividend payments, cash retained on the balance sheet.


**OK, but how, openbb.request.get.fundamentals('ticker')?**

wut ticker?

![really...?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vi7kvwenle4fpwn7mdop.png)

Let's do this!
```
/stocks/load ko
fa
```

![The Fundamental Analysis menu in the OpenBB Terminal (https://openbb-finance.github.io/OpenBBTerminal/terminal/stocks/fundamental_analysis/)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/08tfvtu2tdkkor3gzjrk.png)

Inside the submenu, there are commands listed on the left in blue, with accompanying descriptions on the right. At the bottom, there is also a command with a character on the left, >. Behind this command is yet another submenu!

![Fundamentals in the OpenBB Terminal (https://openbb-finance.github.io/OpenBBTerminal/terminal/stocks/fundamental_analysis/fmp/)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/95ydc77z44v2uxahnyop.png)

As with portfolio construction, diversity of information is critical when making informed decisions. It helps offset the risk of confirmation bias and mitigates reliance on any single source. Redundant features in this submenu are a feature, not a bug.

Like anywhere in the terminal, a help dialogue is called with the additional, -h flag.

![Viewing Coca-Cola fundamentals with the OpenBB Terminal (https://openbb-finance.github.io/OpenBBTerminal/terminal/stocks/fundamental_analysis/fmp/enterprise/)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zn6ainbpsfblrveajvf4.png)

Plot the dividend history (substitute KO with another ticker, anywhere in the terminal to get here):
```
/stocks/load ko/fa/divs -p
```

![Dividend history chart (https://openbb-finance.github.io/OpenBBTerminal/terminal/stocks/fundamental_analysis/divs/)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/govgeaac4ltlpx64k3d9.png)

Something sus?
```
(🦋) /stocks/fa/ $ fraud -h
usage: fraud [-e] [-h] [--export EXPORT]

M-score:
------------------------------------------------
The Beneish model is a statistical model that uses financial ratios calculated with accounting data of a specific company in order to check if it is likely (high probability) that the reported earnings of the company have been manipulated. A score of -5 to -2.22 indicated a low chance of fraud, a score of -2.22 to -1.78 indicates a moderate change of fraud, and a score above -1.78 indicated a high chance of fraud.[Source: Wikipedia]

DSRI:
Days Sales in Receivables Index gauges whether receivables and revenue are out of balance, a large number is expected to be associated with a higher likelihood that revenues and earnings are overstated.

GMI:
Gross Margin Index shows if gross margins are deteriorating. Research suggests that firms with worsening gross margin are more likely to engage in earnings management, therefore there should be a positive correlation between GMI and probability of earnings management.

AQI:
Asset Quality Index measures the proportion of assets where potential benefit is less certain. A positive relation between AQI and earnings manipulation is expected.

SGI:
Sales Growth Index shows the amount of growth companies are having. Higher growth companies are more likely to commit fraud so there should be a positive relation between SGI and earnings management.

DEPI:
Depreciation Index is the ratio for the rate of depreciation. A DEPI greater than 1 shows that the depreciation rate has slowed and is positively correlated with earnings management.

SGAI:
Sales General and Administrative Expenses Index measures the change in SG&A over sales. There should be a positive relationship between SGAI and earnings management.

LVGI:
Leverage Index represents change in leverage. A LVGI greater than one indicates a lower change of fraud.

TATA: 
Total Accruals to Total Assets is a proxy for the extent that cash underlies earnings. A higher number is associated with a higher likelihood of manipulation.

Z-score:
------------------------------------------------
The Zmijewski Score is a bankruptcy model used to predict a firm's bankruptcy in two years. The ratio uses in the Zmijewski score were determined by probit analysis (think of probit as probability unit). In this case, scores less than .5 represent a higher probability of default. One of the criticisms that Zmijewski made was that other bankruptcy scoring models oversampled distressed firms and favored situations with more complete data.[Source: YCharts]McKee-score:
------------------------------------------------
The McKee Score is a bankruptcy model used to predict a firm's bankruptcy in one yearIt looks at a companie's size, profitability, and liquidity to determine the probability.This model is 80% accurate in predicting bankruptcy.

optional arguments:
  -e, --explanation  Shows an explanation for the metrics
  -h, --help         show this help message
  --export EXPORT    Export raw data into csv, json, xlsx 
```
![Checkin' the scene for grifters (https://openbb-finance.github.io/OpenBBTerminal/terminal/stocks/fundamental_analysis/fraud/)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/drqhwy5sn5et5cml3u94.png)

Use a NLP model to highlight areas of concern in SEC filings.
```
(🦋) /stocks/fa/ $ analysis -h
usage: analysis [-h] [--export EXPORT]

Display analysis of SEC filings based on NLP model. [Source: https://eclect.us]

optional arguments:
  -h, --help       show this help message (default: False)
  --export EXPORT  Export raw data into csv, json, xlsx (default: )

(🦋) /stocks/fa/ $ analysis

        RISK FACTORS:
The public health crisis caused by the COVID-19 pandemic and the measures that have been taken or that may be taken in the future by governments, businesses, including us and our bottling partners, and the public at large to limit the spread of COVID-19 have had, and we expect will continue to have, certain negative impacts on our business including, without limitation, the following: • We have experienced a decrease in sales of certain of our products in markets around the world as a result of the COVID-19 pandemic.

The resumption of normal business operations after the disruptions caused by the COVID-19 pandemic may be delayed or constrained by the pandemic’ s lingering effects on our bottling partners, consumers, suppliers and/or third-party service providers.

These actions include focusing investments on a defined growth portfolio by prioritizing brands best positioned for consumer reach; streamlining the innovation pipeline through initiatives that are scalable regionally or globally, as well as maintaining a disciplined approach to local experimentation; refreshing our marketing approach, with a focus on improving our marketing investment effectiveness and efficiency; and investing in new capabilities to capitalize on emerging shifts in consumer behaviors that we anticipate may last beyond this crisis.

• We may be required to record significant impairment charges with respect to noncurrent assets, including trademarks, goodwill and other intangible assets, equity method investments, and other long-lived assets whose fair values may be negatively affected by the effects of the COVID-19 pandemic on our operations.

It is not currently possible to predict with any certainty the impact this requirement could have on our Company and its workforce.

        DISCUSSION AND ANALYSIS:
Gross Profit MarginGross profit margin is a ratio calculated by dividing gross profit by net operating revenues.

The increase in operating income was primarily driven by concentrate sales volume growth of 4513 percent; lower other operating charges and a favorable foreign currency exchange rate impact of 6 percent, partially offset by higher short-term incentive expense and increased marketing spending.

Risk Factors” in Part I and“ Our Business—Challenges and Risks” in Part II of our Annual Report on Form 10-K for the year ended December 31, 2020.

40 The favorable channel and package mix for the three months ended October 1, 2021 in all applicable operating segments was primarily a result of the gradual recovery in away-from-home channels in many markets in the current year and the impact of shelter-in-place and social distancing requirements in the prior year.

The favorable channel and package mix for the nine months ended October 1, 2021 in all applicable operating segments was primarily a result of the gradual recovery in away-from-home channels in many markets in the current year and the impact of shelter-in-place and social distancing requirements in the prior year.

42 The decrease in selling and distribution expenses during the three and nine months ended October 1, 2021 was primarily due to the impact of the COVID-19 pandemic on away-from-home channels, partially offset by the impact of foreign currency exchange rate fluctuations.

Our price, product and geographic mix was also negatively impacted, primarily due to unfavorable channel and product mix as consumer demand has shifted to more at-home consumption versus away-from-home consumption.

As a result, the first quarter of 2021 had five additional days when compared to the first quarter of 2020, and the fourth quarter of 2021 will have six fewer days when compared to the fourth quarter of 2020.

Operating loss in 2021 increased primarily as a result of increased marketing spending and higher short-term incentive and stock-based compensation expense.

Operating loss in 2021 increased primarily as a result of higher short-term incentive and stock-based compensation expense, increased marketing spending and higher other operating charges.

In the fourth quarter of 2020, the Company started a trade accounts receivable factoring program in certain countries.

As a result of timing, the Company paid the third quarterly dividend of 2021 in the third quarter and paid the third quarterly dividend of 2020 in the fourth quarter of 2020. 
```

Historical market cap:
```
(🦋) /stocks/fa/ $ mktcap -h
usage: mktcap [-s START] [-h] [--export EXPORT]

Market Cap estimate over time. [Source: Yahoo Finance]

optional arguments:
  -s START, --start START
                        The starting date (format YYYY-MM-DD) of the market cap display (default: 2019-04-20)
  -h, --help            show this help message (default: False)
  --export EXPORT       Export raw data into csv, json, xlsx and figure into png, jpg, pdf, svg (default: )

(🦋) /stocks/fa/ $ mktcap -s 1962-01-02
```

![$KO historical market cap (https://openbb-finance.github.io/OpenBBTerminal/terminal/stocks/fundamental_analysis/mktcap/)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/92kc49d4tvnq9v4u7j7y.png)

$KO Stock splits over time:

![$KO Stock splits over time (https://openbb-finance.github.io/OpenBBTerminal/terminal/stocks/fundamental_analysis/splits/)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kh1qi9f3wygikzofg3v4.png)

Who's holding?

![Ownership stakes of interest (https://openbb-finance.github.io/OpenBBTerminal/terminal/stocks/fundamental_analysis/shrs/)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v2vzzmekgnxt3c1ec97g.png)

![wait for it...](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1m34cjt9wpq10uwrv7gg.png)


That's right, I would be out of characters if I posted all of the amazing, free, features included in the Fundamental Analysis menu of the OpenBB Terminal! Go to the website now, click the download link, and I will personally send you a second download, for free!!**

https://openbb.co

An operator is standing by now!! Join us: https://discord.com/invite/Up2QGbMKHY

** _just pay separate handling, processing, shipping & processing, fondling, and delivery charges!_