Skip to content

feat(subscription/l2Book): add optional 'fast' field#142

Merged
nktkas merged 2 commits into
nktkas:mainfrom
vtx100:l2-book-field
Jun 16, 2026
Merged

feat(subscription/l2Book): add optional 'fast' field#142
nktkas merged 2 commits into
nktkas:mainfrom
vtx100:l2-book-field

Conversation

@vtx100

@vtx100 vtx100 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

What & why

Add the optional 'fast' field in the websocket subscription schema of L2BookRequest.
The field changes the manner in which the responses are pushed("5 levels if fast, 20 levels if slow")->docs (search for l2Book)
Via telegram Hyperliquid API Announcements(@hyperliquid_api) :

  • "l2Book subscriptions will include an optional fast: true field. When set, the book will push 5 levels every 0.5 seconds The subscription without the flag will push 20 levels every 5 seconds" (https://t.me/hyperliquid_api/326).
  • This was however change to based on feedback: "l2Book without fast: true will push 20 levels every 2 seconds, instead of every 5 seconds"(https://t.me/hyperliquid_api/327)

Type of change

  • Bug fix
  • New API method / feature
  • Schema/type update to match the Hyperliquid API
  • Breaking change

@gambinish

Copy link
Copy Markdown

Is there anything we can do to help move this forward? We are building on top of this and are keen to adopt the fast: true flag into our order book UI as there are a few other SDKs that already support this.

Let us know if there's anything we can do to get this over the finish line!

…request field

- Add `fast?: true` to `L2BookEvent` for snapshots pushed in fast mode
- Change the request field from `v.nullish(v.boolean(), false)` to `v.optional(v.boolean())`, omitting `fast` when unset instead of sending `false`
- Fix the field JSDoc that was written as a `//` line comment instead of `/**`
- Drop the server-rejected `fast: null` test case
@nktkas

nktkas commented Jun 16, 2026

Copy link
Copy Markdown
Owner

I pushed a few changes on top before merging:

  • Added fast to L2BookEvent
  • Reworked the request field to v.optional(v.boolean())
  • Fixed the field JSDoc

Thanks for your contribution!

@nktkas
nktkas merged commit 08f9a8d into nktkas:main Jun 16, 2026
2 checks passed
@nktkas

nktkas commented Jun 16, 2026

Copy link
Copy Markdown
Owner

@gambinish, I was planning to ship the release within 1-2 days (I need to write up all the changes in the new version + double-check that the current API schemas/types are still accurate).

@gambinish

Copy link
Copy Markdown

@gambinish, I was planning to ship the release within 1-2 days (I need to write up all the changes in the new version + double-check that the current API schemas/types are still accurate).

Thank you! We're going to go ahead and integrate this now. Appreciate your effort here.

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.

3 participants