Perps
Funding, marks, books and carry for US-regulated perps, benchmarked against offshore venues
- Connector software
- Free and open source
- Service credentials
- Not needed
- Query Farm hosting
- Available · $10/month organization minimum
Use with an agent
Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.
npx skills add Query-farm/vgi-skills --skill orchard
Copy this request into your coding agent to get started.
Use https://query.farm/products/orchard/connectors/perps/index.md to help me query Perps with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.
Which venues are reachable right now
Example output · captured
- Connector release
- v0.2.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
SELECT venue, status, instrument_count, last_error
FROM perps.main.venues()
ORDER BY venue
| venue | status | instrument_count | last_error |
|---|---|---|---|
| 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 |
Quick start
Choose where to run Perps, then follow the steps below.
The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.
1. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
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;
INSTALL vgi FROM community;
LOAD vgi;
2. Attach the connector
Attach with uvx
Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.
ATTACH 'perps' AS perps (
TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-perps-worker'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'perps' AS perps (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-perps:0.2.0'
);
3. Run a query
SELECT venue, status, instrument_count, last_error
FROM perps.main.venues()
ORDER BY venue
Run the connector on a server you manage. You operate the service and choose who can connect.
1. Deploy the connector on your server
Follow the connector’s deployment instructions. Use its supported HTTP transport, or launch it remotely over SSH. The connection guide explains both options.
2. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
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;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach the connector
For an HTTP deployment, replace the example URL with your endpoint. Add the authentication options your deployment requires. For SSH, use the SSH connection instructions.
ATTACH 'perps' AS perps
(TYPE vgi, LOCATION 'https://your-connector.example.com');
4. Run a query
SELECT venue, status, instrument_count, last_error
FROM perps.main.venues()
ORDER BY venue
Query Farm operates Perps for your team. Hosting has a $10 monthly minimum per organization; usage counts toward it. From $2.97 per instance-month ($10 monthly minimum).
1. Create your hosted connector
Open the console, choose your organization and deployment size, and add any service credentials there.
2. Install the vgi extension
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;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach your deployment
Copy the ATTACH statement from your deployment in the console and run it in DuckDB or Haybarn. Use perps as the catalog alias for the query below.
4. Run a query
SELECT venue, status, instrument_count, last_error
FROM perps.main.venues()
ORDER BY venue
Technical details
- Verified connector release
- v0.2.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
- Verified on
- December 1, 2026
Pin a version for production
When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.
Attach with uvx
Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.
ATTACH 'perps' AS perps (
TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-perps-worker'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'perps' AS perps (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-perps:0.2.0'
);
Overview
Normalized market data for US-regulated perpetual futures on Kalshi, Coinbase Derivatives and Bitnomial, with Hyperliquid, Binance and Bybit as an offshore benchmark: funding, marks, order books, trades and carry analytics. Read-only, no API key needed.
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 — Kalshi perpetuals: markets, funding, books
- Coinbase Advanced Trade API — Coinbase Derivatives perpetual-style futures
- Bitnomial REST API and the OG.com public API — the other US-regulated venues
- Hyperliquid docs — funding, liquidations and HIP-3 builder perps on the offshore benchmark
- CCXT — the library used for the Hyperliquid, Binance and Bybit public endpoints
Catalog
Everything perps exposes once attached — read straight from the worker's
released build.
main 17 functions
Perpetual-futures table functions: venue reference, normalized market data, carry analytics and venue-only raw fields
Schema examples (21)
Which venues are reachable right now
SELECT venue, status, instrument_count, last_error
FROM perps.main.venues()
ORDER BY venue;
| venue | status | instrument_count | last_error |
|---|---|---|---|
| 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 |
What Coinbase Derivatives does not serve publicly, and why
SELECT capability, support, notes
FROM perps.main.capabilities(venue := 'coinbase')
WHERE support <> 'supported'
ORDER BY capability;
Every BTC perp: how much BTC one contract is and how often it funds
SELECT venue, symbol, contract_size, funding_interval_hours, funding_cap
FROM perps.main.instruments(underlying := 'BTC')
ORDER BY venue, contract_size;
Average annualized BTC funding per venue over the last week
SELECT venue, avg(rate_annualized) AS mean_apr, count(*) AS settlements
FROM perps.main.funding(underlying := 'BTC', start_date := now() - INTERVAL 7 DAY)
GROUP BY venue
ORDER BY mean_apr DESC;
17 more examples
ETH perps side by side: price, premium, carry and size
SELECT venue, symbol, mark_price, premium_bps, funding_rate_annualized,
open_interest_usd
FROM perps.main.marks(underlying := 'ETH')
ORDER BY open_interest_usd DESC NULLS LAST;
Notional resting in the top 25 levels of Kalshi's BTC perp, per side
SELECT side, max(cum_usd) AS depth_usd
FROM perps.main.order_book('kalshi', 'KXBTCPERP', depth := 25)
GROUP BY side
ORDER BY side;
Aggressor buy vs sell notional on Kalshi BTC over 15 minutes
SELECT taker_side, count(*) AS n, sum(size_usd) AS usd
FROM perps.main.trades('kalshi', 'KXBTCPERP', start_date := now() - INTERVAL 15 MINUTE)
GROUP BY taker_side
ORDER BY taker_side;
Two weeks of daily Kalshi BTC closes, volume and open interest
SELECT ts, close, volume_usd, open_interest_contracts
FROM perps.main.candles('kalshi', 'KXBTCPERP', bar := '1d')
ORDER BY ts DESC
LIMIT 14;
Which BTC perp trades richest to its own index
SELECT venue, symbol, premium_bps
FROM perps.main.premium(underlying := 'BTC')
ORDER BY premium_bps DESC NULLS LAST;
The widest BTC funding carry between any two venues this week
SELECT venue_a, venue_b, spread_bps, carry_trade
FROM perps.main.funding_spread('BTC')
ORDER BY abs(spread_bps) DESC
LIMIT 5;
What a $50k ETH clip costs on Kalshi
SELECT spread_bps, buy_cost_bps, sell_cost_bps, imbalance
FROM perps.main.depth_metrics('kalshi', 'KXETHPERP', notional_usd := 50000);
Estimated ETH liquidation bands on Hyperliquid with the default leverage mix
SELECT side, leverage, liquidation_price, cum_notional_usd
FROM perps.main.liquidation_estimate('hyperliquid', 'ETH')
WHERE feasible
ORDER BY side, distance_pct;
Where the next BTC funding settlement is heading
SELECT weight_accrued, accrued_rate * 1e4 AS accrued_bps,
projected_rate_annualized
FROM perps.main.kalshi_funding_nowcast('KXBTCPERP');
Kalshi crypto perps' funding deadbands
SELECT symbol, funding_deadband, funding_limit_unit
FROM perps.main.raw_kalshi_markets()
WHERE asset_class = 'Crypto'
ORDER BY symbol;
Mean and worst BTC premium over the last half hour
SELECT avg(premium_bps) AS mean_bps, max(abs(premium_bps)) AS worst_bps
FROM perps.main.raw_kalshi_premium_index('KXBTCPERP', start_date := now() - INTERVAL 30 MINUTE);
Coinbase perps with the highest overnight margin
SELECT symbol, intraday_long_margin_rate, overnight_long_margin_rate
FROM perps.main.raw_coinbase_products()
ORDER BY overnight_long_margin_rate DESC
LIMIT 5;
Bitnomial perps with their size tier and margin rate
SELECT symbol, contract_size, product_group_margin_rate
FROM perps.main.raw_bitnomial_products()
ORDER BY symbol;
How much of its per-interval funding cap each BTC perp's current rate uses (marks joined to instruments; venues that publish no cap drop out)
SELECT m.venue, m.symbol, m.funding_rate, i.funding_cap,
abs(m.funding_rate) / i.funding_cap AS cap_used
FROM perps.main.marks(underlying := 'BTC') AS m
JOIN perps.main.instruments(underlying := 'BTC') AS i USING (venue, symbol)
WHERE i.funding_cap IS NOT NULL
ORDER BY cap_used DESC, m.venue, m.symbol;
Venues that answer right now and serve a public order book, with the endpoint each uses
SELECT v.venue, v.status, c.notes
FROM perps.main.venues() AS v
JOIN perps.main.capabilities() AS c USING (venue)
WHERE c.capability = 'order_book' AND c.support = 'supported' AND v.status = 'ok'
ORDER BY v.venue;
Kalshi BTC perp, last week: each daily bar's open-to-close return next to the funding its three settlements charged longs, both in bps
WITH bars AS (SELECT ts, coalesce(lead(ts) OVER (ORDER BY ts), ts + INTERVAL 1 DAY) AS bar_end, (close / open - 1) * 1e4 AS return_bps FROM perps.main.candles('kalshi', 'KXBTCPERP', bar := '1d')) SELECT b.ts, b.return_bps, sum(f.rate_bps) AS funding_bps
FROM bars AS b
JOIN perps.main.funding(venue := 'kalshi', underlying := 'BTC') AS f ON f.funding_time > b.ts AND f.funding_time <= b.bar_end
GROUP BY b.ts, b.return_bps
HAVING count(*) = 3
ORDER BY b.ts;
The next Kalshi BTC settlement's projected annualized rate against the past week's settled average
SELECT n.funding_time, n.weight_accrued, n.projected_rate_annualized,
h.week_mean_apr, n.projected_rate_annualized - h.week_mean_apr AS vs_week
FROM perps.main.kalshi_funding_nowcast('KXBTCPERP') AS n
CROSS JOIN (SELECT avg(rate_annualized) AS week_mean_apr FROM perps.main.funding(venue := 'kalshi', underlying := 'BTC')) AS h;
candles (venue VARCHAR, symbol VARCHAR, bar := VARCHAR, end_date := TIMESTAMP WITH TIME ZONE, start_date := TIMESTAMP WITH TIME ZONE)
OHLCV bars for one contract (1m, 1h, 1d) with prices per underlying unit and volume in contracts and USD
Two weeks of daily Kalshi BTC closes, volume and open interest
SELECT ts, close, volume_usd, open_interest_contracts
FROM perps.main.candles('kalshi', 'KXBTCPERP', bar := '1d')
ORDER BY ts DESC
LIMIT 14;
Coinbase ETH perp trading range over the last day
SELECT max(high) - min(low) AS range_usd
FROM perps.main.candles('coinbase', 'ETP-20DEC30-CDE', start_date := now() - INTERVAL 1 DAY);
Kalshi BTC perp, last week: each daily bar's open-to-close return next to the funding its three settlements charged longs, both in bps
WITH bars AS (SELECT ts, coalesce(lead(ts) OVER (ORDER BY ts), ts + INTERVAL 1 DAY) AS bar_end, (close / open - 1) * 1e4 AS return_bps FROM perps.main.candles('kalshi', 'KXBTCPERP', bar := '1d')) SELECT b.ts, b.return_bps, sum(f.rate_bps) AS funding_bps
FROM bars AS b
JOIN perps.main.funding(venue := 'kalshi', underlying := 'BTC') AS f ON f.funding_time > b.ts AND f.funding_time <= b.bar_end
GROUP BY b.ts, b.return_bps
HAVING count(*) = 3
ORDER BY b.ts;
capabilities (venue := VARCHAR)
Capability matrix: which data each venue serves publicly, with auth, depth and caveats
What Coinbase Derivatives does not serve publicly, and why
SELECT capability, support, notes
FROM perps.main.capabilities(venue := 'coinbase')
WHERE support <> 'supported'
ORDER BY capability;
How many venues fully support each capability
SELECT capability,
count(*) FILTER (WHERE support = 'supported') AS venues_supported
FROM perps.main.capabilities()
GROUP BY capability
ORDER BY capability;
SELECT venue
FROM perps.main.capabilities()
WHERE capability = 'order_book' AND support = 'supported'
ORDER BY venue;
1 more example
SELECT support, auth_required
FROM perps.main.capabilities(venue := 'kalshi')
WHERE capability = 'funding_history';
depth_metrics (venue VARCHAR, symbol VARCHAR, depth := BIGINT, notional_usd := DOUBLE)
Liquidity summary for one contract: spread, bps cost to fill a USD notional on each side, depth and imbalance
What a $50k ETH clip costs on Kalshi
SELECT spread_bps, buy_cost_bps, sell_cost_bps, imbalance
FROM perps.main.depth_metrics('kalshi', 'KXETHPERP', notional_usd := 50000);
Can Coinbase's BTC perp absorb a $1m market buy
SELECT venue, buy_cost_bps, fully_filled
FROM perps.main.depth_metrics('coinbase', 'BIP-20DEC30-CDE', notional_usd := 1000000);
funding (end_date := TIMESTAMP WITH TIME ZONE, include_estimates := BOOLEAN, start_date := TIMESTAMP WITH TIME ZONE, underlying := VARCHAR, venue := VARCHAR)
Funding-rate history across venues, positive = longs pay shorts, with per-interval and annualized rates
Average annualized BTC funding per venue over the last week
SELECT venue, avg(rate_annualized) AS mean_apr, count(*) AS settlements
FROM perps.main.funding(underlying := 'BTC', start_date := now() - INTERVAL 7 DAY)
GROUP BY venue
ORDER BY mean_apr DESC;
Bitnomial's last nine ETH funding settlements with the mark-vs-index premium
SELECT funding_time, rate_bps, premium_bps
FROM perps.main.funding(venue := 'bitnomial', underlying := 'ETH')
ORDER BY funding_time DESC
LIMIT 9;
funding_spread (underlying VARCHAR, end_date := TIMESTAMP WITH TIME ZONE, start_date := TIMESTAMP WITH TIME ZONE)
Cross-venue funding carry for one underlying: mean annualized rates per contract and the spread for every venue pair
The widest BTC funding carry between any two venues this week
SELECT venue_a, venue_b, spread_bps, carry_trade
FROM perps.main.funding_spread('BTC')
ORDER BY abs(spread_bps) DESC
LIMIT 5;
30-day ETH carry of Bitnomial against every other venue
SELECT symbol_a, symbol_b, spread_bps
FROM perps.main.funding_spread('ETH', start_date := now() - INTERVAL 30 DAY)
WHERE venue_a = 'bitnomial' OR venue_b = 'bitnomial'
ORDER BY spread_bps;
instruments (include_inactive := BOOLEAN, underlying := VARCHAR, venue := VARCHAR)
Perpetual contract specifications per venue: underlying, contract size, tick, funding interval, cap, margin
Every BTC perp: how much BTC one contract is and how often it funds
SELECT venue, symbol, contract_size, funding_interval_hours, funding_cap
FROM perps.main.instruments(underlying := 'BTC')
ORDER BY venue, contract_size;
Kalshi's active perps by asset class
SELECT asset_class, count(*) AS contracts
FROM perps.main.instruments(venue := 'kalshi')
GROUP BY asset_class
ORDER BY contracts DESC;
kalshi_funding_nowcast (symbol VARCHAR, assume_premium := DOUBLE, funding_time := TIMESTAMP WITH TIME ZONE, recent_minutes := BIGINT)
Kalshi funding for one window, computed from the per-second premium with Kalshi's linear time weights: accrued so far, projected to settlement, or reconstructed for a past window
Where the next BTC funding settlement is heading
SELECT weight_accrued, accrued_rate * 1e4 AS accrued_bps,
projected_rate_annualized
FROM perps.main.kalshi_funding_nowcast('KXBTCPERP');
Settlement if the BTC premium holds at 2 bps for the rest of the window
SELECT projected_rate_annualized
FROM perps.main.kalshi_funding_nowcast('KXBTCPERP', assume_premium := 0.0002);
The next Kalshi BTC settlement's projected annualized rate against the past week's settled average
SELECT n.funding_time, n.weight_accrued, n.projected_rate_annualized,
h.week_mean_apr, n.projected_rate_annualized - h.week_mean_apr AS vs_week
FROM perps.main.kalshi_funding_nowcast('KXBTCPERP') AS n
CROSS JOIN (SELECT avg(rate_annualized) AS week_mean_apr FROM perps.main.funding(venue := 'kalshi', underlying := 'BTC')) AS h;
liquidation_estimate (venue VARCHAR, symbol VARCHAR, entry_price := DOUBLE, leverages := VARCHAR, mm_rate := DOUBLE, weights := VARCHAR)
ESTIMATE of liquidation price bands from open interest, an assumed leverage mix and the venue's maintenance margin
Estimated ETH liquidation bands on Hyperliquid with the default leverage mix
SELECT side, leverage, liquidation_price, cum_notional_usd
FROM perps.main.liquidation_estimate('hyperliquid', 'ETH')
WHERE feasible
ORDER BY side, distance_pct;
Kalshi BTC bands under an assumed 5% maintenance margin
SELECT side, leverage, distance_pct
FROM perps.main.liquidation_estimate('kalshi', 'KXBTCPERP', mm_rate := 0.05, leverages := '3,5,10', weights := '0.5,0.3,0.2')
ORDER BY side, leverage;
marks (underlying := VARCHAR, venue := VARCHAR)
Live snapshot per contract: mark, index, bid/ask, premium, current funding, open interest in contracts and USD
ETH perps side by side: price, premium, carry and size
SELECT venue, symbol, mark_price, premium_bps, funding_rate_annualized,
open_interest_usd
FROM perps.main.marks(underlying := 'ETH')
ORDER BY open_interest_usd DESC NULLS LAST;
Kalshi's ten largest perps by open-interest notional
SELECT underlying, open_interest_usd
FROM perps.main.marks(venue := 'kalshi')
ORDER BY open_interest_usd DESC NULLS LAST
LIMIT 10;
How much of its per-interval funding cap each BTC perp's current rate uses (marks joined to instruments; venues that publish no cap drop out)
SELECT m.venue, m.symbol, m.funding_rate, i.funding_cap,
abs(m.funding_rate) / i.funding_cap AS cap_used
FROM perps.main.marks(underlying := 'BTC') AS m
JOIN perps.main.instruments(underlying := 'BTC') AS i USING (venue, symbol)
WHERE i.funding_cap IS NOT NULL
ORDER BY cap_used DESC, m.venue, m.symbol;
order_book (venue VARCHAR, symbol VARCHAR, depth := BIGINT)
Aggregated order book for one contract with sizes in contracts, underlying units and USD, plus cumulative depth
Notional resting in the top 25 levels of Kalshi's BTC perp, per side
SELECT side, max(cum_usd) AS depth_usd
FROM perps.main.order_book('kalshi', 'KXBTCPERP', depth := 25)
GROUP BY side
ORDER BY side;
Top five levels of Coinbase's nano BTC perp
SELECT side, level, price, size_usd
FROM perps.main.order_book('coinbase', 'BIP-20DEC30-CDE', depth := 5)
ORDER BY side, level;
raw_bitnomial_products (symbol := VARCHAR)
Bitnomial perpetual fields: size tier, funding bounds, daily price limits, settlement, product-group margin rate
Bitnomial perps with their size tier and margin rate
SELECT symbol, contract_size, product_group_margin_rate
FROM perps.main.raw_bitnomial_products()
ORDER BY symbol;
Today's price limits around settlement for Bitnomial's BTC perps
SELECT symbol, price_limit_lower, settlement_price, price_limit_upper
FROM perps.main.raw_bitnomial_products()
WHERE base_symbol LIKE 'BTC%'
ORDER BY symbol;
raw_coinbase_products (symbol := VARCHAR)
Coinbase perp-style futures fields: intraday and overnight FCM margin by side, settlement, sessions
Coinbase perps with the highest overnight margin
SELECT symbol, intraday_long_margin_rate, overnight_long_margin_rate
FROM perps.main.raw_coinbase_products()
ORDER BY overnight_long_margin_rate DESC
LIMIT 5;
Where Coinbase charges shorts the most extra overnight margin
SELECT symbol,
overnight_short_margin_rate - overnight_long_margin_rate AS short_premium
FROM perps.main.raw_coinbase_products()
ORDER BY short_premium DESC
LIMIT 5;
raw_kalshi_markets (symbol := VARCHAR)
Kalshi-only perps fields: per-contract marks, funding deadband and cap unit, leverage by size, halts
Kalshi crypto perps' funding deadbands
SELECT symbol, funding_deadband, funding_limit_unit
FROM perps.main.raw_kalshi_markets()
WHERE asset_class = 'Crypto'
ORDER BY symbol;
Kalshi markets whose leverage shrinks most at $1m notional
SELECT symbol, json_extract(leverage_estimates, '$."1000000"') AS lev_at_1m
FROM perps.main.raw_kalshi_markets()
WHERE status = 'active'
ORDER BY lev_at_1m
LIMIT 10;
trades (venue VARCHAR, symbol VARCHAR, end_date := TIMESTAMP WITH TIME ZONE, max_trades := BIGINT, start_date := TIMESTAMP WITH TIME ZONE)
Public trades for one contract in a time window, normalized price and USD size, with taker side
Aggressor buy vs sell notional on Kalshi BTC over 15 minutes
SELECT taker_side, count(*) AS n, sum(size_usd) AS usd
FROM perps.main.trades('kalshi', 'KXBTCPERP', start_date := now() - INTERVAL 15 MINUTE)
GROUP BY taker_side
ORDER BY taker_side;
Per-minute traded notional on Coinbase's BTC perp
SELECT date_trunc('minute', ts) AS minute, sum(size_usd) AS usd
FROM perps.main.trades('coinbase', 'BIP-20DEC30-CDE', max_trades := 2000)
GROUP BY minute
ORDER BY minute;
venues (probe := BOOLEAN)
List every venue with its regulatory type, supported capabilities and live health
Which venues are reachable right now
SELECT venue, status, instrument_count, last_error
FROM perps.main.venues()
ORDER BY venue;
| venue | status | instrument_count | last_error |
|---|---|---|---|
| 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 |
US-regulated venues and how many capabilities each supports, without network calls
SELECT venue, venue_type, len(capabilities) AS n_capabilities
FROM perps.main.venues(probe := false)
WHERE venue_type = 'us_regulated'
ORDER BY venue;
Venues that answer right now and serve a public order book, with the endpoint each uses
SELECT v.venue, v.status, c.notes
FROM perps.main.venues() AS v
JOIN perps.main.capabilities() AS c USING (venue)
WHERE c.capability = 'order_book' AND c.support = 'supported' AND v.status = 'ok'
ORDER BY v.venue;
Try these queries
What Coinbase Derivatives does not serve publicly, and why
SELECT capability, support, notes
FROM perps.main.capabilities(venue := 'coinbase')
WHERE support <> 'supported'
ORDER BY capability
Uses capabilities
Every BTC perp: how much BTC one contract is and how often it funds
SELECT venue, symbol, contract_size, funding_interval_hours, funding_cap
FROM perps.main.instruments(underlying := 'BTC')
ORDER BY venue, contract_size
Uses instruments
Average annualized BTC funding per venue over the last week
SELECT venue, avg(rate_annualized) AS mean_apr, count(*) AS settlements
FROM perps.main.funding(underlying := 'BTC', start_date := now() - INTERVAL 7 DAY)
GROUP BY venue
ORDER BY mean_apr DESC
Uses funding
ETH perps side by side: price, premium, carry and size
SELECT venue, symbol, mark_price, premium_bps, funding_rate_annualized,
open_interest_usd
FROM perps.main.marks(underlying := 'ETH')
ORDER BY open_interest_usd DESC NULLS LAST
Uses marks
Notional resting in the top 25 levels of Kalshi's BTC perp, per side
SELECT side, max(cum_usd) AS depth_usd
FROM perps.main.order_book('kalshi', 'KXBTCPERP', depth := 25)
GROUP BY side
ORDER BY side
Uses order_book
Aggressor buy vs sell notional on Kalshi BTC over 15 minutes
SELECT taker_side, count(*) AS n, sum(size_usd) AS usd
FROM perps.main.trades('kalshi', 'KXBTCPERP', start_date := now() - INTERVAL 15 MINUTE)
GROUP BY taker_side
ORDER BY taker_side
Uses trades
33 more examples in the Catalog, each listed under the table or function it uses.
Questions it can answer
Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.
- Using the perps worker, how many distinct venues in the catalog are US-regulated?
- On Kalshi, how much bitcoin does one contract of the BTC perpetual represent?
- In the perps worker, if Kalshi's BTC perp shows a positive funding rate, which side pays?
- Does Kalshi list single-stock perpetual futures? Name one underlying stock if so.
- How many funding settlements did Kalshi's BTC perpetual have over the last three days?
- What is the current mark price of the ETH perpetual on Coinbase Derivatives, in USD per ETH?
Perps is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.
Related workers
CCXT
Markets & finance
Candles, quotes, order books, trades and perpetual funding from 100+ crypto exchanges
Kalshi
Markets & finance
Kalshi prediction markets — markets, order books, candlesticks, trades and events
Quant
Markets & finance
Black-Scholes option prices and Greeks, bond pricing and yield, and day-count math as SQL functions, backed by QuantLib