Prorate PTC for partial eligibility years - #22
Merged
Merged
Conversation
j-bryan
approved these changes
Jul 31, 2026
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.
This change fixes incorrect PTC behavior where a partial final eligibility year would be omitted when building the PTC cashflows.
The main complication in fixing this bug was that some generation objects were created at a particular date but actually referred to generation over the entire year. Since the
Generationclass only accepted adateargument, there was no way to determine what portion of the generation should be included in the PTC payment. Thus,period_startandperiod_endattributes were added toGeneration. Thedateattribute was preserved in order to maintain backwards compatibility and to allow specification of a particular date to use as a basis for other calculations instead of automatically selecting such a date from the applicable period.The period on each
Generationobject is now used to determine overlap between the generation and the PTC eligibility window. This overlap (and the day count convention used for the PTC) determines how the PTC amount is prorated.Tests have been updated and added for these changes, including regression checks to ensure that the full PTC eligibility window is respected.
Closes #18.