Skip to content

Times without a time zone are UTC; Lighter account summaries; positions freshness - #16

Merged
0xFantomMenace merged 1 commit into
mainfrom
fix/utc-times-account-summaries
Sep 28, 2026
Merged

0xFantomMenace merged 1 commit into
mainfrom
fix/utc-times-account-summaries

Conversation

@0xFantomMenace

Copy link
Copy Markdown
Member

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

  • Timestamp::to_millis() reads a date alone ("2026-09-01", midnight UTC) and a date-time without an offset ("2026-09-01T00:00:00", with a T or a space) as UTC. RFC 3339 strings with an offset and strings of digits work as before.
  • Before, only RFC 3339 strings with an offset parsed, and the two forms above silently became 0.
  • New From<chrono::NaiveDateTime> and From<chrono::NaiveDate> for Timestamp, converted as UTC.
  • The SDK never reads the local time zone. The test suite passes under TZ=America/New_York.

New wrappers

  • LighterPositionsResource::account(account_index) and account_history(account_index, AccountHistoryParams) on client.lighter.positions and client.rh_lighter.positions, returning MetaResponse<Vec<AccountSummary>> with the account's position aggregates. A dex is refused before sending.
  • DataQualityResource::positions_freshness(), returning Vec<PositionsFreshness>.
  • README: the sla() example passes both arguments.

Checks

  • cargo test --all-features: 92 passed on stable, under TZ=America/New_York, and on Rust 1.85 with a freshly resolved lockfile.
  • cargo clippy --all-features --all-targets -- -D warnings and RUSTDOCFLAGS="-D warnings" cargo doc are clean.
  • The README snippets for the new methods compile.
  • The new methods were called against the production API and every response decoded.

…ns freshness

- Timestamp strings without an offset and dates alone convert as UTC;
  before, they silently became 0. From<NaiveDateTime> and From<NaiveDate>
  for Timestamp, as UTC.
- LighterPositionsResource: account() and account_history() (position
  aggregates, now and hourly); a dex is refused before sending.
- DataQualityResource::positions_freshness() and PositionsFreshness.
- README: the sla() example passes both arguments.
@0xFantomMenace
0xFantomMenace merged commit e5923b0 into main Sep 28, 2026
1 check passed
@0xFantomMenace
0xFantomMenace deleted the fix/utc-times-account-summaries branch September 28, 2026 23:15
0xFantomMenace added a commit that referenced this pull request Sep 29, 2026
…ns freshness (#16)

- Timestamp strings without an offset and dates alone convert as UTC;
  before, they became 0. From<NaiveDateTime> and From<NaiveDate> for
  Timestamp, as UTC.
- LighterPositionsResource: account() and account_history().
- DataQualityResource::positions_freshness() and PositionsFreshness.
0xFantomMenace added a commit that referenced this pull request Sep 29, 2026
…ns freshness (#16)

- Timestamp strings without an offset and dates alone convert as UTC;
  before, they became 0. From<NaiveDateTime> and From<NaiveDate> for
  Timestamp, as UTC.
- LighterPositionsResource: account() and account_history().
- DataQualityResource::positions_freshness() and PositionsFreshness.
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.

1 participant