# Ozmium Agent API – Gains Network Close Trade at Market

> Ozmium Agent API – Gains Network Close Trade at Market is a paid API for AI agents from ozmium.org, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-13).

Generates Gains Network closeTradeMarket calldata to close an open perpetual position at market price with an expectedPrice guard.

## Facts

- Endpoint: POST https://ozmium.org/v1/tx/risk/close
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/ozmium-agent-api-gains-network-close-trade-at-market-2d6af7d4
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_qG6iN8eFEmICvvdYPqUfN

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 ozmium-agent-api-gains-network-close-trade-at-market-2d6af7d4 -d '<json body>'
```

Example prompt: Close my open Gains Network position at trade index 5 at market price — use an expected price of 3250.00 as the fill guard.

## When to prefer this

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.

## Known failure modes

- 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

## How this service works

Gains Network closeTradeMarket calldata (close an open position at market; expectedPrice guards the fill). POST /v1/tx/risk/close { index, expectedPrice }.

## Output

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.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "index": {
   "type": "number"
  },
  "expectedPrice": {
   "type": "number"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/ozmium-agent-api-gains-network-close-trade-at-market-2d6af7d4/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from ozmium.org](https://www.zero.xyz/host/ozmium.org/llms.txt)
