Crypto Indicators — 加密货币技术指标
所有接口均为 V2 版本(/api/v2/crypto/indicators/...)。
Curl Setup
BASE="http://43.167.234.49:3101"
AUTH=(-H "X-API-Key: 123456" -H "Content-Type: application/json")
代码格式规则
| 规则 |
值 |
exchange |
必填:binance, okx, bybit, bitget, kucoin, hyperliquid |
symbol |
交易对,如 BTCUSDT, ETHUSDT |
| 日期格式 |
YYYY-MM-DD |
| K线周期 |
1m, 5m, 15m, 1h, 4h, 1d, 1w |
支持的指标(27种)
| # |
Indicator |
Type |
Key Parameters |
Default |
| 1 |
SMA |
Trend |
period |
20 |
| 2 |
EMA |
Trend |
period |
20 |
| 3 |
RSI |
Oscillator |
period |
14 |
| 4 |
MACD |
Trend |
fast_period, slow_period, signal_period |
12, 26, 9 |
| 5 |
BOLL |
Volatility |
period, nbdev |
20, 2.0 |
| 6 |
KDJ |
Oscillator |
fastk_period, slowk_period, slowd_period |
9, 3, 3 |
| 7 |
ADX |
Trend |
period |
14 |
| 8 |
ATR |
Volatility |
period |
14 |
| 9 |
CCI |
Oscillator |
period |
14 |
| 10 |
VWAP |
Volume |
period |
20 |
| 11 |
OBV |
Volume |
无 |
— |
| 12 |
NATR |
Volatility |
period |
14 |
| 13 |
MFI |
Volume |
period |
14 |
| 14 |
WILLR |
Oscillator |
period |
14 |
| 15 |
STDDEV |
Volatility |
period |
20 |
| 16 |
Aroon |
Trend |
period |
14 |
| 17 |
TRIX |
Trend |
period |
9 |
| 18 |
MOM |
Momentum |
period |
10 |
| 19 |
ROC |
Momentum |
period |
12 |
| 20 |
CMO |
Momentum |
period |
14 |
| 21 |
AD |
Volume |
无 |
— |
| 22 |
HT Trendline |
Trend |
无 |
— |
| 23 |
PPO |
Trend |
fast_period, slow_period |
12, 26 |
| 24 |
SAR |
Trend |
acceleration, maximum |
0.02, 0.2 |
| 25 |
Stoch |
Oscillator |
k_period, d_period, smooth_period |
14, 3, 3 |
| 26 |
ULTOSC |
Oscillator |
period1, period2, period3 |
7, 14, 28 |
| 27 |
ADOSC |
Volume |
fast_period, slow_period |
3, 10 |
端点详情
POST /api/v2/crypto/indicators/batch — 批量指标(推荐)
一次请求计算多个指标,禁止逐个调用单指标端点。
| Parameter |
Type |
Required |
Default |
Description |
exchange |
string |
Yes |
— |
交易所 |
symbol |
string |
Yes |
— |
交易对 |
interval |
string |
No |
1d |
1m, 5m, 15m, 1h, 4h, 1d, 1w |
limit |
int |
No |
100 |
记录数上限 |
start |
string |
No |
— |
起始日期 YYYY-MM-DD |
end |
string |
No |
— |
结束日期 YYYY-MM-DD |
indicators |
array |
Yes |
— |
指标列表 |
GET /api/v2/crypto/indicators/{type} — 单指标
| Parameter |
Type |
Required |
Description |
exchange |
string |
Yes |
交易所 |
symbol |
string |
Yes |
交易对 |
interval |
string |
No |
默认 1d |
period |
int |
No |
周期参数 |
limit |
int |
No |
默认 100 |
Batch Params 映射
| Indicator |
params |
示例 |
| sma, ema, rsi, atr, cci, vwap, natr, mfi, willr, stddev, aroon, trix |
[period] |
[14] |
| mom, roc, cmo |
[period] |
[10] |
| macd |
[fast, slow, signal] |
[12, 26, 9] |
| boll |
[period, nbdev] |
[20, 2.0] |
| kdj |
[fastk, slowk, slowd] |
[9, 3, 3] |
| ppo, adosc |
[fast, slow] |
[12, 26] |
| sar |
[acceleration, maximum] |
[0.02, 0.2] |
| stoch |
[k, d, smooth] |
[14, 3, 3] |
| ultosc |
[period1, period2, period3] |
[7, 14, 28] |
| obv, ad, ht_trendline |
无 params |
省略 |
调用示例
批量接口(推荐)
# BTC:RSI + MACD + BOLL + KDJ
curl -sS "${AUTH[@]}" -X POST "$BASE/api/v2/crypto/indicators/batch" -d '{
"exchange": "binance",
"symbol": "BTCUSDT",
"interval": "1d",
"limit": 100,
"indicators": [
{"type": "rsi", "params": [14]},
{"type": "macd", "params": [12, 26, 9]},
{"type": "boll", "params": [20, 2.0]},
{"type": "kdj", "params": [9, 3, 3]}
]
}'
# ETH:4h 级别 MACD + EMA
curl -sS "${AUTH[@]}" -X POST "$BASE/api/v2/crypto/indicators/batch" -d '{
"exchange": "binance",
"symbol": "ETHUSDT",
"interval": "4h",
"limit": 200,
"indicators": [
{"type": "macd", "params": [12, 26, 9]},
{"type": "ema", "params": [20]}
]
}'
单指标接口
# BTC RSI
curl -sS "${AUTH[@]}" "$BASE/api/v2/crypto/indicators/rsi?exchange=binance&symbol=BTCUSDT&interval=1d&period=14&limit=100"
# ETH MACD
curl -sS "${AUTH[@]}" "$BASE/api/v2/crypto/indicators/macd?exchange=binance&symbol=ETHUSDT&interval=1d&fast_period=12&slow_period=26&signal_period=9&limit=100"
# SOL BOLL
curl -sS "${AUTH[@]}" "$BASE/api/v2/crypto/indicators/boll?exchange=binance&symbol=SOLUSDT&interval=1d&period=20&nbdev=2.0&limit=100"
# 无参数指标:OBV
curl -sS "${AUTH[@]}" "$BASE/api/v2/crypto/indicators/obv?exchange=binance&symbol=BTCUSDT&interval=1d&limit=100"
错误排查
| 错误 |
原因 |
修复 |
| 400 (缺 exchange) |
exchange 必填 |
加上 exchange: binance |
| 400 (日期格式) |
用了 YYYYMMDD |
指标端点用 YYYY-MM-DD |
| 404 |
指标类型拼写错误 |
小写:rsi, macd, boll |
| 数据不足 |
K线数量不够计算指标 |
增大 limit |
1---2name: crypto-indicators3description: 加密货币技术指标服务。支持 27 种技术指标,覆盖 MA/EMA/RSI/MACD/KDJ/布林带/ADX/ATR/CCI/VWAP 等。 当用户询问"BTC RSI""以太坊 MACD""加密货币技术指标""BTC 布林带"时触发。4---56# Crypto Indicators — 加密货币技术指标78> 所有接口均为 V2 版本(`/api/v2/crypto/indicators/...`)。910## Curl Setup1112```bash13BASE="http://43.167.234.49:3101"14AUTH=(-H "X-API-Key: 123456" -H "Content-Type: application/json")15```1617---1819## 代码格式规则2021| 规则 | 值 |22|------|-----|23| `exchange` | **必填**:`binance`, `okx`, `bybit`, `bitget`, `kucoin`, `hyperliquid` |24| `symbol` | 交易对,如 `BTCUSDT`, `ETHUSDT` |25| 日期格式 | `YYYY-MM-DD` |26| K线周期 | `1m`, `5m`, `15m`, `1h`, `4h`, `1d`, `1w` |2728---2930## 支持的指标(27种)3132| # | Indicator | Type | Key Parameters | Default |33|---|-----------|------|----------------|---------|34| 1 | SMA | Trend | `period` | 20 |35| 2 | EMA | Trend | `period` | 20 |36| 3 | RSI | Oscillator | `period` | 14 |37| 4 | MACD | Trend | `fast_period`, `slow_period`, `signal_period` | 12, 26, 9 |38| 5 | BOLL | Volatility | `period`, `nbdev` | 20, 2.0 |39| 6 | KDJ | Oscillator | `fastk_period`, `slowk_period`, `slowd_period` | 9, 3, 3 |40| 7 | ADX | Trend | `period` | 14 |41| 8 | ATR | Volatility | `period` | 14 |42| 9 | CCI | Oscillator | `period` | 14 |43| 10 | VWAP | Volume | `period` | 20 |44| 11 | OBV | Volume | 无 | — |45| 12 | NATR | Volatility | `period` | 14 |46| 13 | MFI | Volume | `period` | 14 |47| 14 | WILLR | Oscillator | `period` | 14 |48| 15 | STDDEV | Volatility | `period` | 20 |49| 16 | Aroon | Trend | `period` | 14 |50| 17 | TRIX | Trend | `period` | 9 |51| 18 | MOM | Momentum | `period` | 10 |52| 19 | ROC | Momentum | `period` | 12 |53| 20 | CMO | Momentum | `period` | 14 |54| 21 | AD | Volume | 无 | — |55| 22 | HT Trendline | Trend | 无 | — |56| 23 | PPO | Trend | `fast_period`, `slow_period` | 12, 26 |57| 24 | SAR | Trend | `acceleration`, `maximum` | 0.02, 0.2 |58| 25 | Stoch | Oscillator | `k_period`, `d_period`, `smooth_period` | 14, 3, 3 |59| 26 | ULTOSC | Oscillator | `period1`, `period2`, `period3` | 7, 14, 28 |60| 27 | ADOSC | Volume | `fast_period`, `slow_period` | 3, 10 |6162---6364## 端点详情6566### POST /api/v2/crypto/indicators/batch — 批量指标(推荐)6768一次请求计算多个指标,**禁止逐个调用单指标端点**。6970| Parameter | Type | Required | Default | Description |71|-----------|------|----------|---------|-------------|72| `exchange` | string | **Yes** | — | 交易所 |73| `symbol` | string | **Yes** | — | 交易对 |74| `interval` | string | No | `1d` | `1m`, `5m`, `15m`, `1h`, `4h`, `1d`, `1w` |75| `limit` | int | No | `100` | 记录数上限 |76| `start` | string | No | — | 起始日期 **YYYY-MM-DD** |77| `end` | string | No | — | 结束日期 **YYYY-MM-DD** |78| `indicators` | array | **Yes** | — | 指标列表 |7980### GET /api/v2/crypto/indicators/{type} — 单指标8182| Parameter | Type | Required | Description |83|-----------|------|----------|-------------|84| `exchange` | string | **Yes** | 交易所 |85| `symbol` | string | **Yes** | 交易对 |86| `interval` | string | No | 默认 `1d` |87| `period` | int | No | 周期参数 |88| `limit` | int | No | 默认 100 |8990---9192## Batch Params 映射9394| Indicator | params | 示例 |95|-----------|--------|------|96| sma, ema, rsi, atr, cci, vwap, natr, mfi, willr, stddev, aroon, trix | `[period]` | `[14]` |97| mom, roc, cmo | `[period]` | `[10]` |98| macd | `[fast, slow, signal]` | `[12, 26, 9]` |99| boll | `[period, nbdev]` | `[20, 2.0]` |100| kdj | `[fastk, slowk, slowd]` | `[9, 3, 3]` |101| ppo, adosc | `[fast, slow]` | `[12, 26]` |102| sar | `[acceleration, maximum]` | `[0.02, 0.2]` |103| stoch | `[k, d, smooth]` | `[14, 3, 3]` |104| ultosc | `[period1, period2, period3]` | `[7, 14, 28]` |105| obv, ad, ht_trendline | 无 params | 省略 |106107---108109## 调用示例110111### 批量接口(推荐)112113```bash114# BTC:RSI + MACD + BOLL + KDJ115curl -sS "${AUTH[@]}" -X POST "$BASE/api/v2/crypto/indicators/batch" -d '{116 "exchange": "binance",117 "symbol": "BTCUSDT",118 "interval": "1d",119 "limit": 100,120 "indicators": [121 {"type": "rsi", "params": [14]},122 {"type": "macd", "params": [12, 26, 9]},123 {"type": "boll", "params": [20, 2.0]},124 {"type": "kdj", "params": [9, 3, 3]}125 ]126}'127128# ETH:4h 级别 MACD + EMA129curl -sS "${AUTH[@]}" -X POST "$BASE/api/v2/crypto/indicators/batch" -d '{130 "exchange": "binance",131 "symbol": "ETHUSDT",132 "interval": "4h",133 "limit": 200,134 "indicators": [135 {"type": "macd", "params": [12, 26, 9]},136 {"type": "ema", "params": [20]}137 ]138}'139```140141### 单指标接口142143```bash144# BTC RSI145curl -sS "${AUTH[@]}" "$BASE/api/v2/crypto/indicators/rsi?exchange=binance&symbol=BTCUSDT&interval=1d&period=14&limit=100"146147# ETH MACD148curl -sS "${AUTH[@]}" "$BASE/api/v2/crypto/indicators/macd?exchange=binance&symbol=ETHUSDT&interval=1d&fast_period=12&slow_period=26&signal_period=9&limit=100"149150# SOL BOLL151curl -sS "${AUTH[@]}" "$BASE/api/v2/crypto/indicators/boll?exchange=binance&symbol=SOLUSDT&interval=1d&period=20&nbdev=2.0&limit=100"152153# 无参数指标:OBV154curl -sS "${AUTH[@]}" "$BASE/api/v2/crypto/indicators/obv?exchange=binance&symbol=BTCUSDT&interval=1d&limit=100"155```156157---158159## 错误排查160161| 错误 | 原因 | 修复 |162|------|------|------|163| 400 (缺 exchange) | `exchange` 必填 | 加上 `exchange`: `binance` |164| 400 (日期格式) | 用了 `YYYYMMDD` | 指标端点用 `YYYY-MM-DD` |165| 404 | 指标类型拼写错误 | 小写:`rsi`, `macd`, `boll` |166| 数据不足 | K线数量不够计算指标 | 增大 `limit` |