home / skills / openclaw / skills / crypto-price

crypto-price skill

/skills/evgyur/crypto-price

This skill fetches cryptocurrency prices and generates candlestick charts using CoinGecko or Hyperliquid, delivering price, change, and a chart image.

npx playbooks add skill openclaw/skills --skill crypto-price

Review the files below or copy the command above to add this skill to your agents.

Files (6)
SKILL.md
1.9 KB
---
name: crypto-price
description: Get cryptocurrency token price and generate candlestick charts via CoinGecko API or Hyperliquid API. Use when user asks for token price, crypto price, price chart, or cryptocurrency market data.
metadata: {"clawdbot":{"emoji":"šŸ“ˆ","requires":{"bins":["python3"]}}}
---

# Crypto Price & Chart

Get cryptocurrency token price and generate candlestick charts.

## Usage

Execute the script with token symbol and optional duration:

```bash
python3 {baseDir}/scripts/get_price_chart.py <SYMBOL> [duration]
```

**Examples:**
- `python3 {baseDir}/scripts/get_price_chart.py HYPE`
- `python3 {baseDir}/scripts/get_price_chart.py HYPE 12h`
- `python3 {baseDir}/scripts/get_price_chart.py BTC 3h`
- `python3 {baseDir}/scripts/get_price_chart.py ETH 30m`
- `python3 {baseDir}/scripts/get_price_chart.py SOL 2d`

**Duration format:** `30m`, `3h`, `12h`, `24h` (default), `2d`

## Output

Returns JSON with:
- `price` - Current price in USD/USDT
- `change_period_percent` - Price change percentage for the period
- `chart_path` - Path to generated PNG chart (if available)
- `text_plain` - Formatted text description

**Chart as image (always when chart_path is present):**  
You must send the chart as a **photo**, not as text. In your reply, output `text_plain` and on a new line: `MEDIA: ` followed by the exact `chart_path` value (e.g. `MEDIA: /tmp/crypto_chart_HYPE_1769204734.png`). Clawdbot will attach that file as an image. Do **not** write `[chart: path]` or any other text placeholder — only the `MEDIA: <chart_path>` line makes the image appear.

## Chart Details

- Format: Candlestick chart (8x8 square)
- Theme: Dark (#0f141c background)
- Output: `/tmp/crypto_chart_{SYMBOL}_{timestamp}.png`

## Data Sources

1. **Hyperliquid API** - For HYPE and other Hyperliquid tokens (preferred)
2. **CoinGecko API** - Fallback for other tokens

Price data cached for 300 seconds (5 minutes) in `/tmp/crypto_price_*.json`.

Overview

This skill fetches real-time cryptocurrency prices and generates dark-themed candlestick charts. It uses Hyperliquid for supported tokens (like HYPE) and falls back to CoinGecko for others. Outputs include current price, period change, a PNG chart path, and a ready-to-send text summary.

How this skill works

The skill queries Hyperliquid first for market data, then CoinGecko if needed, and caches responses for 5 minutes to reduce API calls. It builds OHLC candlesticks for the requested duration, renders an 8x8 dark-themed PNG, and returns JSON with price, percent change, chart path, and formatted text. When a chart is produced, include the chart image as a photo using the exact MEDIA line with the chart_path.

When to use it

  • When a user asks for a token price (e.g., BTC, ETH, HYPE).
  • When you need a short-term price chart (30m, 3h, 12h, 24h, 2d).
  • To get both numeric market data and a ready-to-share candlestick image.
  • When integrating crypto price checks into bots or chat workflows.
  • When you want a quick visual of recent price action for decision making.

Best practices

  • Provide a symbol and optional duration (examples: 30m, 3h, 12h, 24h, 2d).
  • Prefer Hyperliquid tokens (HYPE) for higher-fidelity exchange data; others use CoinGecko fallback.
  • Respect the 5-minute cache—repeat requests inside that window may return cached results.
  • When a chart_path is present, deliver the chart as a photo using: MEDIA: <chart_path> on its own line so clients attach the PNG.
  • Validate symbol spelling and use common tickers (BTC, ETH, SOL) for best results.

Example use cases

  • Chatbot answering ā€œWhat is BTC price?ā€ and attaching a 3h candlestick image.
  • Automated reports that include current price, percent change, and a PNG chart for HYPE via Hyperliquid.
  • Manual CLI usage: python3 scripts/get_price_chart.py HYPE 12h to produce JSON + chart file.
  • Portfolio alerts that post a 30m chart and percent change when a threshold is crossed.
  • Research snippets that need quick visual context before deeper analysis.

FAQ

What duration formats are supported?

Use formats like 30m, 3h, 12h, 24h (default), or 2d.

How do I send the generated chart image?

When chart_path is present, include the exact line: MEDIA: /tmp/crypto_chart_<SYMBOL>_<timestamp>.png so the file is attached as a photo.