{"uid":"cap_qG6iN8eFEmICvvdYPqUfN","slug":"ozmium-agent-api-gains-network-close-trade-at-market-2d6af7d4","name":"Ozmium Agent API – Gains Network Close Trade at Market","description":"Gains Network closeTradeMarket calldata (close an open position at market; expectedPrice guards the fill). POST /v1/tx/risk/close { index, expectedPrice }.","url":"https://ozmium.org/v1/tx/risk/close","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"index":{"type":"number"},"expectedPrice":{"type":"number"}}},"responseSchema":null,"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_wa8q_8n21PrsA8O_Av2T7","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":"Generates Gains Network closeTradeMarket calldata to close an open perpetual position at market price with an expectedPrice guard.","exampleAgentPrompt":"Close my open Gains Network position at trade index 5 at market price — use an expected price of 3250.00 as the fill guard.","exampleUseCases":null,"resultDescription":"Returns the encoded closeTradeMarket calldata (unsigned transaction payload) ready to be signed and broadcast on-chain to close the specified Gains Network perpetual position at market, with the expectedPrice field protecting against unfavorable fills.","failureModes":["Invalid or non-existent trade index returns an error","expectedPrice too far from current market causes fill rejection on-chain","Missing required fields (index or expectedPrice) returns a 400 validation error","Network or provider outage returns a 5xx error","Payment not included or insufficient returns 402 Payment Required"],"whenToPreferThis":"Use this endpoint when an AI agent needs to close an open Gains Network (gTrade) perpetual position at the current market price and requires the raw on-chain calldata with an expectedPrice fill guard. Prefer this over manually constructing calldata or using generic swap endpoints when the target is a Gains Network trade position.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T18:46:33.663Z","isFirstParty":false}