Repository navigation
Hyperliquid ledger read to the end; a folded funding day's payment count (0.13.0) - #35
Merged
Merged
Conversation
…e end, as the documentation directs (500 items a page, 2000 fills, the next page from the last item's time, the window's repeats dropped); the shared funding item carries payments, the count the exchange states a folded day sums (Hyperliquid's nSamples, null on a payment), confirmed on mainnet and testnet alike 2026-10-20; CHANGELOG 0.13.0
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.
fosline's ask of 2026-10-20, in David's word: the Hyperliquid funding read stopped at the exchange's 500th item with no sign that more existed, and dropped
nSamples.Established before coding (David's caution: not a testnet quirk). Hyperliquid's documentation, network-neutral: "Responses that take a time range will only return 500 elements or distinct blocks of data. To query larger ranges, use the last returned timestamp as the next
startTimefor pagination";userFillsByTime"at most 2000 fills per response". Probed on mainnet's public info endpoint, 2026-10-20: auserFundingfrom 0 answered exactly 500 of a trader's 969 items, and from the 500th's time the other 469. Funding older than about a week is folded on mainnet exactly as on testnet: one item per coin per day at 00:00:00.000 UTC withnSamples1–24, null on an hourly payment. The documentation listsnSampleswithout stating the fold.Changed
ExchangeClientLedgerItem.fundinggainspayments: Int? = nil, last (breaking for positional patterns, one more_; construction unchanged). Shared, per David's generalize rule: the count the exchange states a summary item sums, nil for one payment.ledgerItemswalks all three windowed reads page by page: a page shorter than the documented cap is the last; a full page is followed from its last item's time (the window is inclusive, so the items already held at that time are dropped); a page adding nothing ends the walk.paymentsisnSamples.Tests: the replay route now honours
startTimeas the exchange does; new tests cover a two-page funding walk (the boundary item once, later payments kept, the request sequence), a short page read once, a read from a cursor, and a folded day's count against the recording. Hyperliquid, exchange, Kraken, Coinbase and OHLCV suites pass locally.Noted for David's pen (in the doc comment and CHANGELOG): the fold is relative to the present, so a re-read from a cursor older than a week hands up folded days where an earlier read handed up their payments. The library does not unfold.
CHANGELOG 0.13.0 rides in this PR per CONTRIBUTING; tag the merge commit.