fix(csv): coupon paths, NaN guard, delimiter-aware headers, CM as cash in TPT export - #24
Merged
Conversation
…h in TPT export positions_csv.xslt / tpt_v7_export.xslt read the coupon from Bond/InterestRate and Bond/CouponFrequency. In FundsXML 4.2.9 the coupon lives under Bond/Coupon/InterestRate and Bond/Coupon/PaymentFrequency (CouponFrequency does not exist in the XSD), so CouponRate and TPT columns 33/38 were always empty. Use the Coupon/* paths with the flat InterestRate as legacy fallback. positions_csv.xslt emitted "NaN" for ValueQuotationCcy when the position has no TotalValue/Amount in its quotation currency (the USD-quoted Apple position); emit an empty field instead, as tpt_v7_export already does. Both header rows were literal comma-joined text, so delimiter=; produced a 1-column header over 19/152-column data rows. Join the header with the same delimiter as the rows. tpt_v7_export.xslt did not treat AssetType CM (call money, a real AssetTypeType value; the sample's ID_021) as cash: CIC category / UAC came out as 0 instead of 7 and the cash ratio (col 9) was 0 although 6.11 % of NAV is call money. Map AC/CM/FT to category 7 and count them in the cash ratio. READMEs: document the corrected paths, the per-share-class price, the cash ratio asset types, add tpt_v7_export.xslt to the XSLT_Transformations overview, and drop references to a spreadsheet and UTF-8_*.xml samples that are not part of the repository (12 asset types in the sample, not 13). Verified (Java runner, Mixed-Fund + Multi-Fund): positions CSV 19 cols x 21 rows, 0 NaN, coupons 1.70/0.75; with delimiter=; header and rows both 19 cols. TPT 152 cols x 42 rows (Multi-Fund: 10), cash ratio 0.061100, bonds CIC DE2 with coupon 1.700000/0.750000; delimiter=; header 152 cols; Python saxonche runner output byte-identical to Java. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YXZWhwE5EbHSybt55K6oUZ
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
Fixes found by a full verification pass over
XSLT_Transformations/CSV_Export:Bond/InterestRate/Bond/CouponFrequency; in FundsXML 4.2.9 the coupon isBond/Coupon/InterestRate+Bond/Coupon/PaymentFrequency(CouponFrequencydoesn't exist in the XSD).CouponRateand TPT cols 33/38 were always empty. Now usesCoupon/*with flatInterestRateas legacy fallback.NaNin positions CSV forValueQuotationCcywhen no amount exists in the quotation currency (USD Apple position) → empty field.delimiter=;broke the header in both stylesheets (literal comma header over;-joined rows) → header now joined with the same delimiter.CM(call money) not treated as cash — CIC/UAC category0instead of7, cash ratio0although 6.11 % of NAV is call money.AC/CM/FTnow map to7and count into col 9.tpt_v7_export.xsltadded to theXSLT_Transformationsoverview, references to a non-committed spreadsheet /UTF-8_*.xmlremoved, 12 asset types not 13).Verification (local, Java runner)
NaN, coupons1.70/0.75delimiter=;0.061100, bondsDE2+ coupon1.700000/0.750000delimiter=;🤖 Generated with Claude Code
https://claude.ai/code/session_01YXZWhwE5EbHSybt55K6oUZ