Skip to content

bench 295: the threshold says when a position closes, not how far price has to move - #2962

Merged
Flotapponnier merged 1 commit into
devfrom
fix/leverage-terms-measured
Oct 12, 2026
Merged

Flotapponnier merged 1 commit into
devfrom
fix/leverage-terms-measured

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

Bench 295 published Gains at 0.1600% of room at 500x, straight from its 80% liquidation threshold. Eleven real liquidations on pairs 300 and 313 fired at a median 59.4% of collateral, which is 0.1189% of price.

The gap is both fee legs. Gains charges 0.02% of notional on the way in and again on the way out, and at 500x that is 20 points of collateral against an 80 point threshold. percentProfit on the LimitExecuted log is the price move times leverage and nothing else, which the perp-liq-rate harness reproduces on 120 of 120 liquidations, so this is the realised trigger rather than a model.

The fee now comes from the pair's own fee group, word 9 of pairs() then word 0 of fees() at 1e10, the read perp-fees runs in production. The model predicts 60.0% against the measured 59.4%; the rest is borrowing, which accrues with holding time and is not a term at open.

Control that validates the method: standard pairs at low leverage read −88.80% at 7.5x and −86.61% at 25x, consistent with their 90% threshold minus small fee legs.

Collateral returned is zero, not a fifth

amountSentToTrader is 0 on all 27 liquidations found, every pair, 7.5x to 500x. The 20 points the threshold leaves never reach the trader. The column was wrong by 20 points on every Gains row, and it is now a real zero, which is also what bench 208 measured over 21,105 liquidations.

Papertrade is measured too, so the comparison is symmetric

Its contract is unverified on hyperevmscan, there is no ABI on Sourcify, Etherscan v2 or any Blockscout mirror, and its two busiest events are absent from the public signature database. So the fields were identified against external truth instead:

  • the price field matches the live Hyperliquid mid under the per instrument factor from its own /state/trading tuple (BTC 10, ETH 100)
  • the leverage field takes values 50, 72, 100, 250, 400, 490, 500, 550, 566, 700, 750 and caps at exactly 1000, the maximum its docs state
  • the direction field was picked by the test, not guessed: under word 1 as long the predicted bust distance is never crossed on 384 adverse closes, max ratio 0.922; under word 0 it is crossed 10 times

A ceiling respected 384 times out of 384 is a measurement. Papertrade's 0.1524% at 500x is no longer "modelled" against Gains' "measured".

No row is ranked

Room comes from holding back less maintenance margin, and the venue that holds back least is the one that keeps everything when it fires. A single ranking on this metric rewards that, whichever venue wins it. Every provider now carries ranked: vector(0).

That also closes the audit's Blocker 1: the product pages were ranking these venues from the one view the bench itself calls not comparable, so /products/papertrade read "#4 of 4" off a comparison of four different leverages.

I considered ranking on collateral lost instead, where Gains wins at every leverage. I did not: losing less collateral means being liquidated earlier, so it is the same quantity inverted to flatter one venue.

Both units publish

New gauge perp_liq_collateral_lost_pct and a ledger column beside it. Gains' own team reads liquidations as a share of collateral, and the two units order the venues differently, so publishing one alone reads as a contradiction. At 500x: Gains 0.1200% of price and 60.0% of collateral, Papertrade 0.1524% and 76.2%.

Stale series

The gauges Reset() each tick. A venue that lowered its maximum leverage would otherwise keep a row on the tabs it no longer offers, at its last value and 100% success, contradicting the bench's own rule that such a venue is absent.

What the page says now, BTC

leverage Gains Papertrade dYdX Hyperliquid
each at its max 0.1200% at 500x 0.0524% at 1000x 0.8000% at 50x 1.2500% at 40x
500x 0.1200% 0.1524% n/a n/a
10x 7.9600% 9.9524% 8.8000% 8.7500%

Collateral returned: Gains 0, Papertrade 0, dYdX 60%, Hyperliquid 50%.

Gates

gofmt, go build, go vet, go test ./cmd/script/ green. OCB_LIVE=1 go test -run TestLeverageTermsLive prints the eight rows above and asserts the two units agree by construction. pnpm validate 247 specs valid. pnpm exec tsc --noEmit clean.

Deploy, after merge

Harness deploy, worker rebuild, mat-reset.sh perp-max-leverage-terms. The gauges gained a metric and the old series are cleared on the first tick, so the bench rebuilds from the new ones.

Bench 295 published Gains at 0.1600% of room at 500x, straight from its
80% liquidation threshold. Eleven real liquidations on pairs 300 and 313
fired at a median 59.4% of collateral, which is 0.1189% of price. The
gap is both fee legs: 0.02% of notional on the way in and again on the
way out, and at 500x that is 20 points of collateral against an 80 point
threshold.

percentProfit on the LimitExecuted log is the price move times leverage
and nothing else, which the perp-liq-rate harness reproduces on 120 of
120 liquidations, so this is the realised trigger and not a model. The
fee now comes from the pair's own fee group, read the way perp-fees
reads it in production. The model predicts 60.0% against the measured
59.4%; the rest is borrowing, which accrues with holding time and is not
a term at open.

COLLATERAL RETURNED IS ZERO, NOT A FIFTH. amountSentToTrader is 0 on all
27 liquidations found, every pair, 7.5x to 500x. The 20 points the
threshold leaves never reach the trader, so the column was wrong by 20
points on every Gains row.

PAPERTRADE IS NOW MEASURED TOO. Its contract is unverified, so the
fields were identified against external truth rather than an ABI: the
price matches the live Hyperliquid mid under the per instrument factor
from its own tuple, the leverage field caps at exactly the 1000 its docs
state, and under the resulting reading the predicted bust distance is
never crossed on 384 adverse closes, the closest reaching 92% of it. A
ceiling respected 384 times is a measurement.

NO ROW IS RANKED. Room comes from holding back less maintenance margin,
and the venue that holds back least is the one that keeps everything
when it fires. A single ranking rewards that whichever venue wins it, so
every row publishes provisional. That also closes the audit's blocker:
the product pages were ranking venues from the one view the bench itself
calls not comparable.

Both units now publish. Gains' own team reads liquidations as a share of
collateral and the two units order the venues differently, so showing
one alone reads as a contradiction.

And the gauges reset each tick. A venue that lowered its maximum would
otherwise keep a row on the leverage tabs it no longer offers, at its
last value and 100% success.
@Flotapponnier
Flotapponnier merged commit 410c281 into dev Oct 12, 2026
2 checks passed
@Flotapponnier
Flotapponnier deleted the fix/leverage-terms-measured branch November 3, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant