Repository navigation
Add vectorized FixedRateBonds collection for bulk bond construction - #6
Merged
Merged
Conversation
Add lifelib_pyql.portfolio.instruments.bonds.FixedRateBonds as the plural/vectorized form of lifelib_pyql.instruments.bonds.FixedRateBond, following the same pattern as Schedules is to Schedule. The class stores parallel arrays of bond parameters and reconstructs individual FixedRateBond objects on demand via indexing. Supports int indexing (returns singular FixedRateBond) and slice indexing (returns new FixedRateBonds subset). https://claude.ai/code/session_01JRwjJ46R8sg7EGof6X3ZWH
Tests cover construction, properties, int/slice/negative indexing, consistency with singular FixedRateBond, scalar and array redemptions, 2D coupons, optional issue_dates, input validation errors, and slice-then-index round-tripping. https://claude.ai/code/session_01JRwjJ46R8sg7EGof6X3ZWH
fumitoh
marked this pull request as ready for review
February 28, 2026 14:44
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.
Summary
This PR introduces a new
FixedRateBondsclass that enables efficient bulk construction and management of fixed-rate bonds using parallel arrays. This complements the existing singularFixedRateBondclass and allows users to work with collections of bonds while maintaining individual bond reconstruction on demand.Key Changes
New
FixedRateBondsCython class (lifelib_pyql/portfolio/instruments/bonds.pyx):__getitem__for both integer indexing (returns singularFixedRateBond) and slicing (returns newFixedRateBonds)Dateobjects on demandType definitions (
lifelib_pyql/portfolio/instruments/bonds.pxd):API export (
lifelib_pyql/portfolio/api.py):FixedRateBondsfrom the portfolio module for public useComprehensive test suite (
test/test_portfolio_bonds.py):FixedRateBondinstancesNotable Implementation Details
FixedRateBondsinstances with properly sliced underlying arrayshttps://claude.ai/code/session_01JRwjJ46R8sg7EGof6X3ZWH