INTELLIFIN FIELD NOTES
Quant Tooling · WebAssembly Privacy

Zero-Upload Browser Wasm for IBKR Flex XML: Computing 365-Day FBAR Peaks and Cost-Basis Schedules in Client RAM

By Xiaolei Lu (Theoretical Physics PhD) Updated 2026-12-02 ~5 min read

Cross-border brokerage reconciliation breaks homegrown spreadsheets in three predictable places: IEEE-754 floating-point penny drift across fractional splits, multi-currency daily valuation curves for FBAR/8938 single-day maximums, and the privacy problem of uploading complete account numbers and net-worth ledgers to third-party servers. Here is the local Rust-to-WebAssembly workpaper architecture we built to solve all three with zero network egress.

# Generate anonymized synthetic IBKR Flex XML & verify compiled Wasm locally (0 bytes uploaded)
npm run test:rust       # 10/10 pure-Rust i128 fixed-point & §1091 unit tests
npm run build           # compiles wasm32-unknown-unknown (~381 KB release binary)
npm test                # 8/8 Vitest checks against compiled dist/ibkr_zerotax.wasm
npm run generate-sample -- --year 2025 --account U9001234 > sample.xml

1. Why IEEE-754 Floats & Cloud Uploads Fail Serious Books

2. Deterministic Pure Rust → wasm32-unknown-unknown Pipeline

Core Module (crates/ibkr-wasm/) Engineering Guarantee Verification Scope
fixed.rs (i128 Fixed-Point) Exact integer scaling at 10^-8 precision across quantities, FX, and splits Zero floating-point drift on fractional fills & pro-rata deferrals
xml.rs & ibkr_parser.rs Zero-dependency Rust parser with DOCTYPE/XXE rejection + CSV/HTML formula XSS neutralization Parses Flex Query XML, Activity Statement CSV, and flat CSV fallback
date.rs & tax_engine.rs Proleptic Gregorian calendar, IRS Pub 550 leap-year rules, FIFO/LIFO lot matching & §1091 61-day window Verified across 10 Rust unit tests + 8 compiled Wasm Vitest specs
cross_border.rs & reports.rs 365/366-day FBAR curve + Form 8949 / CRA T1135 CSV + printable CPA audit sheet ~381 KB static Wasm binary; DevTools Network tab confirms 0 bytes uploaded

The accompanying open-source Flex XML schema validator and synthetic statement generator CLI are already published under MIT ahead of the Dec 15 hosted Wasm web release.

Try the free 0-upload Wasm browser demo & MIT CLI today: Run the live browser-local IBKR Flex XML 0-Upload Wasm Sandbox (0 bytes leave RAM) or inspect github.com/luxiaolei/ibkr-flex-xml-toolkit for offline Flex Query XML structure inspection and synthetic test data generation. The full hosted FBAR/CPA workpaper suite launches on Dec 15.

Disclaimer: Deterministic mathematical data-aggregation workpaper tool only, not tax, accounting, legal, or investment advice. Always review schedules with a licensed CPA/EA.