# Perps

> Funding, marks, books and carry for US-regulated perps, benchmarked against offshore venues

This page includes setup, release pins, credentials, hosting and verification evidence. [JSON alternative](https://query.farm/products/orchard/api/v1/connectors/perps.json) contains the same setup facts for structured readers; choose one format.

## Runtime and release

Use DuckDB or Haybarn **2.0.1** with **VGI protocol 3.4**.
Catalog alias: `perps`. Release: [v0.2.0](https://github.com/Query-farm/vgi-perps/releases/tag/v0.2.0). Metadata generated: 2026-12-01T18:22:16+00:00.

## Choose where it runs

- On your machine: use an installation method below. No Query Farm account is required for local execution.
- Self-host: follow [the connector deployment instructions](https://github.com/Query-farm/vgi-perps) and [connection guide](https://query.farm/vgi/connect-to-a-worker/). Use your real endpoint and its authentication settings.
- Query Farm hosted: [create a deployment](https://auth.queryfarm.cloud/console/new?worker=perps). Hosting has a $10 monthly minimum per organization; usage and license fees may apply. Copy the deployment-specific ATTACH from the console.

## Service credentials and prerequisites

No service credentials are declared by this connector. Individual datasets, input files or deployments may have their own prerequisites.

Secret parameter required flags describe the upstream declaration; they do not override the service-level mode above. Keep secrets in environment variables or the deployment secret store. SQL values in angle brackets are placeholders, not automatic environment lookups. Native DuckDB and Haybarn 2.0.1 do not provide a SQL getenv() function, even when worker-supplied snippets mention it. Read environment variables in your application and pass credential values through client parameter bindings (for example, Python con.execute("CREATE SECRET stripe (TYPE stripe, api_key ?)", [os.environ["STRIPE_API_KEY"]]) after attaching the connector. Omit unused optional parameters and keep real values out of saved SQL and logs.

## Install the extension

In stock DuckDB:

```sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
```

In Haybarn:

```sql
INSTALL vgi FROM community;
LOAD vgi;
```

## Attach the connector

The local recipes below pin the catalog release for repeatability. A public demo endpoint follows its deployed release.

### uvx

Attach with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

```sql
ATTACH 'perps' AS perps (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/vgi-perps@v0.2.0 vgi-perps-worker'
);
```

### Docker

Attach the signed image

Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.

```sql
ATTACH 'perps' AS perps (
  TYPE vgi,
  LOCATION 'oci://ghcr.io/query-farm/vgi-perps:0.2.0'
);
```

## Which venues are reachable right now

Service credentials required for this example: not declared by this example; check the connector requirements above.

```sql
SELECT venue, status, instrument_count, last_error FROM perps.main.venues() ORDER BY venue
```

- [perps.main.venues — table_function](https://query.farm/products/orchard/connectors/perps/objects/table_function.bWFpbg.dmVudWVz.md): exact declaration for this example.

Execution evidence: **captured_result**.

```json
{
  "status": "captured_result",
  "capturedAt": "2026-12-01T06:16:30+00:00",
  "engineVersion": "2.0.1",
  "protocolVersion": "3.4.0",
  "releaseTag": "v0.2.0",
  "sample": {
    "columns": [
      "venue",
      "status",
      "instrument_count",
      "last_error"
    ],
    "types": [
      "VARCHAR",
      "VARCHAR",
      "BIGINT",
      "VARCHAR"
    ],
    "rows": [
      [
        "binance",
        "error",
        null,
        "VenueError: binance (ccxt binanceusdm) fetch_markets failed: ExchangeNotAvailab…"
      ],
      [
        "bitnomial",
        "ok",
        34,
        null
      ],
      [
        "bybit",
        "error",
        null,
        "VenueError: bybit (ccxt bybit) fetch_markets failed: RateLimitExceeded: bybit G…"
      ],
      [
        "coinbase",
        "ok",
        29,
        null
      ],
      [
        "hyperliquid",
        "ok",
        357,
        null
      ]
    ],
    "more": true
  }
}
```

## Connector reference

### Perpetual futures, normalized across venues

Funding, marks, books, trades and bars for **US-regulated perpetual futures** (Kalshi, Coinbase Derivatives, Bitnomial) next to an **offshore benchmark** (Hyperliquid, Binance USD-M, Bybit), in one schema.

**Conventions.** Prices are quote currency per one unit of the underlying (USD per BTC, per share, per troy ounce), whatever the venue's own quoting. Sizes are contracts, and `contract_size` is underlying units per contract. Funding rates are decimal fractions per interval with one sign convention: **positive means longs pay shorts**. Annualized rates are simple: `rate * 8760 / interval_hours`. Times are UTC `TIMESTAMPTZ`.

Each venue sits behind its own adapter; the venue documentation in the repository records how each venue's units and signs were mapped, with sources. Read-only public market data, no account or order endpoints. Market data belongs to the venues and is subject to their terms of use.

## Sources and references

- [Kalshi API](https://docs.kalshi.com/) — Kalshi perpetuals: markets, funding, books
- [Coinbase Advanced Trade API](https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/overview) — Coinbase Derivatives perpetual-style futures
- [Bitnomial REST API](https://bitnomial.com/exchange/docs/api/rest/overview) and the [OG.com public API](https://exchange-developer.crypto.com/fcm-b2c/v1/docs/api/rest-introduction) — the other US-regulated venues
- [Hyperliquid docs](https://hyperliquid.gitbook.io/hyperliquid-docs) — funding, liquidations and HIP-3 builder perps on the offshore benchmark
- [CCXT](https://github.com/ccxt/ccxt) — the library used for the Hyperliquid, Binance and Bybit public endpoints

## Find the exact SQL object

[Browse 17 object declarations](https://query.farm/products/orchard/api/v1/connectors/perps/objects.json) or [search within this connector](https://query.farm/products/orchard/api/v1/search.json?kind=object&connector=perps&q=perps).

Follow one format of each needed object for complete argument types, defaults, named flags, return columns and examples. Existing links above can replace another search. For questions about hosting, credentials or supported operations, stop once the documentation answers the question; SQL and unrelated object lookups are unnecessary.

## Verification and interpretation

- Missing, null, or undeclared metadata means unknown; do not invent defaults, credential scope, platform support or endpoint URLs.
- Search is keyword retrieval, not proof of a capability. Read the exact object declaration before generating SQL.
- A table and a table function can have the same name. Preserve parentheses and use the matching overload and schema.
- Service credentials, external data availability and deployment authentication are separate requirements.
- Catalog verification records the harvest environment. It is not proof that every query or current live API call succeeds. Only an example with captured_result has a saved result for that exact SQL.

```json
{
  "generatedAt": "2026-12-01T18:22:16+00:00",
  "repository": "https://github.com/Query-farm/vgi-perps",
  "harvest": {
    "status": "ok",
    "method": "subprocess",
    "error": null,
    "vgi_version": "9773130dde"
  },
  "catalogVerification": {
    "verified": true,
    "status": "passed",
    "total": 2,
    "passed": 2,
    "failed": 0,
    "needs_credentials": 0,
    "location": "uvx --from git+https://github.com/Query-farm/vgi-perps@v0.2.0 vgi-perps-worker",
    "transport": "subprocess",
    "environment": {
      "vgi_extension_version": "9773130dde",
      "haybarn_version": "2.0.1rc3",
      "engine_version": "v2.0.1",
      "python": "3.12.4",
      "platform": "darwin_arm64",
      "protocol_version": "3.4.0"
    },
    "checked_at": "2026-12-01T06:15:42+00:00"
  },
  "interpretation": "Catalog verification records the harvest environment. It is not proof that every query or current live API call succeeds. Only an example with captured_result has a saved result for that exact SQL."
}
```
