Add fast option to Hyperliquid l2Book subscriptions#68
Merged
Conversation
Hyperliquid announced a websocket push-frequency migration for l2Book: the default l2Book subscription remains the deeper 20-level snapshot feed, while clients can opt into `fast: true` to receive a 5-level book at a higher cadence. The Rust SDK did not expose the new `fast` subscription field, forcing clients to bypass the typed API or hand-roll subscription JSON. Add `fast: Option<bool>` to `Subscription::L2Book`, keep it omitted by default, update examples/docs/CLI call sites, and add a serialization round-trip test for both default and fast l2Book subscriptions. Docs: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
ifdario
reviewed
Jun 19, 2026
ifdario
left a comment
Contributor
There was a problem hiding this comment.
You can also use fast: bool and skip_serializing_if = "std::ops::Not::not"
Represent l2Book fast mode as a two-state bool instead of Option<bool>. The default false value is omitted from serialized subscription payloads via skip_serializing_if = "std::ops::Not::not", while true emits `fast: true`. Update examples, docs, CLI subscription construction, and serialization tests.
Contributor
Author
|
@ifdario Fix, use std::ops::Not::not |
ifdario
approved these changes
Jun 19, 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.
On June 9th 2026. Hyperliquid announced a websocket push-frequency migration for l2Book:
the default l2Book subscription remains the deeper 20-level snapshot feed,
while clients can opt into
fast: trueto receive a 5-level book at ahigher cadence(0.5s).
The Rust SDK did not expose the new
fastsubscription field, forcingclients to bypass the typed API or hand-roll subscription JSON.
Add
fast: Option<bool>toSubscription::L2Book, keep it omitted bydefault, update examples/docs/CLI call sites, and add a serialization
round-trip test for both default and fast l2Book subscriptions.
Docs: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions