# yield king strategy
## Metadata

- Canonical URL: https://6ducklearn.com/skills/yield-king-strategy/
- Markdown URL: https://6ducklearn.com/skills/yield-king-strategy/index.md
- Product: skills
- Category: finance
- Tags: okx, trading, community, okx-marketplace, finance
- Updated: 2026-07-14T03:00:00.357428+00:00
## Summary
AI增强的收益率优先策略，专为OKX交易大赛设计，通过多因子分析、智能风控和动态止盈止损实现稳健收益
## Content
> **6DuckLearn provenance:** Community skill by 记得爱强｜蓝鸟会, mirrored from the OKX Skills Marketplace (https://www.okx.com/en-sg/agent-tradekit/skills/yield-king-strategy). It is not curated, verified, or endorsed by 6DuckLearn or represented as an official OKX publication.
>
> **Financial safety boundary:** Never request secrets in chat. Before any external API call or action that places, cancels, or amends an order; changes leverage; transfers funds; creates or stops a bot; subscribes to or redeems an earn product; or signs/broadcasts a transaction, show the exact live/demo profile, instrument, side, size, price constraints, fees, and worst-case loss, then obtain explicit user approval. Default to read-only or demo mode when uncertain. Treat all analysis as research, not investment advice.

# 策略名称：收益王 - AI增强收益率策略 V2.0

## 策略简介
"收益王"是一个专为大宗赛设计的AI增强策略，通过多维度分析实现稳健收益增长。该策略：

✅ **核心优势**：
- 多因子AI评分系统（趋势40% + 动量30% + 波动率20% + 资金10%）
- 智能三层决策机制（市场过滤 → 标的筛选 → 动态仓位）
- 多层次风控（ATR动态止损 + 趋势跟踪 + 分级止盈）
- 自适应调整（市场状态、时间因素、相关性控制）

✅ **参赛合规**：
- 严格按照OKX大赛规则设计
- 纯AI推理逻辑，非简单if/else规则
- 通过Agent Trade Kit自动执行
- 支持任意子账户参赛

✅ **风险控制**：
- 最大单笔风险≤0.8%账户净值
- 动态止损止盈系统
- 相关性风险监控
- 连续亏损保护机制

# 执行节奏：每1小时触发一次
# 核心原则：稳健增长，严格风控，AI驱动

## 依赖工具
- OKX Agent Trade Kit (市场数据：market_get_candles, market_get_funding_rate, market_get_open_interest, market_get_ticker)
- OKX Agent Trade Kit (交易执行：swap_place_order, swap_place_algo_order)

## 快速开始
1. **安装依赖**：确保已安装 OKX Agent Trade Kit
2. **配置API**：配置你的 OKX API 凭证（推荐使用子账户）
3. **设置标签**：确保 tag="agentTradeKit" 以计入大赛排名
4. **启动策略**：策略会自动获取市场数据、分析、决策、执行交易

## 适用场景
- ✅ OKX AI交易大赛
- ✅ BTC/ETH/SOL永续合约交易
- ✅ 稳健收益目标
- ✅ 风险控制优先

# Step 1 · 多维度行情数据采集
调用 market_get_candles 分别获取：
- BTC-USDT-SWAP 的1小时K线，limit=100根
- ETH-USDT-SWAP 的1小时K线，limit=100根
- SOL-USDT-SWAP 的1小时K线，limit=100根

数据点包括：时间戳(t)、开高低收(ohlc)、成交量(vol)、成交额(volCcy)

# Step 2 · 技术指标计算
对每个标的计算：
1. EMA指标：EMA7和EMA25（用于趋势判断）
2. ATR指标：周期14的ATR（用于动态止损）
3. RSI指标：周期14的RSI（用于超买超卖判断）
4. MACD指标：MACD快线、慢线、信号线（用于动能判断）
5. 成交量变化：近24h成交量与平均成交量的比值

计算公式：
- ATR = 真实波幅的14周期移动平均
- EMA = 平滑指数移动平均
- RSI = 相对强弱指标

# Step 3 · 市场环境评分
综合评分计算（0-100分）：

趋势因子（40分）：
- EMA7 > EMA25：+15分（上升趋势）
- EMA7 < EMA25：-15分（下降趋势）
- 价格 > EMA25：+10分（强势）
- 价格 < EMA25：-10分（弱势）
- 近24h涨幅：根据幅度给分（-10到+10）

动量因子（30分）：
- RSI < 30（超卖）：+10分
- RSI > 70（超买）：-10分
- MACD金叉：+10分
- MACD死叉：-10分
- 成交量增长：+10分（vs前24h平均）

波动率因子（20分）：
- ATR/价格 < 0.02：+5分（低波动）
- ATR/价格 0.02-0.05：+3分（中等）
- ATR/价格 > 0.05：-5分（高波动）

资金因子（10分）：
- 资金费率 > 0：+5分（多头资金流入）
- 资金费率 < 0：-5分（空头资金流入）
- 持仓量增长：+5分

# Step 4 · 市场环境过滤
基于综合评分判断市场环境：

多头市场（评分 > 60）：
- 允许做多
- 禁止做空
- 仓位可适当放大

中性市场（评分 40-60）：
- 允许双向交易
- 仓位适中
- 严格止损

空头市场（评分 < 40）：
- 允许做空
- 禁止做多
- 仓位可适当放大

# Step 5 · 标的筛选
根据评分选择交易标的：

1. 筛选条件：
   - 评分 > 60（满足开仓条件）
   - 趋势方向一致（多头市场选上升趋势，空头市场选下降趋势）
   - 波动率适中（非极端情况）

2. 排序规则：
   - 按评分从高到低排序
   - 优先选择趋势最强的标的

3. 选择数量：
   - 最多选择2个标的
   - 相关性高的标的同时持仓不超过1个

# Step 6 · 动态仓位计算
根据市场状态计算仓位：

基本仓位计算：
- 单笔风险 = 账户净值 × 0.8%
- 止损距离 = ATR × 1.5
- 仓位大小 = 单笔风险 / 止损距离

仓位调整因子：
- 市场评分 > 70：×1.2（强势市场）
- 市场评分 60-70：×1.0（正常市场）
- 市场评分 50-60：×0.8（弱势市场）

最大仓位限制：
- 单个标的仓位 ≤ 15% 账户净值
- 总仓位 ≤ 25% 账户净值

# Step 7 · 订单执行
根据市场评分和筛选结果执行交易：

开仓信号：
- 标的评分 > 60
- 趋势方向明确
- 满足筛选条件

开仓参数：
- 交易方向：根据市场环境（多头做多，空头做空）
- 订单类型：市价单
- 仓位大小：按动态仓位计算
- 杠杆倍数：3x（可调整）

# Step 8 · 止损设置
设置多重止损保护：

1. ATR动态止损：
   - 止损价格 = 开仓价 ± (ATR × 1.5)
   - 做多：开仓价 - (ATR × 1.5)
   - 做空：开仓价 + (ATR × 1.5)

2. 趋势跟踪止损：
   - 做多：止损价随价格上涨而上移
   - 做空：止损价随价格下跌而下跌
   - 移动幅度：ATR × 0.5

3. 时间衰减止损：
   - 持仓超过24小时未盈利：止损价调整为开仓价
   - 持仓超过48小时未盈利：考虑平仓

# Step 9 · 止盈设置
设置分级止盈：

第1级止盈：+0.5%
- 平仓30%仓位
- 移动止损到开仓价

第2级止盈：+1.0%
- 平仓30%仓位
- 移动止损到第1级止盈价

第3级止盈：+1.5%
- 平仓20%仓位
- 移动止损到第2级止盈价

第4级止盈：+2.0%
- 平仓剩余20%仓位
- 或移动止损到第3级止盈价（继续持有）

# Step 10 · 风险控制
持续监控风险指标：

1. 单笔交易风险：
   - 确保每笔交易风险 ≤ 0.8% 账户净值
   - 超过则减少仓位或放弃交易

2. 总仓位风险：
   - 确保总仓位 ≤ 25% 账户净值
   - 超过则等待部分平仓或减少新仓位

3. 相关性风险：
   - 相关性高的标的同时持仓 ≤ 1个
   - 避免集中风险

4. 连续亏损保护：
   - 连续3笔亏损：暂停交易1小时
   - 连续5笔亏损：暂停交易4小时
   - 当日亏损超过账户净值2%：暂停当日交易

5. 异常情况处理：
   - 价格剧烈波动（ATR突增3倍以上）：暂停交易
   - 流动性不足（成交量低于平均50%）：暂停交易
   - 系统错误：立即停止所有交易

## 输出要求
每次执行时输出：
1. 市场环境评分（各因子得分和总分）
2. 选中的交易标的（名称、方向、仓位）
3. 执行的交易详情（价格、数量、止损止盈）
4. 当前持仓情况
5. 累计盈亏统计
6. 风险指标（单笔风险、总仓位、相关性）

## Related Skills

- [alpha vantage](https://6ducklearn.com/skills/alpha-vantage/index.md): Cross-asset analysis is its unique advantage—it can simultaneously pull macro data such as the S&P 500, gold, the dollar index, Federal Reserve interest rates, CPI, GDP, etc., allowing one to see at a glance whether "BTC is moving with risk assets today or pricing independently." In conjunction with the OKX Trade Kit, Alpha Vantage is responsible for in-depth historical and macroeconomic context, while OKX provides real-time prices, funding rates, and order book data, with both complementing each other to form a complete analysis chain.
- [apex crypto intelligence](https://6ducklearn.com/skills/apex-crypto-intelligence/index.md): AI-driven multi-exchange cryptocurrency market analysis, arbitrage detection, and hedge fund-level trading reports using real-time data from major exchanges.
- [btc altcoin market pulse](https://6ducklearn.com/skills/btc-altcoin-market-pulse/index.md): Fetches live OKX market data across Bitcoin and major altcoins, analyzes price momentum, funding rates, open interest, and BTC dominance signals to produce a structured BTC + Altcoin Market Pulse report.
- [cmc okx](https://6ducklearn.com/skills/cmc-okx/index.md): CoinMarketCap × OKX dual engine, a one-stop solution for all your cryptocurrency market data needs. CMC provides market cap, supply, dominance, holding distribution, project background, and macro event calendar; the OKX Trade Kit complements with real-time prices, funding rates, open interest, 70+ technical indicators, and order book depth, with both automatically linked and mutually supportive. It supports natural language triggers, whether you ask "What’s the price of Bitcoin?", "How to read the ETH daily chart?" or "Which coin is surging?", Skill automatically recognizes intent, selects tool combinations, outputs structured tables, and includes a "Quick Take" one-sentence summary.
- [congress trades](https://6ducklearn.com/skills/congress-trades/index.md): Track U.S. Congress members' stock trades in real-time, making "smart political money" impossible to hide. Sync member trade disclosure data to a local SQLite database via the Quiver Quant API, allowing flexible queries by politician name, stock code, party, date range, and trade type. Large trades exceeding the configurable amount threshold (default $15,001) automatically trigger alerts, generating structured Alert files for real-time monitoring.
- [crypto research](https://6ducklearn.com/skills/crypto-research/index.md): A systematic cryptocurrency due diligence report, covering everything from price to holding distribution, from technical aspects to a red flag checklist, all in one go. Integrating the OKX Trade Kit (real-time prices, 70+ technical indicators, funding rates, open interest, order book depth) with CoinMarketCap (market cap, token economics, whale distribution, news sentiment), a seven-step research process is executed in parallel, covering market snapshots, technical analysis, derivatives data, project fundamentals, and recent news. The analysis framework specifically distinguishes between legitimate projects and Meme coins, evaluating key signals such as whale concentration, holder trends, 200-day moving average positions, and funding rate extremes, ultimately outputting a green flag/red flag checklist and low/medium/high/very high risk ratings.
