Skip to content

docs: Gtd payload is Unix milliseconds, not seconds (release 0.8.4)#108

Merged
joaquinbejar merged 1 commit into
mainfrom
fix/gtd-unit-doc
Jul 10, 2026
Merged

docs: Gtd payload is Unix milliseconds, not seconds (release 0.8.4)#108
joaquinbejar merged 1 commit into
mainfrom
fix/gtd-unit-doc

Conversation

@joaquinbejar

Copy link
Copy Markdown
Owner

Summary

Fixes the TimeInForce::Gtd payload-unit documentation (found via joaquinbejar/OrderBook-rs#187). The doc claimed "seconds since epoch" — the outlier inside this crate:

  • TimestampMs, trade timestamps and statistics are all milliseconds;
  • this crate's own tests always used 13-digit millisecond epochs for GTD (order_type.rs, time_in_force.rs);
  • orderbook-rs::OrderBook::has_expired compares the payload against Clock::now_millis().

A caller following the old doc and passing seconds got orders that appeared expired immediately against a milliseconds clock (this nearly caused a 1000× "fix" in the wrong direction downstream — see Option-Chain-OrderBook-Backend#98).

Changes (doc-only — no API, behavior, or wire change)

  • Gtd doc rewritten: milliseconds, rationale, cross-references.
  • GTD bullet in lib.rs/README carries the unit; README regenerated via make readme.
  • gtd_payload_unit_is_milliseconds pins the contract: an ms deadline is live against an ms clock; the same deadline expressed in seconds reads as long-expired.
  • Version 0.8.3 → 0.8.4 + CHANGELOG (bump needed only to republish; cargo-semver-checks passes — API shape unchanged).

Closes the pricelevel half of joaquinbejar/OrderBook-rs#187.

The TimeInForce::Gtd doc claimed "seconds since epoch" — the outlier in
the crate: TimestampMs, trade timestamps and statistics are all
milliseconds, this crate's own tests always used 13-digit ms epochs for
GTD, and orderbook-rs compares the payload against Clock::now_millis. A
caller following the old doc got orders that appeared expired
immediately.

- Gtd doc rewritten (milliseconds, rationale, cross-refs); GTD bullet
  in lib.rs/README carries the unit; README regenerated.
- gtd_payload_unit_is_milliseconds pins the contract: an ms deadline is
  live against an ms clock, and the same deadline expressed in seconds
  reads as long-expired.
- Version 0.8.3 -> 0.8.4 + CHANGELOG (doc-only; bump required to
  republish).

Closes joaquinbejar/OrderBook-rs#187 (the pricelevel half; the
orderbook-rs half — unit docs on has_expired/set_market_close_timestamp
and a dep-floor bump — lands there).
@joaquinbejar joaquinbejar added bug Something isn't working documentation Improvements or additions to documentation labels Jul 10, 2026
@joaquinbejar joaquinbejar requested a review from Copilot July 10, 2026 09:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/orders/time_in_force.rs 94.28% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joaquinbejar joaquinbejar merged commit a5b6167 into main Jul 10, 2026
14 checks passed
@joaquinbejar joaquinbejar deleted the fix/gtd-unit-doc branch July 10, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants