# finmath Health Factor Calculator

> finmath Health Factor Calculator is a paid API for AI agents from finmath.qzqh5rrbkz.workers.dev, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-15).

Computes the DeFi health factor for a collateralized lending position given debt value, collateral value, and liquidation threshold

## Facts

- Endpoint: POST https://finmath.qzqh5rrbkz.workers.dev/v1/health_factor
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/finmath-health-factor-calculator-cb3174b0
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_ZmKv-dFj_CCeaZOnNz3Yf

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 finmath-health-factor-calculator-cb3174b0 -d '<json body>'
```

Example prompt: What's the health factor on my DeFi lending position? I have $5000 in collateral, $2000 in debt, and my liquidation threshold is 0.8.

## When to prefer this

Use this endpoint when you need exact, deterministic health factor arithmetic for a DeFi lending position and cannot trust LLM-approximated math. Ideal for agents monitoring collateralized positions on protocols like Aave or Compound, or when building liquidation alerting systems. Prefer this over manual calculation when correctness and reproducibility are critical.

## Known failure modes

- Missing required fields (debt_value, collateral_value, or liquidation_threshold) returns a 400 error
- Zero or negative collateral_value may produce division errors or undefined results
- Payment failure via x402 protocol returns 402 Payment Required
- Invalid number types for input fields cause schema validation errors
- Extremely large or small numbers may produce precision edge cases

## How this service works

Deterministic finance and crypto math for AI agents: TradFi (NPV, IRR, XIRR, Black-Scholes + Greeks, bonds, VaR, Sharpe) and DeFi (impermanent loss, perp liquidation, funding, Uniswap v3, health factor, cost basis). Exact, model-free arithmetic that LLMs get wrong — priced per call in USDC.

## Output

Returns a numeric health factor result along with metadata. A health factor above 1.0 indicates a safe position; below 1.0 means the position is eligible for liquidation. The result is computed with exact arithmetic, not LLM approximation.

## Example request

```json
{
 "debt_value": 5000,
 "collateral_value": 10000,
 "liquidation_threshold": 0.75
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "debt_value",
  "collateral_value",
  "liquidation_threshold"
 ],
 "properties": {
  "debt_value": {
   "type": "number",
   "description": "debt_value"
  },
  "collateral_value": {
   "type": "number",
   "description": "collateral_value"
  },
  "liquidation_threshold": {
   "type": "number",
   "description": "liquidation_threshold"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "result",
  "meta"
 ],
 "properties": {
  "meta": {
   "type": "object"
  },
  "result": {}
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/finmath-health-factor-calculator-cb3174b0/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from finmath.qzqh5rrbkz.workers.dev](https://www.zero.xyz/host/finmath.qzqh5rrbkz.workers.dev/llms.txt)
