Skip to content
/ btc Public

πŸ’Ž a cli tool to analyze, simulate and manage your Bitcoin portfolio.

Notifications You must be signed in to change notification settings

Caixetadev/btc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

BTC Portfolio Manager

A CLI tool to analyze, simulate and manage your Bitcoin portfolio.

Features

  • 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

Installation

# Clone the repository
git clone https://github.com/caixetadev/btc.git
cd btc

# Build
make build

# Or install globally
make install

Configuration

Set a default CSV file to avoid passing it every time:

# Set default file
btc config -f portfolio.csv

# View current configuration
btc config

Configuration is stored in ~/.config/btc/config.json.

Usage

Check current BTC price

btc price

Analyze portfolio

# With default file configured
btc analyze

# Or specify a file (takes priority over config)
btc analyze portfolio.csv

Portfolio summary

btc summary

Simulate hypothetical price

btc simulate --price 150000

Export report

# Markdown format
btc export --format md > report.md

# Text format
btc export --format txt

Quick Start

An example file is included to test the tool:

btc analyze transactions.example.csv
btc summary transactions.example.csv
btc simulate --price 150000 transactions.example.csv

CSV Format

Create 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

Shell Completion

# Bash
btc completion bash >> ~/.bashrc

# Zsh
btc completion zsh >> ~/.zshrc

# Fish
btc completion fish > ~/.config/fish/completions/btc.fish

Development

# Build
make build

# Run tests
make test

# Format code
make fmt

# Build for all platforms
make build-all

Project Structure

btc/
β”œβ”€β”€ 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

About

πŸ’Ž a cli tool to analyze, simulate and manage your Bitcoin portfolio.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published