Skip to content

fix(lighter) incorrect order parsing for createOrder#28337

Merged
carlosmiei merged 3 commits intoccxt:masterfrom
PimRijkers:lighter-enhancement-improved-order-parsing
Apr 7, 2026
Merged

fix(lighter) incorrect order parsing for createOrder#28337
carlosmiei merged 3 commits intoccxt:masterfrom
PimRijkers:lighter-enhancement-improved-order-parsing

Conversation

@PimRijkers
Copy link
Copy Markdown
Contributor

@PimRijkers PimRijkers commented Apr 4, 2026

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

…meters. Added post-only. Improved parseOrderTimeInForce naming and order. Fixed wrong variable naming in parseOrderType.
@carlosmiei carlosmiei self-assigned this Apr 6, 2026
@carlosmiei
Copy link
Copy Markdown
Collaborator

@PimRijkers thanks for your contribution, we will review and merge it soon.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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, and reduce_only inside parseOrder.
  • Fixed/standardized time-in-force parsing by introducing parseOrderTimeInForce and parseOrderTimeInForceInteger (and removed the misspelled former helper).
  • Updated static test expectations for createOrder parsed 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.

@carlosmiei carlosmiei merged commit 53cd866 into ccxt:master Apr 7, 2026
15 checks passed
@PimRijkers PimRijkers deleted the lighter-enhancement-improved-order-parsing branch April 8, 2026 09:29
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.

3 participants