fix: parse zero GTC expiration as None in OpenOrder#196
Open
kartojal wants to merge 1 commit into
Open
Conversation
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
force-pushed
the
fix/issue-191-openorder-gtc-expiration
branch
from
July 23, 2026 11:55
0524381 to
f713e76
Compare
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.
Fixes #191.
OpenOrder.expires_atparsed a GTC order's wire expiration"0"through the generic epoch parser, yielding1970-01-01T00:00:00Zinstead ofNone. Switch the field to the existingExpirationTimestamptype, matching the user-event order model.Verified against the live CLOB API:
expirationis 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_atnow usesExpirationTimestampinstead of the generic epoch/ISO parser, so wire values0/"0"(GTC “no expiry”) becomeNoneinstead of1970-01-01.Non-zero
expirationvalues 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.