docs: note that spot_meta_and_asset_ctxs returns two non-parallel lists - #309
Open
massimiliano1991 wants to merge 1 commit into
Open
Conversation
universe (324) and assetCtxs (715) are not parallel; pair them through the universe entry's own `index` field. Positions 0-70 line up, which hides the mismatch during casual testing and returns another asset's prices past that point. The perp sibling meta_and_asset_ctxs() IS parallel, so the intuition does not carry over. Docstring only, no behaviour change. Closes hyperliquid-dex#308.
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.
Closes #308.
spot_meta_and_asset_ctxs()returns two lists that are not parallel, and the docstringlays them out adjacently. This adds a
Note:saying so, with the correct pairing. Nobehaviour change — docstring only.
The fact, re-measured on mainnet today (2026-08-10)
Why it deserves a line rather than being obvious
Positions 0-70 line up. Everything you are likely to eyeball while testing is inside the
aligned region, so zipping the two lists looks correct and then silently returns a
different asset's prices. The first divergence:
The perp sibling
meta_and_asset_ctxs()is parallel (232 vs 232), so the naturalintuition carries over from perps and is wrong for spot. The SDK already encodes the
distinction in
Info.__init__— perps useenumerate(meta["universe"]), spot usesspot_info["index"] + 10000— so the knowledge is in the codebase, just not where acaller of this method reads.
Reproduce (no keys, no install)
Happy to trim the note if it reads long — the pairing line is the part that matters.