Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:24mlight A Share investment Agent Risk Management and Position Sizing

From Leeroopedia
Knowledge Sources
Domains Finance, Risk_Management
Last Updated 2026-10-10 14:00 GMT

Overview

A comprehensive risk assessment framework that computes volatility, Value at Risk (VaR), maximum drawdown, and market risk scores to determine position sizing limits and trading actions under different risk scenarios.

Description

Risk management is the process of identifying, assessing, and controlling financial risks. This framework provides a quantitative approach:

  1. Volatility Assessment: Annualized volatility from daily returns, with rolling 120-day standard deviation to compute a volatility percentile relative to its historical distribution.
  1. Value at Risk (VaR): Historical VaR at 95% confidence level — the 5th percentile of daily returns, representing the maximum expected loss on 95% of trading days.
  1. Maximum Drawdown: The largest peak-to-trough decline over a 60-day rolling window, measuring worst-case loss exposure.
  1. Market Risk Score: A composite 0-10 score combining volatility percentile (>1.5σ adds 2, >1σ adds 1), VaR (<-3% adds 2, <-2% adds 1), and max drawdown (<-20% adds 2, <-10% adds 1).
  1. Position Sizing: Adjusts maximum position size based on risk score: 50% for high risk (score ≥ 4), 75% for moderate risk (score ≥ 2), 100% for low risk.
  1. Stress Testing: Simulates market crash (-20%), moderate decline (-10%), and slight decline (-5%) scenarios to estimate potential losses and portfolio impact.

Usage

Use this principle when:

  • Determining appropriate position sizes based on market risk conditions
  • Setting trading action limits (hold/reduce/buy/sell) based on risk scores
  • Stress testing portfolio resilience under adverse market scenarios

Theoretical Basis

Key formulas:

  • Annualized Volatility: σannual=σdaily⋅252
  • Historical VaR (95%): VaR95=Q0.05(returns) (5th percentile of daily returns)
  • Maximum Drawdown: MaxDD=min⁡(Ptmaxk≤tPk−1)

Position sizing logic:

# Abstract logic (not real implementation)
if market_risk_score >= 4:
    max_position = total_portfolio * 0.50  # High risk
elif market_risk_score >= 2:
    max_position = total_portfolio * 0.75  # Moderate risk
else:
    max_position = total_portfolio * 1.00  # Low risk

Trading action logic:

  • risk_score ≥ 9 → hold
  • risk_score ≥ 7 → reduce
  • debate_signal bullish & confidence > 0.5 → buy
  • debate_signal bearish & confidence > 0.5 → sell
  • otherwise → hold

Related Pages

Implemented By

Uses Heuristics

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment