vike-perp-carry
Latest: v1.0.0
First version.
vike-perp-carry
vike-data md reads the REST API /v1/marketdata (CEX perps, 1 credit a call). md carry is the carry screener, and its defaults return the list on vike.io/perp/carry. md funding is one symbol's funding history, for checking that a funding gap is more than one print. Pass the base asset (BTC, not BTCUSDT); venues are lower case.
Commands
vike-data md carry --json # defaults: --legs all --direction funding --costs fees_slippage --horizon 48 --min-spread-pct 0 --sort net --limit 50
vike-data md carry --legs perp_spot --json # spot bought, perp shorted: earns the perp's funding
vike-data md carry --direction convergence --min-spread-pct 0.5 --json # long the cheaper price, short the dearer
vike-data md carry --costs fees --fee-bps 5 --horizon 24 --json
vike-data md funding BTC --exchange binance --start 2026-11-23 --json # one venue's settled funding since a date, newest first
vike-data md funding-now BTC --json # every venue's funding now
--legs:all(the default),perp_perp(a perpetual on each of two venues) orperp_spot(spot bought and a perpetual shorted; spot is never shorted).--direction:funding(the default: long the lower funding rate, short the higher) orconvergence(long the cheaper price, short the dearer).--costs:none(net equals gross),fees(taker fees, entry and exit on both legs) orfees_slippage(fees plus slippage on all four fills, the default).--fee-bps(0-100) replaces every venue's own taker fee. It is refused with--costs none.--slippage-bps(0-100, default 2) is accepted only with--costs fees_slippage.--horizonis the holding period in hours (1-720, sent ashorizon_h): funding accrues over it, and both APRs are annualised from it.--min-spread-pct(0-25, default 0) is the smallest PRICE gap between the two legs, in percent, of either sign. It is not a funding spread.- Any flag the route does not take is a 400. A refusal exits 1 with the server's message.
Reading the answer
The envelope has as_of (unix seconds of the prices), the inputs as applied (legs and direction among them), notional_usd (1000) and rows. Each row has:
symbol, and forlong_andshort_:venueandmarket(perporspot),price(mid);funding_rate(one settlement),interval_handinterval_src,rate_8h,apr,capped,next_funding_ts. Every funding field isnullon a spot leg.
spread_pct: the short leg's price over the long leg's, in percent. It is negative when the long leg is the dearer, which is common with--direction funding.funding_spread_24h_pct: what the pair's funding earns in 24 hours.spread_capture_usd(the gap, captured when prices meet; negative when it costs),net_funding_usd(over the horizon),fees_usd(the costs) andnet_usd. All are for $1,000 on EACH leg.gross_aprandnet_apr, both fractions of the capital on both legs (0.25 = 25 % a year; 3.19 = 319 %).breakeven_h: hours of funding needed to pay the costs the gap does not. 0 means the gap alone pays them;nullmeans funding never does.min_leg_vol_usd: only legs with $1M+ of 24-hour volume are listed. A pair whose perp leg has no current funding rate is left out.
What the funding-leg fields mean:
-
capped: truemeans that leg's rate sits at its venue's published cap or floor. The real pressure may be larger, and the rate can stay pinned there.nullmeans the venue publishes no cap. -
interval_srcsays whereinterval_hcomes from:venue(the venue publishes it for the symbol),fixed(the venue settles hourly for every market) ordefault(nothing published, 8 h assumed). Treat adefaultleg'srate_8handapras an estimate. -
market_statuson a perp leg isdelisting(the venue has set a date,delist_tsin unix seconds) orreduce_only(it takes only orders that close or reduce a position). It isnullwhile the market trades normally and on a spot leg. Never present a row with such a leg as a trade: the position can be force-closed or cannot be opened. -
In the table view (no
--json):- a capped rate prints as
0.002 capped; - the interval prints as published, e.g.
4h, or8h assumedfordefault; - a leg's venue with a status prints as
binance (delisting 2026-12-08)orbybit (reduce_only).
--jsonkeeps the rawcapped,interval_src,market_statusanddelist_tsfields. - a capped rate prints as
Dated futures: the cash-and-carry basis
vike-data md basis BTC --json # every live dated BTC future, highest apr first; basis against the index
vike-data md basis ETH --ref spot --sort expiry --json
Each row in futures describes one contract:
exchange,instrument,expiry(unix seconds),days_to_expiry,type(linearorinverse) withcontract_size;priceandprice_src(book mid, else mark, else last);index_price,spot_price,perp_priceandref_price(the one--refpicks);basis= (price - ref_price) / ref_price, a fraction;apr= basis x 365 / days_to_expiry, the yield of buying the underlying and selling the future to expiry, before fees. It isnullunder 2 days;vol_24h_usdandoi_usd.
Covers binance (USDT-M and COIN-M), bybit, okx, deribit, gate and kraken. Unlike a funding carry, this yield is locked in at entry if held to expiry. A short horizon still inflates the APR, so quote basis next to it.
How to read it:
- Lead with
net_usdfor the horizon andnet_apr, notgross_apr. Say which--legs,--direction,--costsand--horizonyou used. - A large APR on a short horizon is mostly a one-off gap capture annualised: a 2.6 % gap over 48 hours reads as hundreds of percent a year. It is not repeatable. Quote
net_usdper $1,000 a leg next to it. spread_capture_usdassumes the two prices meet within the horizon. If they do not, onlynet_funding_usdis earned, and the exit pays the costs.- Funding is the rate now, not a forecast. Run
md funding <SYM> --exchange <venue>for each perp leg and check that the sign held over recent days. In those rowsapris also a fraction, andrate_8hputs 1h, 4h and 8h venues on one scale.
Anti-patterns
- Don't present
gross_apras the return, and don't read an APR fraction as percent (0.25 is 25 %, not 0.25 %). - Don't compare rows fetched with different
--legs,--direction,--costsor--horizon. - Don't extrapolate a
cappedleg's rate, or a leg withinterval_src: default, without saying so. - Don't call a wide gap free money. Gaps above 25 % are dropped as ticker collisions, and a 2-25 % gap on a thin pair can be a different contract or a stale venue. Check
min_leg_vol_usdand both prices. - Don't treat a row as risk-free: the two legs sit on two venues, each with its own margin, liquidation and transfer risk.
- Don't extrapolate one funding print to a year without the history check above.
Pairs well with
vike-perp-fundingfor each venue's funding of one symbol and the pre-ranked funding-arbitrage listvike-perp-overviewfor the widest price gaps, open interest and long/shortvike-perp-crowdingto see whether the side you would short is crowded
