Behavioral Finance logo

Behavioral Finance

OrganizationPopular
HKUDS
behavioral-finance

Behavioral finance applications: theories of overreaction and underreaction, behavioral explanations for momentum and reversal, investor sentiment cycles, cognitive-bias checklists, and debiasing quantitative strategies.

Overview

PublisherHKUDS
RepositoryVibe-Trading
Skill namebehavioral-finance
Stars
33.6K
Forks
5.5K
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by HKUDS on GitHub. Read the source before you install it.

Installation

Install the Behavioral Finance AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/HKUDS/Vibe-Trading.git /tmp/Vibe-Trading
mkdir -p .claude/skills
cp -r /tmp/Vibe-Trading/agent/src/skills/behavioral-finance .claude/skills/behavioral-finance
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Behavioral Finance in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Behavioral Finance on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Behavioral Finance is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Behavioral Finance Applications

Overview

Translate behavioral-finance theory into quantifiable trading signals and risk-control rules. Core assumption: market participants systematically deviate from rational decision-making, and these biases can be predicted and exploited.

Applicable scenarios:

  • Behavioral interpretation and parameter optimization for momentum / reversal strategies
  • Contrarian signals when market sentiment becomes extreme
  • Debiasing mechanisms in portfolio construction
  • Capturing behavior patterns specific to retail-driven China A-share markets

Core Concepts

Overreaction and Underreaction

Underreaction → momentum effect:

Mechanism: anchoring bias + conservatism
  Investors anchor on old information and update insufficiently to new information
  After an earnings beat, the stock price digests it gradually rather than all at once
China A-share evidence:
  - Earnings-guidance beats still produce 3-5% excess return over the following 20 days
  - After analyst rating upgrades, momentum often persists for 1-3 months
Quant signal:
  SUE (standardized unexpected earnings) > 2σ -> buy and hold for 60 days
  Top 10% 20-day return -> continue holding for 20 days (China A-share momentum cycles are shorter)

Overreaction → reversal effect:

Mechanism: representativeness heuristic + availability bias
  Investors extrapolate recent trends too aggressively and ignore mean reversion
  Panic / euphoria drives reactions beyond what fundamentals support
China A-share evidence:
  - Rebounds after consecutive limit-downs (after 3 limit-downs, the average 20-day rebound is 8%)
  - Big annual losers often earn 5-10% excess return the next year
Quant signal:
  Bottom 10% of 250-day return -> buy and hold for 250 days
  RSI(5) < 10 -> short-term rebound signal (5-10 days)

Key distinction:

DimensionUnderreaction (Momentum)Overreaction (Reversal)
Time scale1-12 months<1 week or >12 months
Information typeClear events (earnings / announcements)Ambiguous information (sentiment / trend)
Best China A-share window20-60 days5-10 days (short term) / 1 year (long term)

Cognitive Bias Checklist

Individual decision biases:

BiasManifestationQuant DetectionDebiasing Strategy
Loss aversionHold losing stocks, sell winners too earlyHolding period: losing positions > winning positions by 2-3xPre-set stop-loss line and execute mechanically
OverconfidenceOvertrading, concentrated positionsMonthly turnover > 100%, single-stock weight > 30%Limit the number of trades per month
Anchoring effectAnchoring to entry price / historical highsAbnormal volume expansion near the entry priceUse relative valuation instead of absolute price
Confirmation biasFocus only on information that supports the existing viewSingle-source information, ignoring bearish newsForce reading the opposing view
Recency biasOverweight recent eventsRecent gains/losses have too much influence on position sizeLengthen the evaluation window (≥60 days)
Framing effectSame information framed differently leads to different decisionsDecision differences between return format and absolute-PnL formatEvaluate consistently in return space

Group behavior biases:

BiasManifestationChina A-share CharacteristicsQuant Indicator
HerdingChasing rallies and panic-selling togetherExtremely fast sector rotation (3-5 days)Intra-sector stock correlation > 0.8
Information cascadesIgnoring private information and following public signalsSector follow-through after a leader stock hits limit-upSector return on the day after leader-stock limit-up
Attention effectBuying stocks that attract attentionExplosive turnover in limit-up / news-driven stocksAbnormal turnover > 3x average

Investor Sentiment Cycle

Fear -> Caution -> Optimism -> Excitement -> Euphoria -> Denial -> Panic -> Fear
  |        |        |        |        |       |        |
 Bottom   Recovery  Mid-uptrend  Pre-top   Top   Early selloff  Pre-bottom

Quant sentiment indicators:
  1. Closed-end fund discount: discount > 15% -> extreme fear -> buy signal
  2. Margin-financing growth: monthly growth > 20% -> euphoria -> reduce position
  3. New account openings: weekly openings > 2x average -> overheated market
  4. Turnover ratio: All-A daily turnover > 3% -> euphoric; < 0.5% -> deeply depressed
  5. Number of limit-up stocks: > 100 -> euphoric; < 10 -> weak

Analysis Framework

1. Disposition-Effect Signal

Principle: investors tend to sell winners and hold losers. Once winning positions are largely cleared, selling pressure eases; when trapped holders are deeply underwater, selling pressure can also ease.

China A-share application:
  Compute the profit ratio in the chip-distribution structure:
  - Profit ratio > 90% and shrinking volume -> winners are reluctant to sell -> may continue rising
  - Profit ratio > 90% and expanding volume -> winners are exiting -> topping signal
  - Profit ratio < 10% and shrinking volume -> low willingness to cut losses -> bottom stabilization
  - Profit ratio < 10% and expanding volume -> panic selling -> short-term oversold

Quant implementation:
  capital_gain_overhang = (current_price - avg_cost) / avg_cost
  where avg_cost is approximated by 60-day VWAP
  CGO > 0.2 -> strong unrealized gains, watch for disposition-effect selling pressure
  CGO < -0.3 -> deeply trapped holders, selling pressure may actually ease

2. Composite Sentiment Indicator

python
# Multi-dimensional sentiment score (0-100, 50 = neutral)
sentiment_components = {
    'turnover_ratio': normalize(all_a_turnover, historical_percentile),      # weight 25%
    'margin_growth': normalize(monthly_margin_growth, historical_percentile), # weight 25%
    'new_high_ratio': normalize(new_high_ratio, historical_percentile),       # weight 20%
    'limit_up_count': normalize(limit_up_count, historical_percentile),       # weight 15%
    'fund_discount': normalize(closed_end_fund_discount, historical_percentile), # weight 15% (inverse)
}

sentiment_score = weighted_sum(components)
# > 80: extreme greed -> cut exposure below 60%
# 60-80: optimistic -> maintain normal exposure
# 40-60: neutral -> keep exposure unchanged
# 20-40: pessimistic -> add gradually
# < 20: extreme fear -> increase exposure above 80%

3. Behavioral Optimization of Momentum Strategies

Traditional momentum (sorting by past 12-month returns) is unstable in China A-shares. A behavioral-finance perspective suggests the following optimizations:

Optimization 1: Separate sentiment momentum from fundamental momentum
  Sentiment momentum = part of recent price rise with no fundamental support -> short-term reversal
  Fundamental momentum = price rise consistent with earnings revisions -> can persist
  Trade: buy stocks with "strong fundamental momentum + weak sentiment momentum"

Optimization 2: Attention-weighted momentum
  High-attention retail names reverse faster
  Indicator: if abnormal turnover > 3x average, cut momentum holding period by 50%
  Example: if a normal momentum basket holds for 60 days, high-attention names hold only 30 days

Optimization 3: Combine cross-sectional momentum and time-series momentum
  Cross-sectional: relative strength (top 20% in return ranking)
  Time-series: absolute trend (price > MA60)
  Both satisfied -> strong signal; only one satisfied -> half position

4. Contrarian Trading Signals

Extreme-fear buy conditions (at least 3 items):
  □ Shanghai Composite RSI(5) < 15
  □ All-A daily turnover < 0.5%
  □ Weekly margin-financing decline > 5%
  □ Limit-up count < 10 and limit-down count > 50
  □ Closed-end fund discount > 15%

Extreme-greed sell conditions (at least 3 items):
  □ Shanghai Composite RSI(5) > 90
  □ All-A daily turnover > 3%
  □ Weekly margin-financing growth > 10%
  □ Limit-up count > 150
  □ Weekly increase in new account openings > 100%

Output Format

Behavioral-finance analysis report:

=== Market Sentiment Diagnosis ===
Date: 2026-03-28
Sentiment score: 72/100 (optimistic bias)
Current phase: transition from optimism to excitement

=== Behavioral-Bias Signals ===
Overreaction detection: 127 stocks rose > 15% in the past 5 days -> 65% probability of short-term reversal
Disposition effect: winner-clearing ratio is low (35%) -> overhead selling pressure remains
Herding effect: sector correlation 0.85 -> severe follow-the-leader behavior, divergence likely soon

=== Strategy Recommendations ===
Momentum strategy: shorten holding period from 60 days to 30 days (market attention is elevated)
Contrarian signal: not triggered (sentiment is not yet extreme)
Position suggestion: maintain 70% exposure, and prioritize names with "strong fundamental momentum + weak sentiment momentum"

=== Debiasing Checklist ===
□ Are you overconfident because of recent profits? -> check position concentration
□ Are you anchored to your entry price? -> re-evaluate using current PE/PB
□ Are you ignoring bearish information? -> force yourself to read bearish research reports

Notes

  1. High retail participation in China A-shares: behavioral-bias signals are more pronounced than in US equities, but sector rotation is also faster, so momentum windows should be shorter
  2. Lag in sentiment indicators: margin-financing balance is released T+1, and new account openings are weekly, so they are not suitable for intraday trading
  3. Structural changes: after 2019, foreign capital and quant participation rose, so the effectiveness of traditional behavioral-finance signals may have weakened
  4. Behavioral factors correlate with traditional factors: disposition-effect factors correlate about 0.3-0.5 with momentum, so control collinearity
  5. Overfitting risk: behavioral stories are easy to explain after the fact, so out-of-sample validation is mandatory
  6. Extreme sentiment is rare: extreme fear / greed appears only 2-3 times per year, so strategy capacity is limited

Dependencies

bash
pip install pandas numpy scipy

Frequently asked questions

What does the Behavioral Finance AI skill do?

Behavioral finance applications: theories of overreaction and underreaction, behavioral explanations for momentum and reversal, investor sentiment cycles, cognitive-bias checklists, and debiasing quantitative strategies.

Why use Behavioral Finance on TypingMind?

Because you install it once and use it with any model. Behavioral Finance is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Behavioral Finance in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/HKUDS/Vibe-Trading/tree/main/agent/src/skills/behavioral-finance. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Behavioral Finance?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Behavioral Finance?

As many as you like. As long as a model supports skills, you can use Behavioral Finance with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Behavioral Finance AI skill free?

Yes. It is published on GitHub by HKUDS under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇