aboutsummaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorTyler <tyler@tylerhoang.xyz>2026-03-30 18:37:40 -0700
committerTyler <tyler@tylerhoang.xyz>2026-03-30 18:37:40 -0700
commitaa3b1a27118ef0efac056ad135a81181bfb15c8e (patch)
treef5a44ad4b3e3c45452c10c89b7b4dcebaed32e75 /components
parentf6b21398b8d9d13fa707955852f4e73158d7db19 (diff)
Fix inverse color coding across all three financial statements
- Corrected existing labels that didn't match yfinance output (e.g. 'research development' → 'research and development', 'income tax expense' → 'tax provision', 'selling general administrative' → 'selling general and administration') - Added balance sheet debt/liability rows: net debt, total debt, long/current debt, capital lease obligations, all liability subtotals, payables - Added cash flow rows: debt issuance (increase = bad), equity dilution (issuance of capital stock = bad), taxes/interest paid (more = bad), buybacks (repurchase of capital stock = inverse so more buybacks = green) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'components')
-rw-r--r--components/financials.py60
1 files changed, 56 insertions, 4 deletions
diff --git a/components/financials.py b/components/financials.py
index 9078770..bc2a482 100644
--- a/components/financials.py
+++ b/components/financials.py
@@ -5,12 +5,64 @@ import streamlit as st
from services.data_service import get_income_statement, get_balance_sheet, get_cash_flow
from utils.formatters import fmt_large
-# Rows where a decline is actually good (e.g. costs, expenses)
+# Rows where an increase is bad (decline = green, increase = red).
+# Labels must match yfinance row names (case-insensitive after .strip().lower()).
_INVERSE_ROWS = {
- "cost of revenue", "cost of goods sold", "operating expenses",
- "selling general administrative", "research development",
- "interest expense", "income tax expense", "total expenses",
+ # ── Income statement ──────────────────────────────────────────────────────
+ "cost of revenue",
"reconciled cost of revenue",
+ "operating expense",
+ "research and development",
+ "selling general and administration",
+ "total expenses",
+ "interest expense",
+ "interest expense non operating",
+ "tax provision",
+ "reconciled depreciation", # non-cash expense; higher = lower reported income
+
+ # ── Balance sheet ─────────────────────────────────────────────────────────
+ "net debt",
+ "total debt",
+ "long term debt",
+ "long term debt and capital lease obligation",
+ "long term capital lease obligation",
+ "current debt",
+ "current debt and capital lease obligation",
+ "current capital lease obligation",
+ "capital lease obligations",
+ "other current borrowings",
+ "commercial paper",
+ "total liabilities net minority interest",
+ "total non current liabilities net minority interest",
+ "current liabilities",
+ "accounts payable",
+ "payables and accrued expenses",
+ "payables",
+ "current accrued expenses",
+ "total tax payable",
+ "income tax payable",
+ "current deferred liabilities",
+ "current deferred revenue",
+ "tradeand other payables non current",
+
+ # ── Cash flow ─────────────────────────────────────────────────────────────
+ # Debt issuance: positive value = new borrowing = bad
+ "issuance of debt",
+ "long term debt issuance",
+ "net long term debt issuance",
+ "net short term debt issuance",
+ "net issuance payments of debt",
+ # Equity dilution: positive value = new shares issued = bad for holders
+ "issuance of capital stock",
+ "common stock issuance",
+ "net common stock issuance",
+ # Taxes & interest paid: higher outflow = bad
+ "income tax paid supplemental data",
+ "interest paid supplemental data",
+ # Buybacks shown as negative outflow — more negative = more buybacks = good,
+ # so INVERSE: decline (more negative) → green
+ "repurchase of capital stock",
+ "common stock payments",
}