360 Secure SkillHub
360 安全技能中心

vike-perp-spread-history

通过 Vike 市场数据服务查询一个币种在两个交易所之间的永续或现货价差历史,返回以基点表示的开收盘、均价、极值边界、采样分钟和盘口宽度,并帮助判断价差是否持续或可交易,也可查看当前最便宜与最贵场所。

分类:数据
vikeio
vikeio
热度 38.28
最近更新 2026-12-02 09:58:39

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add vikeio/vike-perp-spread-history
兼容性
通用兼容
联网要求
需要联网
数据出网
必须出网
Metadata
name
vike-perp-spread-history
description
How the price gap between two exchanges moved over time for one coin - perp against perp or spot against perp on any two venues, per hour, 4 hours or day since 2026-05-30, in basis points (open, close, average and the bounds of the extremes), with how many minutes each leg was priced and each leg's bid-ask width; plus the gap between its cheapest and dearest venue right now. Use when the user asks "how has the BTC gap between Binance and OKX moved this week" / "does Bybit spot trade above the Hyperliquid perp" / "is this cross-exchange spread persistent or a one-off" / "average SOL spread Binance vs Bybit last month" / "where is ETH cheapest right now".
allowed-tools
Bash(vike-data:*)

vike-perp-spread-history

One coin, two legs, one series: leg A's price over leg B's, in basis points. 1 request per call. Pass the base asset (BTC, not BTCUSDT); venues are lower case.

Call it

Use the first of these that is available:

  1. MCP: perp_spreads_history with symbol, exchange_a, exchange_b (all three required) and the optional market_a, market_b, interval, start, end. For the gap now: perp_spreads with symbol.
  2. CLI:
    vike-data md spreads-history BTC --a binance --b okx --interval 4h --json            # the last 7 days, 4-hour buckets
    vike-data md spreads-history ETH --a bybit --market-a spot --b hyperliquid --interval 1d --start 2026-11-01 --json
    vike-data md spreads-history SOL --a binance --b bybit --interval 1h --start 2026-11-28 --end 2026-11-29 --json
    vike-data md spreads BTC --json                                                       # now: BTC's cheapest and dearest venue, whatever the gap
    
  3. curl: the credential is VIKE_API_KEY, else api_key or anon_token from ~/.vike/config.json (Windows %USERPROFILE%\.vike\config.json); with none, get a free anonymous token as vike-core says.
    curl -s "https://data.vike.io/v1/marketdata/perp/spreads/history?symbol=BTC&exchange_a=binance&exchange_b=okx&interval=4h" -H "X-API-KEY: $TOKEN"
    
Flag (API name) Default Values
<symbol> required base asset: BTC, ETH, SOL
--a (exchange_a), --b (exchange_b) required lower-case venue, e.g. binance, okx, bybit, hyperliquid
--market-a, --market-b perp perp or spot
--interval 1h 1h, 4h, 1d; 4h and 1d buckets start at 00:00 UTC
--start, --end the last 7 days ISO-8601 or unix seconds, UTC; start floored to the interval, end exclusive; from 2026-05-30

Reading the answer

The envelope is {symbol, a, b, interval, unit, rows}; a and b name each leg's exchange and market, unit defines the numbers. rows run oldest first, one per bucket:

  • ts (ISO-8601, the bucket's start);
  • open_bps, close_bps, avg_bps: (A / B - 1) x 10,000, positive when leg A is the dearer. 10 bps = 0.1 %;
  • high_bps_bound, low_bps_bound: they only BOUND the bucket's extremes, because each leg's own extreme can fall on a different minute. Never quote them as a gap that was seen;
  • samples_a, samples_b: minutes the leg was priced (at most 60 an hour, 240 in 4 hours, 1440 a day). Few samples make the average thin;
  • book_bps_a, book_bps_b: the leg's mean quoted bid-ask width in bps, null where the venue has no book.

How to read it:

  • Is the gap persistent? Look at the sign and size of avg_bps across the buckets. A gap that keeps its sign for days is structural (fees, funding, a different contract); one that flips around zero is noise.
  • Is it tradeable? Compare avg_bps with both legs' book_bps plus taker fees on four fills. A 3 bps average gap does not pay 2 x 5 bps of fees.
  • Spot against perp (--market-a spot) shows the perp's premium or discount to spot on those venues.
  • Prices are each venue's book mid, else its last price, so a leg without a book (book_bps null) is priced on trades.

The gap right now: md spreads BTC (or perp spreads --symbol BTC, MCP perp_spreads with symbol) returns BTC's one row whatever its size: buy_exchange (the cheapest venue, perp or spot), sell_exchange (the dearest perp), their prices and spread_pct (in percent, not bps). Without a symbol it lists the ten widest gaps of 0.5 % or more. Measured 2026-12-02: perp spreads --symbol BTC returned kraken vs kucoin at 0.07 %.

Limits

  • From 2026-05-30, for the perp symbols listed on at least two major venues (about 300) and their spot pairs.
  • At most 10,000 buckets a call: a year of 1h buckets is too many, ask 4h or 1d.
  • A bucket where one leg was not priced has no row. Nothing found returns empty rows and a note, never zeros: check the venue spelling and that both venues list the coin.
  • Two legs per call. For a third venue, run again.

Errors

  • error: required option '--a <venue>' not specified: the CLI needs both --a and --b.
  • A 400 names the fix (an --interval other than 1h, 4h, 1d; a bad time; too many buckets). The CLI exits 1 with the message.
  • unknown query parameter (curl): use exchange_a and exchange_b, not a and b.
  • Exit code 3 or HTTP 429: the day's requests are used up; show the server's message and stop.

Anti-patterns

  • Don't quote high_bps_bound as "the gap reached X".
  • Don't read bps as percent (100 bps = 1 %), or mix the history's bps with spread_pct in percent.
  • Don't call a historical gap free money: fees, slippage, funding on each perp leg and moving collateral between venues all cost.

Pairs well with

  • vike-perp-overview for the ten widest gaps right now and the perp snapshot
  • vike-perp-carry for a pair's net APR after fees, funding included
  • vike-perp-funding for the funding each perp leg pays while the gap is held