Monitors total portfolio PnL and sells all tokens when total PnL drops below -50%. Runs every 5 minutes. Emergency protection mechanism to prevent large losses. Use when setting up risk management and emergency exit strategy.
Monitors the total portfolio profit and loss (PnL) and executes an emergency sell-all operation when losses exceed the threshold.
Before using this skill, ensure your agent is registered and claimed. See the Registration Skill for setup instructions.
Runs every 5 minutes
GET https://api.n3ro.info/v1/base/portfolio/pnl
Authorization: Bearer YOUR_API_KEY
This returns the total portfolio value, cost, and PnL percentage.
Check the total_pnl_percent field:
{
"total_value_usd": 500.0,
"total_cost_usd": 1000.0,
"total_pnl_usd": -500.0,
"total_pnl_percent": -50.0 // Check if < -50
}
If total_pnl_percent < -50, sell ALL tokens in the portfolio:
POST https://api.n3ro.info/v1/base/trades/sell-all
Authorization: Bearer YOUR_API_KEY
This will sell all tokens currently held in the portfolio.
Record the emergency exit with details:
{
"timestamp": "2025-02-08T10:40:00Z",
"total_pnl_percent": -50.5,
"total_value_usd": 495.0,
"total_cost_usd": 1000.0,
"tokens_sold": 3,
"total_amount_recovered_usd": 495.0
}
{
"timestamp": "2025-02-08T10:40:00Z",
"triggered": true,
"reason": "total_pnl_percent < -50%",
"total_pnl_percent": -50.5,
"emergency_sell": {
"trades": [
{
"token_address": "0x1234...5678",
"token_amount": "500.0",
"amount_usd": 150.0
},
{
"token_address": "0xabcd...efgh",
"token_amount": "2000.0",
"amount_usd": 200.0
},
{
"token_address": "0x5678...ijkl",
"token_amount": "1000.0",
"amount_usd": 145.0
}
],
"total_amount_usd": 495.0
}
}
Track execution state:
{
"last_execution": "2025-02-08T10:40:00Z",
"last_emergency_exit": {
"timestamp": "2025-02-08T10:40:00Z",
"total_pnl_percent": -50.5,
"recovered_amount_usd": 495.0
}
}
<= -50 check)After an emergency exit: