Behavioral Finance

行为金融交易策略 - 识别和利用市场中的认知偏差、情绪极端和群体行为,实现逆向交易和超额收益。

MIT-0 · Free to use, modify, and redistribute. No attribution required.
0 · 99 · 0 current installs · 0 all-time installs
MIT-0
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
medium confidence
Purpose & Capability
Name, description, SKILL.md, and the included Python implementation all focus on behavioral-finance signals, sentiment quantification, and contrarian signal generation. Declared Python dependencies (numpy, pandas) and recommended companion skills (MDL_data_skill, risk_management_skill) are proportionate to the stated purpose.
Instruction Scope
SKILL.md describes specific actions, JSON parameter formats, algorithm formulas, and data sources. It does not instruct the agent to read unrelated system files, environment variables, or send data to arbitrary external endpoints. It does refer to social media/news sentiment and an external MDL_data_skill for market data; retrieving those sources is expected for this domain and is limited in scope.
Install Mechanism
No install spec is present (instruction-only skill plus an included .py file). Nothing is pulled from external URLs or untrusted sources during install. The runtime requires Python packages (pandas/numpy) which are reasonable for numeric/df work.
Credentials
The skill declares no required environment variables, credentials, or config paths. Recommended external data skills are appropriate for market data and risk functionality. There are no unexplained requests for secrets or unrelated service tokens.
Persistence & Privilege
The skill is not always-enabled and uses the platform defaults for invocation. It does not request system-wide persistence or modifications to other skills' configurations in the provided materials.
Assessment
This skill appears coherent with its stated purpose, but before using it in production: (1) verify you have the required market-data capabilities (MDL_data_skill or equivalent) because the skill depends on external sentiment and price feeds; (2) review the full Python source for any network calls or credential use (the provided snippet shows no imports like requests, but the file was truncated in the prompt); (3) do not supply trading account credentials or API keys unless you confirm exactly where and how they will be used; (4) validate backtest and performance claims on your own historical data and run in a sandbox environment first; and (5) consider combining with a risk-management skill as recommended to enforce position sizing and stop-loss discipline.

Like a lobster shell, security has layers — review code before you run it.

Current versionv1.0.0
Download zip
latestvk975j09k7jq84c37fk8tq7wyg9833c1q

License

MIT-0
Free to use, modify, and redistribute. No attribution required.

SKILL.md

行为金融策略技能 (Behavioral Finance Strategy Skill)

概述

基于行为金融学原理的交易策略,专门捕捉由投资者认知偏差、情绪极端和群体行为导致的市场定价错误。通过量化行为指标,识别过度反应、羊群效应、锚定偏差等行为模式,生成逆向交易信号。

核心理论

主要认知偏差

  1. 过度自信:投资者高估自己的判断能力
  2. 过度反应:对新闻事件的反应超过基本面变化
  3. 确认偏误:寻找支持自己观点的信息
  4. 锚定效应:过度依赖历史价格作为参考点
  5. 损失厌恶:对损失的痛苦大于等额盈利的快乐
  6. 羊群效应:跟随他人行为,忽视自己信息
  7. 处置效应:过早卖出盈利股,持有亏损股过久
  8. 代表性偏差:过度依赖近期模式

适用场景

  • 情绪极端点交易:恐慌性抛售后的买入机会
  • 过度反应纠正:重大新闻后的价格回归
  • 羊群效应反转:拥挤交易的逆向操作
  • 锚定偏差利用:突破关键心理价位后的趋势延续
  • 日历效应:月度/季度末的行为模式

核心功能

1. 情绪指标量化

  • 散户情绪指数
  • 机构情绪指标
  • 社交媒体情感分析
  • 搜索热度异常检测

2. 行为偏差识别

  • 过度反应指标
  • 羊群效应强度
  • 锚定点位分析
  • 处置效应检测

3. 逆向交易信号

  • 情绪极端点识别
  • 拥挤交易警告
  • 均值回归机会
  • 趋势延续信号

4. 风险行为预警

  • 泡沫形成预警
  • 恐慌性抛售预警
  • 非理性繁荣识别
  • 流动性陷阱警告

行为模式类型

A类模式(高胜率)

  • 恐慌性抛售:情绪极度悲观后的反弹机会
  • 非理性繁荣:情绪极度乐观后的回调风险
  • V型反转:过度反应后的快速均值回归
  • 突破锚定:突破关键心理价位后的趋势延续

B类模式(中等胜率)

  • 月度效应:月初上涨,月末下跌的季节性模式
  • 周五效应:周末前的持仓调整
  • 财报后漂移:市场对财报信息的延迟反应
  • 分析师羊群:分析师评级高度一致时的反转机会

C类模式(低胜率,高赔率)

  • 黑天鹅过度反应:极端事件后的超调回归
  • 政策冲击消化:政策突变后的市场适应
  • 流动性冲击:流动性突然变化的价格异常
  • 市场结构变化:交易规则变化的行为适应

使用方法

JSON参数格式

{
  "action": "detect_behavioral_patterns",
  "stock_codes": ["002371.SZ", "000001.SZ"],
  "timeframe": "recent_30_days",
  "pattern_types": ["overreaction", "herding", "anchoring"],
  "output_format": "actionable"
}

可用操作

  1. detect_behavioral_patterns - 检测行为金融模式
  2. quantify_market_sentiment - 量化市场情绪
  3. identify_extreme_sentiment - 识别情绪极端点
  4. generate_contrarian_signals - 生成逆向交易信号
  5. monitor_herding_behavior - 监控羊群效应
  6. backtest_behavioral_strategies - 回测行为策略

输出示例

{
  "success": true,
  "skill": "behavioral_finance_skill",
  "behavioral_analysis": {
    "stock": "002371.SZ",
    "timeframe": "2026-03-01 至 2026-03-05",
    "detected_patterns": [
      {
        "pattern_type": "overreaction",
        "confidence": 0.78,
        "description": "近期下跌幅度超过基本面变化",
        "expected_correction": "+4.2% 至 +7.5%",
        "timeframe": "3-7个交易日"
      }
    ],
    "sentiment_indicators": {
      "retail_sentiment": 0.32,
      "institutional_sentiment": 0.45,
      "sentiment_extreme": "过度悲观",
      "sentiment_score": -1.8
    },
    "trading_signal": {
      "signal_type": "contrarian_buy",
      "strength": 0.72,
      "entry_zone": "当前价格±1.5%",
      "target_price": "+6.5%",
      "stop_loss": "-3.0%",
      "holding_period": "5-10个交易日"
    }
  }
}

算法原理

过度反应指标

过度反应分数 = (价格变化幅度) / (基本面变化幅度) - 1
调整因子 = 波动率调整 × 流动性调整
有效过度反应 = 过度反应分数 × 调整因子

羊群效应强度

羊群强度 = 交易集中度 × 意见一致性 × 动量持续性
羊群危险度 = 羊群强度 × 估值偏离度 × 杠杆水平

情绪极端指标

情绪指数 = 标准化(散户情绪 + 2×机构情绪 + 社交媒体情绪)
极端度 = |情绪指数 - 历史中位数| / 历史波动率

逆向信号生成

信号强度 = 极端度 × 过度反应 × (1 - 羊群强度)
风险调整收益 = 预期回归幅度 / (波动率 × 实现概率)

数据源

  1. 价格数据:MDL_data_skill (QMT实时行情)
  2. 交易数据:成交量、大单比例、资金流向
  3. 情绪数据:股吧评论、社交媒体、新闻情感
  4. 基本面数据:估值指标、分析师预期、公司公告

风险控制

  • 情绪陷阱:避免在情绪持续极端时过早反转
  • 流动性风险:低流动性股票的行为信号可靠性低
  • 结构性变化:市场结构变化可能改变行为模式
  • 黑天鹅事件:极端事件可能破坏行为模式假设

风险控制参数

  • 最大仓位:单信号不超过3%
  • 止损纪律:-3%强制止损
  • 时间止损:信号发出后10个交易日未实现即退出
  • 相关性限制:避免同时交易高度相关行为模式

性能指标

  • 历史胜率:60-70%
  • 平均盈亏比:1:2.5-1:3.0
  • 年化收益率:25-40%
  • 最大回撤:<12%
  • 夏普比率:>2.0

依赖技能

  • MDL_data_skill:实时行情和历史数据
  • risk_management_skill:仓位控制和风险管理
  • policy_analysis_skill:政策情绪影响分析

更新日志

  • v1.0.0 (2026-03-05):初始版本发布
  • 核心功能:行为模式检测、情绪量化、逆向信号生成
  • 行为模式:过度反应、羊群效应、锚定偏差、情绪极端

注意:行为金融策略基于市场非理性假设,实际效果受市场环境、投资者结构变化影响。建议结合基本面分析使用,并严格执行风险控制。历史表现不代表未来收益,投资需谨慎。

Files

2 total
Select a file
Select a file to preview.

Comments

Loading comments…