# Leveraged Trade Risk Preflight Query

> Leveraged Trade Risk Preflight Query is a paid API for AI agents from proofwork-codex-0902.ophl.link, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-19).

Calculates position sizing, risk metrics, and liquidation-distance warnings for a hypothetical leveraged long or short trade without placing any order.

## Facts

- Endpoint: GET https://proofwork-codex-0902.ophl.link/x402/leveraged-trade-risk-query?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-19
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/leveraged-trade-risk-preflight-query-bd7d6f13
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_nxZ2zfvJg9KYXkQteOSsp

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 leveraged-trade-risk-preflight-query-bd7d6f13
```

Example prompt: Before I open a 10x leveraged long on BTC with my $5,000 account, entry at $65,000 and stop at $63,500, risking 1% of equity — can you run a risk preflight to show me my position size, fees at 5 bps per side, and how far my liquidation is from my stop?

## When to prefer this

Use this endpoint when an AI agent or trading system needs to validate the risk parameters of a hypothetical leveraged trade before execution — especially when the agent must confirm that a stop loss is not inside the liquidation zone. Prefer this over generic position-size calculators because it explicitly incorporates leverage, fees, slippage, and liquidation distance into a single conservative warning output. Ideal for pre-trade compliance checks, agent-driven risk guardrails, or when a user wants to sanity-check leverage settings without touching a live order.

## Known failure modes

- Missing required fields (side, account_equity_usd, entry_price, stop_price) returns a 400 validation error
- Stop price on the wrong side of entry for the given direction triggers an input validation error
- Leverage out of range (below 1 or above 200) is rejected
- Negative or zero equity or price values are rejected
- Extremely tight stop with very high leverage may produce a warning that liquidation is above/below the stop, signaling an unsafe trade setup
- Payment failure (402) if USDC micropayment not included or insufficient

## How this service works

Size a hypothetical long or short from account risk, stop, leverage, fees, and slippage; return a conservative liquidation-distance warning without placing a trade.

## Output

Returns computed position size in base units and USD notional, dollar and percentage risk, estimated fee and slippage costs, reward-to-risk ratio if a target is provided, and a conservative liquidation-distance warning indicating how far the liquidation price is from the stop loss level — all without placing any trade.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "title": "TradeRiskInput",
     "required": [
      "side",
      "account_equity_usd",
      "entry_price",
      "stop_price"
     ],
     "properties": {
      "side": {
       "enum": [
        "long",
        "short"
       ],
       "type": "string",
       "title": "Side"
      },
      "leverage": {
       "anyOf": [
        {
         "type": "number",
         "maximum": 200,
         "minimum": 1
        },
        {
         "type": "string",
         "pattern": "^(?!^[-+.]*$)[+-]?0*(?:\\d{0,4}|(?=[\\d.]{1,9}0*$)\\d{0,4}\\.\\d{0,4}0*$)"
        }
       ],
       "title": "Leverage",
       "default": "1"
      },
      "stop_price": {
       "anyOf": [
        {
         "type": "number",
         "maximum": 1000000000000,
         "exclusiveMinimum": 0
        },
        {
         "type": "string",
         "pattern": "^(?!^[-+.]*$)[+-]?0*(?:\\d{0,13}|(?=[\\d.]{1,22}0*$)\\d{0,13}\\.\\d{0,8}0*$)"
        }
       ],
       "title": "Stop Price"
      },
      "entry_price": {
       "anyOf": [
        {
         "type": "number",
         "maximum": 1000000000000,
         "exclusiveMinimum": 0
        },
        {
         "type": "string",
         "pattern": "^(?!^[-+.]*$)[+-]?0*(?:\\d{0,13}|(?=[\\d.]{1,22}0*$)\\d{0,13}\\.\\d{0,8}0*$)"
        }
       ],
       "title": "Entry Price"
      },
      "risk_percent": {
       "anyOf": [
        {
         "type": "number",
         "maximum": 100,
         "exclusiveMinimum": 0
        },
        {
         "type": "string",
         "pattern": "^(?!^[-+.]*$)[+-]?0*(?:\\d{0,4}|(?=[\\d.]{1,9}0*$)\\d{0,4}\\.\\d{0,4}0*$)"
        }
       ],
       "title": "Risk Percent",
       "default": "1"
      },
      "target_price": {
       "anyOf": [
        {
         "type": "number",
         "maximum": 1000000000000,
         "exclusiveMinimum": 0
        },
        {
         "type": "string",
         "pattern": "^(?!^[-+.]*$)[+-]?0*(?:\\d{0,13}|(?=[\\d.]{1,22}0*$)\\d{0,13}\\.\\d{0,8}0*$)"
        },
        {
         "type": "null"
        }
       
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/leveraged-trade-risk-preflight-query-bd7d6f13/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from proofwork-codex-0902.ophl.link](https://www.zero.xyz/host/proofwork-codex-0902.ophl.link/llms.txt)
