Repository navigation
Times without a time zone are UTC; Lighter account summaries; positions freshness - #16
Merged
Merged
Conversation
…ns freshness - One shared timestamp helper replaces the per-resource copies. A naive datetime, an ISO string without an offset and a date alone are UTC; before, they were read as the machine's local time. A value that is not a timestamp raises ValueError instead of being dropped. - client.lighter.positions and client.rh_lighter.positions: account(), account_history(), iterate_account_history() and async versions (the account's position aggregates, now and hourly). - client.data_quality.positions_freshness(): one PositionsFreshness row per venue. - Tests run under a non-UTC time zone; README examples use aware datetimes.
0xFantomMenace
added a commit
that referenced
this pull request
Sep 29, 2026
…ns freshness (#16) - One shared helper converts every timestamp. A naive datetime, an ISO string without an offset and a date alone are UTC; before, they were read as the machine's local time. A value that is not a timestamp raises ValueError. - client.lighter.positions and client.rh_lighter.positions: account(), account_history(), iterate_account_history() and async versions. - client.data_quality.positions_freshness() and PositionsFreshness.
0xFantomMenace
added a commit
that referenced
this pull request
Sep 29, 2026
…ns freshness (#16) - One shared helper converts every timestamp. A naive datetime, an ISO string without an offset and a date alone are UTC; before, they were read as the machine's local time. A value that is not a timestamp raises ValueError. - client.lighter.positions and client.rh_lighter.positions: account(), account_history(), iterate_account_history() and async versions. - client.data_quality.positions_freshness() and PositionsFreshness.
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.
Two fixes for 1.12.0: times without a time zone are UTC, and the account summary and positions freshness routes get wrappers.
Times without a time zone are UTC
oxarchive/_time.py, replaces the per-resource conversion copies. Anintpasses through; an awaredatetimeis its instant; a naivedatetimeis UTC; a string of digits is Unix milliseconds; any other string is ISO 8601 (a trailingZis accepted), UTC when it has no offset, and a date alone is midnight UTC.datetimeand an offset-less ISO string were read as the machine's local time. UnderTZ=America/New_York,"2026-09-01","2026-09-01T00:00:00"anddatetime(2026, 9, 1)all became1788235200000(04:00 UTC); they are now1788220800000.ValueErrorinstead of being dropped from the request.datetime.now()is local wall-clock time, so the README and docstring examples now usedatetime.now(timezone.utc).New wrappers
client.lighter.positionsandclient.rh_lighter.positions:account(account_index),account_history(account_index, start=, end=, cursor=, limit=),iterate_account_history()and async versions, for/accounts/{account_index}/accountand/account/history. Rows areAccountSummarywith the account's position aggregates.client.data_quality.positions_freshness()(andapositions_freshness()) for/v1/data-quality/positions, typed asPositionsFreshness.Checks
pytest: 173 passed, also underTZ=Asia/KolkataandTZ=Pacific/Auckland; the new time zone tests setAmerica/New_Yorkthemselves.ruffandmypy --strict: no new findings compared withmaster.