# 🛡️ RISK MANAGEMENT SYSTEM
## Trading Capital Protection Protocol

**Document Version:** 1.0  
**Created:** 2026-03-23  
**Status:** ACTIVE - MANDATORY COMPLIANCE

---

## ⚠️ FUNDAMENTAL PRINCIPLE

> *"You shall not pass... to ruin. A trader without risk management is just a gambler waiting to lose everything."*
> — Gandalf's First Rule of Trading

**NO strategy is profitable without proper risk management.** This is not optional. This is survival.

---

## 🏆 REGRAS DE OURO (GOLDEN RULES)

### Mandatory Limits

| Rule | Limit | Action if Breached |
|------|-------|-------------------|
| **Max Loss per Trade** | 1-2% of capital | STOP - Do not trade |
| **Max Daily Loss** | 5% of capital | STOP trading for 24h |
| **Max Weekly Loss** | 10% of capital | STOP trading for 48h |
| **Max Drawdown** | 15% from peak | MANDATORY REVIEW |
| **Max Trades per Day** | 5 | STOP after 5 trades |
| **Min Risk/Reward Ratio** | 1:2 | Skip if < 1:2 |
| **Max Correlation** | 30% per asset | Diversify |

### Stop Conditions — WHEN TO STOP TRADING

🚨 **STOP IMMEDIATELY if:**
- Lost more than 5% in a single day
- 3 consecutive losses
- Emotional state is elevated (anger, fear, excitement)
- Trading outside your defined hours
- After major news/events (non-farmable)
- Platform/network issues during critical operations

🚪 **MANDATORY COOL-OFF if:**
- 2 losing weeks in a row
- Drawdown exceeds 10%
- You feel "revenge trading" coming on
- Haven't reviewed your rules in 7 days

---

## 📊 POSITION SIZING

### Kelly Criterion (Advanced)

```
f* = (bp - q) / b

Where:
- f* = Kelly percentage of capital to risk
- b = odds received on the trade (profit/loss ratio)
- p = probability of winning
- q = probability of losing (1 - p)
```

**Kelly Fraction Used:** 25% of Kelly (conservative) = `Kelly * 0.25`

### Fixed Fraction Method (Recommended for Starters)

```
Position Size = (Account * Risk%) / Stop Loss Distance

Example:
- Account: $1,000
- Risk%: 2%
- Stop Loss: 5% from entry
- Position = ($1,000 * 0.02) / 0.05 = $400
```

### Position Sizing Table

| Capital | Risk 1% | Risk 2% | Stop 3% | Stop 5% |
|---------|---------|---------|---------|---------|
| $100 | $1 | $2 | $3 | $5 |
| $500 | $5 | $10 | $15 | $25 |
| $1,000 | $10 | $20 | $30 | $50 |
| $2,500 | $25 | $50 | $75 | $125 |
| $5,000 | $50 | $100 | $150 | $250 |
| $10,000 | $100 | $200 | $300 | $500 |

### Quick Calculator (Copy-Paste Formula)

```
╔══════════════════════════════════════════════════════════╗
║           POSITION SIZE CALCULATOR                       ║
╠══════════════════════════════════════════════════════════╣
║                                                          ║
║  Total Capital:       $[___________]                     ║
║  Risk per Trade (%):  [___]%                             ║
║  Stop Loss Distance:  [___]%                             ║
║                                                          ║
║  FORMULA:                                                ║
║  Max Loss = Total Capital × (Risk% / 100)                 ║
║  Position = Max Loss / (Stop% / 100)                     ║
║                                                          ║
║  EXAMPLE:                                                ║
║  Capital: $1,000 | Risk: 2% | Stop: 5%                   ║
║  Max Loss = $1,000 × 0.02 = $20                          ║
║  Position = $20 / 0.05 = $400                            ║
║                                                          ║
║  ANSWER: Position $400 in this trade                      ║
╚══════════════════════════════════════════════════════════╝
```

---

## 📐 RISK/REWARD CALCULATOR

### Ratio Calculation

```
Risk/Reward Ratio = |Entry - Stop Loss| / |Take Profit - Entry|

Good Trade: RR >= 2.0
Acceptable: RR >= 1.5
Skip: RR < 1.5
```

### Quick Reference Table

| Potential Reward | Risk | Ratio | Action |
|-----------------|------|-------|--------|
| 10% | 5% | 1:2 | ✅ TAKE |
| 15% | 5% | 1:3 | ✅ TAKE |
| 8% | 4% | 1:2 | ✅ TAKE |
| 5% | 5% | 1:1 | ⚠️ SKIP |
| 3% | 5% | 1:0.6 | ❌ SKIP |

### R:R Calculator Template

```
╔══════════════════════════════════════════════════════════╗
║           RISK/REWARD CALCULATOR                        ║
╠══════════════════════════════════════════════════════════╣
║                                                          ║
║  Entry Price:      [___________]                         ║
║  Stop Loss:        [___________]                         ║
║  Take Profit:      [___________]                         ║
║                                                          ║
║  Distance to SL:  |Entry - SL| = [___]                  ║
║  Distance to TP:  |TP - Entry| = [___]                  ║
║                                                          ║
║  R:R Ratio = [TP Dist] / [SL Dist] = [___]              ║
║                                                          ║
║  Min Acceptable: 2.0                                     ║
║  Result: [✅ ACCEPT / ⚠️ CAUTION / ❌ REJECT]             ║
╚══════════════════════════════════════════════════════════╝
```

---

## 📉 DRAWDOWN TRACKER

### Drawdown Calculation

```
Drawdown % = ((Peak - Current) / Peak) × 100

Example:
- Peak Balance: $1,000
- Current Balance: $850
- Drawdown = (($1,000 - $850) / $1,000) × 100 = 15%
```

### Drawdown Alerts

| Level | Drawdown | Status | Action |
|-------|----------|--------|--------|
| 🟢 Normal | 0-5% | GREEN | Continue trading |
| 🟡 Warning | 5-10% | YELLOW | Reduce size 50%, increase RR to 1:3 |
| 🟠 Danger | 10-15% | ORANGE | STOP trading, mandatory review |
| 🔴 Critical | >15% | RED | FULL STOP, 7-day cooling period |

### Daily Drawdown Log Template

```markdown
## 📉 DRAWDOWN TRACKER

### Current Session
- Starting Balance: $_________
- Current Balance: $_________
- Session P/L: $_________ (_____%)
- Peak This Session: $_________
- Current Drawdown: _____%

### Weekly Overview
| Day | Start | End | P/L | Peak | Drawdown |
|-----|-------|-----|-----|------|----------|
| Mon |       |     |     |      |          |
| Tue |       |     |     |      |          |
| Wed |       |     |     |      |          |
| Thu |       |     |     |      |          |
| Fri |       |     |     |      |          |
| Sat |       |     |     |      |          |
| Sun |       |     |     |      |          |

### Alert Thresholds
- [ ] Below 5%: Normal operations
- [ ] 5-10%: Reduce position 50%, RR 1:3 minimum
- [ ] 10-15%: STOP, review strategy
- [ ] Above 15%: FULL STOP, 7 days no trading
```

---

## ⚖️ PORTFOLIO ALLOCATION

### Strategy Distribution

```
Total Capital = 100%

├── 🚀 High Risk / High Reward (20%)
│   └── New DeFi protocols, speculative plays
│   └── Max 2% per position
│
├── 📈 Medium Risk / Medium Reward (50%)
│   └── Established DeFi, Arbitrage
│   └── Max 5% per position
│
├── 💰 Low Risk / Stable (30%)
│   └── Liquidity provision, farming
│   └── Max 10% per position
```

### Multi-Strategy Allocation

| Strategy | Capital % | Max per Position | Max Positions |
|----------|-----------|------------------|----------------|
| Airdrop Hunting | 15% | 3% | 5 |
| Arbitrage | 30% | 5% | 6 |
| Faucet Farming | 20% | 2% | 10 |
| Freelance → Crypto | 25% | N/A | - |
| Reserve | 10% | N/A | - |

### Portfolio Rebalancing Rules

- **Weekly Review:** Every Sunday
- **Rebalance Trigger:** >5% deviation from target allocation
- **Max Single Exposure:** Never >10% in one asset/strategy
- **Correlation Check:** Max 30% correlation between positions

---

## 📝 TRADING DIARY TEMPLATE

```markdown
# 📖 TRADING DIARY

## Entry #{ID}
**Date:** {YYYY-MM-DD}  
**Time:** {HH:MM UTC}  
**Strategy:** {Airdrop/Arbitrage/Farming/Speculative}

### Trade Setup
- **Pair/Protocol:** 
- **Entry Price:** 
- **Stop Loss:** 
- **Take Profit:** 
- **Position Size:** $ / % of capital
- **Risk/Reward Ratio:** 1:

### Pre-Trade Checklist
- [ ] Trend direction confirmed?
- [ ] Key levels identified?
- [ ] News/events checked?
- [ ] R:R >= 2.0?
- [ ] Max positions not exceeded?
- [ ] Emotional state calm?

### Execution
- **Entry Time:** 
- **Actual Entry:** 
- **SL Placed:** 
- **TP Placed:** 

### Exit (Fill on Close)
- **Exit Time:** 
- **Exit Price:** 
- **Result:** WIN / LOSS
- **P/L:** $ / %

### Post-Trade Analysis
- **What went right:** 
- **What went wrong:** 
- **Lessons learned:** 
- **Would I take this trade again?** YES / NO

---

## 🧮 LOT SIZE CALCULATOR

### Crypto Position Sizing

```
╔══════════════════════════════════════════════════════════╗
║              LOT SIZE CALCULATOR                         ║
╠══════════════════════════════════════════════════════════╣
║                                                          ║
║  INPUTS:                                                 ║
║  ───────                                                 ║
║  Account Balance:         $[____________]                  ║
║  Risk per Trade:         [___]% (default: 2%)            ║
║  Entry Price:            $[____________]                 ║
║  Stop Loss Price:        $[____________]                 ║
║  (Or Stop Distance:      [___]%)                         ║
║                                                          ║
║  CALCULATION:                                            ║
║  ────────────                                            ║
║  Max Loss = Balance × (Risk% / 100)                     ║
║                                                          ║
║  If using SL price:                                      ║
║  Position = Max Loss / |Entry - SL|                     ║
║                                                          ║
║  If using SL distance %:                                 ║
║  Position = Max Loss / (SL% × Entry)                    ║
║                                                          ║
║  OUTPUT:                                                 ║
║  ───────                                                 ║
║  Max Loss Permitted:    $[____________]                  ║
║  Position Size:         $[____________]                  ║
║  Quantity to Buy:       [____________] units             ║
║                                                          ║
║  EXAMPLES:                                               ║
║  ─────────                                               ║
║  Balance: $1,000 | Risk: 2% | Entry: $100 | SL: $95      ║
║  → Max Loss = $20                                        ║
║  → Position = $20 / $5 = $400 = 4 units                  ║
║                                                          ║
║  Balance: $500 | Risk: 1% | Entry: $50 | SL: 4%         ║
║  → Max Loss = $5                                         ║
║  → Position = $5 / ($50 × 0.04) = $5 / $2 = $250         ║
║  → Quantity = $250 / $50 = 5 units                       ║
╚══════════════════════════════════════════════════════════╝
```

---

## 🛑 STOP LOSS PLACEMENT GUIDELINES

### Method 1: Structural Stop Loss
```
Place SL just beyond key support/resistance levels

- Below support for longs
- Above resistance for shorts
Add 1-2% buffer for volatility
```

### Method 2: ATR-Based Stop
```
SL Distance = 1.5 × ATR(14)

More volatile assets need more buffer
Reduces fake-outs but increases risk per trade
```

### Method 3: Percentage Stop
```
Conservative: 1-2% from entry
Moderate: 3-5% from entry
Aggressive: 6-10% from entry (only for large caps)
```

### Stop Loss Proximity Guidelines

| Asset Type | Recommended SL | Reasoning |
|------------|----------------|-----------|
| Stablecoins (farm) | N/A | No SL needed |
| Large Cap (BTC, ETH) | 3-5% | Less volatility |
| Mid Cap (top 50) | 5-8% | Moderate volatility |
| Small Cap / New | 10-15% | High volatility |
| DeFi Speculative | 15-20% | Extreme volatility |

---

## 📋 PRE-TRADE CHECKLIST

Execute ONLY if ALL items are ✅

```
╔══════════════════════════════════════════════════════════╗
║              PRE-TRADE CHECKLIST                        ║
╠══════════════════════════════════════════════════════════╣
║                                                          ║
║  ACCOUNT STATUS                                          ║
║  ───────────────                                         ║
║  [ ] Daily loss limit NOT reached                        ║
║  [ ] Weekly loss limit NOT reached                       ║
║  [ ] Max trades today NOT exceeded                       ║
║  [ ] Drawdown within acceptable range                     ║
║                                                          ║
║  TRADE SETUP                                             ║
║  ────────────                                            ║
║  [ ] R:R ratio >= 2.0                                    ║
║  [ ] Entry price confirmed                                ║
║  [ ] Stop loss identified                                 ║
║  [ ] Take profit identified                               ║
║  [ ] Position size calculated                             ║
║                                                          ║
║  MARKET CONDITIONS                                       ║
║  ─────────────────                                       ║
║  [ ] No major news in next 2 hours                        ║
║  [ ] Volatility acceptable                                ║
║  [ ] Liquidity sufficient                                 ║
║                                                          ║
║  EMOTIONAL STATE                                          ║
║  ───────────────                                         ║
║  [ ] Feeling calm and focused                             ║
║  [ ] No revenge trading impulse                           ║
║  [ ] No overtrading urge                                  ║
║                                                          ║
║  ALL ✅ = PROCEED                                         ║
║  ANY ❌ = STOP, do not trade                              ║
╚══════════════════════════════════════════════════════════╝
```

---

## 🚨 EMERGENCY PROTOCOLS

### If You Hit Max Daily Loss (5%)

1. **IMMEDIATELY** stop all trading
2. Log out of all exchanges/apps
3. Wait 24 hours minimum
4. Review this document during cool-off
5. Analyze what went wrong
6. Do NOT revenge trade
7. Return only after written reflection

### If Drawdown Exceeds 15%

1. **FULL STOP** — mandatory 7-day no trading
2. Complete detailed post-mortem
3. Identify root causes
4. Adjust parameters if needed
5. Paper trade for 3 days before resuming
6. Start with 50% of normal position size

### If You Feel "In The Zone" (Danger!)

- Overconfidence = overtrading = ruin
- If you're thinking "I can't lose" → YOU ARE ABOUT TO LOSE
- Trust the rules, not your feelings
- Take a 1-hour break and re-check

---

## 📊 MONTHLY RISK REVIEW TEMPLATE

```markdown
# 📊 MONTHLY RISK REVIEW

## Month: {YYYY-MM}

### Performance Summary
- Starting Balance: $
- Ending Balance: $
- Net P/L: $ / %
- Best Trade: $
- Worst Trade: $
- Win Rate: %

### Risk Metrics
- Max Drawdown: % (Target: <15%)
- Avg Risk/Reward: 1:
- Largest Single Loss: $
- Largest Single Win: $
- Avg Position Size: $

### Rule Compliance
- Days within daily loss limit: / 30
- Max trades exceeded: times
- Revenge trades: times
- Emotional trades: times

### Required Changes
1.
2.
3.

### Next Month Goals
1.
2.
3.
```

---

## 🔢 KELLY CRITERION CALCULATOR

```python
# Kelly Criterion Calculator
# Use 25% of Kelly for conservative trading

def kelly_criterion(win_rate, avg_win, avg_loss):
    """
    Calculate optimal position size using Kelly Criterion
    
    Args:
        win_rate: Probability of winning (0.0 to 1.0)
        avg_win: Average gain when winning
        avg_loss: Average loss when losing
    
    Returns:
        Kelly fraction (use 25% of this value)
    """
    if avg_loss == 0:
        return 0
    
    b = avg_win / avg_loss  # Odds received
    p = win_rate
    q = 1 - win_rate
    
    kelly = (b * p - q) / b
    conservative_kelly = kelly * 0.25
    
    return max(0, conservative_kelly)

# Example Usage
win_rate = 0.40  # 40% win rate
avg_win = 100    # Average win $100
avg_loss = 50    # Average loss $50

kelly = kelly_criterion(win_rate, avg_win, avg_loss)
print(f"Kelly Fraction: {kelly:.2%}")
# Output: Kelly Fraction: 5.00%
```

---

## ⚡ QUICK REFERENCE CARD

```
╔══════════════════════════════════════════════════════════╗
║     RISK MANAGEMENT QUICK REFERENCE                      ║
╠══════════════════════════════════════════════════════════╣
║                                                          ║
║  THE GOLDEN RULES                                        ║
║  ────────────────                                        ║
║  • Max 2% per trade                                      ║
║  • Max 5% per day                                        ║
║  • Max 10% per week                                      ║
║  • Max 15% drawdown = STOP                               ║
║  • Max 5 trades per day                                  ║
║  • Min 1:2 risk/reward                                   ║
║                                                          ║
║  POSITION SIZING                                          ║
║  ─────────────────                                       ║
║  Position = (Account × Risk%) / Stop%                    ║
║                                                          ║
║  R:R RATIO                                               ║
║  ─────────                                               ║
║  R:R = TP_Distance / SL_Distance                         ║
║  Must be >= 2.0 to take trade                             ║
║                                                          ║
║  DRAWDOWN ALERT LEVELS                                    ║
║  ────────────────────────                                ║
║  🟢 0-5%   = Normal                                       ║
║  🟡 5-10%  = Reduce size 50%                              ║
║  🟠 10-15% = STOP, review                                 ║
║  🔴 >15%   = FULL STOP, 7 days                           ║
║                                                          ║
║  WHEN TO STOP                                            ║
║  ────────────                                            ║
║  • 3 consecutive losses                                  ║
║  • Emotional state elevated                              ║
║  • Daily loss limit hit                                  ║
║  • After revenge urge                                    ║
║  • Outside trading hours                                 ║
║                                                          ║
╚══════════════════════════════════════════════════════════╝
```

---

## 📁 Related Documents

- `DEFI-STRATEGIES.md` — Strategy-specific risk parameters
- `ARBITRAGE-PLAN.md` — Arbitrage risk considerations
- `HYPERLIQUID-BOOTSTRAP.md` — Platform-specific limits

---

## 🔄 Version History

| Version | Date | Changes |
|---------|------|---------|
| 1.0 | 2026-03-23 | Initial creation |

---

**Remember:** The market will always be there tomorrow. Your capital won't if you don't protect it.

*"Risk management is not about not losing — it's about not losing too much."*

🧙‍♂️ Gandalf, Risk Manager
