Skip to content

lucianosrp/led

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LED

Fast, async, native Rust CLI for tracking shared expenses between people — like Tricount, but from your terminal.

Usage

led <payer> <participants...> <amount> <currency> <label> [date] [time]

The payer is always also a participant. All participants split the expense equally by default.

Split modes

Each participant can specify how much they owe:

  • bob — equal split (default, splits the remainder equally)
  • bob:50% — percentage of the total amount
  • bob:80 — fixed amount in the currency

Fixed amounts and percentages are subtracted first. The remainder is split equally among participants with no modifier.

Adding expenses

Equal split between two people:

led alice bob 100 USD dinner

Alice paid 100 USD. Both split equally (50 each). Bob owes alice 50 USD.

Equal split between three people:

led alice bob carol 234 USD trip

Alice paid 234 USD. All three split equally (78 each). Bob and carol each owe alice 78 USD.

Percentage split:

led alice bob:70% 100 USD lunch

Alice paid 100 USD. Bob owes 70 USD, alice covers the remaining 30 USD.

Fixed amount:

led alice bob:80 100 USD dinner

Alice paid 100 USD. Bob owes exactly 80 USD, alice covers the remaining 20 USD.

Mixed fixed and equal:

led alice bob:60 carol 100 USD trip

Alice paid 100 USD. Bob owes 60 (fixed). Alice and carol split the remaining 40 equally (20 each).

Zero share (gift):

led alice bob:0 100 USD gift

Alice paid 100 USD. Bob owes nothing. Alice covers the full cost.

Custom date and time:

led alice bob 100 USD dinner 2026-06-01
led alice bob 100 USD dinner 2026-06-01 10:00

Optional YYYY-MM-DD and HH:MM at the end override the default timestamp (now).

Aliases

Set short names for people or groups to speed up entry:

Person alias:

led alias a alice
led alias b bob

Now led a b 100 HKD dinner expands to led alice bob 100 HKD dinner.

Group alias:

led alias friends bob carol dave

Now led a friends 300 USD party expands to led alice bob carol dave 300 USD party — a 4-way equal split.

List and remove aliases:

led alias list
led alias rm friends

Aliases are stored in the database and work everywhere — direct commands, imports, and batch files.

Querying balances

Show all balances (who owes whom), per currency:

led balance

Convert all balances to a single currency:

led balance USD

Converts every expense to USD using historical exchange rates from each expense's date. Missing rates are automatically fetched from the ECB via Frankfurter. Cross-rates (e.g. GBP→USD) are computed through EUR.

Simplify to minimum transfers:

led balance USD --simplify

Reduces the number of transfers needed to settle up. Requires a target currency.

Filter by person:

led balance alice
led balance USD alice

List all recorded expenses:

led list
led list --last 10

Show details of a single expense:

led show 5

Displays payer, amount, date, and per-participant breakdown with share mode.

Search expenses:

led search lunch
led search 2025-06

Searches by label, payer, or date.

Undo the last expense:

led undo

Managing expenses

Remove an expense by ID:

led rm 3

Remove all expenses involving a person:

led rm bob

Removes every expense where bob is the payer or a participant.

Re-index IDs to be sequential after deletions:

led reidx

Currency exchange rates

LED uses the European Central Bank (ECB) rates via Frankfurter for currency conversion. Rates are cached locally in the database.

Pre-fetch historical rates:

led fx pull EURUSD 2025
led fx pull EURGBP 2021-2023
led fx pull EURUSD 2021-now

Fetches daily rates for a year, year range, or from a year to the present. Supports all ~30 ECB currencies (USD, EUR, GBP, JPY, CHF, CAD, AUD, HKD, etc.).

Auto-fetch: When you run led balance USD and a rate is missing for a particular expense date, LED automatically fetches it in a single bulk request and caches it. Subsequent queries are instant.

Check local FX data:

led fx status

Shows stored rate pairs, date ranges, day counts, and database size.

Importing from Tricount

Import expenses directly from a Tricount shared group:

led tricount tISMCgrIMgFuxudZ
led tricount https://tricount.com/en/join/tISMCgrIMgFuxudZ

Authenticates with the Tricount API, fetches all expenses, converts them to LED format, and shows a preview before importing. Accepts a Tricount share key or full URL.

Status

led status

Shows a comprehensive summary: expense count, date range, participants, per-currency totals, top spenders, outstanding balances, and FX data.

Exporting data

led export csv
led export json
led export led

The led format outputs the same syntax used by import, enabling full roundtrip backup/restore:

led export led > backup.txt
led import backup.txt

Batch import

Import multiple expenses from a file (one per line):

led import expenses.txt

Or from stdin:

led import -

Lines starting with # are treated as comments. Aliases are expanded during import. Example file:

# Trip expenses
alice bob 100 USD dinner
bob alice carol 234 USD trip
alice bob:70% 200 EUR hotel
carol alice:50 bob 300 USD groceries 2026-01-15

Flags

  • -y — Skip confirmation prompt and execute immediately.
  • -n / --dry-run — Preview what would happen without making changes.

By default, every command shows a summary of what will happen and asks for confirmation before writing to the database.

Storage

All expenses, aliases, and cached FX rates are stored locally in an encrypted SQLite database at ~/.led/ledger.db, powered by Turso (libSQL fork) with AES-256-GCM encryption at rest.

On first run, LED generates an encryption key and stores it at ~/.led/key. Keep this file safe — if you lose it, your ledger is unrecoverable.

Performance

Benchmarked with 10,000 expenses across 3 currencies:

Operation Time
led import (10k rows) 140ms
led balance (raw) 20ms
led balance USD (cached rates) 75ms
led balance USD (first run, fetches rates) ~2.5s
led list 43ms

About

Fast, async, native Rust CLI for tracking shared expenses between people — like Tricount, but from your terminal.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages