Skip to content

feat: paper trading mode against live Hyperliquid data (#61) - #62

Merged
joeblau merged 3 commits into
mainfrom
feat/paper-trading
Oct 19, 2026
Merged

joeblau merged 3 commits into
mainfrom
feat/paper-trading

Conversation

@joeblau

@joeblau joeblau commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Closes #61

Built with the Kimi CLI (kimi-code v2.2.0).

Paper mode (--paper, config set mode paper, run --paper) runs the full command surface against real mainnet Hyperliquid market data. A local simulator handles fills: book walking, resting limits, reduce-only, TP/SL, taker/maker and builder fees, hourly funding, and approximate margin/liquidation. It never signs or submits anything, and needs no Privy, approveAgent or deposit. State lives under ~/.bloxwap/paper/; paper reset / paper summary manage it. Every envelope and event carries mode/paper labels, and going live requires config set mode live --yes. SKILL.md, README and the docs site (new paper page) are updated. Locally: build, lint, typecheck, 286 tests, docs build/check all pass.

Paper mode runs the full command surface against real mainnet Hyperliquid
public market data (info + WS l2Book/trades/bbo, meta, funding) and never
signs or submits: no Privy session, approveAgent or deposit. Enable it with
the global --paper flag, config set mode paper (going back to live requires
--yes) or run --paper.

- deterministic simulator: market/IOC book walking with slippage, resting
  limits filled on trade-through, reduce-only, TP/SL triggers, HL taker/maker
  fees plus the 1 bp builder fee, hourly funding accrual, cross/isolated
  leverage with an approximate margin and liquidation model
- locked, restartable paper state under ~/.bloxwap/paper (state, trades,
  events, audit, runner pid/socket/logs) fully separated from live state
- paper runner engine streams live books/trades to fill resting orders,
  accrues funding and liquidates on a timer, without a signer
- every envelope and event labels mode/paper; order/cancel/modify/leverage
  keep the same validation, normalized errors, risk limits, builder fee and
  audit trail; init/fund/rotate/revoke refuse paper mode
- paper reset/summary commands; status/balance/positions/orders/events/logs
  read paper state
- fixture-book unit tests for the simulator, store, exchange adapter, engine,
  mode routing and dispatch flows; env-gated mainnet smoke test
SKILL.md recommends paper first, then fund and go live, with paper envelope
examples; READMEs, a new docs/paper page (repo markdown and MDX), config
reference updates for mode/paper.startingBalance/BLOXWAP_MODE, regenerated
command reference and embedded skill content, and a PROGRESS entry.
metaAndAssetCtxs 'funding' is already the hourly funding rate (paid every
hour), so the simulator charges notional * rate * hours instead of rate/8.
Update simulator math and comments, funding test expectations, and the
paper trading docs that described the eight-hour division.
@joeblau
joeblau merged commit beeb399 into main Oct 19, 2026
8 checks passed
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.

Paper trading mode: simulate against live Hyperliquid market data

1 participant