Skip to content

fix: parse zero GTC expiration as None in OpenOrder#196

Open
kartojal wants to merge 1 commit into
mainfrom
fix/issue-191-openorder-gtc-expiration
Open

fix: parse zero GTC expiration as None in OpenOrder#196
kartojal wants to merge 1 commit into
mainfrom
fix/issue-191-openorder-gtc-expiration

Conversation

@kartojal

@kartojal kartojal commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #191.

OpenOrder.expires_at parsed a GTC order's wire expiration "0" through the generic epoch parser, yielding 1970-01-01T00:00:00Z instead of None. Switch the field to the existing ExpirationTimestamp type, matching the user-event order model.

Verified against the live CLOB API: expiration is returned in epoch seconds ("0" for GTC, the signed seconds value for GTD), so the test fixtures now use seconds instead of milliseconds.


Note

Low Risk
Localized parsing fix for one model field with tests; behavior change only affects how GTC/zero expirations and second-based expirations are represented.

Overview
OpenOrder.expires_at now uses ExpirationTimestamp instead of the generic epoch/ISO parser, so wire values 0 / "0" (GTC “no expiry”) become None instead of 1970-01-01.

Non-zero expiration values are interpreted as epoch seconds, matching the live CLOB API and the user-event order model. Test fixtures and model tests were updated accordingly, including coverage for zero expiration as int or string.

Reviewed by Cursor Bugbot for commit f713e76. Bugbot is set up for automated code reviews on this repo. Configure here.

OpenOrder.expires_at used the generic epoch parser, so a GTC order's
wire expiration "0" parsed as 1970-01-01 instead of None. Use the
existing ExpirationTimestamp type, matching the user-event order model.
The CLOB API returns expiration in epoch seconds, so the test fixtures
now use seconds instead of milliseconds.

Fixes #191
@kartojal
kartojal force-pushed the fix/issue-191-openorder-gtc-expiration branch from 0524381 to f713e76 Compare July 23, 2026 11:55
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.

[Bug]: OpenOrder parses GTC expiration "0" as 1970 instead of no expiration

1 participant