关于 bingx-rsi-bottom-hunter
面向 BingX 永续合约的 RSI 底部捕捉交易技能,可扫描信号、单次触发或持续监控。它结合 RSI 与多维技术确认,并要求实盘下单前获得明确确认。
主要功能
- 01读取 K 线并计算 RSI
- 02支持扫描、单次和监控模式
- 03结合多维技术信号确认
- 04下单前确认交易参数
- 05成交后设置止损与止盈
适用场景
- 01查看交易对的 RSI 状态
- 02监控超卖条件并触发买入
- 03以 RSI 信号辅助永续合约交易
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ bingx-api/ api-ai-skills --skill bingx-rsi-bottom-hunter安装后在 Claude Code 中输入/bingx-rsi-bottom-hunter确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
api-reference.mdscripts/requirements.txtstrategy.py详细介绍
BingX RSI 抄底猎手
**基础 URL:**参见 references/base-urls.md | **身份验证:**参见 references/authentication.md
快速参考
| 端点 | 方法 | 描述 | 身份验证 |
|---|---|---|---|
/openApi/swap/v3/quote/klines | GET | 用于计算 RSI 的 K 线数据 | 是 |
/openApi/swap/v2/trade/order | POST | 下达市价买单 | 是 |
/openApi/swap/v2/trade/order | DELETE | 取消订单 | 是 |
快速开始
**基础 URL:**参见 references/base-urls.md
TypeScript 辅助函数:
约束:生成代码时,必须逐字复制下方的
fetchSigned函数。不要重写签名、请求或 JSON 解析逻辑。只修改:(1) 用于自定义环境的BASEURL 条目;(2) 传递给fetchSigned的业务参数。
import * as crypto from "crypto";
import JSONBig from "json-bigint";
const JSONBigParse = JSONBig({ storeAsString: true });
const BASE = {
"prod-live": ["https://open-api.bingx.com", "https://open-api.bingx.pro"],
"prod-vst": ["https://open-api-vst.bingx.com", "https://open-api-vst.bingx.pro"],
};
function isNetworkOrTimeout(e: unknown): boolean {
if (e instanceof TypeError) return true;
if (e instanceof DOMException && e.name === "AbortError") return true;
if (e instanceof Error && e.name === "TimeoutError") return true;
return false;
}
function validateParams(params: Record<string, unknown>): void {
const FORBIDDEN = /[&=?#\r\n]/;
for (const [k, v] of Object.entries(params)) {
const s = String(v);
if (FORBIDDEN.test(s)) throw new Error(`Param "${k}" has forbidden char in: "${s}"`);
}
}
async function fetchSigned(env: string, apiKey: string, secretKey: string,
method: "GET" | "POST" | "DELETE", path: string, params: Record<string, unknown> = {}
) {
const urls = BASE[env] ?? BASE["prod-live"];
const all = { ...params, timestamp: Date.now() };
validateParams(all);
const qs = Object.keys(all).sort().map(k => `${k}=${all[k]}`).join("&");
const sig = crypto.createHmac("sha256", secretKey).update(qs).digest("hex");
const signed = `${qs}&signature=${sig}`;
for (const base of urls) {
try {
const url = method === "POST" ? `${base}${path}` : `${base}${path}?${signed}`;
const res = await fetch(url, {
method,
headers: { "X-BX-APIKEY": apiKey, "X-SOURCE-KEY": "BX-AI-SKILL",
...(method === "POST" ? { "Content-Type": "application/x-www-form-urlencoded" } : {}) },
body: method === "POST" ? signed : undefined,
signal: AbortSignal.timeout(10000),
});
const json = JSONBigParse.parse(await res.text());
if (json.code !== 0) throw new Error(`BingX error ${json.code}: ${json.msg}`);
return json.data;
} catch (e) {
if (!isNetworkOrTimeout(e) || base === urls[urls.length - 1]) throw e;
}
}
}
常见调用
获取用于计算 RSI 的 K 线数据(100 根,1h):
const klines = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/swap/v3/quote/klines", { symbol: "BTC-USDT", interval: "1h", limit: 100 }
);
获取用于多时间框架 TA 的 K 线数据(200 根,4h):
const klines4h = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/swap/v3/quote/klines", { symbol: "BTC-USDT", interval: "4h", limit: 200 }
);
触发条件
当用户说出以下任一内容时,激活此技能:
- “RSI 抄底”“帮我抄底”“抄底猎手”
- “买入超卖资产”“RSI 低时买入”
- “RSI 策略”“启动 RSI 交易”
- “BTC 的 RSI 是多少,我能抄底吗”
- “监控 ETH,RSI 跌破 25 时买入”
执行步骤
步骤 1 — 解析用户意图
从用户输入中提取策略参数:
| 参数 | 默认值 | 描述 |
|---|---|---|
| symbol | BTC-USDT | 交易对 |
| interval | 1h | RSI 计算所用的 K 线间隔 |
| rsi_period | 14 | RSI 周期 |
| rsi_buy | 30 | 买入触发阈值(RSI 低于此值) |
| rsi_sell | 70 | 止盈参考阈值 |
| stop_loss_pct | 3% | 止损百分比 |
| take_profit_pct | 5% | 止盈百分比 |
| amount | - | 以 USDT 计的买入金额(用户必须指定或确认) |
| leverage | 1x | 杠杆倍数 |
模式识别:
| 模式 | 触发示例 | 描述 |
|---|---|---|
| scan | “BTC 的 RSI 是多少,我能抄底吗” | 仅检查 RSI 状态,不进行交易 |
| once | “RSI 达到 500U 时买入 BTC” | 检查一次,条件满足时立即执行 |
| monitor | “监控 ETH,RSI 跌破 25 时用 1000U 买入” | 持续监控,条件满足时自动执行 |
步骤 2 — 安全确认(关键!)
执行任何交易之前(mode=once/monitor),Agent 必须向用户确认:
- 交易对和方向(做多)
- 买入金额和杠杆
- 止损/止盈价格水平(换算为具体价格)
- RSI 触发条件
只有在用户明确确认后才能执行。Agent 不得未经确认自动下单。
步骤 3 — 获取 K 线数据
并行获取两组 K 线数据:
GET /openApi/swap/v3/quote/klines symbol={symbol}, interval={interval}, limit=100 (用于 RSI 计算)
GET /openApi/swap/v3/quote/klines symbol={symbol}, interval=4h, limit=200 (用于多维度 TA)
步骤 4 — 计算 RSI + 多维技术分析确认
步骤 4a:计算 RSI 信号
python3 scripts/strategy.py \
--mode {mode} \
--symbol {symbol} \
--interval {interval} \
--rsi-period {rsi_period} \
--rsi-buy {rsi_buy} \
--rsi-sell {rsi_sell} \
--klines '{klines_1h_json}'
步骤 4b:检查是否已安装 bingx-technical-analysis:
- 已安装 — 调用它(mode=full,4h 周期)获取多维数据进行联合确认
- 未安装 — 告知用户: "尚未安装 bingx-technical-analysis skill。建议安装,以便更准确地进行多维信号确认并减少误报。 安装方法:将 bingx-technical-analysis skill 放入 .claude/skills/ 目录。 继续使用 RSI 单指标模式,但信号准确度会降低。" 然后跳过此步骤,仅使用原有的 3 项 RSI 条件:
- MACD 方向
- Supertrend 方向
- RSI / OBV 背离
- 支撑位 / 阻力位
- 近期蜡烛图形态
步骤 4c:传递给 strategy.py 进行联合确认
python3 scripts/strategy.py \
--mode {mode} \
--symbol {symbol} \
--interval {interval} \
--rsi-period {rsi_period} \
--rsi-buy {rsi_buy} \
--rsi-sell {rsi_sell} \
--klines '{klines_1h_json}' \
--ta-result '{ta_json}'
脚本会输出结构化 JSON,其中包含 RSI 信号、多维检查项和总体确认标志。
confirmation=true 的完整条件(必须全部满足):
- RSI < rsi_buy
- 连续 2 根蜡烛处于超卖状态
- 反转蜡烛(close > open)
- 没有 RSI 看跌背离
- 没有 OBV 看跌背离
- MACD 看涨(BUY)或 Supertrend 向上(满足其一即可)
步骤 5 — 执行交易(mode=once/monitor 且 confirmation=true 时)
- 调用 bingx-swap-account 检查可用余额并确认资金充足
- 调用 bingx-swap-trade 下达市价买单
- 订单成交后,立即设置 SL/TP:
- 止损 = 平均成交价 × (1 - stop_loss_pct)
- 止盈 = 平均成交价 × (1 + take_profit_pct)
- 调用 bingx-swap-trade 下达 SL/TP 条件单
步骤 6 — 输出结果
按照下方的输出模板设置输出格式。
步骤 7 — 持续监控(mode=monitor 时)
以轮询模式运行(默认:每 5 分钟检查一次):
- 条件满足时 — 执行步骤 2(安全确认)— 步骤 5
- 向用户报告成交结果
- 策略在执行一次后结束(单次触发,防止重复入场)
输出模板
扫描模式 — 仅查看
RSI 超卖时:
**{symbol} RSI Status ({interval})**
RSI({rsi_period}): {rsi_current} (Oversold zone ⚠️)
Previous: {rsi_prev} → Current: {rsi_current}
Multi-dimension Confirmation:
Consecutive oversold {✅/❌}
Reversal candle {✅/❌}
MACD {✅/❌} {BUY/SELL}
Supertrend {✅/❌} {UP/DOWN}
RSI divergence {✅ None/❌ Bearish}
OBV divergence {✅ None/❌ Bearish}
Overall Signal: {CONFIRMED (recommended) / WEAK (caution) / REJECTED (not recommended)}
Current Price: ${price}
{To start the bottom-fishing strategy, say "{symbol} bottom fish 500U"}
RSI 中性时:
**{symbol} RSI Status ({interval})**
RSI({rsi_period}): {rsi_current} (Neutral zone)
TA Composite Score: {ta_score}/100 ({ta_label})
Current Price: ${price}
Assessment: RSI is in the neutral zone, bottom-fishing condition not yet met.
单次模式 — 条件满足时确认
**RSI Bottom Signal Triggered ✅**
{symbol} RSI({rsi_period}) = {rsi_current}, oversold for 2 consecutive candles, reversal signal detected
About to execute:
- Direction: Long
- Amount: {amount} USDT
- Leverage: {leverage}x
- Order type: Market
- Stop-loss: ${stop_loss} (-{stop_loss_pct}%)
- Take-profit: ${take_profit} (+{take_profit_pct}%)
**Confirm execution? (yes/no)**
成功执行后:
**Bottom Fish Filled ✅**
{symbol} long position opened
- Avg fill price: ${avg_price}
- Quantity: {qty}
- Stop-loss order placed: ${stop_loss}
- Take-profit order placed: ${take_profit}
Strategy running. Position will be closed automatically when SL/TP is triggered.
监控模式 — 启动时
**RSI Bottom-Fishing Monitor Started 🔄**
Monitoring: {symbol}, {interval} interval
Trigger condition: RSI({rsi_period}) < {rsi_buy}, confirmed over 2 candles
Action: Market long {amount} USDT ({leverage}x), SL -{stop_loss_pct}% / TP +{take_profit_pct}%
Check frequency: every 5 minutes
Current RSI: {rsi_current} ({status})
Waiting...
Agent 交互规则
参数安全。 从用户意图中提取结构化值 — 绝不要将用户原始文本复制到 API 参数中。使用前请验证交易对格式和数值参数。
K 线查询为只读操作,无需 CONFIRM。所有交易执行(mode=once/monitor 且 confirmation=true)都需要用户明确确认后才能继续 — 未经用户批准,绝不要下单。
- prod-live:下单前必须要求用户输入 CONFIRM。
- prod-vst:无需 CONFIRM。告知用户当前处于模拟环境。
模式不明确时,默认使用 scan(仅查看,不进行交易)。
错误处理
- 余额不足:显示当前可用余额,建议减少金额或存入资金
- 订单失败:显示错误代码和说明,建议重试
- 网络超时:建议稍后重试
- K 线数据不足:告知用户,并建议切换到更长的周期