feat: add import/write capabilities and transaction management tools#45
Open
dgehriger wants to merge 3 commits intoma4nn:masterfrom
Open
feat: add import/write capabilities and transaction management tools#45dgehriger wants to merge 3 commits intoma4nn:masterfrom
dgehriger wants to merge 3 commits intoma4nn:masterfrom
Conversation
… events Add PpXmlWriter class for direct XML manipulation of Portfolio Performance files: - BUY/SELL with cross-linked portfolio + account transactions - DIVIDENDS, INTEREST, DEPOSIT, WITHDRAWAL (simple account txns) - DELIVERY_INBOUND/OUTBOUND (portfolio txns without cash leg) - ACCOUNT_TRANSFER with cross-entry references - Security definitions and STOCK_SPLIT events - Automatic .bak backup before writes Add 11 MCP import tools (import_security, import_buy, import_sell, etc.) Add CLI 'import' command group with matching subcommands Add 18 tests covering all transaction types, backup, errors, and roundtrip
- Add import_fees, import_taxes MCP tools and PpXmlWriter methods - Add delete_transaction MCP tool with cross-entry cleanup - Fix add_account_transfer to use PP-native XStream structure: canonical TRANSFER_IN in destination, transactionFrom in crossEntry - Add cross-currency transfer support (to_amount/to_currency params) - Add portfolio_id parameter to add_buy/add_sell for multi-currency - Smart BUY/SELL crossEntry placement based on account/portfolio nesting to satisfy XStream document-order id/reference constraint - Update tests for new transfer and crossEntry patterns
229c9b1 to
0e9dd30
Compare
|
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 adds write/import capabilities to pp-terminal, enabling programmatic creation of transactions, securities, and events in Portfolio Performance XML files — both via MCP tools and the CLI.
Note
This is a substantial feature addition that may be out of scope for the upstream project. I built this for my own use and am sharing it in case it is useful. No hard feelings if it is not accepted — I am happy to maintain it on my fork.
Changes
Commit 1:
fix: handle null property values in PP XML v69+(PR #44)Commit 2:
feat: add import/write capabilitiesPpXmlWriter— new module that writes transactions and securities into PP XML files via lxml, preserving existing structure and XStream id/reference semanticsimport_security,import_buy,import_sell,import_dividend,import_deposit,import_withdrawal,import_delivery_inbound,import_delivery_outbound,import_interest,import_account_transfer,import_stock_split, plusimport_fees,import_taxes,delete_transactionimportcommand group with matching subcommands.bakbackup before every writeCommit 3:
feat: add fees/taxes/delete tools, fix transfer structureadd_account_transferto produce PP-native XStream structure (canonicalTRANSFER_INin destination account,transactionFromnested in crossEntry)to_amount/to_currency)portfolio_idparameter for multi-currency BUY/SELL setupsTesting
All 251 tests pass. The one pre-existing failure (
test_cache_fallback_on_io_error) is unrelated to these changes.