feature: CoinGecko cryptocurrency price extractor #27

Closed
opened 2026-02-14 16:12:46 +00:00 by Claude · 1 comment
Collaborator

Description

Mort has a .crypto command (pkg/crypto/crypto.go) that displays cryptocurrency prices with charts. Currently it screenshots a self-hosted chart endpoint using go-extractor. A CoinGecko site extractor would provide structured price data that could complement or replace the screenshot approach.

CoinGecko is the most widely used free crypto data aggregator and doesn't require an API key for basic page scraping.

Proposed API

package coingecko

type CoinPrice struct {
    Name       string
    Symbol     string
    Price      float64
    Change24h  float64  // percentage
    Change7d   float64
    MarketCap  float64
    Volume24h  float64
    High24h    float64
    Low24h     float64
}

type Config struct{}
var DefaultConfig = Config{}

func (c Config) GetPrice(ctx context.Context, b extractor.Browser, coin string) (*CoinPrice, error)

URL Pattern

https://www.coingecko.com/en/coins/{coin-id} — e.g., https://www.coingecko.com/en/coins/bitcoin

Benefits

  • Structured crypto price data for mort's .crypto command
  • No API key required (browser-based scraping)
  • Could add chart screenshot support too
  • Useful for any go-extractor consumer needing crypto prices
## Description Mort has a `.crypto` command (`pkg/crypto/crypto.go`) that displays cryptocurrency prices with charts. Currently it screenshots a self-hosted chart endpoint using go-extractor. A CoinGecko site extractor would provide structured price data that could complement or replace the screenshot approach. CoinGecko is the most widely used free crypto data aggregator and doesn't require an API key for basic page scraping. ## Proposed API ```go package coingecko type CoinPrice struct { Name string Symbol string Price float64 Change24h float64 // percentage Change7d float64 MarketCap float64 Volume24h float64 High24h float64 Low24h float64 } type Config struct{} var DefaultConfig = Config{} func (c Config) GetPrice(ctx context.Context, b extractor.Browser, coin string) (*CoinPrice, error) ``` ## URL Pattern `https://www.coingecko.com/en/coins/{coin-id}` — e.g., `https://www.coingecko.com/en/coins/bitcoin` ## Benefits - Structured crypto price data for mort's `.crypto` command - No API key required (browser-based scraping) - Could add chart screenshot support too - Useful for any go-extractor consumer needing crypto prices
Claude added the enhancementpriority/medium labels 2026-02-14 21:01:03 +00:00
Author
Collaborator

Implemented in PR #46. Added sites/coingecko package with GetPrice() method returning CoinPrice (name, symbol, price, 24h/7d change, market cap, volume, 24h high/low). Includes parseLargeNumber() for T/B/M suffix handling and full mock-based test coverage.

Implemented in PR #46. Added `sites/coingecko` package with `GetPrice()` method returning `CoinPrice` (name, symbol, price, 24h/7d change, market cap, volume, 24h high/low). Includes `parseLargeNumber()` for T/B/M suffix handling and full mock-based test coverage.
Sign in to join this conversation.