mcpField
B
blofin-risk-manager

blofin-risk-manager

github.com/blofinOther881 installsUpdated 32w ago
Repository

About blofin-risk-manager

A BloFin trading risk-management skill for traders that assesses position sizing, liquidation exposure, leverage, and portfolio risk using account and market data.

Key features

  1. 01Pre-trade risk assessment
  2. 02Risk-based position sizing
  3. 03Liquidation distance monitoring
  4. 04Portfolio exposure analysis
  5. 05Leverage safety checks

Use cases

  1. 01Assess risk before opening a leveraged trade
  2. 02Compare position sizes at different leverage levels
  3. 03Identify positions nearing liquidation
  4. 04Review portfolio concentration and exposure

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/blofin/blofin-skills-hub --skill blofin-risk-manager

After installing, type/blofin-risk-managerin Claude Code to confirm it loaded.

Details

From the project README

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:

  1. Get account balance via get_balance — available equity
  2. Get instrument specs via get_instruments — contract value, max leverage
  3. Get current price via get_tickers
  4. Get existing positions via get_positions — current exposure
  5. 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:

  1. Ask user for risk tolerance (default: 2% of equity per trade)
  2. Get account equity from get_balance
  3. Get contract specs from get_instruments
  4. Get current price from get_tickers
  5. Calculate recommended position size at different leverage levels

Present as a table:

LeveragePosition SizeNotionalRequired MarginLiquidation Distance
5xXX contracts$X,XXX$XXXXX%
10xXX contracts$X,XXX$XXXXX%
20xXX contracts$X,XXX$XXXXX%

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:

  1. Get all positions via get_positions

  2. Get mark prices via get_mark_price for each position

  3. For each position, calculate:

    • Distance to liquidation: |markPrice - liquidationPrice| / markPrice * 100%
    • Unrealized PnL and PnL ratio
    • Effective leverage (notional value / margin)
  4. Risk classification:

Distance to LiquidationRisk LevelAction
> 30%LowNormal monitoring
15% - 30%MediumConsider reducing position or adding margin
5% - 15%HighStrongly recommend reducing position
< 5%CriticalImmediate 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:

  1. Get all positions via get_positions
  2. Get account balance via get_balance
  3. 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:

  1. Get leverage info via get_leverage_info for each held instrument
  2. 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 SizeRecommended Max LeverageRationale
< $1,0005xLimited margin buffer
$1,000 - $10,00010xModerate buffer
$10,000 - $100,00020xExperienced trader range
> $100,000Per strategyProfessional 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

  1. Never encourage excessive risk — if a user wants 100x leverage on their full balance, advise against it clearly
  2. Default risk per trade: 1-2% of account equity
  3. Always show liquidation price when discussing leveraged positions
  4. Warn about correlation risk — multiple positions in similar assets (e.g., BTC + ETH) are correlated
  5. Recommend stop losses for every position
  6. Account for fees — they reduce margin and affect liquidation price
  7. Cross margin warning — in cross mode, one liquidation can cascade to affect all positions

Comments

Markdown supported