crypto-market-analyzer

TotalClaw 作者 totalclaw

比特币和以太坊的加密货币市场分析。从 Binance API 获取 4 小时(24 小时)和 1 天(30 天)数据,计算技术指标(RSI、SMA、支撑/阻力),并提供看涨/看跌情绪分析和推理。当用户请求加密货币市场报告、BTC/ETH 分析或每日市场摘要时使用。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~hmzo-crypto-market-analyzer
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~hmzo-crypto-market-analyzer/file -o hmzo-crypto-market-analyzer.md
# Crypto Market Analyzer

This skill provides automated cryptocurrency market analysis for Bitcoin (BTC) and Ethereum (ETH).

## What It Does

- Fetches market data from Binance public API (no authentication required)
- Analyzes 4-hour timeframe (last 24 hours)
- Analyzes daily timeframe (last 30 days)
- Calculates technical indicators:
  - RSI (Relative Strength Index, 14-period)
  - Simple Moving Averages (20-day and 50-day)
  - Support and resistance levels
  - Price change (24h and 7d)
- Provides sentiment analysis (Bullish/Bearish/Neutral) with confidence level
- Generates structured reports with reasoning

## Usage

### Generate Market Report

Run the analysis script:

```bash
python3 scripts/fetch_crypto_data.py
```

Output format (JSON):

```json
{
  "BTCUSDT": {
    "indicators": {
      "current_price": 43250.50,
      "sma_20": 42800.00,
      "sma_50": 41500.00,
      "rsi": 58.3,
      "support": 42000.00,
      "resistance": 44000.00,
      "price_change_24h": 2.5,
      "price_change_7d": 5.8
    },
    "sentiment": {
      "sentiment": "Bullish (看涨)",
      "confidence": 0.75,
      "reasons": [
        "RSI (58.3) shows bullish momentum",
        "Price above both SMAs (20d and 50d) - bullish trend",
        "Strong 24h gain (2.50%) - bullish"
      ]
    },
    "timestamp": "2026-02-11T14:38:00"
  },
  "ETHUSDT": { ... }
}
```

### Generate Human-Readable Report

To create a user-friendly report, use the JSON output and format it:

```
📊 加密货币市场分析报告
生成时间: 2026-02-11 14:38

## 比特币 (BTC)

💰 当前价格: $43,250.50
📈 24h涨跌: +2.5%
📊 7日涨跌: +5.8%

### 技术指标
- RSI (14): 58.3
- SMA 20: $42,800
- SMA 50: $41,500
- 支撑位: $42,000
- 阻力位: $44,000

### 市场判断
🎯 趋势: 看涨 (Bullish)
📊 置信度: 75%

📝 分析理由:
- RSI (58.3) 显示多头动能
- 价格位于20日和50日均线上方 - 上升趋势
- 24小时涨幅强劲 (2.50%) - 多头信号

## 以太坊 (ETH)
...
```

## Scheduled Execution

This skill is designed for daily automated execution at 10:00 AM (UTC+8).

To schedule via OpenClaw cron:

```bash
# Create a cron job to run daily at 10:00 AM UTC+8
# This corresponds to 02:00 UTC
```

The cron job should:
1. Execute the analysis script
2. Parse the JSON output
3. Format a human-readable report
4. Send the report to the user via messaging channel

## Technical Details

### Data Source

- **API**: Binance Public API
- **Endpoint**: `/api/v3/klines`
- **Rate Limits**: 1200 request weight per minute (well within limits)
- **No Authentication Required**: Public market data

### Timeframes

- **4h**: 6 candles (24 hours of data)
- **1d**: 30 candles (30 days of data)

### Indicators Explained

- **RSI**: Momentum oscillator (0-100). <30 = oversold, >70 = overbought
- **SMA 20/50**: Trend indicators. Price > both SMAs = bullish
- **Support/Resistance**: Recent low/high averages
- **Price Change**: Percentage change over specified period

### Sentiment Logic

Sentiment is determined by combining multiple signals:

1. RSI position (oversold/overbought/momentum)
2. Price vs moving averages (trend direction)
3. Recent price changes (momentum strength)

Each signal contributes to a bullish/bearish score, which determines:
- Overall sentiment (Bullish/Bearish/Neutral)
- Confidence level (0.3 to 0.9)
- Detailed reasoning

## Extending the Skill

To add more cryptocurrencies:

Edit `scripts/fetch_crypto_data.py` and modify the `symbols` list:

```python
symbols = ["BTCUSDT", "ETHUSDT", "SOLUSDT", "ADAUSDT"]
```

To add more indicators:

Extend the `calculate_technical_indicators()` function with additional calculations (MACD, Bollinger Bands, etc.).

To customize sentiment logic:

Modify the `analyze_sentiment()` function to adjust weighting and thresholds.

---

## 中文说明

# Crypto Market Analyzer

本技能为比特币(BTC)和以太坊(ETH)提供自动化的加密货币市场分析。

## 功能说明

- 从 Binance 公共 API 获取市场数据(无需认证)
- 分析 4 小时时间框架(最近 24 小时)
- 分析日线时间框架(最近 30 天)
- 计算技术指标:
  - RSI(相对强弱指数,14 周期)
  - 简单移动平均线(20 日和 50 日)
  - 支撑位和阻力位
  - 价格变动(24 小时和 7 天)
- 提供情绪分析(看涨/看跌/中性)及置信度
- 生成带推理的结构化报告

## 用法

### 生成市场报告

运行分析脚本:

```bash
python3 scripts/fetch_crypto_data.py
```

输出格式(JSON):

```json
{
  "BTCUSDT": {
    "indicators": {
      "current_price": 43250.50,
      "sma_20": 42800.00,
      "sma_50": 41500.00,
      "rsi": 58.3,
      "support": 42000.00,
      "resistance": 44000.00,
      "price_change_24h": 2.5,
      "price_change_7d": 5.8
    },
    "sentiment": {
      "sentiment": "Bullish (看涨)",
      "confidence": 0.75,
      "reasons": [
        "RSI (58.3) shows bullish momentum",
        "Price above both SMAs (20d and 50d) - bullish trend",
        "Strong 24h gain (2.50%) - bullish"
      ]
    },
    "timestamp": "2026-02-11T14:38:00"
  },
  "ETHUSDT": { ... }
}
```

### 生成可读报告

要创建用户友好的报告,使用 JSON 输出并对其进行格式化:

```
📊 加密货币市场分析报告
生成时间: 2026-02-11 14:38

## 比特币 (BTC)

💰 当前价格: $43,250.50
📈 24h涨跌: +2.5%
📊 7日涨跌: +5.8%

### 技术指标
- RSI (14): 58.3
- SMA 20: $42,800
- SMA 50: $41,500
- 支撑位: $42,000
- 阻力位: $44,000

### 市场判断
🎯 趋势: 看涨 (Bullish)
📊 置信度: 75%

📝 分析理由:
- RSI (58.3) 显示多头动能
- 价格位于20日和50日均线上方 - 上升趋势
- 24小时涨幅强劲 (2.50%) - 多头信号

## 以太坊 (ETH)
...
```

## 定时执行

本技能设计为每天上午 10:00(UTC+8)自动执行。

通过 OpenClaw cron 进行调度:

```bash
# Create a cron job to run daily at 10:00 AM UTC+8
# This corresponds to 02:00 UTC
```

该 cron 任务应当:
1. 执行分析脚本
2. 解析 JSON 输出
3. 格式化为可读报告
4. 通过消息渠道将报告发送给用户

## 技术细节

### 数据来源

- **API**:Binance 公共 API
- **Endpoint**:`/api/v3/klines`
- **速率限制**:每分钟 1200 请求权重(远在限制范围内)
- **无需认证**:公共市场数据

### 时间框架

- **4h**:6 根 K 线(24 小时数据)
- **1d**:30 根 K 线(30 天数据)

### 指标说明

- **RSI**:动量振荡指标(0-100)。<30 = 超卖,>70 = 超买
- **SMA 20/50**:趋势指标。价格 > 两条 SMA = 看涨
- **支撑位/阻力位**:近期低点/高点均值
- **价格变动**:在指定周期内的百分比变化

### 情绪逻辑

情绪由多个信号组合决定:

1. RSI 位置(超卖/超买/动量)
2. 价格相对移动平均线(趋势方向)
3. 近期价格变动(动量强度)

每个信号都对看涨/看跌得分有所贡献,从而决定:
- 总体情绪(看涨/看跌/中性)
- 置信度(0.3 至 0.9)
- 详细推理

## 扩展技能

要添加更多加密货币:

编辑 `scripts/fetch_crypto_data.py` 并修改 `symbols` 列表:

```python
symbols = ["BTCUSDT", "ETHUSDT", "SOLUSDT", "ADAUSDT"]
```

要添加更多指标:

通过额外的计算(MACD、布林带等)扩展 `calculate_technical_indicators()` 函数。

要自定义情绪逻辑:

修改 `analyze_sentiment()` 函数以调整权重和阈值。