Expose Hyperliquid TWAP WS feeds as custom data - #4674
Open
graceyangfan wants to merge 1 commit into
Open
Conversation
Add opt-in userTwapHistory and userTwapSliceFills custom data end-to-end (DataClient, WS client/handler, PyO3/stubs, Arrow/catalog, docs). Closes nautechsystems#4673
cjdsellers
marked this pull request as ready for review
August 10, 2026 02:00
Member
|
Hi @graceyangfan, Thank you for the PR. I found one issue in the custom-data routing: Could you either reject metadata that differs from its canonical form before subscribing, or retain the original subscription identity when emitting, and add a test covering the subscribe-to-emit topic identity? |
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.
Problem / goal
Hyperliquid WebSocket already streams
userTwapHistoryanduserTwapSliceFills, but strategies cannot consume them through Nautilus custom data. Issue #4673 asks to expose these as opt-in adapter custom data (research / TWAP lifecycle), not as core market-data types and not via the default execution user bootstrap.Closes #4673
Scope
In this PR
HyperliquidTwapHistory,HyperliquidTwapSliceFill(#[custom_data], registered for Arrow + JSON)twapIdon history rows, optionaldescription,Decimalsizes on TWAP state, seconds-vs-ms venue time handlingNautilusWsMessage::CustomData) → WS client subscribe/unsubscribe → data client branchesDataTypetype name +metadata["user"]+ identifier = user addressuser, WS emit fixtures, live JSON parse fixtures, Arrow + Parquet catalog round-tripsOut of scope (explicit)
twapPlace/ TWAP order placementtwapStateschannelsubscribe_all_user_channels(execution default)DataClientAdapteralready refcounts customDataTypetopics; these channels are not a competing shared-stream profile like depth-for-latency)Design notes (reviewer map)
Sibling path: Hyperliquid
PublicTrade/ user-keyed custom data (same transport, handler emit, data-client branch style). User-keyed (not instrument-keyed): strategies passmetadata={"user": "0x..."}; the address need not be the adapter trading account.Non-obvious choices:
subscribe_all_user_channelsHyperliquidTwapStatus(activated/terminated/finished/error+Unknown)twap_idOption<u64>twapId; keep optional for older shapesinstrument_id = None, do not drop rowcoinDecimalfor sizes/prices/feesis_snapshotfrom venue envelopeTesting
Local (paths that fail without this change):
Note (macOS only):
--test catalogwith thepythonfeature can triplinker_messages(__eh_frametoo large). Catalog tests are validated witharrow,high-precision(nopython). Linux CI is unaffected.Follow-ups
twapStatesif product needs live state snapshots beyond historyto_arrow_record_batch_byteshelper (onlyHyperliquidPublicTradehas this today among HL custom types)Reviewer checklist (self)
HYPERLIQUID_CLIENT_ID