Repository navigation
Debt, construction, depreciation, and PTC schedules use anchored dates - #49
Merged
Merged
Conversation
…ation, and tax credit schedules
Co-Authored-By: Claude <noreply@anthropic.com>
…s and take end_of_month Co-Authored-By: Claude <noreply@anthropic.com>
j-bryan
force-pushed
the
anchored-finance-tax
branch
from
October 13, 2026 22:04
173afa2 to
b2d352e
Compare
This was referenced Oct 13, 2026
dylanjm
approved these changes
Oct 14, 2026
dylanjm
left a comment
Collaborator
There was a problem hiding this comment.
Changes are good, basically adds end_of_month bool to relevant methods and fixes MACRS tables.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #38 (does not close it). Closes #50. Stacked on #46, in stack #51.
Debt, construction, depreciation, and PTC schedules now date each period from the schedule start using
add_periods, instead of stepping from the previous date, and each one takesend_of_month(keyword-only, defaultTrue).AmortizationSchedule.builder/.build,amortize, andAmortizationBuildertakeend_of_month. Payment dates andinterest_free(from_date=..., to_date=...)both use the anchored dates. When payments are spread over calendar periods, the final payment covers the period up to the next anchored boundary.ConstructionSpendConfig.end_of_month, also accepted byConstructionSpendBuilderandconstruction_spend_schedule. Interest servicing periods are anchored at the construction start. The implicit escalation uses the same flag; a user-suppliedescalation_policykeeps its own setting.macrs_scheduleand bothvdb_scheduledate loops (the"none"convention, and the half-year/mid-quarter conventions withoutschedule_dates) use anchored dates. A Feb 29 placed-in-service date no longer raises inmacrs_schedule.incentives.pyno longer importsdateutil.tests/unit/test_finance_tax_anchoring.pychecks every schedule's dates against the anchored boundaries, plus worked examples for Apr 30 starts and February placements under both settings. Here the boundaries come from a temporaryanchored_boundarytest helper; Property tests use independent references instead of reimplemented calendar oracles #52 switches these tests toadd_periods(tested against hand values in Anchored schedule boundaries with an end-of-month rule #45) and removes the helper.MACRS table correction
A separate commit, a7dd644, corrects two columns of the mid-quarter tables to match IRS Publication 946. In 15-year, Q4, years 9–15 had the 0.0590/0.0591 alternation shifted by one position, and the column summed to 1.0001. In 20-year, Q4, year 18 was 0.04458 instead of 0.04459, and the column summed to 0.99999. Every table now sums to exactly 1.0. This changes depreciation amounts for Q4 mid-quarter placements of 15- and 20-year property. It was found by the MACRS property test and isn't related to anchoring.
Behavior changes
With
end_of_month=Trueas the default:Not in this PR
ptc(end_of_month=...)sets only the eligibility end. Its implicit rate escalation keeps the default, because that helper (_generation_escalation) lives ingeneration.py, which Property-based tests for CashFlowStream #41–Consistent capacity factor validation #44 also change. That work moves to PR 4, as noted in the plan on Recurring schedules drift after a month-end or leap-day start #38.EnergyProject: the debt compiler, depreciation, PTC, and construction sections use the default. Passing a project-wide setting through them is PR 5.time_delta_per_periodanddateutil: still used by the builder's scheduling and contract settlements, until PR 7.Testing
uv run ruff check,uv run mypy dcaf/, anduv run pytestpass (961 tests), and the Hypothesis properties also pass at 3,000 examples each. No existing test changed result.ruff format --checkflags one unwrappedparametrizeentry intests/unit/test_finance_tax_anchoring.py; #52 reformats it.🤖 Generated with Claude Code