Crypto Price & Chart
Get cryptocurrency token price and generate candlestick charts.
Usage
Execute the script with token symbol and optional duration:
CODEBLOCK0
Examples:
- - INLINECODE0
- INLINECODE1
- INLINECODE2
- INLINECODE3
- INLINECODE4
Duration format: 30m, 3h, 12h, 24h (default), INLINECODE9
Output
Returns JSON with:
- -
price - Current price in USD/USDT - INLINECODE11 - Price change percentage for the period
- INLINECODE12 - Path to generated PNG chart (if available)
- INLINECODE13 - 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: INLINECODE20
Data Sources
- 1. Hyperliquid API - For HYPE and other Hyperliquid tokens (preferred)
- CoinGecko API - Fallback for other tokens
Price data cached for 300 seconds (5 minutes) in /tmp/crypto_price_*.json.
加密货币价格与图表
获取加密货币代币价格并生成K线图。
使用方法
使用代币符号和可选时长执行脚本:
bash
python3 {baseDir}/scripts/getpricechart.py [duration]
示例:
- - python3 {baseDir}/scripts/getpricechart.py HYPE
- python3 {baseDir}/scripts/getpricechart.py HYPE 12h
- python3 {baseDir}/scripts/getpricechart.py BTC 3h
- python3 {baseDir}/scripts/getpricechart.py ETH 30m
- python3 {baseDir}/scripts/getpricechart.py SOL 2d
时长格式: 30m、3h、12h、24h(默认)、2d
输出
返回JSON格式数据,包含:
- - price - 当前价格(美元/USDT)
- changeperiodpercent - 周期内价格变化百分比
- chartpath - 生成的PNG图表路径(如有)
- textplain - 格式化文本描述
图表作为图片(当chart_path存在时始终如此):
您必须将图表作为照片发送,而非文本。在回复中,输出textplain,并在新一行中输出MEDIA: 后紧跟精确的chartpath值(例如MEDIA: /tmp/cryptochartHYPE1769204734.png)。Clawdbot将把该文件作为图片附件。请不要写[chart: path]或任何其他文本占位符——只有MEDIA: path>这一行才能使图片显示。
图表详情
- - 格式:K线图(8x8正方形)
- 主题:深色(#0f141c背景)
- 输出:/tmp/cryptochart{SYMBOL}_{timestamp}.png
数据来源
- 1. Hyperliquid API - 用于HYPE及其他Hyperliquid代币(首选)
- CoinGecko API - 其他代币的备用方案
价格数据缓存300秒(5分钟),存储于/tmp/cryptoprice*.json。