instant-price-cli

module
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2026 License: MIT

README

instant-price-cli

A fast, zero-dependency CLI tool to get real-time cryptocurrency prices in any currency.

$ price btc
BTC: 80,259.82 USD

$ price btc --change
BTC: 80,259.82 USD
  24h   +0.08%
  7d    +2.01%
  30d  +11.78%
  1y   -22.06%

$ price btc --graph w
BTC: 80,259.82 USD
BTC/USD — Last 7d
81,722.22 ┤                                                            
          ┤                              ╱╱╱╱╱╲                        
80,954.78 ┤                        ╱╱╱╱╱╱      ╲╲                      
          ┤                      ╱╱              ╲╲╲                   
80,187.33 ┤                   ╱╱╱                   ╲╲─────────────────
          ┤                ╱╱╱                                         
79,419.89 ┤             ╱╱╱                                            
          ┤          ╱╱╱                                               
          ┤─────────╱                                                  
78,268.72 └                                                            
           ────────────────────────────────────────────────────────────
          Sat     Sun              Tue              Thu             Sat

$ price btc --json
{
  "symbol": "BTC",
  "currency": "USD",
  "price": 80259.82
}

$ price btc --change --json
{
  "symbol": "BTC",
  "currency": "USD",
  "price": 80259.82,
  "change": {
    "24h": 0.08,
    "7d": 2.01,
    "30d": 11.78,
    "1y": -22.06
  }
}

Requirements

Install

go install github.com/maryayi/instant-price-cli/cmd/price@latest

This installs the price binary into $GOPATH/bin (usually ~/go/bin). Make sure that directory is in your $PATH:

# Add to ~/.bashrc or ~/.zshrc if not already there
export PATH="$HOME/go/bin:$PATH"

API key

CryptoCompare now requires an API key — unauthenticated requests are rejected with HTTP 401. Create a free key from your CryptoCompare API keys page, then make it available to price in one of two ways.

Option 1 — environment variable:

export APP_CONFIG_CRYPTO_COMPARE_API_KEY="your-api-key-here"

Add that line to your ~/.bashrc or ~/.zshrc to persist it across sessions.

Option 2 — .env file:

Create a .env file in the directory you run price from:

APP_CONFIG_CRYPTO_COMPARE_API_KEY=your-api-key-here

If both are set, the environment variable takes precedence. Keep your key out of version control — .env is already listed in .gitignore.

Rate limits

The free tier is capped at roughly 1 request/second, 10/minute, and 100/day. Commands that make two calls (--change, --graph) are paced automatically to stay within the per-second limit. If you exceed a limit, the API returns a clear over your rate limit error.

Usage

price [options] <CRYPTO>

The symbol and currency code are both case-insensitive.

Options:

Flag Shorthand Default Description
--currency -c USD Currency code to display the price in
--change Show price change for 24h, 7d, 30d, and 1y
--graph PERIOD -g ASCII price chart: d=day, w=week, m=month, y=year
--json Output results as JSON
--version -v Show version
--help -h Show help message

Note: --change has no shorthand because -c is reserved for --currency.

Examples:

# Default (USD)
price btc
price ETH

# Other currencies — flag can go before or after the symbol
price btc --currency EUR
price btc -c GBP
price --currency JPY eth
price -c=CAD sol

# Show price change over multiple timeframes
price btc --change
price btc -c EUR --change

# ASCII price chart
price btc --graph d        # last 24 hours (hourly)
price btc --graph w        # last 7 days
price btc -g m             # last 30 days
price btc -g y -c EUR      # last year in EUR

# Output as JSON (combinable with other flags)
price btc --json
price btc --change --json
price btc -c EUR --json

# Help and version
price --help
price --version

Build from source

git clone https://github.com/maryayi/instant-price-cli.git
cd instant-price-cli
go build -o price ./cmd/price

Then move the binary to a directory in your $PATH:

# Linux / macOS
mv price /usr/local/bin/

Data source

Prices are fetched live from CryptoCompare. A free API key is required — see API key above.

License

MIT

Directories

Path Synopsis
cmd
price command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL