> ## Documentation Index
> Fetch the complete documentation index at: https://uncoded.ch/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Risk Management — The Operator Framework

> How to think about risk in unCoded. Capital sizing, reserves, kill switch, stop-losses, sub-accounts. The framework that keeps a bad month from becoming a catastrophic one.

<Info>
  **Risk management is the layer that decides how much you lose when you lose.** Strategy decides direction; risk management decides survival. Most operators who blow up don't have bad strategies — they have inadequate risk management. Get this right and a bad month is recoverable; get it wrong and a bad week can be terminal.
</Info>

## The five pillars of unCoded risk management

<CardGroup cols={2}>
  <Card title="The kill switch" icon="power-off" href="/risk-management/kill-switch">
    Your most important control. Pauses new orders immediately. Existing positions continue to manage. Use early, use often.
  </Card>

  <Card title="Stop-loss and trailing stops" icon="bullseye" href="/risk-management/stop-loss-and-trailing">
    Per-mode stop-losses bound the worst-case per-trade outcome. Trailing stops protect profit on trending positions.
  </Card>

  <Card title="Capital allocation" icon="money-bill-wave" href="/risk-management/capital-allocation">
    How much capital you commit per pair, per mode, per venue. The sizing decisions that determine exposure.
  </Card>

  <Card title="Reserves" icon="vault" href="/risk-management/reserves">
    The 50% rule. Trading capital + reserve = total exchange balance. Reserve is what you don't deploy.
  </Card>

  <Card title="Sub-accounts" icon="layer-group" href="/risk-management/sub-accounts">
    Strategy isolation. Run experimental modes in sub-accounts so a misbehaving strategy can't affect your validated setup.
  </Card>

  <Card title="The kill switch (again)" icon="power-off">
    Worth listing twice. It's the control that's there for the worst day. Operators who use it well sleep well.
  </Card>
</CardGroup>

## The honest framing

<Warning>
  **unCoded does not guarantee returns.** It is a disciplined execution engine that enforces the rules you authored or selected. The market decides outcomes. Risk management is the layer that limits how much the market can hurt you on any given day.

  What unCoded does NOT do for you:

  * ❌ Predict the future direction of the market.
  * ❌ Detect black-swan events before they happen.
  * ❌ Override your decisions when they're bad.
  * ❌ Recover capital you've already lost.
  * ❌ Compensate for inadequate operator discipline.

  What unCoded DOES do for you:

  * ✅ Enforce per-mode stop-losses on every position.
  * ✅ Honor trailing-stop logic when configured.
  * ✅ Halt new buying when you flip the kill switch.
  * ✅ Continue managing existing positions during your absence.
  * ✅ Provide the data (Dashboard, logs, backtest results) you need to make informed risk decisions.

  Risk management is the operator's job. The bot enforces; you decide.
</Warning>

## The risk-management hierarchy

Operators who survive long-term apply risk management in this priority order:

<Steps>
  <Step title="Permission scoping (no withdrawal)">
    Most-important. Even a fully compromised key cannot drain your account if withdrawal is disabled. See [API Key Security](/exchanges/api-key-security).
  </Step>

  <Step title="Reserve sizing (50% rule)">
    Don't deploy 100% of your exchange balance. Reserve buffer absorbs drawdowns and provides flexibility.
  </Step>

  <Step title="Per-pair capital limits">
    No single pair gets more than `25%` of your trading capital. Concentration risk is a real source of operator pain.
  </Step>

  <Step title="Per-mode stop-loss configuration">
    Verify stop-losses are set on every active mode. The default values are typically conservative; tighter is acceptable, looser requires deliberate intent.
  </Step>

  <Step title="Kill-switch readiness">
    Bookmark the Dashboard's kill-switch button location. Speed matters when something is wrong.
  </Step>

  <Step title="Sub-account isolation for experiments">
    Never test new modes/strategies on the same account as your validated production setup.
  </Step>

  <Step title="Daily kill-switch readiness check">
    A daily 30-second check that the bot is doing what you expect builds the intuition you need to spot anomalies fast.
  </Step>
</Steps>

## Common operator risk patterns

<AccordionGroup>
  <Accordion title="The all-in operator (avoid)" icon="ban">
    Pattern: deploys 100% of exchange balance to active modes, no reserve. "I want to maximize the working capital."

    Failure mode: any drawdown is felt at full leverage. A `-20%` drawdown removes 20% of your operational base. No buffer to take advantage of opportunities, no buffer to absorb stress.

    **Better**: 50% in active modes, 50% reserve. Lower nominal returns when good but dramatically better resilience when bad.
  </Accordion>

  <Accordion title="The over-diversified operator" icon="boxes-stacked">
    Pattern: 20+ active pairs, multiple modes, multiple venues. "Diversification reduces risk."

    Failure mode: cognitive overload. You can't track 20+ positions across multiple modes. Anomalies go unnoticed. Per-pair capital is so small that fees dominate.

    **Better**: 3–8 active pairs maximum, 1–2 modes, 1–2 venues. Manageable scope.
  </Accordion>

  <Accordion title="The kill-switch-averse operator" icon="ban">
    Pattern: refuses to use the kill switch because "I don't want to miss the recovery."

    Failure mode: keeps buying into worsening situations. The kill switch's purpose is to pause new buying — existing positions still ride the recovery if there is one.

    **Better**: flip the kill switch at the first sign of unfamiliar market behavior. You can always flip it back. Cost of a false alarm: zero. Cost of not flipping when you should: large.
  </Accordion>

  <Accordion title="The mode-jumper" icon="rotate">
    Pattern: switches modes weekly based on recent performance. "BasicMode is underperforming; let me try FullBullMarket."

    Failure mode: every mode change loses the in-flight positions' optimization. By the time you've validated the new mode, the regime has shifted again.

    **Better**: pick a mode after backtesting, run it for 2+ months, evaluate dispassionately, only change after evidence (not gut feeling).
  </Accordion>

  <Accordion title="The leveraged-thinking operator" icon="explosion">
    Pattern: thinks of trading capital as "borrowed funds I want to multiply."

    Failure mode: emotional attachment to specific outcome size. Decisions distorted by the need to "win back" losses or "compound" wins.

    **Better**: think of trading capital as "capital allocated to the trading machine." Win, lose, or break-even, the relationship is dispassionate. Risk management is easier when ego is not involved.
  </Accordion>
</AccordionGroup>

## Worst-case scenarios — what to plan for

<AccordionGroup>
  <Accordion title="Symbol crashes -50% in a day" icon="chart-line-down">
    The buy ladder fully invests, position is heavily underwater, sell ladder is far above current price, the position is "stuck."

    **What unCoded does**: continues holding the position. Stop-loss triggers if reached. Sell ladder waits for price recovery.

    **What you should do**:

    * Don't panic-close at the bottom (ironic but common).
    * Decide: is the symbol fundamentally OK? If yes, hold. If you've lost confidence, exit manually and accept the loss.
    * Use kill switch to prevent new buying on that pair.
    * Capital reserve helps you avoid being forced to sell at the bottom.
  </Accordion>

  <Accordion title="Exchange goes offline for hours/days" icon="cloud-bolt">
    Connection drops, no orders can be placed or modified.

    **What unCoded does**: existing exchange-side orders continue. Bot retries connection until venue returns. Reconciles on reconnect.

    **What you should do**:

    * Funds are safe — they're on the exchange, not your VPS.
    * Sit tight. There's nothing operator action can fix during venue outage.
    * Watch news for updates on the venue's status.
    * When venue returns, verify reconciliation matches expectation.
  </Accordion>

  <Accordion title="VPS dies (provider failure, accidental destruction)" icon="server">
    Your VPS becomes unreachable. Database may be lost (depending on backup state).

    **What unCoded does**: exchange-side orders continue honoring. Trading effectively pauses until the bot is brought back online.

    **What you should do**:

    * Restore from your most recent database backup (you do back up daily, right?).
    * Spin up a replacement VPS, deploy unCoded, restore database, restart.
    * The exchange is the source of truth for your funds. Your capital is intact.
    * Lost: only the local trade history since last backup.
  </Accordion>

  <Accordion title="API key gets compromised (somehow)" icon="key">
    Unauthorized API activity from your key.

    **What unCoded does**: nothing — this is exchange-level.

    **What you should do**:

    * Immediately revoke the key at the venue.
    * Generate new key with correct permissions.
    * Update Dashboard, restart bot.
    * Review the venue's audit log for the leak window — what did the attacker do?
    * **Because you correctly disabled withdrawal**, the worst case is the attacker traded your funds. They can't drain.
  </Accordion>

  <Accordion title="Operator panic — bad day in the markets" icon="user">
    You're stressed. Positions are underwater. You want to do something.

    **What unCoded does**: keeps following the rules.

    **What you should do**:

    1. Step back. Coffee. Walk.
    2. Open the Dashboard. Look at actual positions, actual P\&L, actual unrealized exposure.
    3. Decide: is this within historical drawdown ranges? If yes, hold.
    4. If you really want to act: kill switch ON. Don't close positions out of fear.
    5. Wait for clarity (an hour? a day?). Then decide with calmer head.

    Most "panic decisions" worsen outcomes. The bot's discipline is your friend during your worst hours.
  </Accordion>
</AccordionGroup>

## Best practices — the universal risk principles

<Tip>
  * ✅ **Never enable withdrawal on API keys**. Single most important rule.
  * ✅ **Keep `~50%` of total exchange balance as reserve** (not deployed to active modes).
  * ✅ **No single pair > `25%` of your trading capital**.
  * ✅ **Backtest before deploying capital**. Validate on multiple historical regimes.
  * ✅ **Forward-test on small capital before scaling**. Backtest is necessary, not sufficient.
  * ✅ **Verify per-mode stop-losses are set** on every active mode.
  * ✅ **Daily 5-minute Dashboard check** to build intuition for normal behavior.
  * ✅ **Bookmark the kill-switch button** for fast access during stress.
  * ✅ **Rotate API keys quarterly**. Even without incidents.
  * ✅ **Sub-account isolation for experiments**. Don't risk validated production on new strategies.
  * ✅ **Documented operator runbook** — daily/weekly/monthly routines.
  * ✅ **Don't double-down during drawdowns**. Reserve is for emergencies, not for averaging losses.
  * ✅ **Maintain VPS daily database backups** off-site. Recovery time matters.
  * ✅ **Calm-head decision-making during volatility**. No panic actions.
  * ✅ **Treat the bot as the discipline you don't have at 3 AM** — let it work.
</Tip>

## What's next

<CardGroup cols={2}>
  <Card title="Kill switch" icon="power-off" href="/risk-management/kill-switch">
    Your most important control — when to flip, how it behaves.
  </Card>

  <Card title="Stop-loss and trailing" icon="bullseye" href="/risk-management/stop-loss-and-trailing">
    Per-mode stop-loss configuration and trailing-stop dynamics.
  </Card>

  <Card title="Capital allocation" icon="money-bill-wave" href="/risk-management/capital-allocation">
    Sizing decisions — per pair, per mode, per venue.
  </Card>

  <Card title="Reserves" icon="vault" href="/risk-management/reserves">
    The 50% rule and how to think about reserve capital.
  </Card>

  <Card title="Sub-accounts" icon="layer-group" href="/risk-management/sub-accounts">
    Strategy isolation for experimentation.
  </Card>

  <Card title="Backtesting" icon="flask" href="/backtesting/why-backtest">
    Validate before risking capital.
  </Card>
</CardGroup>
