Skip to content

fix(csv): coupon paths, NaN guard, delimiter-aware headers, CM as cash in TPT export - #24

Merged
karlkauc merged 1 commit into
mainfrom
fix/csv-tpt-export
Aug 29, 2026
Merged

fix(csv): coupon paths, NaN guard, delimiter-aware headers, CM as cash in TPT export#24
karlkauc merged 1 commit into
mainfrom
fix/csv-tpt-export

Conversation

@karlkauc

Copy link
Copy Markdown
Contributor

Summary

Fixes found by a full verification pass over XSLT_Transformations/CSV_Export:

  • Coupon never exported — both stylesheets read Bond/InterestRate / Bond/CouponFrequency; in FundsXML 4.2.9 the coupon is Bond/Coupon/InterestRate + Bond/Coupon/PaymentFrequency (CouponFrequency doesn't exist in the XSD). CouponRate and TPT cols 33/38 were always empty. Now uses Coupon/* with flat InterestRate as legacy fallback.
  • NaN in positions CSV for ValueQuotationCcy when 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.
  • TPT: CM (call money) not treated as cash — CIC/UAC category 0 instead of 7, cash ratio 0 although 6.11 % of NAV is call money. AC/CM/FT now map to 7 and count into col 9.
  • READMEs updated accordingly (paths, per-share-class price, cash-ratio types, tpt_v7_export.xslt added to the XSLT_Transformations overview, references to a non-committed spreadsheet / UTF-8_*.xml removed, 12 asset types not 13).

Verification (local, Java runner)

run result
positions CSV, Mixed-Fund 19 cols × 21 rows, 0 NaN, coupons 1.70 / 0.75
positions CSV, delimiter=; header 19 cols = rows 19 cols
TPT, Mixed-Fund 152 cols × 42 rows, cash ratio 0.061100, bonds DE2 + coupon 1.700000/0.750000
TPT, delimiter=; header 152 cols
TPT, Multi-Fund 10 rows (4×2 + 2×1)
Python saxonche runner byte-identical to Java

🤖 Generated with Claude Code

https://claude.ai/code/session_01YXZWhwE5EbHSybt55K6oUZ

…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
@karlkauc
karlkauc merged commit 9a51e3c into main Aug 29, 2026
4 checks passed
@karlkauc
karlkauc deleted the fix/csv-tpt-export branch August 30, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant