-
Notifications
You must be signed in to change notification settings - Fork 0
FX Implementation Summary
Masked-Kunsiquat edited this page Dec 25, 2025
·
4 revisions
This page summarizes the FX (multi-currency) system for CrewSplit.
- Offline-first conversions using cached rates
- Deterministic math for reproducible settlements
- Clear audit trail of which rates were used
Stores cached exchange rates from multiple sources.
- Key fields: base_currency, quote_currency, rate, source, fetched_at, priority
- Manual rates win via higher priority
- Soft deletes preserve auditability
Links trips to specific rates used at the time of settlement or export.
- Same currency: return 1.0 and skip DB lookup.
- Direct rate lookup (base -> quote) with priority + recency ordering.
- Inverse lookup (quote -> base) and use 1/rate.
- If missing, prompt for manual rate entry.
- Fetch rates when online and stale
- Store rates in SQLite
- Convert amounts on read using cached rates
- Persist original + converted amounts for auditability
- Show a staleness warning when rates are old
- Provide manual entry for missing pairs
- Display both original and converted amounts