---
name: Greeks.live Backtester
description: Use when the user wants to backtest BTC or ETH option strategies, retrieve Greeks.live SABR/WV4 surfaces, calculate option IV from SABR/WV4 parameters, or fetch Deribit perpetual ticker data through the Greeks.live Backtester Data API. Trigger for requests about option strategy backtests, delta/DTE option legs, SABR/WV4 surface data, BTC/ETH option implied volatility, or perpetual ticker inputs.
---

# greeks-live-pro Data API

Fill this once before running the examples:

```bash
export USER_API_KEY="PASTE_YOUR_API_KEY_HERE"
```

`greeks-live-pro` exposes CSV-only endpoints for BTC and ETH SABR/WV4 volatility surfaces and Deribit perpetual ticker data.

Base URL:

```text
https://backtest.glvs.ai
```

## Authentication

Every Data API request requires your own API key. Ask a `greeks-live-pro` administrator to create one for your user account.

Before running any example, replace the single `User API key` placeholder near the top of this file with the API key provided by the administrator. Do not commit a real API key to source control.

Send the key with either header:

```text
Authorization: Bearer $USER_API_KEY
X-API-Key: $USER_API_KEY
```

Examples use the `USER_API_KEY` environment variable above:

```bash
BASE_URL="https://backtest.glvs.ai"
```

## Contract

- Successful responses are raw CSV, not JSON-wrapped.
- Error responses are JSON with standard HTTP status codes.
- All times are UTC ISO timestamps, for example `2026-05-01T07:00:00Z`.
- `asset` accepts `BTC` or `ETH` and defaults to `BTC`.
- Single-point queries use `time`.
- Batch queries use `start_time`, `end_time`, and `interval`.
- Supported intervals: `1m`, `5m`, `15m`, `30m`, `1h`, `4h`, `1d`.
- A request can contain at most 10,000 target buckets.
- `derivative-ticker.csv` is limited to 90 days per batch request by default. Split longer ranges.
- The as-of lookback window is 7 days. If no source data exists within that window, the target bucket is omitted.

Successful CSV response headers:

```text
Content-Type: text/csv; charset=utf-8
Content-Disposition: attachment; filename="<endpoint-specific-name>.csv"
```

## Time Grid Semantics

The API does not dump every raw row in `[start_time, end_time]`. It builds a fixed target grid and performs as-of selection for each target timestamp:

```text
target_times = start_time, start_time + interval, ..., end_time
```

For each `query_time`, the API returns the latest source record with:

```text
source_time <= query_time
source_time >= query_time - 7 days
```

This avoids look-ahead bias in backtests.

## GET /api/v1/sabr.csv

Returns SABR/WV4 surface rows. Each target time returns all valid expiries from the selected as-of surface timestamp.

### Query Parameters

| Name | Required | Description |
| --- | --- | --- |
| `time` | single-point only | UTC ISO timestamp. Mutually exclusive with batch parameters. |
| `start_time` | batch only | First UTC target timestamp. |
| `end_time` | batch only | Last UTC target timestamp. Inclusive on the interval grid. |
| `interval` | batch only | One of `1m`, `5m`, `15m`, `30m`, `1h`, `4h`, `1d`. |
| `asset` | no | `BTC` or `ETH`; defaults to `BTC`. |

### Examples

```bash
curl -H "Authorization: Bearer $USER_API_KEY" \
  -o sabr.csv \
  "$BASE_URL/api/v1/sabr.csv?time=2026-05-01T07:00:00Z"
```

```bash
curl -H "Authorization: Bearer $USER_API_KEY" \
  -o sabr_5m.csv \
  "$BASE_URL/api/v1/sabr.csv?asset=ETH&start_time=2026-05-01T07:00:00Z&end_time=2026-05-01T08:00:00Z&interval=5m"
```

### CSV Columns

| Column | Description |
| --- | --- |
| `query_time` | Requested target grid timestamp. |
| `source_time` | Actual SABR surface timestamp selected by as-of lookup. |
| `asset` | Asset code: `BTC` or `ETH`. |
| `expiry` | Option expiry code from the source surface. |
| `t` | Time to expiry in years. |
| `forward` | Expiry-matched forward price used by the surface. For option pricing at the same expiry, prefer this over the selected asset's perpetual ticker. |
| `alpha` | SABR/WV4 alpha parameter. |
| `rho` | SABR/WV4 rho parameter. |
| `nu` | SABR/WV4 nu parameter. |
| `c0` | WV4 parameter. |
| `cd` | WV4 down-wing parameter. |
| `cw` | WV4 wing-width parameter. |
| `kp` | WV4 put-side shape parameter. |
| `kc` | WV4 call-side shape parameter. |
| `model_mode` | Surface model mode, for example `wv4_8p`. |
| `rmse` | Calibration RMSE. |
| `n_strikes` | Number of strikes used in calibration. |
| `surface_confidence` | Surface quality/confidence label emitted by the model. |

## Compute Option IV From SABR/WV4 Parameters

Use one selected surface row from `sabr.csv`. The returned IV is Black-76/lognormal implied volatility. Call/put type does not change IV; it only changes Black-76 price, delta, and greeks.

For same-expiry option pricing, use the row's `forward` as the forward/futures input. The derivative ticker endpoint returns the selected asset's `BTC-PERPETUAL` or `ETH-PERPETUAL` data, which is useful for perpetual hedge and reference data but is not the same-expiry option forward.

For WV4 rows, compute IV from:

```text
F = forward
T = t
alpha = alpha
rho = rho
nu = nu
cd = cd
cw = cw
kp = kp
kc = kc
K = option strike
```

WV4 IV:

```text
x = ln(K / F)
sqrt_t = sqrt(T)
z = x / (alpha * sqrt_t)
s2 = rho * nu * sqrt_t
eta = 1

e = sqrt(z^2 + eta^2)
s_eta = z / e
w = 0.5 * (1 + s_eta)
kappa = kp * (1 - w) + kc * w
phi = z^2 / (z^2 + kappa^2)

c0 = (4 - 3 * rho^2) * nu^2 * T / 6
c_eff = c0 + cd * s_eta + cw * phi
l = 1 + s2 * z
q = 2 * z^2 * c_eff
a = max(l^2 + q, 1e-16)
r = sqrt(a)
v = max(0.5 * (l + r), 1e-16)

iv = alpha * sqrt(v)
```

If the target DTE lies between two expiries, interpolate total variance at fixed log-moneyness:

```text
F_target = linear_interp(T_target, T_low, F_low, T_high, F_high)
m = ln(K_target / F_target)

K_low = F_low * exp(m)
K_high = F_high * exp(m)

iv_low = IV(surface_low, K_low)
iv_high = IV(surface_high, K_high)

total_variance = linear_interp(
  T_target,
  T_low, iv_low^2 * T_low,
  T_high, iv_high^2 * T_high
)

iv_target = sqrt(total_variance / T_target)
```

## GET /api/v1/derivative-ticker.csv

Returns Deribit BTC or ETH perpetual ticker data. Each target time returns the latest ticker row at or before `query_time`.

### Query Parameters

| Name | Required | Description |
| --- | --- | --- |
| `time` | single-point only | UTC ISO timestamp. Mutually exclusive with batch parameters. |
| `start_time` | batch only | First UTC target timestamp. |
| `end_time` | batch only | Last UTC target timestamp. Inclusive on the interval grid. |
| `interval` | batch only | One of `1m`, `5m`, `15m`, `30m`, `1h`, `4h`, `1d`. |
| `asset` | no | `BTC` or `ETH`; defaults to `BTC`. |

The symbol follows the selected asset: `BTC-PERPETUAL` or `ETH-PERPETUAL`.

### Example

```bash
curl -H "Authorization: Bearer $USER_API_KEY" \
  -o ticker_eth.csv \
  "$BASE_URL/api/v1/derivative-ticker.csv?asset=ETH&start_time=2026-05-01T07:00:00Z&end_time=2026-05-01T08:00:00Z&interval=1m"
```

### CSV Columns

| Column | Description |
| --- | --- |
| `query_time` | Requested target grid timestamp. |
| `source_time` | Actual ticker timestamp selected by as-of lookup. |
| `asset` | Asset code: `BTC` or `ETH`. |
| `exchange` | Exchange name, currently `deribit`. |
| `symbol` | Ticker symbol: `BTC-PERPETUAL` or `ETH-PERPETUAL`. |
| `last_price` | Last traded price when available. |
| `mark_price` | Derivative mark price. |
| `index_price` | Underlying index price. |
| `funding_rate` | Current funding rate when available. |
| `funding_ts` | Funding timestamp when available. |
| `predicted_funding_rate` | Predicted funding rate when available. |
| `open_interest` | Open interest when available. |

## Usage Limits

Defaults:

- 60 Data API requests per API key per UTC hour.
- 10,000 target buckets per request.
- 90 days maximum ticker batch span.
- App-local Data API weighted units may return `429` when the service is busy.

Split large workloads into smaller windows. This is especially important for ticker queries because very large time spans scan much more source data even when the output grid is coarse.

## Errors

| Status | Meaning |
| --- | --- |
| `400` | Invalid time shape, unsupported interval, end before start, too many buckets, or ticker span too large. |
| `401` | Missing or invalid API key. |
| `403` | API key owner disabled or key revoked. |
| `404` | No SABR surface or ticker data found for the requested grid. |
| `429` | API hourly quota exceeded or Data API is busy. |
| `503` | Backend query/runtime failure. |

Example:

```json
{"detail":"derivative-ticker.csv supports at most 90 days per request. Split the time range into smaller windows."}
```
