Otto AI · Close Position

by Otto AI

POSTBase

$0.01

per call · USD Coin on Base

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

Endpoint

POST https://x402.ottoai.services/close-position

3

Calls / 30d

2

Unique payers / 30d

Aug 28

Last called

exact

Payment scheme

Call this service

TypeScript · @x402/fetch
import { wrapFetchWithPayment } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const fetchWithPay = wrapFetchWithPayment(fetch, account);

const res = await fetchWithPay("https://x402.ottoai.services/close-position", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "asset": "BTC",
    "partialClosePercentage": 100
  }),
});
const data = await res.json();
cURL
curl -X POST \
  "https://x402.ottoai.services/close-position" \
  -H "Content-Type: application/json" \
  -d '{"asset":"BTC","partialClosePercentage":100}' \
  -H "X-PAYMENT: <signed x402 payment>"

Example response

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

Payment details

Pay to0x5bb4b0c766e0d5d791d9403fc275c22064709f68
AssetUSD Coin · 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
NetworksBase
Schemesexact

Is this your API?

Pin it to the top of Market Data and the homepage with a featured placement.

Get featured →

More from Otto AI & similar services