# QuantOracle Portfolio Rebalance Plan

> QuantOracle Portfolio Rebalance Plan is a paid API for AI agents from api.quantoracle.dev, paid per call via x402, $0.05/call, status unknown (last checked 2026-10-12).

Calculates an optimal set of trades to rebalance a crypto portfolio toward target allocation weights, minimizing drift and transaction costs

## Facts

- Endpoint: POST https://api.quantoracle.dev/v1/portfolio/rebalance-plan?utm_source=zero.xyz
- Price: $0.05/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-12
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/api-quantoracle-dev-fe604f58
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_WSkshfRtG4IwnDRMCZLSR

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 api-quantoracle-dev-fe604f58 -d '<json body>'
```

Example prompt: My crypto portfolio is currently BTC $50,000, ETH $30,000, SOL $10,000, and USDC $10,000 — can you generate a rebalancing plan to hit target weights of 40% BTC, 35% ETH, 15% SOL, 10% USDC, with a minimum trade size of $500 and transaction costs of 10 bps?

## When to prefer this

Use this endpoint when you need a precise, cost-aware rebalancing trade plan for a multi-asset crypto portfolio with specific target weights. Prefer this over generic allocation calculators when you need drift analysis (before and after), transaction cost accounting in basis points, and a minimum trade threshold to avoid dust trades. Best for agents managing automated portfolio rebalancing workflows.

## Known failure modes

- Missing or invalid target_weights that don't sum to 1.0 — returns 400 validation error
- current_holdings with negative or zero values — returns 400 bad request
- min_trade_usd larger than portfolio imbalances — may result in zero trades returned
- transaction_cost_bps outside valid range — returns 400 validation error
- Network timeout or service unavailability — returns 5xx error
- Payment failure via x402 protocol — returns 402 Payment Required

## How this service works

Free, fast quant finance calculators powered by a deterministic, multi-chain API. Black-Scholes, options profit, Kelly, VaR, crypto liquidation, and more.

## Output

Returns a list of specific buy/sell trades (asset, action, amount in USD, estimated cost), the number of trades, portfolio value, current vs target weights, drift before and after rebalancing, total rebalancing cost in USD and basis points, and post-rebalance weights — all computed in under 15ms.

## Example request

```json
{
 "target_weights": {
  "BTC": 0.5,
  "ETH": 0.3,
  "SOL": 0.2
 },
 "current_holdings": {
  "BTC": 50000,
  "ETH": 30000,
  "SOL": 20000
 }
}
```

## 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",
    "bodyType",
    "body"
   ],
   "properties": {
    "body": {
     "type": "object",
     "title": "RebalancePlanIn",
     "required": [
      "current_holdings",
      "target_weights"
     ],
     "properties": {
      "min_trade_usd": {
       "type": "number",
       "title": "Min Trade Usd",
       "default": 10,
       "minimum": 0,
       "description": "Minimum trade size in USD (smaller drifts are ignored)"
      },
      "target_weights": {
       "type": "object",
       "title": "Target Weights",
       "description": "Asset symbol -> target weight (must sum to ~1.0)",
       "additionalProperties": {
        "type": "number"
       }
      },
      "current_holdings": {
       "type": "object",
       "title": "Current Holdings",
       "description": "Asset symbol -> current dollar value",
       "additionalProperties": {
        "type": "number"
       }
      },
      "transaction_cost_bps": {
       "type": "number",
       "title": "Transaction Cost Bps",
       "default": 10,
       "minimum": 0,
       "description": "One-way transaction cost in bps (incl. spread + commission)"
      }
     }
    },
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "POST",
      "PUT",
      "PATCH"
     ],
     "type": "string"
    },
    "bodyType": {
     "enum": [
      "json",
      "form-data",
      "text"
     ],
     "type": "string"
    }
   },
   "additionalProperties": false
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/api-quantoracle-dev-fe604f58/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.quantoracle.dev](https://www.zero.xyz/host/api.quantoracle.dev/llms.txt)
