BloFin Risk Manager
Comprehensive risk management skill for BloFin trading. Helps users size positions correctly, monitor liquidation risk, assess portfolio exposure, and maintain disciplined trading.
Risk Analysis Workflows
1. Pre-Trade Risk Assessment
Before any trade, evaluate the risk:
- Get account balance via
get_balance— available equity - Get instrument specs via
get_instruments— contract value, max leverage - Get current price via
get_tickers - Get existing positions via
get_positions— current exposure - Calculate and present:
Pre-Trade Risk Assessment
=========================
Instrument: BTC-USDT
Account Equity: $X,XXX
Available Margin: $X,XXX
Current Price: $XX,XXX
Proposed Trade:
- Side: Long
- Size: XX contracts
- Leverage: XXx
- Notional Value: $X,XXX
- Required Margin: $X,XXX
- Margin Usage After Trade: XX%
Risk Metrics:
- Estimated Liquidation Price: $XX,XXX
- Distance to Liquidation: XX%
- Max Loss (to liquidation): $X,XXX
- Risk per Account: XX% of equity
⚠️ Warning: [if margin usage > 50% or risk > 5% of equity]
Example prompts:
- "Should I open a 10x BTC long with 100 contracts?"
- "What's the risk if I short ETH with 5x leverage?"
- "How much can I lose on this trade?"
2. Position Sizing Calculator
Calculate optimal position size based on risk tolerance:
Use this formula:
Max Position Size = (Account Equity * Risk%) / (Entry Price * Contract Value * (1/Leverage))
Where Risk% is the maximum percentage of equity to risk (default 2%).
Steps:
- Ask user for risk tolerance (default: 2% of equity per trade)
- Get account equity from
get_balance - Get contract specs from
get_instruments - Get current price from
get_tickers - Calculate recommended position size at different leverage levels
Present as a table:
| Leverage | Position Size | Notional | Required Margin | Liquidation Distance |
|---|---|---|---|---|
| 5x | XX contracts | $X,XXX | $XXX | XX% |
| 10x | XX contracts | $X,XXX | $XXX | XX% |
| 20x | XX contracts | $X,XXX | $XXX | XX% |
Example prompts:
- "How many BTC contracts should I buy?"
- "Calculate position size for 2% risk on ETH"
- "What's a safe position size for SOL-USDT?"
3. Liquidation Monitoring
Monitor liquidation risk for all open positions:
-
Get all positions via
get_positions -
Get mark prices via
get_mark_pricefor each position -
For each position, calculate:
- Distance to liquidation:
|markPrice - liquidationPrice| / markPrice * 100% - Unrealized PnL and PnL ratio
- Effective leverage (notional value / margin)
- Distance to liquidation:
-
Risk classification:
| Distance to Liquidation | Risk Level | Action |
|---|---|---|
| > 30% | Low | Normal monitoring |
| 15% - 30% | Medium | Consider reducing position or adding margin |
| 5% - 15% | High | Strongly recommend reducing position |
| < 5% | Critical | Immediate action required — reduce or close |
Example prompts:
- "Am I at risk of liquidation?"
- "Check my liquidation distances"
- "Which positions are most dangerous?"
4. Portfolio Exposure Analysis
Evaluate overall portfolio risk:
- Get all positions via
get_positions - Get account balance via
get_balance - Calculate:
- Total notional exposure (sum of all position notional values)
- Net exposure (long notional - short notional)
- Gross leverage (total notional / equity)
- Directional bias (net long vs net short)
- Concentration risk (% of exposure in single instrument)
Present:
Portfolio Exposure Report
=========================
Total Equity: $X,XXX
Total Notional: $XX,XXX
Gross Leverage: X.Xx
Net Exposure: $X,XXX (long/short biased)
Position Breakdown:
| Instrument | Side | Notional | % of Total | Leverage |
|------------|------|----------|-----------|----------|
Concentration: XX% in [top instrument] ⚠️ (>30% = concentrated)
Example prompts:
- "What's my total exposure?"
- "Am I too concentrated in BTC?"
- "Show my portfolio risk breakdown"
5. Leverage Safety Check
Evaluate whether current leverage settings are appropriate:
- Get leverage info via
get_leverage_infofor each held instrument - Compare against:
- Account size (smaller accounts should use lower leverage)
- Market volatility (high volatility = lower leverage recommended)
- Number of open positions (more positions = lower per-position leverage)
General leverage guidelines:
| Account Size | Recommended Max Leverage | Rationale |
|---|---|---|
| < $1,000 | 5x | Limited margin buffer |
| $1,000 - $10,000 | 10x | Moderate buffer |
| $10,000 - $100,000 | 20x | Experienced trader range |
| > $100,000 | Per strategy | Professional risk management |
Example prompts:
- "Is my leverage too high?"
- "What leverage should I use for a $5,000 account?"
- "Review my leverage settings"
Risk Management Rules
- Never encourage excessive risk — if a user wants 100x leverage on their full balance, advise against it clearly
- Default risk per trade: 1-2% of account equity
- Always show liquidation price when discussing leveraged positions
- Warn about correlation risk — multiple positions in similar assets (e.g., BTC + ETH) are correlated
- Recommend stop losses for every position
- Account for fees — they reduce margin and affect liquidation price
- Cross margin warning — in cross mode, one liquidation can cascade to affect all positions