Risk Management¶
PolyBot includes comprehensive risk management controls to protect your capital.
Risk Limits¶
Position Limits¶
# Maximum size for any single position
MAX_POSITION_SIZE_USD=1000
# Maximum number of open orders
MAX_OPEN_ORDERS=50
Exposure Limits¶
# Maximum total capital at risk
MAX_TOTAL_EXPOSURE_USD=10000
# Maximum exposure per venue
RISK_MAX_VENUE_EXPOSURE_USD=5000
# Maximum concentration in one venue
RISK_MAX_VENUE_CONCENTRATION=0.7
Loss Limits¶
How Limits Work¶
Pre-Trade Checks¶
Before every trade, PolyBot checks:
- Position size - Is order within limits?
- Total exposure - Will this exceed max exposure?
- Daily P&L - Have we hit loss limit?
- Open orders - Are we at max orders?
If any check fails, the signal is rejected.
Real-Time Monitoring¶
The executor service continuously monitors:
- Current exposure across all positions
- Unrealized P&L
- Daily realized P&L
- Per-venue concentration
Risk Dashboard¶
View risk metrics in the dashboard:
Or via CLI:
Shows: - Current exposure vs limits - P&L for the day - Position breakdown by strategy - Alerts and warnings
Per-Strategy Limits¶
Each strategy has its own limits:
class MyStrategy(BaseStrategy):
def _get_config(self) -> StrategyConfig:
return StrategyConfig(
max_position_size=100.0, # USD
max_positions=5, # count
)
Delta Management¶
For multi-venue trading:
# Maximum net delta (directional exposure)
RISK_MAX_DELTA=500
# Trigger auto-hedge at this delta
RISK_HEDGE_DELTA_THRESHOLD=100
# Enable automatic hedging
RISK_AUTO_HEDGE_ENABLED=false
Alerts¶
PolyBot generates alerts when:
- Exposure exceeds 80% of limit
- Daily loss exceeds 50% of limit
- Position concentration too high
- Unusual activity detected
View alerts:
Best Practices¶
Starting Out¶
- Use conservative limits - Start small
- Enable shadow mode - Test without real risk
- Monitor actively - Watch the dashboard
- Review daily - Check P&L and positions
Scaling Up¶
- Increase gradually - 20-50% at a time
- Track metrics - Win rate, average P&L
- Adjust per strategy - Different strategies, different limits
- Keep reserves - Don't deploy 100% of capital
Emergency Procedures¶
If something goes wrong:
# Disable all strategies immediately
polybot strategy disable --all
# Cancel all open orders
polybot orders cancel --all
# Check positions
polybot positions
# Review recent activity
polybot logs --tail 100
Configuration Examples¶
Conservative¶
Moderate¶
Aggressive¶
Warning
Higher limits mean higher potential losses. Only use aggressive settings if you fully understand the risks.