Skip to content

CLI Reference

Griffen Fargo edited this page May 3, 2026 · 6 revisions

CLI Reference

daybook init

Create the config file and SQLite database.

daybook init

Creates ~/.daybook/config.json and ~/.daybook/data.db. Safe to run multiple times — won't overwrite existing files.

daybook account

daybook account add <id>

Register a new source account.

daybook account add <id> --source <source> --identifier <id> --label <label>
Flag Required Description
--source Yes Source type: coinbase, kraken, eth, polygon
--identifier Yes Email (exchanges) or wallet address (EVM)
--label No Human-readable label

daybook account list

List all configured accounts.

daybook account list

daybook sync

Ingest transactions from a source into the database.

daybook sync --source <source> [options]
Flag Description
--source <src> Source to sync: coinbase, kraken, eth, polygon
--file <path> CSV file path (required for coinbase and kraken)
--account <id> Specific account to sync (optional, uses first matching account)
--from <date|block> Start sync from date (ISO 8601) or block number. EVM only.
--include-failed-gas Include gas from failed transactions via Etherscan. EVM only. Requires ETHERSCAN_API_KEY.

Examples

# Full Coinbase import
daybook sync --source coinbase --file ~/Downloads/coinbase.csv

# Full Kraken import
daybook sync --source kraken --file ~/Downloads/kraken-ledger.csv

# Full EVM sync
daybook sync --source eth

# Incremental sync from a date
daybook sync --source eth --from 2024-01-01

# Incremental sync from a block
daybook sync --source polygon --from 50000000

# Include failed transaction gas
daybook sync --source eth --include-failed-gas

Notes

  • --from is not supported for CSV sources (Coinbase, Kraken). Filter by date after import.
  • --include-failed-gas requires the ETHERSCAN_API_KEY environment variable.
  • All syncs are idempotent — duplicate events are skipped via INSERT OR IGNORE.

daybook events

daybook events count

Show the total number of raw events in the database.

daybook events count

daybook events list

Display raw events in a structured Ink table.

daybook events list [options]
Flag Description
--type <type> Filter by event type (e.g., trade, income, crypto_in)
--source <source> Filter by source (e.g., coinbase, kraken, eth)
--account <id> Filter by account ID
--limit <n> Maximum rows to display (default: 20)

The table displays: timestamp, type, asset/amount (all legs joined with /), source, and account. Fee legs are shown dimmed with a (fee) prefix. The account column is omitted when the terminal is narrower than 100 characters.

daybook classify

Run the 7-rule classifier chain over raw events to produce ledger entries.

daybook classify [options]
Flag Description
--dry-run Preview changes without writing to the database
--review Interactively review and override unclassified events after classification
--no-review Suppress interactive review (default when stdout is not a TTY)

Dry Run

--dry-run runs the full classifier and displays a diff against the current database state:

[dry-run] No changes written to database

  Events processed:    1,945
  Entries computed:    1,832
    trade:             412
    transfer_self:     89
    ...
    unclassified:      3

  Changes vs current DB:
    + 12 new entries
    - 5 removed entries
    = 1,815 unchanged

Interactive Review

--review launches an Ink-based interface after classification completes. Navigate unclassified entries with arrow keys, press Enter to select a type override, or q to exit. Overrides are persisted as ClassifierOverride records.

daybook export

Export a tax-ready CSV for a given year.

daybook export <year> [options]
Flag Description
--method <method> Cost basis method: FIFO (default), HIFO, specific-id
--output <path> Output CSV file path
--lot-selections <path> Load Specific ID lot selections from a JSON file
--no-wash-sale-flag Omit the Wash Sale? column from CSV output

Specific ID

When using --method specific-id:

  • Without --lot-selections: launches an interactive Ink-based lot picker. For each disposal, you see available lots with acquisition date, amount, unit cost, and holding period. Select lots with checkboxes, press s to skip (falls back to FIFO for that disposal).
  • With --lot-selections <path>: loads a JSON file mapping lot IDs to amounts. Use this to replay a previous selection without the interactive flow.

After interactive selection, the tool prints the path to a JSON file you can use for replay.

Wash Sale Flagging

By default, the CSV includes a Wash Sale? column (Y or N) for each disposal. A disposal is flagged when:

  • The disposal has a loss (gainLoss < 0)
  • The same asset was acquired within ±30 calendar days (UTC) of the disposal

The export summary prints the count of flagged disposals. Use --no-wash-sale-flag to suppress both the column and the summary line.

Wash sale flags are informational only — daybook does not compute disallowance amounts.

daybook compare

Compare tax outcomes across cost basis methods.

daybook compare <year>

Displays a side-by-side Ink table showing short-term gain, long-term gain, total taxable, and income for FIFO and HIFO methods.

daybook overrides

daybook overrides set

Set a manual price override for an asset on a specific date.

daybook overrides set <asset> <date> <price>

daybook overrides list

List all price overrides.

daybook overrides list

daybook overrides remove

Remove a price override by ID.

daybook overrides remove <id>

Clone this wiki locally