feat: add Hedge Mode (MultiWay position mode) support#16
Merged
Conversation
Lets users hold independent Long and Short positions on the same contract. - account position-mode <oneway|multiway> (alias: position mode) -> POST /user/positionMode - order buy/sell --strategy <oneway|long|short> -> order `strategy` field - show `strategy` column in `position list` and `order list` - register the position-mode tool in the MCP tool-catalog (dangerous) - document Hedge Mode in README/AGENTS/CONTEXT Verified: cargo build + cargo test green (98 unit + 16 integration); clippy clean on changed files. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
byshing
approved these changes
Jun 24, 2026
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.
What
Adds Hedge Mode (MultiWay position mode) to the CLI, letting users hold independent Long and Short positions on the same contract instead of netting into one.
Switch position mode —
POST /user/positionModeaccount position-modeis the canonical command (sibling ofaccount margining-mode, which posts to the analogous/user/marginingMode);position modeis a CLI alias delegating to the same handler. Optional--target-account-idfor paired/sub-accounts. Confirmation-gated like other state-changing commands (skip with--yes).MultiWaysends{"positionMode":"MultiWay"}; One-Way omits the field, per the API contract.Hedge legs on orders —
strategyfield onPOST /order--strategyacceptsoneway/long/shortand maps to the exact API casing. Thestrategycolumn is now shown inposition listandorder list.MCP
agents/tool-catalog.jsongains thestrategyparam on buy/sell and a new dangerousaccount position-modetool. Theposition modealias is intentionally CLI-only (no catalog entry) to avoid a duplicate MCP tool.Docs
README / AGENTS / CONTEXT document Hedge Mode, with links to the BitMEX support articles.
Testing
cargo buildandcargo testpass — 98 unit + 16 integration tests (new coverage: position-mode body builder, orderstrategybuilder, MCP registry, and help-text assertions).cargo clippyis clean on the changed files.--validateshows"strategy":"Long"in the order body (omitted when unset); all mode aliases (multiway/hedge/oneway/multi-way/one-way) route to/user/positionMode; invalid values are rejected by clap.Notes
positionModefield is omitted (swagger: "leave empty for one way mode"); equivalent to sendingnull.🤖 Generated with Claude Code