Getting Started

Configuration

Edit on GitHub

Config File

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

Structure

json
{
  "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

FieldTypeDescription
idstringUnique account identifier (used in CLI flags)
sourcestringSource type: coinbase, kraken, binance, binance-us, csv, eth, polygon
identifierstringEmail/account label (exchanges and CSV buckets) or wallet address (EVM)
labelstringHuman-readable label (optional)

Tax Settings

FieldDefaultOptions
costBasisMethodFIFOFIFO, HIFO, specific-id
lotPooluniversaluniversal

Environment Variables

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

VariableRequired ForDescription
ALCHEMY_API_KEYEVM syncAlchemy API key for Ethereum and Polygon data. Free at alchemy.com
ETHERSCAN_API_KEY--include-failed-gasEtherscan API key for failed transaction gas tracking. Free at etherscan.io/apis
COINGECKO_API_KEYCoinGecko pricingOptional. Free tier works without a key for basic usage

Setting Environment Variables

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

bash
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

TablePurpose
raw_eventsAppend-only source data
raw_event_legsAsset legs for each raw event
ledger_entriesClassifier output (rebuilt on each classify run)
classifier_overridesUser corrections that survive re-classification
pricesCached USD prices from the pricing chain
price_overridesManual 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/:

text
~/.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.