{"id":50483307,"url":"https://github.com/whtsky/splitwise-fx","last_synced_at":"2026-06-01T19:30:58.964Z","repository":{"id":356270397,"uuid":"1231781985","full_name":"whtsky/splitwise-fx","owner":"whtsky","description":"Bulk currency conversion for Splitwise expenses (replaces the Pro feature)","archived":false,"fork":false,"pushed_at":"2026-05-07T09:32:09.000Z","size":61,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-07T11:36:44.225Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/whtsky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-07T09:27:59.000Z","updated_at":"2026-05-07T09:32:09.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/whtsky/splitwise-fx","commit_stats":null,"previous_names":["whtsky/splitwise-fx"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/whtsky/splitwise-fx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whtsky%2Fsplitwise-fx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whtsky%2Fsplitwise-fx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whtsky%2Fsplitwise-fx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whtsky%2Fsplitwise-fx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whtsky","download_url":"https://codeload.github.com/whtsky/splitwise-fx/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whtsky%2Fsplitwise-fx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33790692,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-01T19:30:57.559Z","updated_at":"2026-06-01T19:30:58.952Z","avatar_url":"https://github.com/whtsky.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# splitwise-fx\n\nBulk currency conversion for Splitwise expenses.\n\nPulls a Splitwise group's expenses, converts every foreign-currency line to a target currency at the **UnionPay transaction-date rate** (the rate Chinese banks actually used to settle), and writes the converted values back via the Splitwise API.\n\n## Install\n\n```bash\nuv tool install splitwise-fx\n```\n\n(Or `pipx install splitwise-fx`, or any other tool that installs Python CLIs into isolated venvs.)\n\nAfter install, `splitwise-fx` is on your `PATH`.\n\n## Setup\n\nGet a Splitwise API key from \u003chttps://secure.splitwise.com/apps\u003e and export it:\n\n```bash\nexport SPLITWISE_API_KEY=your-key-here\n```\n\n(Add to `~/.zshrc` / `~/.bashrc` to persist. You can also pass `--api-key` per-invocation, or drop a `.env` file in the directory you run from.)\n\n## Usage\n\n```bash\n# preview, then prompt y/N to apply\nsplitwise-fx --group \"东京旅行\" --to CNY\n\n# preview only — exit without prompting\nsplitwise-fx --group \"东京旅行\" --to CNY --dry-run\n\n# skip the prompt (automation)\nsplitwise-fx --group \"东京旅行\" --to CNY --yes\n\n# date window\nsplitwise-fx --group \"东京旅行\" --to CNY --after 2026-04-01 --before 2026-05-01\n\n# bypass the on-disk rate cache\nsplitwise-fx --group \"东京旅行\" --to CNY --no-cache\n```\n\n`--group` accepts either the group's name (case-insensitive) or its numeric ID. If the name is ambiguous or missing, the CLI lists matches and exits.\n\n## How it works\n\n1. Pulls expenses from the chosen group, paginating Splitwise's API.\n2. For each foreign-currency expense, looks up that day's rate.\n3. Skips settle-up payments and same-currency lines.\n4. Converts cost + each user's `paid_share` and `owed_share` using `Decimal`. Distributes ±0.01 rounding residuals to the largest non-zero shares so `sum(paid) == sum(owed) == cost` holds (Splitwise rejects updates that violate this).\n5. Renders a Rich preview with rate source per line (`UPI` or `FRA`).\n6. On confirm, posts each update via `POST /update_expense/{id}`, sleeping 1 s between writes.\n\n### Rate sources\n\n| Source | When used | Notes |\n|---|---|---|\n| UnionPay (`unionpayintl.com/upload/jfimg/{YYYYMMDD}.json`) | Target currency is one of: AUD CAD CNY EUR GBP HKD HUF JPY MNT MOP NZD SGD THB USD VND | Files exist for every day including weekends/CN holidays (Friday rate carries through). |\n| Frankfurter (`api.frankfurter.dev/v2/rate/{src}/{dst}`) | Target outside UnionPay's 15 base currencies, or pair missing from UnionPay file | Free, ECB-backed. |\n\nRates are cached on disk under `${XDG_CACHE_HOME:-~/.cache}/splitwise-fx/`. Past dates never expire (historical rates are immutable); today's date refreshes every hour.\n\n## Caveats\n\n- **Idempotency**: re-running with a different `--to` after a first conversion will re-convert already-converted expenses. The filter only skips lines whose `currency_code` already matches the target.\n- **Settle-up payments are skipped** — converting them would corrupt the ledger.\n- **Splitwise rate limits are undocumented**; the CLI sleeps 1 s between writes and backs off on 429s.\n\n## Development\n\n```bash\ngit clone https://github.com/whtsky/splitwise-fx\ncd splitwise-fx\nuv sync\n\n# linters / type-checker / tests\nuv run ruff check\nuv run ruff format --check\nuv run mypy src tests\nuv run pytest\n```\n\n## Releasing (maintainer notes)\n\nReleases publish to PyPI via GitHub Actions Trusted Publishing on tag push:\n\n```bash\n# bump version in pyproject.toml and src/splitwise_fx/__init__.py\ngit commit -am \"release: vX.Y.Z\"\ngit tag vX.Y.Z\ngit push origin main vX.Y.Z\n```\n\nThe `release.yml` workflow builds with `uv build` and publishes via `pypa/gh-action-pypi-publish`. Trusted publishing is configured one-time at \u003chttps://pypi.org/manage/account/publishing/\u003e.\n\n## License\n\nMIT — see [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhtsky%2Fsplitwise-fx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhtsky%2Fsplitwise-fx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhtsky%2Fsplitwise-fx/lists"}