介绍
# Crypto Price & Chart
获取加密代币价格并生成蜡烛图。
## 使用方法
使用代币符号和可选的时间段执行脚本:
```bash python3 {baseDir}/scripts/get_price_chart.py <SYMBOL> [duration] ```
**示例:** - `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`
**时间段格式:** `30m`, `3h`, `12h`, `24h`(默认), `2d`
## 输出
返回包含以下内容的 JSON: - `price` - 当前价格(USD/USDT) - `change_period_percent` - 该时间段的价格变化百分比 - `chart_path` - 生成的 PNG 图表路径(如果有) - `text_plain` - 格式化后的文本描述
**图表作为图片(当 chart_path 存在时始终如此):** 你必须将图表作为**照片**发送,而不是文本。在你的回复中,输出 `text_plain` 并换行后输出:`MEDIA: ` 后跟确切的 `chart_path` 值(例如 `MEDIA: /tmp/crypto_chart_HYPE_1769204734.png`)。Clawdbot 会将该文件作为图片附件。请**不要**写 `[chart: path]` 或任何其他文本占位符——只有 `MEDIA: <chart_path>` 这一行才能使图片显示出来。
## 图表详情
- 格式:蜡烛图(8x8 方形) - 主题:深色(#0f141c 背景) - 输出:`/tmp/crypto_chart_{SYMBOL}_{timestamp}.png`
## 数据源
1. **Hyperliquid API** - 用于 HYPE 和其他 Hyperliquid 代币(首选) 2. **CoinGecko API** - 用于其他代币的备用来源
价格数据缓存 300 秒(5 分钟)在 `/tmp/crypto_price_*.json` 中。