diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2732ea..2992088 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,6 +97,19 @@ jobs: for f in $G/*.xml; do xmllint --noout --nonet --schema ci-schemas/4.2.9/FundsXML.xsd "$f" done + # embedded documents: base64 decodes to exactly SizeInBytes bytes, each one a PDF + .venv/bin/python - $G/Fund-Documents_2025-10.xml <<'PY' + import base64, sys + import xml.etree.ElementTree as ET + docs = ET.parse(sys.argv[1]).getroot().findall("Documents/Document") + embedded = [d for d in docs if d.find("BinaryData") is not None] + assert embedded, "no embedded document" + for d in embedded: + data = base64.b64decode(d.findtext("BinaryData")) + assert len(data) == int(d.findtext("SizeInBytes")), d.findtext("FileName") + assert data.startswith(b"%PDF-1.4") and data.rstrip().endswith(b"%%EOF"), d.findtext("FileName") + print("embedded", d.findtext("FileName"), len(data), "bytes ok") + PY - name: XSD - negative fixture must FAIL run: | @@ -241,6 +254,8 @@ jobs: for f in FundsXML_Files/4.2.9/realistic/*.xml; do echo "== $f" $S -Dexec.args="$SCH $f" + # a documents-only delivery (ControlData + Documents) has no fund, positions or share classes + if ! grep -q '' "$f"; then echo "no : portfolio checks skipped"; continue; fi $X -Dexec.args="XSLT_DataQuality_Checks/Custom_Internal_Checks/custom_internal_checks.xslt $f r_dq.html" if grep -q 'class="fail"' r_dq.html; then echo "::error::custom DQ check failed for $f"; exit 1; fi $X -Dexec.args="XSLT_Transformations/Factsheet/factsheet_html.xslt $f r_fs.html" diff --git a/FundsXML_Files/4.2.9/realistic/Fund-Documents_2025-10.xml b/FundsXML_Files/4.2.9/realistic/Fund-Documents_2025-10.xml new file mode 100644 index 0000000..fe1f909 --- /dev/null +++ b/FundsXML_Files/4.2.9/realistic/Fund-Documents_2025-10.xml @@ -0,0 +1,174 @@ + + + + + EXAMPLE-FUND-DOCUMENTS-2025-10 + 2025-11-03T06:15:00 + 4.2.9 + 2025-10-31 + + AT + EXAMPLE-AM + Example Asset Management GmbH + Asset Manager + + INITIAL + en + + + + + Prospectus + + 2025-01 + en + true + + AT + DE + CH + + + + XMPL00FNDMULTI000170 + + Example Multi Asset Opportunities Fund + EUR + + Prospectus Example Multi Asset Opportunities Fund + EX-Multi-Asset_Prospectus_2025-01_en.pdf + true + application/pdf + No + 2025-01-15 + 1843206 + https://www.example.com/funds/XMPL00FNDMULTI000170/documents/EX-Multi-Asset_Prospectus_2025-01_en.pdf + + + + PRIIPS-KID + + 2025-02 + en + + AT + DE + + + + + ATXMPLF03016 + + Example Multi Asset Opportunities Fund EUR R (acc) + EUR + + + + ATXMPLF03024 + + Example Multi Asset Opportunities Fund EUR I (acc) + EUR + + + PRIIPs KID Example Multi Asset Opportunities Fund + EX-Multi-Asset_PRIIPs-KID_2025-02_en.pdf + true + application/pdf + No + 2025-02-14 + 2026-02-13 + 1696 + + JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4K + ZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4K + ZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAg + MCA1OTUgODQyXSAvUmVzb3VyY2VzIDw8IC9Gb250IDw8IC9GMSA0IDAgUiAvRjIgNSAwIFIgPj4g + Pj4gL0NvbnRlbnRzIDYgMCBSID4+CmVuZG9iago0IDAgb2JqCjw8IC9UeXBlIC9Gb250IC9TdWJ0 + eXBlIC9UeXBlMSAvQmFzZUZvbnQgL0hlbHZldGljYSAvRW5jb2RpbmcgL1dpbkFuc2lFbmNvZGlu + ZyA+PgplbmRvYmoKNSAwIG9iago8PCAvVHlwZSAvRm9udCAvU3VidHlwZSAvVHlwZTEgL0Jhc2VG + b250IC9IZWx2ZXRpY2EtQm9sZCAvRW5jb2RpbmcgL1dpbkFuc2lFbmNvZG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W0KZW5kb2Jq + CjcgMCBvYmoKPDwgL1RpdGxlIChLZXkgSW5mb3JtYXRpb24gRG9jdW1lbnQgLSBQUklJUHMgLSBF + eGFtcGxlIE11bHRpIEFzc2V0IE9wcG9ydHVuaXRpZXMgRnVuZCBcKGZpY3RpdGlvdXNcKSkgL0F1 + dGhvciAoRXhhbXBsZSBBc3NldCBNYW5hZ2VtZW50IEdtYkggXChmaWN0aXRpb3VzXCkpIC9Qcm9k + dWNlciAobWFrZV9yZWFsaXN0aWMucHkpID4+CmVuZG9iagp4cmVmCjAgOAowMDAwMDAwMDAwIDY1 + NTM1IGYgCjAwMDAwMDAwMTUgMDAwMDAgbiAKMDAwMDAwMDA2NCAwMDAwMCBuIAowMDAwMDAwMTIx + IDAwMDAwIG4gCjAwMDAwMDAyNTcgMDAwMDAgbiAKMDAwMDAwMDM1NCAwMDAwMCBuIAowMDAwMDAw + NDU2IDAwMDAwIG4gCjAwMDAwMDEyNTUgMDAwMDAgbiAKdHJhaWxlcgo8PCAvU2l6ZSA4IC9Sb290 + IDEgMCBSIC9JbmZvIDcgMCBSID4+CnN0YXJ0eHJlZgoxNDYwCiUlRU9GCg== + + + + + Factsheet + + 2025-10 + en + + AT + DE + + + + + ATXMPLF03016 + + Example Multi Asset Opportunities Fund EUR R (acc) + EUR + + + Factsheet Example Multi Asset Opportunities Fund EUR R (acc) October 2025 + EX-Multi-Asset_Factsheet_ATXMPLF03016_2025-10_en.pdf + true + application/pdf + No + 2025-11-03 + 2025-11-30 + 1605 + + JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4K + ZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4K + ZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAg + MCA1OTUgODQyXS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Glvbi4pIFRq + CjAgLTE1IFRkCihDb21wYW5pZXMsIGZ1bmRzIGFuZCBpZGVudGlmaWVycyBhcmUgaW52ZW50ZWQg + XChJU0lOcyBhbmQgTEVJcyB3aXRoIHRoZSBwcmVmaXggWE1QTFwpLikgVGoKMCAtMTUgVGQKKEdl + bmVyYXRlZCBieSBtYWtlX3JlYWxpc3RpYy5weSAtIGh0dHBzOi8vZ2l0aHViLmNvbS9mdW5kc3ht + bC9leGFtcGxlcykgVGoKRVQKZW5kc3RyZWFtCmVuZG9iago3IDAgb2JqCjw8IC9UaXRsZSAoRmFj + dHNoZWV0IE9jdG9iZXIgMjAyNSAtIEV4YW1wbGUgTXVsdGkgQXNzZXQgT3Bwb3J0dW5pdGllcyBG + dW5kIFwoZmljdGl0aW91c1wpKSAvQXV0aG9yIChFeGFtcGxlIEFzc2V0IE1hbmFnZW1lbnQgR21i + SCBcKGZpY3RpdGlvdXNcKSkgL1Byb2R1Y2VyIChtYWtlX3JlYWxpc3RpYy5weSkgPj4KZW5kb2Jq + CnhyZWYKMCA4CjAwMDAwMDAwMDAgNjU1MzUgZiAKMDAwMDAwMDAxNSAwMDAwMCBuIAowMDAwMDAw + MDY0IDAwMDAwIG4gCjAwMDAwMDAxMjEgMDAwMDAgbiAKMDAwMDAwMDI1NyAwMDAwMCBuIAowMDAw + MDAwMzU0IDAwMDAwIG4gCjAwMDAwMDA0NTYgMDAwMDAgbiAKMDAwMDAwMTE3NSAwMDAwMCBuIAp0 + cmFpbGVyCjw8IC9TaXplIDggL1Jvb3QgMSAwIFIgL0luZm8gNyAwIFIgPj4Kc3RhcnR4cmVmCjEz + NjkKJSVFT0YK + + + + diff --git a/FundsXML_Files/4.2.9/realistic/README.md b/FundsXML_Files/4.2.9/realistic/README.md index f87b645..9f3e6dd 100644 --- a/FundsXML_Files/4.2.9/realistic/README.md +++ b/FundsXML_Files/4.2.9/realistic/README.md @@ -5,9 +5,9 @@ Four complete month-end files of fictional funds, sized and structured like real reporting data: hundreds of positions, a month of transactions and income, several share classes with a daily NAV history. The small samples in `../positions/` stay the place to learn the structure; these files are for testing tools, mappings -and performance on data that looks like production. +and performance on data that looks like production. A fifth file delivers the documents of the multi-asset fund. -All four are valid against the +All five are valid against the [4.2.9 schema](https://github.com/fundsxml/schema/releases/download/4.2.9/FundsXML.xsd) and pass [`basic_checks.sch`](../../../Schematron_DataQuality_Checks/Basic_Checks/basic_checks.sch) without errors or warnings (checked in CI). @@ -18,12 +18,31 @@ warnings (checked in CI). | `Euro-Bond-Fund_2025-10.xml` | 1.0 MB | 838,581,814.97 | 207: 200 bonds (fixed, floating, zero; sovereign, agency, covered, corporate), 4 interest rate futures, 1 interest rate swap, account, fee accrual | 2: EUR R acc, EUR I dist | 56 (trades with accrued interest, flows) | coupons, account interest | Accrued interest, dirty prices, yields, durations, ratings, maturity/rating/issuer-type breakdowns | | `Multi-Asset-Derivatives-Fund_2025-10.xml` | 0.6 MB | 278,791,093.07 | 81 over 12 asset types: equities, bonds, ETFs, warrants, certificates, options, futures, FX forwards, swaps (IRS, cross currency, CDS, total return), call money, accounts, fee accrual | 4: EUR R, EUR I, CHF and USD hedged | 56 | dividends, coupons, interest | Counterparties, swap legs, underlyings with delta, delta-adjusted and commitment exposures, leverage and VaR; `RegulatoryReportings` with an EMT V4.2 per share class and a TPT V7 (Solvency II) of the EUR R class with its equities and bonds | | `Fund-of-Funds_2025-10.xml` | 0.4 MB | 155,706,556.38 | 38: 35 target funds of 5 managers, 2 accounts, fee accrual | 2: EUR T acc, EUR A dist | 30 | fund distributions, interest | `FundOfFundFlag`, look-through level 1 (`PositionsDecomposed`) into the target funds' securities | +| `Fund-Documents_2025-10.xml` | 10 KB | – | – | – | – | – | `ControlData` + `Documents` only, for the Multi-Asset fund: prospectus as a **link** (`DocumentURL` on example.com, assigned to the fund by LEI), PRIIPs KID (two share classes) and factsheet (one share class) **embedded** as base64 PDF in `BinaryData`, with `SizeInBytes` = decoded length; see below | Share classes in another currency than the fund report their net assets twice, marked with `isShareClassCcy` and `isFundCcy`. Reporting date is 2025-10-31; transactions, income, subscriptions and redemptions cover October 2025. +## Documents: link or embedded + +`Fund-Documents_2025-10.xml` shows the two ways to deliver a document in `Documents/Document`: + +| Document | `Type/ListedType` | Assigned to | Delivery | `FileName` | +|---|---|---|---|---| +| Prospectus | `Prospectus` | `Fund` (LEI `XMPL00FNDMULTI000170`) | `DocumentURL` (https://www.example.com/…), `SizeInBytes` of the file behind the link | `EX-Multi-Asset_Prospectus_2025-01_en.pdf` | +| PRIIPs KID | `PRIIPS-KID` | `ShareClasses`: `ATXMPLF03016` (EUR R), `ATXMPLF03024` (EUR I) | `BinaryData` (base64, 76 characters per line) | `EX-Multi-Asset_PRIIPs-KID_2025-02_en.pdf` | +| Factsheet | `Factsheet` | `ShareClasses`: `ATXMPLF03016` (EUR R) | `BinaryData` | `EX-Multi-Asset_Factsheet_ATXMPLF03016_2025-10_en.pdf` | + +The embedded PDFs are one-page PDF 1.4 files that the generator writes byte for byte (no timestamps, no `/ID`), +so the base64 stays identical on every run; they only say that they are fictitious training samples. +`SizeInBytes` is the exact length of the decoded bytes. To extract one: + +```bash +python -c "import base64,sys,xml.etree.ElementTree as E; d=E.parse(sys.argv[1]).find('Documents/Document[2]'); open(d.findtext('FileName'),'wb').write(base64.b64decode(d.findtext('BinaryData')))" Fund-Documents_2025-10.xml +``` + ## What is consistent The generator checks these before it writes a file (and CI checks the first two with `fund-summary.xq`): @@ -57,7 +76,7 @@ Both have valid check digits, so validators accept them. Company names ("Example ## Regenerate ```bash -python FundsXML_Files/4.2.9/realistic/make_realistic.py # writes the four files here +python FundsXML_Files/4.2.9/realistic/make_realistic.py # writes the five files here python FundsXML_Files/4.2.9/realistic/make_realistic.py --lint FundsXML_Files tests/fixtures python FundsXML_Files/4.2.9/realistic/make_realistic.py --verify-online # asks GLEIF and ESMA FIRDS ``` diff --git a/FundsXML_Files/4.2.9/realistic/make_realistic.py b/FundsXML_Files/4.2.9/realistic/make_realistic.py index eac6d3b..80faa6a 100644 --- a/FundsXML_Files/4.2.9/realistic/make_realistic.py +++ b/FundsXML_Files/4.2.9/realistic/make_realistic.py @@ -9,7 +9,9 @@ The samples describe four fictional funds of a fictional management company at the reporting date 2025-10-31, with the transactions, income, subscriptions and -redemptions of October 2025. Everything is invented, but consistent: +redemptions of October 2025, plus a Documents delivery (prospectus as a link, PRIIPs KID +and factsheet as embedded base64 PDFs) for the multi-asset fund. Everything is invented, +but consistent: * positions (incl. cash, accrued interest and accrued fees) add up to the fund's net assets exactly; the position percentages add up to 100; @@ -1948,6 +1950,166 @@ def fund_of_funds(): return doc, fund, classes, breakdowns, risk, None +# --------------------------------------------------------------------------------------------- +# documents: a Documents delivery for the multi-asset fund (one link, two embedded PDFs) +# --------------------------------------------------------------------------------------------- + +def pdf_text(text): + """A PDF literal string in WinAnsiEncoding (cp1252), non-ASCII bytes as octal escapes.""" + out = [] + for b in text.encode("cp1252"): + ch = chr(b) + out.append("\\" + ch if ch in "\\()" else ch if 32 <= b < 127 else "\\%03o" % b) + return "(" + "".join(out) + ")" + + +def build_pdf(title, subtitle, lines): + """A one-page PDF 1.4 (A4, Helvetica, uncompressed), byte-identical on every run. + + No creation date, no /ID, fixed object order; the xref offsets are computed from the bytes. The /Info + title is ASCII only (document info strings use PDFDocEncoding, not WinAnsi). + """ + content = ["BT", "/F2 18 Tf", "56 770 Td", pdf_text(title) + " Tj", + "/F2 13 Tf", "0 -24 Td", pdf_text(subtitle) + " Tj", "/F1 10.5 Tf", "0 -16 Td"] + for line in lines: + content += ["0 -15 Td", pdf_text(line) + " Tj"] + content.append("ET") + stream = ("\n".join(content) + "\n").encode("latin-1") + objects = [ + b"<< /Type /Catalog /Pages 2 0 R >>", + b"<< /Type /Pages /Kids [3 0 R] /Count 1 >>", + b"<< /Type /Page /Parent 2 0 R /MediaBox [0 0 595 842] " + b"/Resources << /Font << /F1 4 0 R /F2 5 0 R >> >> /Contents 6 0 R >>", + b"<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >>", + b"<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >>", + b"<< /Length %d >>\nstream\n" % len(stream) + stream + b"endstream", + ("<< /Title " + pdf_text((title + " - " + subtitle).replace("\u2014", "-")) + " /Author " + pdf_text(MANCO["name"] + " (fictitious)") + + " /Producer (make_realistic.py) >>").encode("latin-1"), + ] + out = bytearray(b"%PDF-1.4\n%\xe2\xe3\xcf\xd3\n") + offsets = [] + for n, body in enumerate(objects, 1): + offsets.append(len(out)) + out += b"%d 0 obj\n" % n + body + b"\nendobj\n" + xref = len(out) + out += b"xref\n0 %d\n0000000000 65535 f \n" % (len(objects) + 1) + out += b"".join(b"%010d 00000 n \n" % o for o in offsets) + out += b"trailer\n<< /Size %d /Root 1 0 R /Info 7 0 R >>\nstartxref\n%d\n%%%%EOF\n" % (len(objects) + 1, xref) + pdf = bytes(out) + # self-check: every xref entry points at its object, startxref at the xref table + for n, o in enumerate(offsets, 1): + assert pdf.startswith(b"%d 0 obj" % n, o) + assert pdf.startswith(b"xref", int(pdf.rsplit(b"startxref\n", 1)[1].split(b"\n")[0])) + return pdf + + +def emit_binary(w, data): + """base64 in lines of 76 characters (MIME style), indented like the other content.""" + import base64 + b64 = base64.b64encode(data).decode("ascii") + w.open("BinaryData") + w.lines.extend(" " * w.depth + b64[i:i + 76] for i in range(0, len(b64), 76)) + w.close("BinaryData") + + +def emit_document(w, d): + w.open("Document") + w.open("Type") + w.leaf("ListedType", d["type"]) + w.close("Type") + w.leaf("Version", d.get("version")) + w.leaf("Language", "en") + w.leaf("TranslationsAvailable", d.get("translations")) + w.open("PublicationCountries") + for c in d["countries"]: + w.leaf("Country", c) + w.close("PublicationCountries") + if d.get("fund"): + f = d["fund"] + w.open("Fund") + w.open("Identifiers") + w.leaf("LEI", f["lei"]) + w.close("Identifiers") + w.leaf("Name", f["name"]) + w.leaf("Currency", "EUR") + w.close("Fund") + if d.get("classes"): + w.open("ShareClasses") + for c in d["classes"]: + w.open("ShareClass") + w.open("Identifiers") + w.leaf("ISIN", c["isin"]) + w.close("Identifiers") + w.leaf("Name", c["full_name"]) + w.leaf("Currency", c["ccy"]) + w.close("ShareClass") + w.close("ShareClasses") + w.leaf("Name", d["name"]) + w.leaf("FileName", d["file"]) + w.leaf("ForPublicUsage", True) + w.leaf("Format", "application/pdf") + w.leaf("Signature", "No") + w.leaf("CreationDate", d["created"]) + w.leaf("ExpirationDate", d.get("expires")) + w.leaf("SizeInBytes", len(d["pdf"]) if d.get("pdf") else d["size"]) + w.leaf("DocumentURL", d.get("url")) + if d.get("pdf"): + emit_binary(w, d["pdf"]) + w.close("Document") + + +def fund_documents(): + """Prospectus as a link, PRIIPs KID and factsheet embedded as base64 PDFs (multi-asset fund).""" + _, fund, classes, *_ = multi_asset() + for c in classes: + c["full_name"] = fund["name"] + " " + c["name_suffix"] + r, i = classes[0], classes[1] + sample = ["This is a fictitious training sample for the FundsXML element.", + "It is not a real document and contains no investment information.", + "Companies, funds and identifiers are invented (ISINs and LEIs with the prefix XMPL).", + "Generated by make_realistic.py - https://github.com/fundsxml/examples"] + kid = build_pdf( + "Key Information Document \u2014 PRIIPs", fund["name"] + " (fictitious)", + [f"Share classes: {r['name_suffix']} {r['isin']}, {i['name_suffix']} {i['isin']}", + f"Manufacturer: {MANCO['name']}, {MANCO['city']} (fictitious)", "Date of this document: 2025-02-14", ""] + sample) + factsheet = build_pdf( + "Factsheet October 2025", fund["name"] + " (fictitious)", + [f"Share class: {r['name_suffix']} {r['isin']}", f"Reporting date: {AS_OF.isoformat()}", + f"Net asset value per share: {r['nav']} {r['ccy']}", ""] + sample) + slug = "EX-Multi-Asset" + documents = [ + {"type": "Prospectus", "version": "2025-01", "translations": True, "countries": ["AT", "DE", "CH"], "fund": fund, + "name": f"Prospectus {fund['name']}", "file": f"{slug}_Prospectus_2025-01_en.pdf", "created": "2025-01-15", + "size": 1843206, "url": f"https://www.example.com/funds/{fund['lei']}/documents/{slug}_Prospectus_2025-01_en.pdf"}, + {"type": "PRIIPS-KID", "version": "2025-02", "countries": ["AT", "DE"], "classes": [r, i], + "name": f"PRIIPs KID {fund['name']}", "file": f"{slug}_PRIIPs-KID_2025-02_en.pdf", "created": "2025-02-14", + "expires": "2026-02-13", "pdf": kid}, + {"type": "Factsheet", "version": "2025-10", "countries": ["AT", "DE"], "classes": [r], + "name": f"Factsheet {fund['name']} {r['name_suffix']} October 2025", + "file": f"{slug}_Factsheet_{r['isin']}_2025-10_en.pdf", "created": "2025-11-03", "expires": "2025-11-30", + "pdf": factsheet}, + ] + return documents + + +def render_documents(doc_id): + w = Writer() + w.lines.append('') + w.lines.append("") + w.lines.append('') + w.depth = 1 + emit_control(w, doc_id) + w.open("Documents") + for d in fund_documents(): + emit_document(w, d) + w.close("Documents") + w.depth = 0 + w.lines.append("") + return w.text() + + FILES = { "Global-Equity-Fund_2025-10.xml": global_equity, "Euro-Bond-Fund_2025-10.xml": euro_bond, @@ -1955,6 +2117,7 @@ def fund_of_funds(): "Fund-of-Funds_2025-10.xml": fund_of_funds, } REGULATORY = {"Multi-Asset-Derivatives-Fund_2025-10.xml"} # files with RegulatoryReportings (EMT, TPT) +DOCUMENT_FILES = {"Fund-Documents_2025-10.xml": render_documents} # ControlData + Documents only def render(builder, doc_id, regulatory=False): @@ -2077,6 +2240,13 @@ def main(): with open(args.out / name, "w", encoding="utf-8", newline="\n") as f: f.write(render(builder, doc_id, regulatory=name in REGULATORY)) print("wrote", args.out / name) + for name, renderer in DOCUMENT_FILES.items(): + if args.only and args.only != name: + continue + doc_id = "EXAMPLE-" + name.replace(".xml", "").upper().replace("_", "-") + with open(args.out / name, "w", encoding="utf-8", newline="\n") as f: + f.write(renderer(doc_id)) + print("wrote", args.out / name) return 0 diff --git a/FundsXML_Files/README.md b/FundsXML_Files/README.md index 3d1e079..bc862ef 100644 --- a/FundsXML_Files/README.md +++ b/FundsXML_Files/README.md @@ -227,7 +227,7 @@ schema URL it was validated against. | [4.2.9](./4.2.9/transactions/) | transactions | `Fund_Transactions.xml` | BUY/SELL/CASH, `AssetUniqueID` IDREF linking | | [4.2.9](./4.2.9/documents/) | documents | `Fund_Documents.xml` | Factsheet (URL) + PRIIPS-KID (embedded base64) | | [4.2.9](./4.2.9/regulatory/) | regulatory | `EFT_Regulatory.xml` | `RegulatoryReportings/DirectReporting/EFTs` | -| [4.2.9](./4.2.9/realistic/) | realistic | `Global-Equity-Fund_2025-10.xml`, `Euro-Bond-Fund_2025-10.xml`, `Multi-Asset-Derivatives-Fund_2025-10.xml`, `Fund-of-Funds_2025-10.xml` | Month-end files of fictional funds at production scale (81–207 positions, 30–67 transactions, 2–4 share classes with daily prices), generated by `make_realistic.py`, synthetic identifiers | +| [4.2.9](./4.2.9/realistic/) | realistic | `Global-Equity-Fund_2025-10.xml`, `Euro-Bond-Fund_2025-10.xml`, `Multi-Asset-Derivatives-Fund_2025-10.xml`, `Fund-of-Funds_2025-10.xml`, `Fund-Documents_2025-10.xml` | Month-end files of fictional funds at production scale (81–207 positions, 30–67 transactions, 2–4 share classes with daily prices) and a documents delivery (prospectus link, embedded PRIIPs KID and factsheet PDFs), generated by `make_realistic.py`, synthetic identifiers | | [4.2.9](./4.2.9/signed/) | signed | `Signed_Fund_Skeleton.xml` | Enveloped `ds:Signature` skeleton (schema-valid, not verifiable — real signing in `XML_Signature/`) | | [4.1.0](./4.1.0/positions/) | positions | `Equity-Fund_Positions.xml` | Compact equity fund, older valid version | | [4.0.0](./4.0.0/positions/) | positions | `Equity-Fund_Positions.xml` | Oldest release — **no `ControlData/Version`** |