# PAPER DESK v3 research: Excursion Restitution Ledger at 100×
Research date: 2026-11-03 UTC. Scope: research and an implementation-ready specification for BTC and ETH on Papertrade. This assignment delivers the report, not a deployed indicator, trading integration, or a validated profitable strategy. The existing read-only site is preserved. A companion scope note is in `RESEARCH-README.md`.
**Finding:** Papertrade removes funding and notional fees but does not remove the cost of trading. It discounts profitable moves while taking losses in full; its hard-bust trigger precedes zero equity; and settled profit can be an unpaid queue claim. An indicator must earn its edge from price prediction and execution discipline. PAPER emissions do not establish that edge.
**Proposal:** **Excursion Restitution Ledger (ERL-100)**, a new candle-geometry construction proposed here. It retains price intervals rejected by wicks, erases only the portions subsequently accepted by candle bodies, and asks whether a two-bar reclaim has enough surviving support and an unobstructed corridor to justify its *net* payoff. A separate liquidation-map layer can veto a new entry, never manufacture historical evidence. No performance claim is made.
## 1. Evidence, date and interpretation
The fourteen requested pages were fetched and read in full, including formulas and page endings. They identify **contract set 2**, current since 2026-10-21; their displayed update date is 2026-10-21. Links below identify the exact pages. This is a documentation study, not a contract audit or an onchain parameter snapshot. “Current” below means what those pages represented on the research date; owner-adjustable values require revalidation before operational use.
Labels used throughout:
- **Documented:** a primary-source description, not independently verified behavior.
- **Derived:** arithmetic or a logical implication of the documented model.
- **Hypothesis/design:** the proposed strategy, thresholds or policy, requiring testing.
- **Unknown:** information not supplied by the docs or the assignment's API.
### Source register and coverage
| Source read | What it supports |
| --- | --- |
| [Architecture overview](https://docs.papertrade.xyz/how/architecture/) | Exchange, executor, relayer, token/staking contracts, precompiles |
| [Asymmetric impact PnL](https://docs.papertrade.xyz/how/asymmetric-impact/) | Deadband, both holdbacks, impact formula, example parameters |
| [Pricing: BBO precompile](https://docs.papertrade.xyz/how/pricing-bbo/) | Midpoint, validation limits, retirement/frozen price |
| [PAPER mint curve](https://docs.papertrade.xyz/how/mint-curve/) | Exponential issuance, insolvency clock, eligible basis |
| [Risk](https://docs.papertrade.xyz/how/risk/) | Manipulation, OI headroom, privileged roles and upgrades |
| [Solvency & queue](https://docs.papertrade.xyz/how/solvency-queue/) | Cash, side bucket, FIFO priority, debt-funded accounting |
| [Trades and pricing](https://docs.papertrade.xyz/learn/trades-pricing/) | Trader experience, immutable isolated positions, limits |
| [Wins and losses](https://docs.papertrade.xyz/learn/wins-losses/) | Win fee, loss accounting, builder fee |
| [Liquidations](https://docs.papertrade.xyz/learn/liquidations/) | Buffer, full-margin bust, keeper and voluntary close |
| [Paper Emissions](https://docs.papertrade.xyz/learn/paper-emissions/) | Loss-only eligibility and economic purpose |
| [Staking Dividends](https://docs.papertrade.xyz/learn/staking-dividends/) | Fee split, excess sweep, distribution conditions |
| [The LP and payout queue](https://docs.papertrade.xyz/learn/lp-queue/) | Zero-seed LP, available versus queued collateral |
| [$PAPER overview](https://docs.papertrade.xyz/paper/overview/) | Token rights, launch transfer restrictions, dilution |
| [FAQ](https://docs.papertrade.xyz/intro/faq/) | HyperCore custody versus HyperEVM state; frontend access |
## 2. What a trader is actually trading
### Architecture and pricing
**Documented:** these are synthetic positions against the protocol LP, not positions opened on Hyperliquid. `Exchange` records balances, positions and settlement. Signed intents pass through Papertrade's relayer and authorized `BatchExecutor`; an alternative frontend cannot directly submit opens and closes. `PriceOracle` reads HyperCore precompiles. PAPER issuance and staking have separate contracts. [Architecture](https://docs.papertrade.xyz/how/architecture/)
Trading state lives on HyperEVM, while the FAQ describes USDC balances as held on HyperCore and moved through CoreWriter. A read-only terminal therefore observes a system involving two execution/accounting surfaces; a displayed balance is not proof of immediate external withdrawal. [FAQ](https://docs.papertrade.xyz/intro/faq/)
The execution reference is `(bestBid + bestAsk) / 2`, from BBO precompile `0x000000000000000000000000000000000000080e`; BTC and ETH asset indices are 0 and 1 on the documented chain-999 deployment. Zero or crossed books revert, but there is no independent deviation or time-weighted breaker. A nonzero uncrossed distorted midpoint can pass. Market retirement freezes that instrument's BBO permanently for closes and liquidations and prevents new opens; a global opens pause does not freeze prices. [Pricing](https://docs.papertrade.xyz/how/pricing-bbo/)
**Derived:** “zero slippage” describes fill price relative to the contract's midpoint *at execution*. It does not promise execution at the candle close, click price, or an earlier quote. Relayer delay, block inclusion and a candle-feed/BBO mismatch remain timing risks. A candle feed that tracks Hyperliquid closely is still not an execution receipt. The assignment provides that feed relationship; it does not quantify its tracking error.
**Documented:** no funding, spread or user-paid gas; the relayer pays gas. Positions have fixed isolated margin and leverage, cannot be topped up or partially closed, and can only be closed in full or liquidated. The page lists BTC/ETH, up to 1000×, and a $10M individual-position notional limit. [Trades and pricing](https://docs.papertrade.xyz/learn/trades-pricing/)
**Design implication:** ERL uses full exits, no averaging down, and no assumption that unused account funds rescue a position. This report evaluates 100× only.
### Payout math and costs
**Documented model:** let `p` be favorable fractional price movement, `N` notional, `f` win fee and `b` builder fee. All price units below are fractions, so one basis point is `0.0001`:
```text
standard: a=.000075, z=.0006, k=3.597, exponent=2
off-hours: a=.00003, z=.001, k=6.085, exponent=3
u = (p-a)/(z-a)
H(p) = k*(z-a)*u²*(1-u)^exponent if a
= F + reclaimBuffer*c_j`.
3. `(U_j-L_j)/c_j <= rangeMax`.
The confirmation must satisfy all of:
1. `L_i > L_j` (no retouch of the sweep extreme).
2. `C_i >= C_j + confirmMin*c_i`.
3. `C_i >= F + reclaimBuffer*c_i`.
4. `(U_i-L_i)/c_i <= rangeMax`.
This fixes the reclaim event on `j` and final confirmation on `i`. A rejected event cannot be revived on `i+1`; that later bar needs its own preceding sweep. No event waits indefinitely for a favorable future confirmation.
### 4.6 Stop, target and score
Set reference raw entry `E=c_i` and directional entry `X=s*E`. Compute:
```text
Sx = L_j - stopPad*E
r = (X-Sx)/E
p = min(targetMax, max(targetMin, targetRiskMultiple*r))
Tx = X + p*E
J = coverage(D-, [L_j,F])
A = coverage(D+, [X,Tx])
W = min(g_standard(p), g_offhours(p))
R = 100*(r+latencyReserve)
netRR = W/R
ERL = J*(1-A)*netRR
rawStop = s*Sx
rawTarget = s*Tx
```
`W` and `R` are fractions of margin, not price. The conservative payout profile uses the worse of the two curves because their active state is not exposed. Builder fee defaults to zero **only for a clearly labeled papertrade.xyz scenario**; show a 0.5% builder sensitivity alongside it. An unknown venue/profile must be labeled `ECONOMICS UNVERIFIED`, not silently treated as a verified current quote.
Signal only if `riskMin<=r<=riskMax`, `J>=supportMin`, `A<=obstacleMax`, `netRR>=netRRMin`, and `ERL>=budgetMin`, in addition to the event gates. Both directions qualifying on one bar produces `AMBIGUOUS/NO ENTRY`; do not choose by hindsight. A nonfinite calculation gives `INVALID`, never a buy or sell.
ERL is a dimensionless decision budget, **not a calibrated probability**. For example, `J=.8`, `A=.1`, and `netRR=2.0` gives `ERL=1.44`; changing either interval history can veto the same close pattern. Historical geometry can emit a candle-only candidate even when live data are absent. Eligibility and economic assumptions must be visible separately.
### 4.7 Entry, holding, exit and invalidation
**Long:** after `i` closes, consider opening at the next available BBO; stop is below sweep low, target above entry. **Short:** after `i` closes, consider opening at the next available BBO; stop is above sweep high, target below entry. There is no fill on bar `i` in a historical execution simulation.
Reference entry expires at the end of the next bar (`t_i+2Δ`). For historical testing, attempt the next bar open only; no favorable intrabar limit-fill assumption. With actual fill `Efill`, keep the raw stop fixed, recompute `r=s*(Efill-rawStop)/Efill`, `p`, target, corridor coverage and economics against the same frozen pre-entry ledger. Skip if any gate fails, or `abs(Efill-E)/E>.0002` (2 bps), or fill is at/past stop. This explicit fill adaptation is a separate execution assessment; it never edits the historical candidate.
Use actual `bustPrice` if available: the raw stop must be at least `.003*Efill` (30 bps) inside the safe side of bust. Long requires `rawStop>bustPrice+.003*Efill`; short requires `rawStop=materialUsd` and `Crowding>=.75`, or if `Near>=materialUsd`. These thresholds are unvalidated policy: avoid joining material fragile same-side positioning near the proposed exit path. A large `Fav` does not upgrade a core rejection into an entry. All-zero masses produce `NO MAP EVIDENCE`, not a high-confidence clearance. If masses are nonzero and no veto fires, report `NO MAP VETO`, never “safe.”
A valid summary with `queueUsd>0` or `lpUsd<=0` produces `PAYOUT RISK — NO NEW ENTRY` for this cash-focused policy. Positive `lpUsd` and zero queue are only a coarse screening condition: the assignment does not define whether `lpUsd` is free cash, tracked LP or net equity, and the response cannot certify cash coverage. Explicitly mark `LP ACCOUNTING UNVERIFIED`. No use of `tvlUsd-marginUsd` as an invented LP balance is permitted.
If either route is missing, stale, invalid or mismatched, preserve the historical core candidate and show live eligibility `UNKNOWN`; in the live-enabled view, do not show an actionable entry. Users may explicitly select candle-only research mode, which remains labeled as lacking live filters. Summary fields `openPositions` and `lifetimeVolumeUsd` are context, not directional evidence; volume is cumulative, not a flow rate. A live map never alters an open trade's stop/target. Fresh crowding veto can flag `NO ADDITIONAL ENTRY`; it does not trigger a new intrabar strategy exit.
## 6. Future TypeScript and PAPER DESK integration contract
This assignment specifies the implementation; it does not claim that these methods or modules have been added. Preserve the read-only GET-only architecture, current indicators, CSP, bundled assets and account viewer when implementing the next stage.
Proposed pure module boundary under `src/signal/`:
```ts
// types.ts, validate.ts, intervals.ts, payoff.ts, core.ts, live.ts
// All values passed explicitly; no fetch, Date.now(), DOM or mutation.
computeErl(candles, {symbol, timeframeSec, nowSec, params, payoutProfile})
-> {bars: ErlBar[], candidates: ErlCandidate[], diagnostics: Diagnostic[]}
assessErlFill(candidate, fillPrice, bustPrice, frozenLedger, payoutProfile)
-> EntryAssessment
assessErlLive(candidate, liquidationMap, protocolSummary, nowSec, liveParams)
-> LiveAssessment
```
Output each bar's time, direction, frontier, penetration, `J`, `A`, `r`, target fraction, `W`, `R`, netRR, score, stop/target and reason codes. Rejected candidates should expose their failed gates without drawing entry arrows. A signal does not assert an account trade occurred. Keep `confirmedAt=t+Δ`, `earliestFillAt=confirmedAt`, execution observations and live `asOf` distinct. Inputs are readonly; return new objects, with `null` for unavailable numerical values and explicit status codes rather than zero-filled success.
Proposed additions to `src/api.ts` and the existing mock backend:
```ts
type LiquidationRange = 1 | 2 | 5 | 10 | 25;
type SignalSymbol = 'BTC' | 'ETH';
interface LiqAmounts {
longUsd: number; shortUsd: number;
longCount: number; shortCount: number;
}
interface LiquidationBucket extends LiqAmounts { lo: number; hi: number }
interface LiquidationMap {
symbol: SignalSymbol; rangePct: LiquidationRange;
from: number; to: number; asOf: Timestamp;
buckets: LiquidationBucket[]; below: LiqAmounts; above: LiqAmounts;
}
interface ProtocolSummary {
asOf: Timestamp; tvlUsd: number; marginUsd: number; lpUsd: number;
queueUsd: number; openPositions: number; lifetimeVolumeUsd: number;
}
// Backend methods; all GET, same origin, with existing abort/error behavior:
liquidationMap(symbol: SignalSymbol, range: LiquidationRange,
signal?: AbortSignal): Promise;
protocolSummary(signal?: AbortSignal): Promise;
```
Routes are exactly `/api/markets/:symbol/liquidation-map?range=…` and `/api/protocol/summary`; do not overload the existing account `summary(address)` method. Keep existing candles route and 1000-bar cap. Types alone do not validate JSON: apply runtime checks before calling signal functions. `lpUsd` may be signed pending backend accounting clarification; reject negative TVL, margin, queue, position count or lifetime volume.
Mock implementation should use explicit injected timestamps and deterministic seeded BTC/ETH snapshots, exactly 150 buckets, all supported ranges, and internally consistent prices. Include zero-evidence, concentrated-adverse, favorable-heavy, outside-range, stale, malformed and queued-summary fixtures. Never silently replace failed real data with mocks. Fixtures are synthetic and must not be presented as observed Papertrade liquidity.
Proposed UI: add ERL as an optional analytical overlay, not a trade ticket. Show confirmed candidates, fixed stop/target, a small ledger/corridor explanation and failed gates. Keep old BB markers visually distinct. Live assessment gets a separate latest-bar badge with time, freshness and reason; it is not drawn across history. Disable 100× entry labels on unsupported timeframes. Refresh live routes with the existing visibility-aware polling pattern, cancel symbol/range switches and reject late responses from previous requests. No wallet, signing, private keys, POSTs or third-party runtime data calls are needed.
## 7. Failure modes and unanswered questions
### Expected strategy failures
- **Trend acceleration:** repeatedly rejected intervals can all fail together. A wick is not a standing limit order, and surviving geometry can be stale even before expiry.
- **OHLC path ambiguity:** body acceptance is a chosen proxy. A bar can trade through an interval many times without its body covering it; ERL intentionally does not claim tick-level knowledge.
- **Quiet-market false precision:** minor candle-feed/BBO differences can exceed the reclaim buffer. Small targets are also most affected by payout curvature.
- **News, gaps and relayer delay:** stop fills can occur past bust. Bar-closed invalidation is too slow to guarantee capital preservation.
- **Correlated BTC/ETH entries:** two individually acceptable plans can represent one macro risk event.
- **Parameter and regime drift:** active economics, market retirement or a contract upgrade can invalidate a stored profile.
- **Queue mismatch:** nominal strategy profit can rise while paid cash does not. A low queue today says little about the settlement state several minutes later.
- **Live snapshot instability:** entries, closes and liquidation removal change bucket mass without a BBO move; polling cannot establish causality or reconstruct history.
- **Research overfitting:** many interval thresholds give many opportunities to select attractive backtests. Frozen defaults and independent holdouts are essential.
### Unanswered operational questions
| Question | Consequence / safe research treatment |
| --- | --- |
| What are the actual active per-market parameters, curve mode, builder attribution and fixed-point rounding? | Use labeled documented scenarios; no exact settlement quote or verified-live economics badge |
| What exact formula/rounding produces bust prices, especially shorts? | Use actual position bustPrice; approximate historical bust only, sensitivity around the buffer |
| How is zero initial supply bootstrapped before/at rebate activation? | Do not invent the activation state or claim complete issuance reconstruction |
| Precisely what does backend `lpUsd` mean? Does TVL include debt? | Display raw fields, do not certify free cash or infer the mint bonus |
| What is the backend `asOf` encoding and candle timestamp convention? | Explicit boundary normalization; reject ambiguous timestamps |
| Which perp feed supplies candles, and how large is its BBO tracking error during stress? | No execution-price equivalence; stress basis/latency; obtain sampled BBO before live evaluation |
| Does the backend include all positions in the map and use current bust math? Are buckets inclusive at either end? | Treat as approximate reported exposure; exact endpoint measure does not locate individual positions |
| What operational stop service exists, with what delay or outage behavior? | Read-only alerts only; do not promise protective orders or automatic execution |
| How do queue claims age and how much backing cash is actually withdrawable? | No repayment-time estimate or marked-to-cash queue profits |
These do not block writing a hypothesis and specification. They do block presenting it as verified execution-ready economics or a proven trading edge. No requester-specific key, owner address or contract deployment is needed for this report.
## 8. Verification and falsifiable test plan
### Pure-function Vitest suite for the implementation stage
“Exhaustive” here means every rule, boundary and failure branch below, with property tests over interval operations; it cannot mean every possible floating-point candle sequence. Tests belong with the future modules under `src/signal/`, not only in disposable scratch space.
| Test group | Required assertions |
| --- | --- |
| Validation / closure | Empty and insufficient input; invalid OHLC, NaN/Infinity, zero/negative prices, negative volume, duplicate/out-of-order/off-grid timestamps; exactly closing vs still-forming bar; 24-bar warmup; segment reset on gaps; no fabricated bars |
| Interval algebra | Disjoint, nested, coincident and endpoint-touching intervals; full/partial/multiple cuts; split residues; overlapping later bodies; zero-length bodies/wicks; clipping; max-weight overlap without double counting |
| Ledger causality | Later body erases only overlapped territory; earlier body cannot erase future wick; later wick cannot repay; rank-weight and expiry edges; same OHLC multiset in different order gives a deliberately different ledger |
| Numerical integration | Hand-solvable piecewise densities; coverage bounded `[0,1]`; partition refinement leaves integral unchanged; translation/scaling invariance of geometry; brute-force sampling cross-check within a stated approximation error |
| Both directions | Known valid long and short fixtures; a reciprocal-coordinate mirror with the same positive reference denominator yields symmetric interval/gate behavior; economically different BTC/ETH profiles remain different |
| Event gates | Equality and just-outside every penetration, range, reclaim, progress, risk, support, obstacle, netRR and ERL threshold; strict higher confirmation low; no delayed revival; both sides -> ambiguous |
| Payout | Deadband zero; each holdback boundary and interior; both modes, BTC/ETH, builder on/off; finite at tiny q; monotonic payout; size independence of fraction; no win fee on losses; compare table within 0.0001 percentage point |
| State / execution | Earliest next-bar fill; expiry; 2-bp drift boundary; fill beyond stop; re-evaluation with frozen ledger; bust-distance gate; fixed stop/target; full exits; holding-bar count; structural equality semantics; cooldown boundary; no same-bar reversal |
| No repaint | For every prefix, outputs equal that prefix of the full run; appended extreme future bars do not change prior outputs; altering forming-bar OHLC has no effect; frozen input objects survive calls unchanged; repeat calls bitwise stable for same ordered inputs |
| Live validity | Every range, 149/150/151 buckets, malformed widths/order/gaps/totals/counts, symbols, timestamps at stale/future boundaries, center drift, insufficient range; no historical application; no bucket allocation from below/above totals |
| Live calculation | Partial bucket overlap; empty mass -> unknown evidence; exact crowding/materiality/near gates; long/short mappings; zero/signed LP and active queue; missing/stale summary; no favorable-mass promotion; core output unchanged after refresh |
| Client / UI | Correct relative GET paths, AbortSignal and encoding; deterministic mocks; no fallback on HTTP error; canceled/stale response isolation; no active-bar arrows; live-only label; unsupported timeframe and economics warnings; no write or third-party requests |
A short property-test generator can be implemented with a deterministic local PRNG and Vitest already in the project; no new dependency is necessary. A meaningful hand fixture should verify that subtracting a body `[102,104]` from a lower wick `[100,105]` leaves `[100,102]` and `[104,105]`, not zero evidence. With weight `.75`, coverage over `[100,105]` is `.45`. Adding an overlapping weight `.5` cannot increase already-covered `.75` density. This tests the distinctive construction rather than only reusing its implementation.
### Execution backtest, distinct from signal tests
Use sequential walk-forward blocks per symbol and regime. Freeze initial defaults before opening any holdout. Keep BTC and ETH results separate and report all tested parameter variants. A 1000-bar 1m response is only about 16.7 hours; even 1000 5m bars is about 3.47 days. That is inadequate to validate a robust edge. The assignment exposes neither candle pagination nor liquidation history. Obtain a documented offline archive or accumulate future observations before making broad performance claims; do not fabricate months of data or infer a map history from candles.
Fill entries at next open plus explicit adverse basis/latency scenarios. The candle-only simulator needs a declared **hypothetical stop-execution model**; it cannot prove real stop availability. On each holding bar:
1. Process opening gaps first. If the open is beyond bust, record full-margin loss. If beyond stop but before bust, use the gap-open price, not the stop price. Never improve a target fill across a favorable gap without modeling execution.
2. If high/low touches both stop and target, use stop-first in the conservative result. If a bust is also reachable, disclose a full-bust stress result; OHLC cannot order these events or guarantee stop execution before bust.
3. Closed-bar failure/time exits fill at the following open with the same gap/bust checks. Never fill at a previous close merely because that close caused the decision.
4. When observations end, report open/unresolved positions separately; do not force a favorable closing price.
Report gross move, actual modeled net USD, cash-paid versus queued claims where settlement history exists, PAPER quantity separately, expectancy per trade, win/loss distributions, liquidation fraction, maximum adverse/favorable excursion, turnover, hold duration, drawdown and full-margin tail losses. Include calendar coverage, trade count, uncertainty intervals and consecutive-loss clusters. Do not treat correlated trades as independent samples for confidence calculations.
Stress payout parameters, builder fees, standard/off-hours switching, 1/2/5/10-bp execution drift, 0/1/2-bar relayer delays, missing bars, stop outages and basis spikes. Compare against equal-frequency random-entry controls with identical risk/holding rules, simple failed-breakout and continuation baselines, and ablations removing ledger erasure, recency weighting, overhead burden and payout gates. Ledger ablation should measure incremental information, not just fewer trades. A candidate that works only under optimistic intrabar ordering is rejected.
Prospective live-map testing must timestamp raw snapshots and decisions when actually observed, with dataset provenance. Compare base candidates and veto outcomes on the same opportunities; never pick only the later successful snapshots. Until that archive exists, live-layer performance is **unmeasured**, not backtested. Protocol-summary state must be archived separately to evaluate paid-cash returns.
### Checks actually performed for this report
All fourteen requested primary pages were retrieved and reviewed. The payoff table was recomputed locally from the displayed equations for both assets and both modes. The companion scratch check verifies table rounding, holdback/deadband boundaries, monotonic payoff on a dense grid, illustrative bust arithmetic, break-even calculations, the interval example, document links/required sections, and that every requested source appears. These checks establish internal arithmetic and document coverage only; they are not independent evidence of strategy profitability, exact contract behavior, or deployed functionality. No historical or live trading test, Vitest implementation suite, production build or onchain audit was performed for this report-only deliverable.