Skip to content
sauloduttraPublic

About

Financial Reporting & Analysis toolkit from first principles: FIFO/LIFO/AVCO, depreciation, IFRS vs GAAP impairment, lease amortization, full vs partial goodwill, DB pensions, Beneish/Altman quality scores, effective tax rate. 61 tests verifying algebraic identities. CFA Level II Vol 2 complete.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

fra-lab

A Financial Reporting & Analysis toolkit in pure Python. Covers the full CFA Level II Financial Reporting & Analysis curriculum (Vol 2) — 8 modules, 61 tests verifying algebraic identities, every closed-form formula derived from its accounting definition, no black-box dependencies (stdlib only; pytest for the test suite).

$ pytest tests/
=========================== 61 passed in 0.13s ============================

Why this exists

FRA is the densest reading of the CFA curriculum because every topic is an accounting identity that ALSO has measurement choices (FIFO vs LIFO, GAAP vs IFRS, full vs partial goodwill). The two layers get conflated in textbooks. This repo separates them:

  • The identity (inviolable: COGS + Ending Inv == Total Available; Goodwill_full == Goodwill_partial + NCI%·implied_goodwill; sum of principal payments == initial lease liability)
  • The measurement choice (which method, which standard) is just a parameter to the function.

Each function is ~20-30 lines from the definition. Each test pins an identity.

The 8 modules

Module Topic Headline functions
inventory.py FIFO / LIFO / AVCO + LIFO reserve + LIFO→FIFO conversion fifo, lifo, avco, lifo_to_fifo_adjustments
depreciation.py Straight-line, DDB, Units of Production + asset-age straight_line_schedule, double_declining_balance_schedule, asset_age_estimates
impairment.py IFRS (reversible, IAS 36) vs US GAAP (write-down only, ASC 360) gaap_impairment, ifrs_impairment, ifrs_impairment_reversal, ifrs_revaluation
leases.py Finance-lease amortization: interest vs principal split lease_liability_pv, amortize_finance_lease, compute_level_payment
consolidation.py Goodwill (full vs partial) + NCI in business combinations full_goodwill, partial_goodwill, compare_methods
pensions.py DB plans: PBO roll-forward + periodic pension cost + funded status roll_pbo, roll_plan_assets, periodic_pension_cost, funded_status
quality.py Beneish M-Score (manipulation) + Altman Z-Score (bankruptcy) beneish_m_score, altman_z_score (with classification helpers)
taxes.py Effective tax rate + reconciliation + multinational blend effective_tax_rate, reconcile, blended_effective_rate

API in 30 seconds

from fra import (
    # Inventory
    CostLayer, fifo, lifo, avco, lifo_to_fifo_adjustments,
    # Depreciation
    straight_line_schedule, double_declining_balance_schedule,
    asset_age_estimates,
    # Impairment (different rules per standard)
    gaap_impairment, ifrs_impairment,
    # Leases
    lease_liability_pv, amortize_finance_lease,
    # Consolidation
    compare_methods,
    # Pensions
    roll_pbo, periodic_pension_cost, funded_status,
    # Quality
    BeneishInputs, beneish_m_score,
    AltmanInputs, altman_z_score,
    # Taxes
    Jurisdiction, blended_effective_rate,
)

# Inventory: same data, three methods, three answers
beg