A CLI tool to analyze, simulate and manage your Bitcoin portfolio.
- Real-time BTC price from CoinGecko API
- Portfolio analysis with profit/loss per purchase
- Price simulation for hypothetical scenarios
- Colored output (green for profits, red for losses)
- Configuration system with default file
- Export reports in Markdown or plain text
# Clone the repository
git clone https://github.com/caixetadev/btc.git
cd btc
# Build
make build
# Or install globally
make installSet a default CSV file to avoid passing it every time:
# Set default file
btc config -f portfolio.csv
# View current configuration
btc configConfiguration is stored in ~/.config/btc/config.json.
btc price# With default file configured
btc analyze
# Or specify a file (takes priority over config)
btc analyze portfolio.csvbtc summarybtc simulate --price 150000# Markdown format
btc export --format md > report.md
# Text format
btc export --format txtAn example file is included to test the tool:
btc analyze transactions.example.csv
btc summary transactions.example.csv
btc simulate --price 150000 transactions.example.csvCreate a CSV file with your purchases (see transactions.example.csv for reference):
date,btc_amount,usd_paid
2024-01-15T10:30:00,0.02,1200.00
2024-06-20T14:00:00,0.03,2300.00| Column | Description |
|---|---|
date |
Purchase date (ISO 8601 format) |
btc_amount |
Amount of BTC purchased |
usd_paid |
Amount paid in USD |
# Bash
btc completion bash >> ~/.bashrc
# Zsh
btc completion zsh >> ~/.zshrc
# Fish
btc completion fish > ~/.config/fish/completions/btc.fish# Build
make build
# Run tests
make test
# Format code
make fmt
# Build for all platforms
make build-allbtc/
βββ main.go
βββ transactions.example.csv # Example portfolio for testing
βββ cmd/
β βββ root.go
β βββ config.go # btc config
β βββ price.go # btc price
β βββ analyze.go # btc analyze
β βββ summary.go # btc summary
β βββ simulate.go # btc simulate
β βββ export.go # btc export
βββ internal/
β βββ config/
β β βββ config.go # Configuration management
β βββ portfolio/
β β βββ csv.go # CSV parser
β β βββ portfolio.go # Portfolio logic
β βββ price/
β β βββ api.go # CoinGecko API client
β βββ simulator/
β β βββ simulator.go # Price simulator
β βββ ui/
β βββ colors.go # Terminal colors
βββ Makefile
βββ go.mod
βββ go.sum