Skip to content

Configuration

Griffen Fargo edited this page May 9, 2026 · 2 revisions

Configuration

Config File

daybook stores its configuration at ~/.daybook/config.json. Created by daybook init, validated by zod on load.

Structure

{
  "accounts": [
    {
      "id": "main-coinbase",
      "source": "coinbase",
      "identifier": "you@example.com",
      "label": "My Coinbase"
    },
    {
      "id": "main-kraken",
      "source": "kraken",
      "identifier": "you@example.com",
      "label": "My Kraken"
    },
    {
      "id": "main-binance",
      "source": "binance",
      "identifier": "you@example.com",
      "label": "My Binance"
    },
    {
      "id": "main-binance-us",
      "source": "binance-us",
      "identifier": "you@example.com",
      "label": "My Binance.US"
    },
    {
      "id": "csv-imports",
      "source": "csv",
      "identifier": "manual-ledger",
      "label": "Universal CSV"
    },
    {
      "id": "eth-main",
      "source": "eth",
      "identifier": "0xYourAddress",
      "label": "Main ETH"
    },
    {
      "id": "polygon-main",
      "source": "polygon",
      "identifier": "0xYourAddress",
      "label": "Main Polygon"
    }
  ],
  "tax": {
    "costBasisMethod": "FIFO",
    "lotPool": "universal"
  },
  "providers": {
    "alchemy": { "apiKeyEnv": "ALCHEMY_API_KEY" },
    "coingecko": { "apiKeyEnv": "COINGECKO_API_KEY" }
  },
  "dbPath": "~/.daybook/data.db"
}

Account Fields

Field Type Description
id string Unique account identifier (used in CLI flags)
source string Source type: coinbase, kraken, binance, binance-us, csv, eth, polygon
identifier string Email/account label (exchanges and CSV buckets) or wallet address (EVM)
label string Human-readable label (optional)

Tax Settings

Field Default Options
costBasisMethod FIFO FIFO, HIFO, specific-id
lotPool universal universal

Environment Variables

API keys are stored in environment variables, not in the config file.

Variable Required For Description
ALCHEMY_API_KEY EVM sync Alchemy API key for Ethereum and Polygon data. Free at alchemy.com
ETHERSCAN_API_KEY --include-failed-gas Etherscan API key for failed transaction gas tracking. Free at etherscan.io/apis
COINGECKO_API_KEY CoinGecko pricing Optional. Free tier works without a key for basic usage

Setting Environment Variables

Add to your shell profile (~/.bashrc, ~/.zshrc, etc.):

export ALCHEMY_API_KEY="your-key-here"
export ETHERSCAN_API_KEY="your-key-here"

Or use a .env file in your working directory (daybook does not auto-load .env files — use a tool like direnv or source it manually).

Database

daybook uses a single SQLite database at the path specified in dbPath (default: ~/.daybook/data.db). The database uses WAL mode for concurrent read access.

Tables

Table Purpose
raw_events Append-only source data
raw_event_legs Asset legs for each raw event
ledger_entries Classifier output (rebuilt on each classify run)
classifier_overrides User corrections that survive re-classification
prices Cached USD prices from the pricing chain
price_overrides Manual price entries

Migrations

Migrations are applied automatically when the database is opened:

  • 001_initial.sql — full schema
  • 002_price_overrides.sql — price overrides table

User Data Location

All user data lives under ~/.daybook/:

~/.daybook/
├── config.json    — configuration (zod-validated)
└── data.db        — SQLite database (WAL mode)

No secrets are stored in the config file. API keys stay in environment variables.

Clone this wiki locally