{
  "x402Version": 2,
  "id": 26451,
  "slug": "26451",
  "resource": "https://agentpay.tools/tools/pre_trade_check/call",
  "description": "Pre-trade risk check for AI agents trading crypto: live orderbook slippage at YOUR size, side-aware funding carry, open-interest crowding, and optional contract security — composed into a single ok/caution/avoid verdict with per-factor reasons and raw data embedded. Answers 'is this trade sane?' before trading, not after. Replaces four API integrations plus the judgment layer.",
  "type": "http",
  "serviceName": "AgentPay Pre-Trade Risk Check",
  "resourceType": "Payments",
  "accepts": [
    {
      "scheme": "exact",
      "network": "eip155:8453",
      "payTo": "0xE8B25A72dD6aeF69515452a61AD231C7DF2843b7",
      "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "amount": "10000",
      "amountUsd": 0.01,
      "maxTimeoutSeconds": 300
    },
    {
      "scheme": "exact",
      "network": "stacks:1",
      "payTo": "SP23XKWSEQ9D4CVPT0H39N2TYVEE5AJECPKW6CZ3C",
      "asset": "SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token",
      "amount": "13",
      "maxTimeoutSeconds": 119
    },
    {
      "scheme": "exact",
      "network": "stacks:1",
      "payTo": "SP23XKWSEQ9D4CVPT0H39N2TYVEE5AJECPKW6CZ3C",
      "asset": "STX",
      "amount": "24957",
      "maxTimeoutSeconds": 119
    }
  ],
  "outputSchema": {
    "properties": {
      "example": {
        "type": "object"
      },
      "type": {
        "type": "string"
      }
    },
    "required": [
      "type"
    ],
    "type": "object"
  },
  "extensions": {
    "bazaar": {
      "description": "Pre-trade risk check for AI agents trading crypto: 'I want to long $X of SYMBOL — is now sane?' Live slippage at your size + side-aware funding carry + OI crowding + optional security scan → one ok/caution/avoid verdict with per-factor breakdown and raw components embedded.",
      "info": {
        "errors": [
          {
            "body": {
              "error": "<summary>",
              "reason": "<machine-readable reason>"
            },
            "retry": "Re-request the challenge and pay again",
            "status": 402,
            "when": "No payment attached (this challenge), or the attached payment failed verification: wrong amount/recipient, memo mismatch, expired, or already used (replay)"
          },
          {
            "body": {
              "detail": [
                {
                  "loc": [
                    "body"
                  ],
                  "msg": "<what is wrong>",
                  "type": "<error type>"
                }
              ]
            },
            "retry": "Fix the body and retry with a fresh payment",
            "status": 422,
            "when": "Request body present but malformed (invalid JSON or wrong field types) WITH a payment header attached — checked BEFORE settlement, so the payment is never consumed. An unpaid malformed request gets the 402, not a 422"
          },
          {
            "body": {
              "detail": "Tool '<name>' not found"
            },
            "status": 404,
            "when": "Unknown tool name"
          },
          {
            "body": {
              "error": "Rate limit exceeded"
            },
            "retry": "Back off and retry after a minute",
            "status": 429,
            "when": "Rate limited (per-IP and per-wallet limits)"
          },
          {
            "body": {
              "error": "Tool execution failed",
              "payment_status": "refund_pending",
              "tool": "<name>"
            },
            "status": 500,
            "when": "Payment settled on-chain but tool execution failed — the payment is marked refund_pending automatically; you are not charged for a failed call"
          },
          {
            "body": {
              "detail": "<what is unavailable>"
            },
            "retry": "Retry shortly",
            "status": 503,
            "when": "Tool temporarily unavailable, or the gateway cannot persist the challenge (fail-closed)"
          }
        ],
        "input": {
          "body": {
            "parameters": {
              "side": "long",
              "size_usd": 50000,
              "symbol": "ETH"
            }
          },
          "bodyType": "json",
          "method": "POST",
          "type": "http"
        },
        "output": {
          "example": {
            "factors": {
              "carry": {
                "level": "ok",
                "median_funding_pct": 0.01,
                "reason": "carry unremarkable"
              },
              "crowding": {
                "level": "ok",
                "long_short_ratio": 1.2,
                "reason": "positioning unremarkable"
              },
              "liquidity": {
                "level": "ok",
                "reason": "fills within 0.001% of best price",
                "slippage_pct": 0.001
              },
              "security": {
                "level": "skipped",
                "reason": "no token_address provided"
              }
            },
            "side": "long",
            "size_usd": 50000,
            "symbol": "ETH",
            "verdict": "ok"
          },
          "type": "json"
        }
      },
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "properties": {
          "input": {
            "additionalProperties": false,
            "properties": {
              "body": {
                "properties": {
                  "parameters": {
                    "properties": {
                      "side": {
                        "description": "Trade direction (funding carry is side-aware; default long)",
                        "enum": [
                          "long",
                          "short"
                        ],
                        "type": "string"
                      },
                      "size_usd": {
                        "description": "Intended position size in USD (drives the slippage check; default 10000)",
                        "type": "number"
                      },
                      "symbol": {
                        "description": "Asset to check, e.g. 'ETH', 'BTC', 'SOL'",
                        "type": "string"
                      },
                      "token_address": {
                        "description": "Optional ERC-20 address — adds a GoPlus security scan",
                        "type": "string"
                      }
                    },
                    "required": [
                      "symbol"
                    ],
                    "type": "object"
                  }
                },
                "type": "object"
              },
              "bodyType": {
                "enum": [
                  "json",
                  "form-data",
                  "text"
                ],
                "type": "string"
              },
              "method": {
                "enum": [
                  "POST"
                ],
                "type": "string"
              },
              "type": {
                "const": "http",
                "type": "string"
              }
            },
            "required": [
              "type",
              "bodyType",
              "body",
              "method"
            ],
            "type": "object"
          },
          "output": {
            "properties": {
              "example": {
                "type": "object"
              },
              "type": {
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "type": "object"
          }
        },
        "required": [
          "input"
        ],
        "type": "object"
      }
    }
  },
  "tags": [
    "trading",
    "trade",
    "risk",
    "slippage",
    "pre-trade-check",
    "bazaar"
  ],
  "sourceHost": "agentpay.tools",
  "lastUpdated": "2026-10-11T05:18:08.358Z",
  "quality": {
    "calls30d": 27,
    "uniquePayers30d": 15,
    "lastCalledAt": "2026-10-11T05:18:07.89Z"
  },
  "metadata": {
    "serviceName": "AgentPay Pre-Trade Risk Check",
    "extensions": {
      "bazaar": {
        "description": "Pre-trade risk check for AI agents trading crypto: 'I want to long $X of SYMBOL — is now sane?' Live slippage at your size + side-aware funding carry + OI crowding + optional security scan → one ok/caution/avoid verdict with per-factor breakdown and raw components embedded.",
        "info": {
          "errors": [
            {
              "body": {
                "error": "<summary>",
                "reason": "<machine-readable reason>"
              },
              "retry": "Re-request the challenge and pay again",
              "status": 402,
              "when": "No payment attached (this challenge), or the attached payment failed verification: wrong amount/recipient, memo mismatch, expired, or already used (replay)"
            },
            {
              "body": {
                "detail": [
                  {
                    "loc": [
                      "body"
                    ],
                    "msg": "<what is wrong>",
                    "type": "<error type>"
                  }
                ]
              },
              "retry": "Fix the body and retry with a fresh payment",
              "status": 422,
              "when": "Request body present but malformed (invalid JSON or wrong field types) WITH a payment header attached — checked BEFORE settlement, so the payment is never consumed. An unpaid malformed request gets the 402, not a 422"
            },
            {
              "body": {
                "detail": "Tool '<name>' not found"
              },
              "status": 404,
              "when": "Unknown tool name"
            },
            {
              "body": {
                "error": "Rate limit exceeded"
              },
              "retry": "Back off and retry after a minute",
              "status": 429,
              "when": "Rate limited (per-IP and per-wallet limits)"
            },
            {
              "body": {
                "error": "Tool execution failed",
                "payment_status": "refund_pending",
                "tool": "<name>"
              },
              "status": 500,
              "when": "Payment settled on-chain but tool execution failed — the payment is marked refund_pending automatically; you are not charged for a failed call"
            },
            {
              "body": {
                "detail": "<what is unavailable>"
              },
              "retry": "Retry shortly",
              "status": 503,
              "when": "Tool temporarily unavailable, or the gateway cannot persist the challenge (fail-closed)"
            }
          ],
          "input": {
            "body": {
              "parameters": {
                "side": "long",
                "size_usd": 50000,
                "symbol": "ETH"
              }
            },
            "bodyType": "json",
            "method": "POST",
            "type": "http"
          },
          "output": {
            "example": {
              "factors": {
                "carry": {
                  "level": "ok",
                  "median_funding_pct": 0.01,
                  "reason": "carry unremarkable"
                },
                "crowding": {
                  "level": "ok",
                  "long_short_ratio": 1.2,
                  "reason": "positioning unremarkable"
                },
                "liquidity": {
                  "level": "ok",
                  "reason": "fills within 0.001% of best price",
                  "slippage_pct": 0.001
                },
                "security": {
                  "level": "skipped",
                  "reason": "no token_address provided"
                }
              },
              "side": "long",
              "size_usd": 50000,
              "symbol": "ETH",
              "verdict": "ok"
            },
            "type": "json"
          }
        },
        "schema": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "properties": {
            "input": {
              "additionalProperties": false,
              "properties": {
                "body": {
                  "properties": {
                    "parameters": {
                      "properties": {
                        "side": {
                          "description": "Trade direction (funding carry is side-aware; default long)",
                          "enum": [
                            "long",
                            "short"
                          ],
                          "type": "string"
                        },
                        "size_usd": {
                          "description": "Intended position size in USD (drives the slippage check; default 10000)",
                          "type": "number"
                        },
                        "symbol": {
                          "description": "Asset to check, e.g. 'ETH', 'BTC', 'SOL'",
                          "type": "string"
                        },
                        "token_address": {
                          "description": "Optional ERC-20 address — adds a GoPlus security scan",
                          "type": "string"
                        }
                      },
                      "required": [
                        "symbol"
                      ],
                      "type": "object"
                    }
                  },
                  "type": "object"
                },
                "bodyType": {
                  "enum": [
                    "json",
                    "form-data",
                    "text"
                  ],
                  "type": "string"
                },
                "method": {
                  "enum": [
                    "POST"
                  ],
                  "type": "string"
                },
                "type": {
                  "const": "http",
                  "type": "string"
                }
              },
              "required": [
                "type",
                "bodyType",
                "body",
                "method"
              ],
              "type": "object"
            },
            "output": {
              "properties": {
                "example": {
                  "type": "object"
                },
                "type": {
                  "type": "string"
                }
              },
              "required": [
                "type"
              ],
              "type": "object"
            }
          },
          "required": [
            "input"
          ],
          "type": "object"
        }
      }
    }
  },
  "liveness": {
    "reliability": null
  },
  "verified": false,
  "featured": false,
  "provider": {
    "host": "agentpay.tools",
    "manifest_name": "agentpay.tools",
    "source": "cdp-mirror",
    "source_manifest_url": "https://api.cdp.coinbase.com/platform/v2/x402/discovery/resources",
    "submitted_at": "2026-10-14T01:15:01.050Z"
  },
  "exampleResponse": {
    "example": {},
    "type": "string"
  }
}