Install
openclaw skills install money-never-sleepMNS (Money Never Sleep, Market Neutral Strategist) CLI skill for autonomous agents. Provides investment portfolio tracking, market sentiment analysis using CNN Fear & Greed Index, and strategy suggestion report generation. Use when managing a contrarian investment portfolio, generating buy/sell suggestions based on market sentiment thresholds, or producing daily strategy reports. NOTE: This tool provides strategy suggestions only - it does NOT connect to any broker APIs or execute actual trades. All trades must be manually executed by users on their brokerage platforms and then recorded via CLI commands. Triggers include: "管理投资组合", "生成策略建议", "获取市场报告", "查看持仓收益", "更新现金余额", "记录买入卖出", "查看恐贪指数", "投资组合再平衡", "MNS 报告", "回测策略"
openclaw skills install money-never-sleep本 skill 提供 MNS 逆向投资策略的 CLI 操作能力。MNS 是基于 CNN Fear & Greed Index 情绪指标的量化投资工具,通过 contrarian 策略在情绪极度恐慌时买入,极度贪婪时卖出,实现市场中性风格的长期投资。
- 源码公开: 所有源码公开托管于 GitHub
- 无网络交易: 不连接任何券商 API,所有数据存储在本地 SQLite 数据库
- 无敏感权限: 无需使用也不自动读取用户任何金融账户配置
重要说明: 本工具仅提供策略建议和记录功能,不连接任何券商 API。 用户需自行在券商平台执行交易后,通过 CLI 记录交易结果。
# 通过 npm 安装(推荐)
npm install -g @never-sleeps/mns-cli
# 或通过 bun 安装
bun install -g @never-sleeps/mns-cli
# 或直接使用 npx(无需安装)
npx @never-sleeps/mns-cli --help
# 初始化配置文件和数据库
# 如果已有数据,会提示确认后再覆盖
mns init
# 使用 --force 跳过确认直接覆盖
mns init --force
# 设置初始现金
mns cash set 100000
mns add QQQ "纳指100" us_stocks
mns add SH600000 "浦发银行" cn_stocks
mns add GLD "黄金ETF" counter_cyclical
mns buy QQQ 100 450.50
mns buy SH600000 500 12.30
# 查看当前持仓(含年化收益)
mns portfolio
# 获取今日策略报告(基于最新恐贪指数)
mns report
# 查看当前恐贪指数
mns sentiment
# 手动更新单个资产价格
mns price QQQ 460.00
# 自动更新所有资产价格(需要网络)
mns update-prices
# 查看最近交易历史
mns history --limit 50
# 查看现金余额
mns cash
# 查看所有配置
mns config
# 查看特定配置项(支持 dot-path 语法)
mns config thresholds.fear
mns config buy_ratio.extreme_fear
# 修改配置项(策略参数)
mns config thresholds.greed 75
mns config buy_ratio.fear 30.0
mns config sell_ratio.extreme_greed_target_high 60.0
# 查看可调参数列表
mns backtest params
# 运行默认配置回测
mns backtest run
# 使用自定义配置回测
mns backtest run --config path/to/config.toml
# 对比多个配置
mns backtest run --compare config1.toml,config2.toml
~/.mns/config.toml~/.mns/mns.db./reports/(可通过 settings.report_output_dir 配置)买入比例基于恐贪指数区间:
| 恐贪区间 | 指数范围 | 买入比例 | 逻辑 |
|---|---|---|---|
| 极度恐慌 | FGI < 30 | 60% (默认) | 极度恐慌,适度买入 |
| 恐慌 | 30 ≤ FGI < 45 | 35% (默认) | 恐慌,保守买入 |
| 中性 | 45 ≤ FGI < 55 | 0% (默认) | 中性,暂停买入 |
| 贪婪 | 55 ≤ FGI < 70 | 0% (默认) | 贪婪,不买入 |
| 极度贪婪 | FGI ≥ 70 | 0% (默认) | 极度贪婪,不买入 |
卖出建议综合考虑:
卖出矩阵(按情绪区间和收益档位):
| 情绪区间 | target_high | target_low | below_target |
|---|---|---|---|
| 极度贪婪 | 50% | 30% | 20% |
| 贪婪 | 40% | 25% | 0% |
| 中性 | 15% | 0% | 0% |
| 恐慌/极度恐慌 | 0% | 0% | 0% |
注:target_high = 年化收益 ≥ annualized_target_high(默认15%),target_low = 年化收益 ≥ annualized_target_low(默认10%)
可用现金按 contrarian 权重分配到各资产:
weight = min(max_weight, max(1.0, cost_price / current_price))max_contrarian_weight(默认 2.0)防止过度集中单一标的当持仓浮亏 ≥ 20% 时触发风险警告,建议根据市场情绪差异化处理:
| 情绪环境 | 建议操作 |
|---|---|
| Extreme Fear/Fear | 可能是加仓机会 |
| Neutral | 审视基本面 |
| Greed/Extreme Greed | 紧急审视(别人赚钱你还在亏) |
# 1. 自动更新所有资产价格
mns update-prices
# 2. 查看策略报告
mns report
# 3. 根据建议执行买入(如有)
mns buy QQQ 50 445.00
# 4. 记录卖出(如有)
mns sell QQQ 100 455.00
# 5. 查看最新持仓
mns portfolio
# 查看当前买入比例
mns config buy_ratio
# 调整极端恐慌买入比例到 60%
mns config buy_ratio.extreme_fear 60.0
# 降低中性区间买入到 10%
mns config buy_ratio.neutral 10.0
# 调整卖出矩阵
mns config sell_ratio.extreme_greed_target_high 70.0
# 调整止盈线
mns config settings.annualized_target_low 12.0
mns config settings.annualized_target_high 18.0
# 调整逆向权重上限(防止单标的过度集中)
mns config settings.max_contrarian_weight 1.5
# 1. 添加资产到池子
mns add TSLA "特斯拉" us_stocks
# 2. 初始建仓买入
mns buy TSLA 50 250.00
# 3. 更新当前价格
mns price TSLA 255.00
以下分析功能由 Agent 组合使用基础命令完成,非单一 CLI 命令。
组合使用基础命令分析行业表现:
# 1. 查询行业 ETF 表现
mns analyze XLK # 科技
mns analyze XLF # 金融
mns analyze XLE # 能源
mns analyze XLV # 医疗
mns analyze XLY # 消费
mns analyze XLP # 消费必需品
mns analyze XLB # 材料
mns analyze XLU # 公用事业
mns analyze XLI # 工业
mns analyze XLRE # 房地产
# 2. 分析各行业龙头股
mns analyze AAPL # 科技龙头
mns analyze JPM # 金融龙头
mns analyze XOM # 能源龙头
# 3. 对比行业表现与大盘指数
mns market-indices # 获取大盘指数参考
mns portfolio # 查看当前持仓行业分布
Agent 分析要点:
基于已有数据进行组合分析:
# 1. 查看当前持仓
mns portfolio
# 2. 获取市场情绪
mns sentiment
# 3. 获取策略报告
mns report
# 4. 查看历史表现
mns history --limit 100
Agent 分析要点:
组合计算风险指标:
# 1. 获取持仓成本与当前价格
mns portfolio
# 2. 获取历史价格记录
mns history --limit 365
# 3. 结合市场波动率
mns market # 包含 VIX 指数
Agent 风险指标计算:
(年化收益 - 无风险利率) / 波动率(需历史数据支持)风险等级判定:
| 风险等级 | 条件 |
|---|---|
| 低风险 | 单一持仓 < 20%,无浮亏 > 20% 标的,现金 > 20% |
| 中风险 | 单一持仓 20-30%,或 1-2 个标的浮亏 10-20% |
| 高风险 | 单一持仓 > 30%,或 3+ 标的浮亏 > 20%,或 VIX > 30 |
完整的配置参数说明请参考 references/strategy.md,其中包含:
命令使用方法请参考 references/commands.md。
price 或 update-prices 命令更新价格,确保持仓收益数据准确report 和 sentiment 命令通过 HTTP 获取实时 CNN Fear & Greed Index,需要网络访问annualized = (current / cost) ^ (365 / holding_days) - 1,持仓天数 < min_holding_days 时不显示sentiment 和 report 可能因 API 不可用失败,建议重试或使用缓存数据references/commands.md - 完整命令参考references/strategy.md - 策略参数详解