# OneSource Deepstate Market Cost-to-Quote Analytics

> OneSource Deepstate Market Cost-to-Quote Analytics is a paid API for AI agents from api.onesource.io, paid per call via x402, $0.02/call, status unknown (last checked 2026-09-14).

Returns gas cost analytics (fees, rests, cancels) for resting and cancelling orders on a Deepstate order book market, bucketed by time period

## Facts

- Endpoint: GET https://api.onesource.io/deepstate/v1/analytics/cost-to-quote
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/onesource-deepstate-market-cost-to-quote-analytics-0c555191
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_5VFnXWQb2TiS4r-OBdqXD

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 onesource-deepstate-market-cost-to-quote-analytics-0c555191
```

Example prompt: Can you pull the gas cost analytics for Deepstate order book 'ETH-USDC' from January 1 to January 31, broken down by 1-hour buckets, so I can see how much was spent on rests and cancels?

## When to prefer this

Use this endpoint when you need gas cost analytics specifically for a Deepstate order book market — it provides granular fee breakdowns (L1 vs total, rests vs cancels) with time-bucketed aggregations that generic EVM RPC endpoints cannot supply. Prefer this over raw RPC calls when you need pre-aggregated cost-to-quote metrics rather than raw transaction data.

## Known failure modes

- Missing required 'book' query parameter returns a 400 error
- Invalid 'res' enum value (not '1h' or '1d') returns a validation error
- Invalid or non-existent book ID returns empty or error response
- Date range with no data returns empty buckets or zero totals
- Payment failure or missing x402 payment header returns 402 Payment Required

## How this service works

Deepstate, the on-chain order-book exchange on Robinhood Chain. Gas spent resting and cancelling orders for a market.

## Output

Returns aggregated gas cost metrics for the specified order book and time range, including: total fee, median fee, L1 fee, L1 share percentage, rest count, cancel count, and transaction count — both as overall totals and broken down into time buckets (1h or 1d) with market session labels.

## 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",
     "required": [
      "book"
     ],
     "properties": {
      "to": {
       "type": "string"
      },
      "res": {
       "enum": [
        "1h",
        "1d"
       ],
       "type": "string"
      },
      "book": {
       "type": "string"
      },
      "from": {
       "type": "string"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "to": {
       "type": "string"
      },
      "from": {
       "type": "string"
      },
      "totals": {
       "type": "object",
       "properties": {
        "rests": {
         "type": "integer"
        },
        "cancels": {
         "type": "integer"
        },
        "tx_count": {
         "type": "integer"
        },
        "l1_fee_raw": {
         "type": "string"
        },
        "l1_share_pct": {
         "type": "number"
        },
        "total_fee_raw": {
         "type": "string"
        },
        "median_fee_raw": {
         "type": "string"
        }
       }
      },
      "book_id": {
       "type": "string"
      },
      "buckets": {
       "type": "array",
       "items": {
        "type": "object",
        "properties": {
         "rests": {
          "type": "integer"
         },
         "bucket": {
          "type": "string"
         },
         "cancels": {
          "type": "integer"
         },
         "tx_count": {
          "type": "integer"
         },
         "l1_fee_raw": {
          "type": "string"
         },
         "l1_share_pct": {
          "type": "number"
         },
         "total_fee_raw": {
          "type": "string"
         },
         "market_session": {
          "type": "string"
         },
         "median_fee_raw": {
          "type": "string"
         }
        }
       }
      },
      "book_slug": {
       "type": "string"
      },
      "book_label": {
       "type": "string"
      },
      "resol
… (truncated)
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "to": "2026-09-02T16:00:00Z",
  "from": "2026-09-02T14:00:00Z",
  "totals": {
   "rests": 427,
   "cancels": 385,
   "tx_count": 790,
   "l1_fee_raw": "19018200000000000",
   "l1_share_pct": 18.99,
   "total_fee_raw": "100178400000000000",
   "median_fee_raw": "119700000000000"
  },
  "book_id": "0xdf941c235503a5d2e67aee5dea00f2965f99421c0d034bd77f924c05c66bf399",
  "buckets": [
   {
    "rests": 219,
    "bucket": "2026-09-02T14:00:00Z",
    "cancels": 198,
    "tx_count": 402,
    "l1_fee_raw": "9186100000000000",
    "l1_share_pct": 18.75,
    "total_fee_raw": "48973600000000000",
    "market_session": "regular",
    "median_fee_raw": "118000000000000"
   }
  ],
  "book_slug": "NVDA-USDG",
  "book_label": "NVDA/USDG",
  "resolution": "1h"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/onesource-deepstate-market-cost-to-quote-analytics-0c555191/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.onesource.io](https://www.zero.xyz/host/api.onesource.io/llms.txt)
