feat: Replace portfolio/position ops with unified portfolio block management#107
Merged
feat: Replace portfolio/position ops with unified portfolio block management#107
Conversation
- Added models for portfolio block operations including: - PortfolioBlockPortfolioPatch - PortfolioBlockPositionAdd - PortfolioBlockPositionDispose - PortfolioBlockPositionUpdate - PortfolioBlockPositions - UpdatePortfolioBlockOperation - Updated tests to cover new portfolio block functionalities: - Test for creating, updating, and deleting portfolio blocks. - Enhanced test coverage for portfolio block retrieval and position management.
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
Introduces a new portfolio block abstraction that unifies portfolio and position operations into a single, cohesive management model. This replaces the previous separate CRUD operations for portfolios and positions with consolidated portfolio block operations that handle both concerns atomically.
Key Accomplishments
API Layer Refactoring
op_create_portfolio,op_delete_portfolio, andop_update_portfolioto their_blockcounterparts (op_create_portfolio_block,op_delete_portfolio_block,op_update_portfolio_block)op_create_position,op_delete_position,op_update_position) — position management is now handled within portfolio block operationsNew Domain Models
CreatePortfolioBlockRequest— encapsulates portfolio creation with embedded position dataUpdatePortfolioBlockOperation— supports portfolio patching, position adds, updates, and disposals in a single operationDeletePortfolioBlockOperation— handles portfolio block deletionPortfolioBlockPortfolioFields— defines portfolio-level field schemaPortfolioBlockPortfolioPatch— represents partial portfolio updatesPortfolioBlockPositionAdd/PortfolioBlockPositionUpdate/PortfolioBlockPositionDispose— granular position mutation types within a block contextPortfolioBlockPositions— container model for position collectionsClient Simplification
investor_client.pyto use the new portfolio block API surface, reducing overall complexity (~120 lines net reduction in client code)Model Exports
models/__init__.pyto export all new models and remove deprecated onesBreaking Changes
create_portfolio,update_portfolio,delete_portfolio,create_position,update_position,delete_position— these no longer exist as separate client methodsCreatePortfolioRequest,UpdatePortfolioOperation,DeletePortfolioOperation,CreatePositionRequest,UpdatePositionOperation,DeletePositionOperationcreate_portfolio_block,update_portfolio_block,delete_portfolio_block) which manage positions inlineTesting
tests/test_investor_client.pyhas been substantially updated (~175 lines changed) to cover the new portfolio block operationsInfrastructure Considerations
🤖 Generated with Claude Code
Branch Info:
feature/portfolio-blockmainCo-Authored-By: Claude noreply@anthropic.com