Skill: charts
Generate professional technical analysis charts using the local crypto_charts.py module.
Generate All Charts (Full Suite)
Generates charts for all 6 tracked assets: BTC, ETH, XRP, SUI, Gold, Silver.
Warning: Takes 2-3 minutes due to API rate limits between requests.
CODEBLOCK0
Charts saved to: ~/clawd/charts/chart_btc.png, chart_eth.png, etc.
Generate Single Chart
For a quick single-asset chart without waiting for the full suite:
CODEBLOCK1
Tracked Assets
| coin_id | Symbol | Chart Color | Data Source |
|---|
| bitcoin | BTC | #F7931A | Yahoo Finance → CoinGecko |
| ethereum |
ETH | #627EEA | Yahoo Finance → CoinGecko |
| ripple | XRP | #00AAE4 | Yahoo Finance → CoinGecko |
| sui | SUI | #6FBCF0 | Yahoo Finance → CoinGecko |
| gold | XAU | #FFD700 | Yahoo Finance |
| silver | XAG | #C0C0C0 | Yahoo Finance |
What the Charts Include
- - Candlestick bars (green up / red down) — 90 days of daily data
- 20 SMA (blue) and 50 SMA (gold) — trend and support/resistance
- Fibonacci retracement levels (0%, 23.6%, 38.2%, 50%, 61.8%, 78.6%, 100%)
- RSI subplot (purple) — with overbought (70) and oversold (30) lines
- Current price marker — dot + horizontal line in the asset's accent color
Pattern Detection (Automatic)
The module auto-detects and reports:
- - SMA crossovers (Golden Cross / Death Cross)
- Head & Shoulders / Inverse H&S
- Fibonacci zone positioning
- Trend strength (7-day momentum)
- RSI condition (overbought/oversold/neutral)
- Price position within 90-day range
Sending Charts via Telegram
After generating, send the chart image using Clawdbot's native
message command:
CODEBLOCK2
Rules
- - Charts use 90 days of history — enough for meaningful TA
- Yahoo Finance is tried first (free, reliable), CoinGecko is fallback
- Rate limit: 8-second delays between coins, 20-second batch cooldowns
- Always run
cleanup_old_charts() first to avoid disk buildup - Chart images are ~150 DPI, dark theme (#0f172a background)
技能:图表生成
使用本地 crypto_charts.py 模块生成专业的技术分析图表。
生成所有图表(完整套件)
为所有6个追踪资产生成图表:BTC、ETH、XRP、SUI、黄金、白银。
警告: 由于请求间的API速率限制,需要2-3分钟。
bash
cd ~/clawd && python3 -c
import json
from crypto
charts import generateall
charts, cleanupold_charts
cleanup
oldcharts()
report = generate
allcharts(output_dir=os.path.expanduser(~/clawd/charts))
print(json.dumps(report, indent=2, default=str))
2>&1
图表保存至:~/clawd/charts/chartbtc.png、charteth.png等。
生成单个图表
如需快速生成单个资产图表,无需等待完整套件:
bash
cd ~/clawd && python3 -c
import os, json
from crypto_charts import (
fetch
yfinance, fetchohlc, fetch
marketdata,
calc
movingaverages, calc
rsi, calcfibonacci,
detect
patterns, generatechart, COINS
)
coinid = COINID # bitcoin, ethereum, ripple, sui, gold, silver
info = COINS[coin_id]
获取数据(优先Yahoo Finance,备用CoinGecko)
df = fetch
yfinance(coinid)
if df is None or len(df) < 10:
df = fetch
ohlc(coinid)
if df is None or len(df) < 10:
df = fetch
marketdata(coin_id)
if df is not None and len(df) >= 5:
df = calcmovingaverages(df)
df = calc_rsi(df)
fib = calc_fibonacci(df)
patterns = detect_patterns(df)
chartpath = os.path.expanduser(f~/clawd/charts/chart{info[\symbol\].lower()}.png)
generatechart(coinid, df, fib, chart_path)
print(f图表:{chart_path})
print(f价格:\${df[\close\].iloc[-1]:,.2f})
print(fRSI:{df[\rsi\].iloc[-1]:.1f})
print(形态:)
for p in patterns:
print(f - {p})
else:
print(数据不足,无法生成图表)
追踪资产
| coin_id | 符号 | 图表颜色 | 数据源 |
|---|
| bitcoin | BTC | #F7931A | Yahoo Finance → CoinGecko |
| ethereum |
ETH | #627EEA | Yahoo Finance → CoinGecko |
| ripple | XRP | #00AAE4 | Yahoo Finance → CoinGecko |
| sui | SUI | #6FBCF0 | Yahoo Finance → CoinGecko |
| gold | XAU | #FFD700 | Yahoo Finance |
| silver | XAG | #C0C0C0 | Yahoo Finance |
图表包含内容
- - K线柱(绿色上涨/红色下跌)—— 90天日线数据
- 20 SMA(蓝色)和50 SMA(金色)—— 趋势与支撑/阻力位
- 斐波那契回调位(0%、23.6%、38.2%、50%、61.8%、78.6%、100%)
- RSI子图(紫色)—— 含超买(70)和超卖(30)线
- 当前价格标记—— 以资产主题色显示的点+水平线
形态检测(自动)
模块自动检测并报告:
- - SMA交叉(金叉/死叉)
- 头肩顶/头肩底
- 斐波那契区间定位
- 趋势强度(7日动量)
- RSI状态(超买/超卖/中性)
- 价格在90天区间内的位置
通过Telegram发送图表
生成后,使用Clawdbot的原生message命令发送图表图片:
message (Telegram, target=7887978276) [attach ~/clawd/charts/chart_btc.png]
规则
- - 图表使用90天历史数据——足够进行有意义的技术分析
- 优先使用Yahoo Finance(免费、可靠),CoinGecko作为备用
- 速率限制:币种间延迟8秒,批次冷却20秒
- 始终先运行cleanupoldcharts()以避免磁盘堆积
- 图表图片约150 DPI,深色主题(#0f172a背景)