Skip to main content
POST
/
emergency-exit
curl -X POST "https://api.strike.markets/emergency-exit" \
  -H "X-API-Key: stk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "positionId": 12345
  }'
{
  "success": true,
  "refundedAmount": "100.0"
}
curl -X POST "https://api.strike.markets/emergency-exit" \
  -H "X-API-Key: stk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "positionId": 12345
  }'
{
  "success": true,
  "refundedAmount": "100.0"
}

Overview

Perform an emergency exit from a position, immediately returning your original margin without realizing profit or loss. This is a last-resort option that should only be used in exceptional circumstances.
Emergency exit forfeits any potential profit or loss and should only be used when normal position closure is not possible or during system emergencies.
This endpoint requires authentication with a valid Privy JWT token. You can only emergency exit positions that belong to your wallet.

Authentication

Include your Privy JWT token in the Authorization header:
X-API-Key: stk_your_api_key_here

Request Body

positionId
integer
required
The unique identifier of the position to emergency exit.How to get: Use Get Positions to find your position IDs
Example: 12345

Response Fields

success
boolean
Indicates if the emergency exit was completed successfully
refundedAmount
string
The original margin amount returned to your account in USD

Emergency Exit Mechanics

How It Works

  1. Position Cancelled: The position is immediately removed from the system
  2. Margin Refunded: Your original margin is returned to your balance
  3. No PnL: No profit or loss is realized, regardless of current position value
  4. No Fees: No closure fees are charged for emergency exits

What You Get Back

  • Original margin only: The exact USD amount you put up as margin
  • No interest or funding: No compensation for time held
  • No profit: Even if position was profitable, you only get original margin

What You Forfeit

  • Unrealized PnL: Any profit or loss is abandoned
  • Potential gains: No benefit from favorable price movements
  • Position exposure: All market exposure is immediately eliminated

When to Use Emergency Exit

Legitimate Use Cases

System Issues

  • Platform downtime: When normal trading is unavailable
  • Smart contract issues: If there are blockchain-related problems
  • Critical bugs: When position management is compromised

Personal Emergencies

  • Immediate liquidity needs: When you need your margin back instantly
  • Account security concerns: If you suspect account compromise
  • Technical difficulties: When you cannot access normal trading functions

Market Conditions

  • Extreme volatility: When normal price discovery breaks down
  • Liquidity crisis: When position closure might be impaired
  • Force majeure events: During exceptional market circumstances

When NOT to Use Emergency Exit

Normal Trading: Use Close Position instead
Taking Profits: You forfeit all gains with emergency exit
Cutting Losses: Normal closure may be more beneficial
Portfolio Rebalancing: Use regular trading operations
Fear of Liquidation: Normal closure is usually better

Business Logic

Position Validation

  • Position must exist and belong to authenticated wallet
  • Position must be in “open” status
  • Cannot emergency exit already closed or liquidated positions

Refund Calculation

Refunded Amount = Original Margin
Example:
  • Original margin: 100.00 USD
  • Current position value: 150.00 USD (profit) or 75.00 USD (loss)
  • Emergency exit refund: 100.00 USD (always original margin)

Balance Updates

After successful emergency exit:
  1. Position removed: Deleted from all position tracking
  2. Margin returned: Original margin added to withdrawable balance
  3. No other effects: No PnL, fees, or other adjustments

Comparison with Normal Closure

AspectNormal ClosureEmergency Exit
SpeedMarket-dependentImmediate
PnL Realization✅ Yes❌ No
Fees✅ Dynamic fees apply✅ No fees
Profit Potential✅ Keep gains❌ Forfeit gains
Loss Management❌ Realize losses✅ Avoid losses
Use CaseNormal tradingEmergency only

Error Responses

400 Bad Request
object
Invalid position ID or position cannot be emergency exited
{
  "error": 400,
  "message": "Position not found or already closed"
}
401 Unauthorized
object
Missing or invalid authentication token
{
  "error": 401,
  "message": "Authorization header missing"
}
403 Forbidden
object
Attempting to emergency exit position that doesn’t belong to your wallet
{
  "error": 403,
  "message": "Position does not belong to authenticated wallet"
}
429 Too Many Requests
object
Rate limit exceeded (10 requests per minute for trading endpoints)
{
  "error": "RATE_LIMIT_EXCEEDED",
  "message": "Rate limit exceeded. Please wait 45 seconds.",
  "retry_after": 45
}

Usage Examples

Emergency Exit from Profitable Position

Request:
{
  "positionId": 12345
}

Response:
{
  "success": true,
  "refundedAmount": "100.0"
}
Analysis: Position was profitable (125 USD potential gain), but only 100 USD margin refunded

Emergency Exit from Loss Position

Request:
{
  "positionId": 12346
}

Response:
{
  "success": true,
  "refundedAmount": "100.0"
}
Analysis: Position had 45 USD unrealized loss, but full 100 USD margin refunded

Large Position Emergency Exit

Request:
{
  "positionId": 12347
}

Response:
{
  "success": true,
  "refundedAmount": "1000.0"
}
Analysis: Regardless of position size or profit/loss, only original margin returned

Risk Considerations

Opportunity Cost

  • Forfeited profits: Any gains are lost permanently
  • Market recovery: Position might have recovered if held
  • Timing risk: Market conditions might improve after exit

Strategic Impact

  • Portfolio disruption: Removes planned market exposure
  • Reentry costs: New positions incur fresh fees and spreads
  • Tax implications: May affect accounting for gains/losses

Emotional Factors

  • Panic decisions: Emergency exits are often made under stress
  • Regret potential: May regret forfeiting profits later
  • Learning opportunity: Missing chance to learn from position management

Best Practices

Before Using Emergency Exit

  1. Assess alternatives: Can you use normal closure instead?
  2. Check market conditions: Is normal trading functioning?
  3. Consider consequences: Are you forfeiting significant profits?
  4. Evaluate urgency: Is this truly an emergency?

Decision Framework

Emergency Exit Decision Tree:

Is normal trading available?
├─ YES: Use normal closure instead
└─ NO: Continue assessment

Is this truly urgent?
├─ NO: Wait for normal trading to resume
└─ YES: Continue assessment

Can you afford to forfeit PnL?
├─ NO: Consider waiting
└─ YES: Emergency exit may be appropriate

After Emergency Exit

  1. Review decision: Document why emergency exit was necessary
  2. Monitor markets: Track what would have happened if held
  3. Learn from experience: Update risk management procedures
  4. Plan reentry: If needed, plan new position entry

Recovery and Next Steps

After an emergency exit:
  1. Confirm Refund - Check Account for margin refund
  2. Review Dashboard - Update portfolio view in Dashboard
  3. Assess Markets - Use Market Data to evaluate conditions
  4. Consider Reentry - If conditions improve, consider new positions
Emergency exit is irreversible and forfeits all potential profit. Only use when absolutely necessary.
Keep emergency exit as a true last resort. In most cases, normal position closure or even waiting out temporary issues is preferable to forfeiting potential gains.

Authorizations

X-API-Key
string
header
required

Strike Protocol API key authentication

Body

application/json
positionId
integer
required

Position ID for emergency exit

Response

Emergency exit completed successfully

success
boolean
refundedAmount
string

Amount refunded in USD