Repository navigation
feat(sdk): support the trailingStop exchange action - #175
Merged
Merged
Conversation
Hyperliquid's dedicated trailing stop action places a native trailing stop
with a fixed retracement distance — { pct } as a percent string or { px } as
an absolute price — plus a nullable activationPx. Its success response
carries data.oid directly instead of an order-style statuses array, so the
error parser gains a fourth shape for data-level { error } responses, at
runtime (isErrorResponse/getErrorMessage) and at the type level
(ExcludeErrorResponse).
Wire it up end to end: trailingStop() and buildTrailingStop() under
api/exchange, an actions/trailingStop entry point, ExchangeClient.trailingStop
with coin-symbol resolution (CoinTrailingStopParameters), package.json
exports, offline + conformance tests, and the clients.md symbol-orders
inventory and example.
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
Adds SDK support for Hyperliquid's native trailing stop exchange action:
trailingStop()+buildTrailingStop()canonical builder underapi/exchange,actions/trailingStopentry point,ExchangeClient.trailingStopwithcoin-symbol resolution, package.json exports — following the established per-method pattern (twapOrder).data.oiddirectly rather than an order-stylestatusesarray, so the parser gains a fourth error shape for data-level{ error }responses — runtime (isErrorResponse/getErrorMessage) and type level (ExcludeErrorResponsenarrowsdatato{ oid: number }). Audited all existing response types: none carryerrorunderdata, so no false positives.activationPx: null, validation rejections,data.oidsuccess,data.errorrejection), client/coin-resolution/error-shape/conformance entries.clients.mdsymbol-orders inventory + example.Validation
bun run check— format, lint, docs content, tsc (TS5), TS7 native, JSDoc/export/import sync gates: all passbun run test:offline— 2087 pass, 0 fail (244 live tests skipped by design)bun run build— dist builds; published consumer contract checks passNote: the live test block follows the repo pattern but hasn't run against testnet yet (needs a funded key) — undocumented server-side retracement bounds could surface on its first live run.