liveBook · Manning

Balance_sheet

As explained in Investing for Programmers

balance_sheet is a yfinance object property that exposes a company’s balance sheet as a DataFrame.

balance_sheet is a yfinance Ticker property that returns a company’s balance sheet as a pandas DataFrame. Financially, it records assets, liabilities, and shareholders’ equity; liabilities exceeding assets can signal serious trouble. section 2.1.2 section 3.4.1

Interpret the returned structure as follows:

  • Read report filing dates from columns and reported metrics from rows. section 3.4.1
  • Use the quarterly_balance_sheet attribute when quarterly results are required. section 3.4.1
  • Combine balance-sheet values with income-statement values to calculate ratios such as return on assets or debt-to-equity. section 3.4.1

Retrieve the latest balance sheet

import yfinance as yf company = yf.Ticker("MSFT") company.balance_sheet latest = company.balance_sheet.columns[0] debt_to_equity = company.balance_sheet[latest]["Total Debt"] / company.balance_sheet[latest]["Stockholders Equity"] section 3.4.1

Assets = Liabilities + Shareholders’ equity

Use the accounting identity to check how assets relate to liabilities and shareholders’ equity. section 2.1.2

How Investing for Programmers covers it

How deep it goes
Defines assets, liabilities, and equity, then descends to DataFrame columns, rows, quarterly access, and ratio formulas.
Examples
Uses Microsoft and Apple tickers, DataFrame report dates, and debt-to-equity calculations.
What you can do after
Apply it via yfinance to inspect reported balance sheets and calculate selected company ratios.
How it connects
Connects balance sheets with income statements, cash-flow statements, liquidity, and financial ratios.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Investing for Programmers. The section links point to the parts of the book it draws on.