Agent skill

Behavioral Finance for Trading

by HKUDS in HKUDS/Vibe-Trading

Turns behavioral-finance theory into trading signals and risk rules: overreaction and underreaction, momentum and reversal, sentiment extremes and a cognitive-bias checklist.

MITAuto-check passedBusiness, Finance & HR

Install Behavioral Finance for Trading

skills CLI
$ npx skills add HKUDS/Vibe-Trading --skill behavioral-finance -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install HKUDS/Vibe-Trading behavioral-finance --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/HKUDS/Vibe-Trading.git skills-src && mkdir -p .claude/skills && cp -r skills-src/agent/src/skills/behavioral-finance .claude/skills/behavioral-finance && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
behavioral-finance
GitHub stars
35k
Token cost
~2.7k tokens
SKILL.md length
523 words
Files
1
Skills in repo
89
Repo updated
First seen
Licence
MIT

At a glance

Turns behavioral-finance theory into trading signals and risk rules: overreaction and underreaction, momentum and reversal, sentiment extremes and a cognitive-bias checklist.

  • Works in 4 steps: Disposition-Effect Signal → Composite Sentiment Indicator → Behavioral Optimization of Momentum… → …
  • Interpreting a momentum or reversal strategy through behavioral explanations
  • SKILL.md covers Overview, Core Concepts, Analysis Framework and Output Format, plus 2 more sections
  • Calls pip

What it does

The skill treats market participants as systematically biased and shows how to turn that into quantifiable signals and risk controls. Underreaction, driven by anchoring and conservatism, is tied to momentum, while overreaction, driven by the representativeness heuristic and availability bias, is tied to reversal. A comparison table contrasts the two by time scale, type of information and the best window for China A-shares.

A cognitive-bias checklist covers loss aversion, overconfidence, anchoring and confirmation bias, each with how it appears, a quantitative way to detect it and a debiasing step, such as a pre-set stop-loss or a cap on monthly trades. Other use cases are contrarian signals when sentiment becomes extreme, debiasing in portfolio construction and behavior patterns specific to retail-driven A-share markets.

When your agent uses it

  • Interpreting a momentum or reversal strategy through behavioral explanations
  • Looking for contrarian signals when market sentiment is extreme
  • Checking a trading process for loss aversion, overconfidence or anchoring
  • Tuning strategy windows for retail-driven China A-share markets

Example prompts

  • “Explain why my 20-day momentum strategy works on A-shares in behavioral terms.”
  • “Which cognitive biases show up in my trade log, and how would I detect them quantitatively?”
  • “Suggest contrarian signals for when market sentiment turns extreme.”
  • “Add debiasing rules to my portfolio construction process.”

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Disposition-Effect Signal
  2. Composite Sentiment Indicator
  3. Behavioral Optimization of Momentum Strategies
  4. Contrarian Trading Signals

What it can do on your machine

Read from SKILL.md and the folder at commit b1f6ce7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use pip, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Behavioral Finance for Trading loads about 2.7k tokens when it runs. Until then it costs about 60 tokens; SKILL.md has 523 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~60
When it runs · the whole SKILL.md, loaded when a task matches
~2.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from HKUDS/Vibe-Trading at commit b1f6ce7, republished under its MIT licence (© HKUDS). 523 words, ~2,655 tokens.

Download SKILL.mdSave it as .claude/skills/behavioral-finance/SKILL.md (or your agent's skills folder).
name
behavioral-finance
description
Behavioral finance applications: theories of overreaction and underreaction, behavioral explanations for momentum and reversal, investor sentiment cycles, cognitive-bias checklists, and debiasing quantitative strategies.
category
analysis

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
Show full SKILL.md (203 more words)Show less
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

© HKUDS, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in agent/src/skills/behavioral-finance of HKUDS/Vibe-Trading.

Open the folder on GitHubat commit b1f6ce7

Compare with similar skills

Behavioral Finance for Trading next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Behavioral Finance for Trading compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Behavioral Finance for Trading this skillHKUDS/Vibe-Trading35k—~2.7kAutomated safety check: PassMIT
Multi-Symbol Market Scannertradesdontlie/tradingview-mcp6.8k2 repos~447Automated safety check: PassCustom licence
Tushare Datazillionare/zillionare3212 repos~2.3kAutomated safety check: PassNone
Tradingview MCPatilaahmettaner/tradingview-mcp5k—~1.3kAutomated safety check: PassMIT
TradingView Replay Practicetradesdontlie/tradingview-mcp6.8k2 repos~446Automated safety check: PassCustom licence
Digital Oraclekomako-workshop/digital-oracle878—~5.9kAutomated safety check: PassMIT

Similar skills

  • Multi-Symbol Market Scanner

    tradesdontlie/tradingview-mcp

    Scans a list of trading symbols in TradingView for setups, patterns or strategy results and reports them as a ranked comparison table.

    6.8k GitHub starsUsed in 2 repos~447 tokens
    Business, Finance & HRAuto-check passed
  • Tushare Data

    zillionare/zillionare

    面向中文自然语言的 Tushare 数据研究技能。用于把“看看这只股票最近怎么样”“帮我查财报趋势”“最近哪个板块最强”“北向资金在买什么”“给我导出一份行情数据”这类请求,转成可执行的数据获取、清洗、对比、筛选、导出与简要分析流程。适用于 A 股、指数、ETF/基金、财务、估值、资金流、公告新闻、板块概念与宏观数据等研究场景。

    321 GitHub starsUsed in 2 repos~2.3k tokens
    Business, Finance & HRAuto-check passed
  • Tradingview MCP

    atilaahmettaner/tradingview-mcp

    AI Trading Intelligence — live prices, 30+ technical indicators, backtesting (6 strategies), walk-forward overfitting detection, trade logs, equity curves, licensed news sentiment (Marketaux), and…

    5k GitHub stars~1.3k tokensUpdated yesterday
    Business, Finance & HRAuto-check passed
  • TradingView Replay Practice

    tradesdontlie/tradingview-mcp

    Guides a manual practice session in TradingView replay mode: set a chart, step through historical bars, take trades and review the P&L.

    6.8k GitHub starsUsed in 2 repos~446 tokens
    Business, Finance & HRAuto-check passed
  • Digital Oracle

    komako-workshop/digital-oracle

    Answer prediction questions using market trading data, not opinions.

    878 GitHub stars~5.9k tokensUpdated 2 mo ago
    Business, Finance & HRAuto-check passed
  • WorldQuant BRAIN Alpha Research

    QuantML-Research/wq-alpha-research

    Chinese-language playbook for WorldQuant BRAIN alphas: choose fields, write expressions, backtest, diagnose check failures, tune turnover, submit and build portfolios.

    407 GitHub stars~4.9k tokensUpdated 3 mo ago
    Business, Finance & HRAuto-check passed

More from HKUDS/Vibe-Trading

All 89 skills in this repo
  • Eastmoney Market Data

    HKUDS/Vibe-Trading

    Index of Eastmoney's free, no-token market data interfaces for China A-shares and Hong Kong stocks: fund flows, dragon-tiger lists, margin trading, reports and news.

    35k GitHub stars~1k tokensUpdated yesterday
    Auto-check passed
  • OKX Market Data

    HKUDS/Vibe-Trading

    Retrieves public OKX cryptocurrency market data such as spot prices, candlesticks, funding rates and open interest through the OKX V5 REST API, with no authentication.

    35k GitHub stars~1.3k tokensUpdated yesterday
    Auto-check passed
  • SEC EDGAR Filings Fetcher

    HKUDS/Vibe-Trading

    Fetches U.S. SEC EDGAR data: resolves tickers to CIK numbers, lists recent 10-K, 10-Q and 8-K filings with document URLs, and pulls XBRL financial series.

    35k GitHub stars~1.4k tokensUpdated yesterday
    Auto-check passed
  • A-Share ST Risk Screener

    HKUDS/Vibe-Trading

    Predicts whether a mainland China A-share company risks an ST or *ST warning after its next annual report, using financial thresholds and Sina penalty records.

    35k GitHub stars~4.9k tokensUpdated yesterday
    Auto-check passed
  • Breaks a structural trend such as AI infrastructure into its physical supply chain and ranks lesser-known listed companies sitting on each bottleneck.

    35k GitHub stars~2.7k tokensUpdated yesterday
    Auto-check passed
  • Plans and drafts an eight-part, roughly 120k-word investigative series on one company, built around a strict fact-check pass rather than fast drafting.

    35k GitHub stars~2.4k tokensUpdated yesterday
    Auto-check passed

Questions about Behavioral Finance for Trading

What does Behavioral Finance for Trading do?

Turns behavioral-finance theory into trading signals and risk rules: overreaction and underreaction, momentum and reversal, sentiment extremes and a cognitive-bias checklist. The skill treats market participants as systematically biased and shows how to turn that into quantifiable signals and risk controls. Underreaction, driven by anchoring and conservatism, is tied to momentum, while overreaction, driven by the representativeness heuristic and availability bias, is tied to reversal.

When should I use Behavioral Finance for Trading?

Behavioral Finance for Trading fits situations like: interpreting a momentum or reversal strategy through behavioral explanations; looking for contrarian signals when market sentiment is extreme; checking a trading process for loss aversion, overconfidence or anchoring; tuning strategy windows for retail-driven China A-share markets.

How do I install Behavioral Finance for Trading in Claude Code?

Run `npx skills add HKUDS/Vibe-Trading --skill behavioral-finance -a claude-code`. Or copy the skill folder (agent/src/skills/behavioral-finance in HKUDS/Vibe-Trading) into .claude/skills/behavioral-finance in your project. Claude Code loads it when a task matches its description.

How do I install Behavioral Finance for Trading in Codex?

Run `npx skills add HKUDS/Vibe-Trading --skill behavioral-finance -a codex`. Or copy the skill folder (agent/src/skills/behavioral-finance in HKUDS/Vibe-Trading) into .agents/skills/behavioral-finance in your project. Codex loads it when a task matches its description.

Can I use Behavioral Finance for Trading in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add HKUDS/Vibe-Trading --skill behavioral-finance -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/behavioral-finance, .gemini/skills/behavioral-finance, .github/skills/behavioral-finance and .opencode/skills/behavioral-finance in your project.

What does Behavioral Finance for Trading need to run?

Going by SKILL.md and its folder, Behavioral Finance for Trading needs the command-line tools its instructions call (pip).

Does Behavioral Finance for Trading access the network?

SKILL.md contains no URLs. Its commands use pip, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Behavioral Finance for Trading safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Behavioral Finance for Trading use?

Behavioral Finance for Trading is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Behavioral Finance for Trading use?

About 2.7k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Behavioral Finance for Trading?

Skills that share tags, products or a category with Behavioral Finance for Trading: Multi-Symbol Market Scanner (tradesdontlie/tradingview-mcp, 6.8k stars), Tushare Data (zillionare/zillionare, 321 stars), Tradingview MCP (atilaahmettaner/tradingview-mcp, 5k stars) and TradingView Replay Practice (tradesdontlie/tradingview-mcp, 6.8k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Behavioral Finance for Trading?

HKUDS (a GitHub organization) maintains it in HKUDS/Vibe-Trading, which has 35,097 GitHub stars. The repository holds 89 skills in this directory. The repository was last updated on October 9, 2026.

Source: HKUDS/Vibe-Trading on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.