# Otto AI — Close Trading Position

> Otto AI — Close Trading Position is a paid API for AI agents from x402.ottoai.services, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-14).

Closes an open trading position for a given asset, returning exit price, closed size, and realized PnL

## Facts

- Endpoint: POST https://x402.ottoai.services/close-position
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/otto-ai-close-trading-position-85073c2b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_-G1_TzYovcahjSlIed2Vx

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability otto-ai-close-trading-position-85073c2b -d '<json body>'
```

Example prompt: Close my BTC position of 250 units on Otto AI — I want to exit now and see the realized PnL.

## When to prefer this

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.

## Known failure modes

- 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

## How this service works

Close an open perpetual position on Hyperliquid (full or partial). Cancels all attached TP/SL trigger orders automatically.

## Output

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.

## Request schema (JSON Schema)

```json
{
 "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."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "asset": "BTC",
  "status": "success",
  "exitPrice": 67500,
  "closedSize": 250,
  "realizedPnl": "15.23",
  "closedPercentage": 100
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/otto-ai-close-trading-position-85073c2b/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402.ottoai.services](https://www.zero.xyz/host/x402.ottoai.services/llms.txt)
