fix(lighter) incorrect order parsing for createOrder#28337
Merged
carlosmiei merged 3 commits intoccxt:masterfrom Apr 7, 2026
Merged
fix(lighter) incorrect order parsing for createOrder#28337carlosmiei merged 3 commits intoccxt:masterfrom
carlosmiei merged 3 commits intoccxt:masterfrom
Conversation
…meters. Added post-only. Improved parseOrderTimeInForce naming and order. Fixed wrong variable naming in parseOrderType.
Collaborator
|
@PimRijkers thanks for your contribution, we will review and merge it soon. |
There was a problem hiding this comment.
Pull request overview
This PR fixes lighter#parseOrder so it correctly parses orders returned from createOrder, where the deep-extended request fields (e.g., order_type, time_in_force, is_ask, reduce_only) are integers rather than the string values expected by the existing parser.
Changes:
- Added integer-to-string normalization for
is_ask,order_type,time_in_force, andreduce_onlyinsideparseOrder. - Fixed/standardized time-in-force parsing by introducing
parseOrderTimeInForceandparseOrderTimeInForceInteger(and removed the misspelled former helper). - Updated static test expectations for
createOrderparsed responses (type, timeInForce, side, reduceOnly, postOnly).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| ts/src/lighter.ts | Updates parseOrder to handle integer-encoded fields from createOrder deep-extend, adds integer parsing helpers, and sets postOnly/reduceOnly consistently. |
| ts/src/test/static/response/lighter.json | Adjusts expected parsed createOrder outputs to reflect correct parsing (e.g., type, timeInForce, side, reduceOnly). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Problem
The current parseOrder method doesn't parse correctly for the createOrder method.
Explanation
The current parseOrder method focuses on parsing orders that are received from the fetch and watch methods.
The parseOrder method is also used for deep-extending the order object that is returned by the createOrder method. The deep-extend uses the method parameters to extend from, but these values can't be used directly. They are corresponding integer values of the actual string values.
Solution
Check for integer values and create corresponding string values from them. These string values will then be used to correctly parse the order.
Other Minor Changes
Added post-only property
Corrected parameter/variable naming
Corrected time-in-force ordering