{"uid":"cap_-G1_TzYovcahjSlIed2Vx","slug":"otto-ai-close-trading-position-85073c2b","name":"Otto AI — Close Trading Position","description":"Close an open perpetual position on Hyperliquid (full or partial). Cancels all attached TP/SL trigger orders automatically.","url":"https://x402.ottoai.services/close-position","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"asset":{"type":"string","description":"Asset ticker of the open position"},"userAddress":{"type":"string","description":"Optional for external x402 callers — the operated account is your verified payment payer, not this field. Internal/dApp callers must send a valid EVM address."},"partialClosePercentage":{"type":"number","description":"Percentage of the position to close (1-100). 100 closes it fully. Required — an omitted percentage is rejected, never treated as a full close."}}},"responseSchema":{"type":"json","example":{"asset":"BTC","status":"success","exitPrice":67500,"closedSize":250,"realizedPnl":"15.23","closedPercentage":100}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.01","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.01/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_s8bHa3d2FuOFj4g9xj4VD","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.01","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Closes an open trading position for a given asset, returning exit price, closed size, and realized PnL","exampleAgentPrompt":"Close my BTC position of 250 units on Otto AI — I want to exit now and see the realized PnL.","exampleUseCases":[{"title":"Exit losing position, realize losses","prompt":"I need to get out of my ETH perpetual position right now — it's going against me and I want to close it and see exactly how much I lost."},{"title":"Lock in profits on winning trade","prompt":"My SOL position is up nicely today — go ahead and close it out for me and tell me what I made in realized PnL."},{"title":"Automated stop-loss position closure","prompt":"My trading bot just hit the stop-loss threshold on my BTC futures position — close it immediately and give me the exit price and final PnL so I can log the result."}],"resultDescription":"Returns a JSON object with the asset symbol, success flag, exit price (e.g. 67500), closed size (e.g. 250), and realized PnL in USD (e.g. 15.23). Confirms the trade was closed and the financial outcome.","failureModes":["Position not found or already closed — returns error with position ID","Insufficient liquidity to close at current price","Asset symbol not recognized or unsupported","Payment of $0.01 USDC not settled via x402 — request rejected","Network or exchange connectivity failure causing execution timeout"],"whenToPreferThis":"Use this endpoint when you need to programmatically exit an open crypto trading position and receive the realized PnL, exit price, and confirmation — especially for automated trading agents managing Hyperliquid or DeFi perpetual positions via x402 micropayments.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T06:38:58.506Z","isFirstParty":false}