Prerequisites
- Node.js >= 20
- pnpm 9+
Installation
bash
git clone https://github.com/gfargo/daybook.git
cd daybook
pnpm install
pnpm buildTo make the daybook command available globally:
bash
npm install -g .Environment Variables
daybook uses environment variables for API keys. Add these to your shell profile or .env file:
| Variable | Required For | How to Get |
|---|---|---|
ALCHEMY_API_KEY | EVM sync (Ethereum, Polygon) | Free at alchemy.com |
ETHERSCAN_API_KEY | --include-failed-gas flag | Free at etherscan.io/apis |
COINGECKO_API_KEY | CoinGecko pricing (optional) | Free tier works without a key |
First Run
1. Initialize
Create the config file and SQLite database:
bash
daybook initThis creates ~/.daybook/config.json and ~/.daybook/data.db.
2. Add Accounts
Register your exchange accounts and wallets:
bash
# Coinbase
daybook account add main-coinbase \
--source coinbase \
--identifier you@example.com \
--label "My Coinbase"
# Kraken
daybook account add main-kraken \
--source kraken \
--identifier you@example.com \
--label "My Kraken"
# Binance
daybook account add main-binance \
--source binance \
--identifier you@example.com \
--label "My Binance"
# Binance.US
daybook account add main-binance-us \
--source binance-us \
--identifier you@example.com \
--label "My Binance.US"
# Generic CSV import bucket
daybook account add csv-imports \
--source csv \
--identifier manual-ledger \
--label "Universal CSV"
# Ethereum wallet
daybook account add eth-main \
--source eth \
--identifier 0xYourAddress \
--label "Main ETH"
# Polygon wallet
daybook account add polygon-main \
--source polygon \
--identifier 0xYourAddress \
--label "Main Polygon"Verify your accounts:
bash
daybook account list3. Sync Transactions
Import data from each source:
bash
# Coinbase API — see [Coinbase API Setup](/docs/coinbase-api-setup) for key setup, then:
daybook sync --source coinbase --from 2024-01-01
# Coinbase CSV — download CSV from Coinbase, then:
daybook sync --source coinbase --file ~/Downloads/Coinbase-All-Transactions.csv
# Kraken — download ledger CSV from Kraken, then:
daybook sync --source kraken --file ~/Downloads/kraken-ledger.csv
# Binance — download ledger CSV from Binance, then:
daybook sync --source binance --file ~/Downloads/binance-ledger.csv
# Binance.US — download tax-report CSV from Binance.US, then:
daybook sync --source binance-us --file ~/Downloads/binance-us-tax.csv
# Generic universal/manual CSV:
daybook sync --source csv --file ~/Downloads/universal-ledger.csv
# EVM wallets — fetches from Alchemy API
daybook sync --source eth
daybook sync --source polygonAll syncs are idempotent. Running them again with the same data is a no-op.
4. Classify Events
Run the classifier to produce ledger entries:
bash
daybook classifyTo preview what would change first:
bash
daybook classify --dry-runTo interactively review and override unclassified events:
bash
daybook classify --review5. Export Tax Report
bash
# Default: FIFO method
daybook export 2024 --output ./taxes-2024.csv
# Compare methods first
daybook compare 2024
# Export with HIFO
daybook export 2024 --method HIFO --output ./taxes-2024-hifo.csvIncremental Workflow
After the initial full sync, use incremental sync for faster updates:
bash
# Sync only new transactions since a date
daybook sync --source eth --from 2024-06-01
# Or from a specific block number
daybook sync --source eth --from 20000000
# Re-classify with the new data
daybook classify
# Re-export
daybook export 2024 --output ./taxes-2024.csvNext Steps
- CLI Reference — full command documentation
- Source Adapters — details on each source adapter
- Tax Engine — cost basis methods and wash sale flagging