Financial Model in Python – Tootsie Roll

jrdnocs1 pts0 comments

orcaset-py/examples/tr at main · Orcaset/orcaset-py · GitHub

//files/disambiguate" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

//files/disambiguate;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

Orcaset

orcaset-py

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star<br>10

FilesExpand file tree

main

/tr<br>Copy path

Directory actions

More options<br>More options

Directory actions

More options<br>More options

Latest commit

History<br>History<br>History

main

/tr

Top

Folders and files<br>NameNameLast commit message<br>Last commit date<br>parent directory<br>..<br>model

model

README.md

README.md

depreciation_schedule.py

depreciation_schedule.py

main.py

main.py

View all files

README.md<br>Outline<br>Tootsie Roll

This example builds a financial model for Tootsie Roll (TR). It builds connected income, balance sheet, and cash flow statements. The model pulls nine quarters of historical filing data from CSV documents. Statement presentation follows the same format as TR's filings.

The model contains approximately 100 line items plus dynamically generated line items for the detailed depreciation schedule. It is meant to demonstrate how to build models using Ocaset rather than being the basis for actual investment.

Project layout

tr/<br>├── README.md<br>├── main.py # Prints the three statements and a balance check<br>├── depreciation_schedule.py # Prints cohort-level capex and depreciation detail<br>└── model/<br>├── __init__.py # Public entry points: statements, Assumptions, ModelContext<br>├── assumptions.py # Assumption dataclasses and the ModelContext they ride on<br>├── data.py # Loads historical filing data from CSV<br>├── income.py # Income statement line items<br>├── ppe.py # Fixed asset schedule: capex and cohort depreciation<br>├── assets.py # Balance sheet assets<br>├── liabilities.py # Balance sheet liabilities<br>├── equity.py # Balance sheet equity<br>├── balance_sheet.py # Assembles the balance sheet statement<br>├── cash_flow.py # Cash flow statement line items<br>├── dividends.py # Dividends and share repurchases<br>├── checks.py # pytest model invariant checks<br>└── data/<br>├── historical-income.csv<br>├── historical-balance-sheet.csv<br>└── historical-cash-flow.csv

Run this model

Clone the repo and navigate to this directory (examples/tr), then run the main.py:

cd examples/tr<br>python main.py

Fixed asset schedule

The fixed asset schedule lives in model/ppe.py. It projects capital expenditures and builds a cohort-based depreciation schedule from them. Its outputs feed the cash flow statement (capex, depreciation) and the balance sheet (gross buildings and machinery roll forward with class capex, and accumulated depreciation rolls forward with total depreciation).

TR does not disclose the split of costs between buildings and machinery, nor a runoff schedule for the amounts currently on the balance sheet, so the schedule is built from a small set of assumptions, each anchored to a filed number:

Capital expenditures continue historicals at a flat quarterly amount equal to the average of the last eight historical quarters.

Class split. Capex is allocated between buildings and machinery by each class's share of gross balance growth over the historical window (about 26% buildings). The building_capex_share assumption overrides the derived split when set.

Existing PPE runs off as a single combined cohort: the net depreciable base (gross buildings plus machinery less accumulated depreciation) depreciates at the trailing-four-quarter reported run-rate until exhausted. Anchoring to the run-rate keeps projected depreciation continuous with historicals, and using one combined cohort avoids inventing a class split of accumulated depreciation that TR does not disclose.

New capex depreciates in cohorts: each projected quarter of class capex becomes a cohort depreciating straight-line over the class useful life (buildings_useful_life_years and machinery_useful_life_years assumptions), starting the quarter after the spend.

Total depreciation is reported historicals followed by the sum of the existing-pool runoff and the two classes' cohort totals.

The cohort schedules are exposed as keyed series (building_depreciation_cohorts and machinery_depreciation_cohorts) and can be...

depreciation model balance main sheet cohort

Related Articles