Skip to content

docs(trade): spell out --reduce-only side semantics (close = opposite side)#61

Open
psmiratisu wants to merge 1 commit into
mainfrom
docs/reduce-only-side-semantics
Open

docs(trade): spell out --reduce-only side semantics (close = opposite side)#61
psmiratisu wants to merge 1 commit into
mainfrom
docs/reduce-only-side-semantics

Conversation

@psmiratisu

@psmiratisu psmiratisu commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Problem

We're seeing a high volume of Reduce only order would increase position rejections from Hyperliquid. Root cause: the --reduce-only help text ("Only reduce an existing perp position") and the README example ("Reduce-only (close part of a position)") never state the one rule that matters — the order side must be the opposite of the position. An LLM agent reasoning "my position is long, so --side long" when closing gets this rejection 100% of the time, and the docs are exactly what agents read to compose these commands.

Change

  • --reduce-only help string now reads: "Close/shrink an existing perp position. --side must be the OPPOSITE of the position (close a long with --side short, close a short with --side long). Never set this when opening or adding to a position — HL rejects it."
  • README perp section shows both close directions as examples and a callout explaining the exact HL rejection message otherwise.

Docs-only; no behavior change. tsc --noEmit clean.

Companion server-side fix: internal-trading-bot#59 adds a plan-time position check so a wrong reduce-only order fails instantly with the correct close order spelled out, instead of after the full sign roundtrip.

🤖 Generated with Claude Code


Note

Low Risk
Documentation-only changes to README and Commander option help; no trade execution or validation logic modified.

Overview
Clarifies Hyperliquid perp --reduce-only usage in docs and CLI help so agents stop submitting orders with the wrong --side.

The --reduce-only option description in acp trade now states that --side must be opposite to the open position (short to close a long, long to close a short), and warns not to use the flag when opening or adding.

The README perp section replaces a single reduce-only example with both close directions and adds a callout that mismatched sides trigger Hyperliquid’s "Reduce only order would increase position" rejection.

No runtime or API behavior changes — documentation and help text only.

Reviewed by Cursor Bugbot for commit 2c78eb9. Bugbot is set up for automated code reviews on this repo. Configure here.

… side)

The help text ("Only reduce an existing perp position") and README example
never stated the rule that matters: a reduce-only order's --side must be the
OPPOSITE of the position (close a long with --side short, close a short with
--side long), and the flag must never be set when opening. LLM agents reading
the docs were sending side == position when closing, which HL rejects with
"Reduce only order would increase position" — our most frequent perp error.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants