Protocol stack
BasisYield runs entirely on Hyperliquid — a decentralised perpetual-futures protocol built on HyperEVM (an EVM-compatible execution layer) secured by HyperBFT consensus (a custom BFT variant, not Ethereum). Hyperliquid launched in January 2026.
The stack from bottom to top:
| Layer | Component | Role |
|---|---|---|
| L1 | HyperBFT validators | Consensus and settlement; finalises all trades on-chain |
| L2 | HyperEVM | EVM-compatible execution layer; smart contracts, agent key enforcement |
| DEX | Hyperliquid core | Central limit order book (CLOB), shared liquidity pool, funding rate engine |
| Builder | markets.xyz (km:) | Sub-DEX with independent funding rate calculation; stocks, bonds, commodities, FX |
| Builder | trade.xyz (xyz:) | Second sub-DEX; same assets, independent funding, independent OI |
| Application | BasisYield engine | Python/FastAPI bot; reads funding data, places orders, manages risk |
User collateral (USDC) is held in the user's own Hyperliquid wallet at all times. The engine holds no custody of any funds.
Builder sub-DEXs
Hyperliquid allows third-party "builders" to create front-ends that attach custom fees and have independent funding rate calculations while sharing underlying Hyperliquid liquidity. markets.xyz and trade.xyz are two such builders.
Critical detail for spread-carry: although both builders source liquidity from the same Hyperliquid CLOB, each builder maintains an independent open-interest (OI) register. This means the funding rate imbalance on km:EUR can differ materially from xyz:EUR even when the underlying price is identical — because the crowd of leveraged traders routed to each builder differs. It is this OI divergence that creates the fundable spread.
When Hyperliquid conducts a system-wide event (e.g. the March 2025 liquidity crisis), both builders are affected simultaneously — this is a correlated risk that the spread-carry hedge does not neutralise.
Agent keys
Hyperliquid's native account abstraction provides agent keys: sub-keys derived from or approved by a master wallet that have restricted capabilities enforced at the protocol level.
A trade-only agent key has the following capability set, fixed by the protocol:
| Capability | Trade-only agent | Master wallet |
|---|---|---|
| Place limit / market orders | ✓ | ✓ |
| Cancel open orders | ✓ | ✓ |
| Modify existing orders | ✓ | ✓ |
| Withdraw funds | ✗ — blocked at protocol | ✓ |
| Transfer between sub-accounts | ✗ — blocked at protocol | ✓ |
| Approve new agent keys | ✗ — blocked at protocol | ✓ |
BasisYield only ever holds a trade-only agent key for each user. The user retains the master wallet at all times. Revoking the agent key is a single on-chain transaction signed by the master wallet.
The withdrawal restriction is documented in Hyperliquid's own public documentation and is not a BasisYield policy — it cannot be overridden by BasisYield even if we wanted to.
Funding mechanism
Hyperliquid perpetual contracts use a premium-based funding rate calculated every hour (not every 8 hours as on most CEX perps). The rate for a given hour is derived from the order-book premium:
-- where positive rate → longs pay shorts; negative → shorts pay longs
OI_imbalance = (long_OI − short_OI) / (long_OI + short_OI)
sensitivity ≈ 0.0001 per 1% OI imbalance (per-asset, set by exchange)
cap = 0.05% per hour on most assets
The funding payment is settled in USDC at each hour mark. A position of size N notional on the paying side transfers N × rate_h USDC to the receiving side.
The key empirical finding that motivates the strategy: on the builder sub-DEXs, the same side of a given asset has paid funding 84–96% of all hours over observed multi-month windows. This persistent directionality is the exploitable edge — it reflects persistent one-sided leverage demand from the builder's user base.
Spread-carry sleeve
For each traded pair (e.g. EUR), the engine holds two legs simultaneously:
Leg B (xyz:EUR): LONG at size S, leverage L
-- net delta: (S_long − S_short) × price = 0 when |S_long| = |S_short|
Each leg runs in its own margin account on its own builder. Because the builders do not share margin pools, the cross-leg delta-neutrality is economic, not accounting: when EUR moves +5%, Leg B gains S × 5% × L USDC in unrealised PnL while Leg A loses the same amount. Both numbers are in separate accounts; the net is zero in aggregate but the losing leg's collateral actually drains until a rebalance transfer moves funds.
Spread income
The hourly income from the spread is:
-- collected if the leg we are short on (km:EUR) pays a higher rate
-- net of exchange fees per hour: roughly 0 (maker rebate offsets taker fee on hybrid fills)
Entry criteria
A pair is entered only when all of the following hold over the trailing week:
- The trailing-7-day average funding gap exceeds a minimum threshold (currently 2× the estimated execution cost).
- The gap has been in the same direction for ≥80% of hours in the trailing window (persistence filter).
- The pair's per-leg notional at the target leverage does not exceed 10% of the thinner builder's current OI for that asset (capacity guard).
- The kill-switch is not triggered (see §Kill-switch).
The engine ranks qualifying pairs by 7-day gap × persistence and holds the top 4.
Weekend-harvest sleeve
Real-world underlying markets (equities, bonds, commodities, FX) close Friday ~5pm New York and reopen Sunday ~6pm New York (18:00 ET). During the weekend closure, Hyperliquid perpetuals keep trading with no external price anchor. Historical data shows funding rates running 3–10× weekday levels during this window.
Weekend-rent trade
Entry: Friday evening after underlying market close. The bot enters a single-leg position (no spread; hedge is not viable when the rate is so highly one-sided that both sides pay). Leverage: 3×. Position is held through the weekend and closed at the Sunday reopen.
The income model:
-- typically 44–46 hourly periods × elevated rate
-- single-leg exposure: directional risk while market is closed
At 3× leverage, the liquidation threshold is 1/3 − 2% ≈ 31%. The largest observed single-weekend gap in the 142-day history is under 6%. The headroom is large but not infinite.
Sunday snap-back trade
As the underlying reopens, the 24/7 perpetual price converges toward the real market opening print. The engine enters a directional position when the gap exceeds 0.3%, sized at 3× leverage, and exits at convergence or after 90 minutes whichever comes first. This is a directional trade with directional risk — not market-neutral.
Disclosure: the Sunday snap-back trade is intentionally speculative. It carries directional price exposure. It is sized and logged separately from the spread-carry sleeve. Do not evaluate the strategy's overall risk profile without accounting for this component.
Pair selection
The engine currently monitors 11 asset pairs across the two builders. The candidate universe covers:
- US equities (SPY-equivalent, QQQ-equivalent)
- US bonds (TLT-equivalent)
- Commodities (USOIL, GOLD)
- FX majors (EUR, GBP, JPY, CHF, AUD, CAD)
Active pairs are rotated weekly. Pairs with decaying spreads are exited within the next daily scan cycle; new qualifying pairs are entered at the next suitable entry window (avoiding weekend entries for the spread-carry sleeve).
Kill-switch
Two independent triggers can activate the kill-switch:
| Trigger | Condition | Type | Effect |
|---|---|---|---|
| BTC volatility | |BTC 24h change| ≥ 5% | Evergreen (persists until BTC calms) | Skip all weekend entries; halve all new position sizes |
| Polymarket | Monitored geopolitical event odds < 25%, or moved ≥ 5 pts in 24h | Duration-limited (removed when event resolves) | Same: skip weekend entries, halve new positions |
The kill-switch is a veto, not a vote: either trigger alone is sufficient. It only blocks opening new positions; existing positions and close-order issuance are never blocked.
The current BTC threshold (5%) was set based on the observation that spread dislocations during high-volatility regimes are both more likely and more correlated across pairs — reducing the value of diversification within the portfolio.
Liquidation formula
For a position at leverage L, the exchange liquidates when unrealised loss exhausts maintenance margin. The formula for the adverse price move required to trigger liquidation:
-- maintenance_margin_frac ≈ 0.02 (2%) on Hyperliquid for most assets
At L = 5×: liq_drift = 1/5 − 0.02 = 0.18 (18%)
At L = 3×: liq_drift = 1/3 − 0.02 = 0.31 (31%)
At L = 2×: liq_drift = 1/2 − 0.02 = 0.48 (48%)
At L = 10×: liq_drift = 1/10 − 0.02 = 0.08 (8%)
The rebalance alert fires at 10% adverse drift — giving a 1.8× safety headroom factor at the current 5× leverage (alert at 10%, forced exit at 18%).
Important for spread-carry: because the two legs are in separate margin accounts, a large directional price move depletes the losing leg's collateral while the winning leg accrues gains. The gains are not automatically transferred to shore up the losing leg. This is the primary operational risk requiring active monitoring — a sufficiently fast or large price move can force the losing leg into liquidation before a rebalance executes.
Leverage table
The Sharpe ratio is constant across leverage levels — both return and volatility scale proportionally. The tradeoff is purely about margin headroom:
| Leverage | APR (spread) | APY (combined) | Sharpe | Liq threshold | Alert headroom |
|---|---|---|---|---|---|
| 2× | ~6.1% | ~9.6% | 2.80 | 48% | 4.8× |
| 3× | ~9.1% | ~13.2% | 2.80 | 31% | 3.1× |
| 4× | ~12.2% | ~16.8% | 2.80 | 23% | 2.3× |
| 5× (default) | ~15.2% | ~24.0% | 2.80 | 18% | 1.8× |
| 7× | ~21.3% | ~30.6% | 2.80 | 12% | 1.2× |
| 10× | ~30.4% | ~42.5% | 2.80 | 8% | 0.8× |
The default 5× is the highest level at which the rebalance alert still provides meaningful headroom (≥1.5×) before forced exit. Above 5× the alert fires with less than 1.5× margin, meaning fast adverse moves can skip the alert entirely and proceed to liquidation.
Note: the weekend harvest sleeve runs at a fixed 3× regardless of the user's chosen spread-carry leverage setting.
Margin drain mechanics
When the underlying price drifts by d (as a fraction), the losing leg's margin balance changes as follows:
-- where initial_margin = notional / L
At L=5, d=10% (alert threshold):
initial_margin = notional / 5 = 0.20 × notional
drain = 0.10 × notional
remaining = 0.10 × notional (50% of initial margin consumed)
At L=5, d=18% (liquidation):
remaining ≈ 0.02 × notional (maintenance margin — exchange liquidates here)
The engine checks leg-price drift every 60 seconds. If drift exceeds the alert threshold, it sends a notification and queues a margin top-up or position reduction depending on available vault balance.
Hybrid maker/IOC execution
The spread-carry trade requires filling two legs simultaneously to avoid being flat-long or flat-short during the entry transition. The hybrid model handles this:
- Rest a maker order on the lower-liquidity venue (typically the quiet side). Maker orders are posted at the top of the book and receive exchange maker rebates (~−0.01% to −0.02% per fill on Hyperliquid builders).
- When the maker order fills, immediately send an IOC (Immediate-Or-Cancel) market order on the other leg. IOC orders are taker-side (~0.04% to 0.07% fee) but execute instantly at current best price.
The net fee for a round-trip (entry + exit) hybrid fill:
≈ (−0.015% + 0.055%) × 2
≈ 0.08% of notional per full round-trip
-- actual rates vary per asset and venue; this is the observed median
In the backtest, the solid middle line uses this hybrid assumption. The upper band assumes pure maker fills (lower fees, slower fills); the lower band assumes pure taker fills (higher fees, instant execution). The band covers realistic execution variance.
Weekend harvest execution
Weekend entries and exits are single-leg. Entry is a limit order rested for up to 10 minutes; if unfilled, re-prices once. Exit is a market order at the Sunday reopen. Sunday snap-back entry is a market order on gap detection (>0.3% threshold); exit is market on convergence signal or 90-minute timeout.
Builder fee model
BasisYield attaches a builder fee of fee_tenth_bps = 20 (= 2 basis points = 0.02%) to every fill. This fee is collected on-chain by the builder address and is the platform's only revenue source.
Annual cost model at $100K fund
Spread carry fills: ~6 fills/month × $35,000 notional × 4 pairs × 2 legs = $1,680,000
(entry + partial exits + re-entries at typical decay rate)
Weekend harvest: ~21 weekends × $XX notional (varies by rates)
Total estimated: ~$535,000/month (at $100K equity, 5× leverage)
Annual builder fee: $535,000 × 12 × 0.0002 = $1,284/year
As % of 24% APY on $100K: $1,284 / $24,000 = 5.35%
Exchange taker fees (not BasisYield): ~$2,888/year at same turnover
(at 0.045% taker average, net of maker rebates on hybrid fills)
The builder fee is settled at the time of each fill. It is visible in the fill details via the Hyperliquid API and on the dashboard trade log.
Order flow and lifecycle
Each spread-carry pair goes through a defined lifecycle:
- Scan: Every hour, the engine polls both builders for funding rates on all 11 monitored assets. Rates are stored in the local SQLite ledger.
- Score: Each pair is scored by trailing-7-day gap × persistence. Top 4 qualifying pairs become target holdings.
- Entry: If a pair scores into the top 4 and is not currently held, the engine submits the two-leg hybrid entry. A maker order rests on the quiet leg; the IOC fires on fill.
- Monitor: Drift is checked every 60 seconds. Funding accrual is verified against expected amounts every hour. Anomalies are flagged to the notification system.
- Rebalance: If drift exceeds the alert threshold, the engine assesses whether to top up margin (transfer from vault) or reduce the position. Position reduction is preferred if vault balance is low.
- Exit: If a pair scores out of the top 4 (gap decayed), the engine sends simultaneous market orders on both legs to close. Exit is also triggered if a kill-switch fires.
Methodology
The backtest replays the current strategy rules against actual historical funding-rate data from the two builder sub-DEXs. The data window is all available history since venue launch — January 2026 through the current date, currently 142 days.
Data sources
- Hourly funding rates: queried directly from the Hyperliquid API, stored in the local SQLite database as they are observed in production.
- Trade prices: midpoint of the best bid/ask at each simulated entry time.
- No synthetic or off-exchange data is used; every data point corresponds to a real observed rate or price.
Execution assumptions
| Scenario | Maker fee | Taker fee | Slippage | Use |
|---|---|---|---|---|
| Maker (upper band) | −0.015% | — | 0 | Best-case; assumes all fills at quoted price |
| Hybrid (middle / reported) | −0.015% | +0.055% | 0.01% | Primary reported figure; matches live execution plan |
| Taker (lower band) | — | +0.055% | 0.02% | Worst-case; all fills as aggressive market orders |
Reported metrics
- APR: (total funding income − total fees) / initial equity, annualised.
- APY: APR compounded hourly:
(1 + APR/8760)^8760 − 1. - Sharpe: annualised mean daily return / annualised stddev of daily returns.
- Max drawdown: largest peak-to-trough equity decline in the backtest period.
Known limitations
We disclose these limitations explicitly. A backtest is not a track record.
- Short history: 142 days is not enough to claim statistical confidence in tail-risk estimates (drawdowns, crash scenarios). The venues launched in January 2026; there is no longer history anywhere.
- Market impact ignored: The backtest assumes fills at the observed midpoint. At larger position sizes, the engine's orders would move the market. Capacity guards are in place but impact is not explicitly modelled.
- Structural regime risk: The funding-rate edge depends on a structurally imbalanced user base on the builder sub-DEXs. If that changes (equalising capital arrives, user base shifts), the edge compresses. The backtest cannot predict this.
- Execution risk: Real latency, API failures, and partial fills can cause the two legs of a spread to be entered at different prices than assumed. The hybrid model partially accounts for this via the taker slippage assumption.
- Weekend gap risk: The largest observed weekend gap is under 6% on any observed asset; the 31% liquidation threshold appears safe. But the exchange launched in 2026 — a true tail event (crisis, major geopolitical event over a weekend) has not yet been observed in the data.
- Correlation with Hyperliquid platform events: A March 2025 liquidity crisis temporarily restricted Hyperliquid withdrawals. This is not reflected in the funding-rate backtest but is part of the risk profile.
Custody model
BasisYield's custody model is enforced at three levels:
- Protocol level: The trade-only agent key permission set is defined in Hyperliquid's smart contracts. Withdrawal is not in the capability set and cannot be added by the platform operator.
- Key possession: BasisYield holds only the agent key, never the user's master wallet private key. The master wallet is required for fund movement.
- On-chain verifiability: All agent key permissions, all fills, and all funding payments are recorded on-chain and can be independently verified by querying the Hyperliquid API or a block explorer.
The non-custodial design removes one specific category of counterparty risk — BasisYield cannot take or lose user funds. It does not remove exchange risk (Hyperliquid platform failure), smart-contract risk, or strategy risk.
Threat model
| Threat | Impact | Mitigation | Residual risk |
|---|---|---|---|
| BasisYield platform compromise | Attacker gains agent key | Agent key cannot withdraw; worst case is position manipulation | Positions may be closed/opened adversarially, but funds cannot leave user wallet |
| Hyperliquid exploit | Exchange-level fund loss | None — cannot be hedged at protocol level | Full loss of on-exchange balance is possible |
| Smart-contract bug in agent key logic | Withdrawal restriction bypassed | Protocol is audited by Hyperliquid; track record since Jan 2026 | Non-zero; DeFi protocols carry inherent smart-contract risk |
| Strategy failure (rates go to zero) | Returns compress to zero or slightly negative (fees) | Exit thresholds; bot closes positions when spread below cost | Capital preserved; returns lost for the period |
| Forced liquidation | Collateral loss on the liquidated leg | Drift monitoring; rebalance alert at 1.8× before liq threshold | Fast move could skip alert; partial capital loss possible |
| Regulatory shutdown | Exchange access blocked | None; BasisYield is not regulated | Positions may become inaccessible during a regulatory event |
Configuration parameters
Core strategy parameters as of v0.4.x:
Glossary
- Agent key
- A Hyperliquid-native sub-key with restricted capabilities (trade-only). Withdrawal is blocked at protocol level.
- APR
- Annual Percentage Rate — simple annual return, not compounded.
- APY
- Annual Percentage Yield — return compounded at the settlement interval. ~22% APR → ~24% APY.
- Backtest
- Strategy rules replayed against historical data. Not a forward-looking guarantee.
- Builder sub-DEX
- A custom front-end on Hyperliquid with independent OI accounting and funding rates. markets.xyz and trade.xyz are examples.
- Builder fee
- On-chain fee per fill attached to trades routed through a builder front-end. BasisYield charges 2 bps.
- BFT consensus
- Byzantine Fault Tolerant consensus — the finality mechanism for HyperBFT. Provides single-slot finality unlike Ethereum's probabilistic finality.
- CLOB
- Central Limit Order Book — the matching engine underlying Hyperliquid's shared liquidity pool.
- Delta
- Sensitivity of a position's value to price changes. Delta = 0 means a 1% price move has zero net effect on PnL.
- Funding rate
- Periodic payment between longs and shorts on a perpetual contract, set by OI imbalance. Paid hourly on Hyperliquid builders.
- HyperBFT
- Hyperliquid's custom BFT consensus protocol; provides sub-second finality for all fills.
- HyperEVM
- EVM-compatible execution layer of Hyperliquid; enforces agent key restrictions via smart contracts.
- IOC (Immediate-Or-Cancel)
- An order type that fills immediately at the best available price and cancels any unfilled remainder. Taker-side.
- Kill-switch
- A circuit breaker that halts new position openings when BTC volatility or Polymarket risk signals exceed defined thresholds.
- Leverage
- Ratio of notional exposure to collateral. At 5×, $1 of collateral controls $5 of notional. Amplifies both gains and losses.
- Liquidation
- Forced close of a position by the exchange when margin falls below maintenance level. Collateral is forfeited.
- Maker order
- A limit order that rests in the book, adding liquidity. Receives a rebate on Hyperliquid builders (~−0.015%).
- Maintenance margin
- Minimum collateral level the exchange requires to keep a position open. On Hyperliquid, ~2% of notional for most assets.
- Margin account
- The collateral pool backing a single position on a single exchange. Each spread-carry leg has its own margin account.
- Market-neutral
- A position with net delta ≈ 0; a price move in either direction has negligible PnL effect.
- Non-custodial
- A platform design where the operator never holds user funds. Assets remain on-chain in the user's own wallet.
- Open interest (OI)
- Total notional value of all open positions on a contract. OI imbalance between long and short determines funding direction.
- Perpetual futures
- A derivative tracking an asset's price with no expiry date. Uses funding to keep price anchored to the spot.
- Polymarket
- A prediction market platform. BasisYield uses geopolitical event odds from Polymarket as a kill-switch input.
- Sharpe ratio
- Annualised mean return divided by annualised standard deviation of returns. Measures risk-adjusted efficiency.
- Slippage
- The difference between the expected fill price and the actual fill price due to market movement during order execution.
- Spread carry
- Simultaneously holding long and short positions on the same asset across two venues with different funding rates, capturing the rate gap.
- Taker order
- An order that crosses the spread and removes liquidity from the book immediately. Pays a fee (~0.055% on Hyperliquid builders).
- USDC
- USD Coin — a regulated stablecoin pegged 1:1 to the US dollar, issued by Circle. Used as collateral on Hyperliquid.
- Vault
- The USDC balance in the user's Hyperliquid wallet not currently deployed as margin. Used for rebalance top-ups.
- Weekend harvest
- The sleeve of the strategy that holds single-leg positions over weekends to capture elevated funding during real-market closure.