Repository navigation
Phase 5: Add inventory-aware quoting and bounded inventory skew - #2
Merged
Merged
Conversation
btorressz
marked this pull request as ready for review
October 5, 2026 03:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements HyperAMM Phase 5 directly on top of the accepted Phase 4.1 foundation.
Inventory architecture
InventoryStateplus pure deterministicInventoryPolicy.Info.user_state(account_address)/assetPositions[].position.szi.Quoting
r = clamp((position-target)/soft_limit, -1, 1).-r * max_inventory_price_skew_bps.base_order_sizefloor, preserving the Phase 4.1 baseline and curve profile.Hard limits
Runtime, API, and terminal
GET /api/v1/positionsexposes normalized inventory and computed skew state./ws/terminalincludes inventory, ratio, reservation, price skew, multipliers, hard-limit state, source, freshness, and version.Tests and documentation
docs/INVENTORY_SKEW.md; updates README, architecture, AMM math, and roadmap..github/workflows/phase5-acceptance.ymlusing Python 3.12 and Node 24.Acceptance — final head
0403b777c02f109d8163d2dfdf60a14f7dc2dbecpytest: 105 passed, 1 warning in 1.87sGET /api/v1/health: HTTP 200{"status":"ok","app":"HyperAMM","market_connection":"CONNECTED","stale":false,"mode":"DEMO","simulated":true}npm run typecheck: PASS —tsc -b --pretty falsenpm run build: PASS —tsc -b && vite build, Vite production build completed in 2.08sgit diff --check origin/main...HEAD: PASS, no outputAcceptance result
Phase 5 passes the requested offline acceptance gate. Phase 6 remains unstarted and can begin after this PR is merged.
Scope boundary
No Phase 6 volatility/book-imbalance logic, Phase 7 perp/funding adaptation, Phase 8 oracle/risk-firewall expansion, AI/LLM agents, optimization solvers, or mainnet execution is included.