-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement ws order type refactoring #320
Conversation
WalkthroughThe recent updates primarily focus on refactoring and enhancing the codebase for handling WebSocket responses and order events. Key changes include transforming constant function declarations into function statements, reorganizing enums related to fill types, and refining interfaces for order and fill event data. These modifications aim to improve code clarity, maintainability, and alignment with updated interfaces and type definitions. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- src/client/webSocket/transform.ts (3 hunks)
- src/types/enums/response.ts (4 hunks)
- src/types/webSocket/response/orders.ts (11 hunks)
- src/types/webSocket/response/ordersFill.ts (6 hunks)
Additional comments not posted (19)
src/types/webSocket/response/ordersFill.ts (7)
1-5
: Ensure that the new importsFillTypeOrder
andFillTypeSystem
are used appropriately throughout the file.
22-30
: The documentation forIDEXOrderFillEventDataSystem
has been updated to reflect its specific use case. Ensure that the documentation accurately describes the behavior and usage of this interface.
33-38
: Thetype
property inIDEXOrderFillEventDataSystem
has been correctly updated to useFillTypeSystem
. This change aligns with the new enum definitions and should help clarify the type of fills this interface represents.
Line range hint
44-53
: Thetype
property inIDEXOrderFillEventDataGeneral
has been updated to useFillTypeOrder
. This is consistent with the restructuring of the fill types and should ensure that the interface correctly represents order-related fills.
63-63
: The union typeIDEXOrderFillEventData
has been updated to include the new interfaces. This change is necessary to ensure that all potential fill event data types are correctly handled.
123-128
: They
property inWebSocketResponseOrderFillShortSystem
has been updated to use thetype
fromIDEXOrderFillEventDataSystem
. This change ensures that the short message format aligns with the new system fill types.
158-159
: The union typeWebSocketResponseOrderFillShort
has been updated to include the new short message formats. This is crucial for ensuring that the WebSocket responses can handle both system and general fill types.src/client/webSocket/transform.ts (2)
Line range hint
117-143
: The functiontransformOrderFill
has been converted from an arrow function to a regular function declaration. This change improves readability and maintainability. Ensure that the function correctly handles the transformation logic, especially the conditional parts that depend on whether the fill is general or system-specific.
Line range hint
145-189
: The functiontransformOrdersMessage
has been updated to handle different types of order data based on the presence of theo
property. This function now correctly distinguishes between system fills and general order data, mapping fills appropriately. Ensure that the transformation logic is robust and handles all edge cases.src/types/enums/response.ts (3)
Line range hint
30-50
: TheFillTypeSystem
enum has been introduced to separate system-specific fill types from order-related fills. This change improves clarity and helps in distinguishing between different contexts where fills are used. Ensure that the enum is used consistently across the codebase.
54-65
: TheFillTypeOrder
enum has been introduced to specifically handle order-related fill types. This separation from system fills is a good practice as it clarifies the usage and makes the code more maintainable.
76-80
: TheFillType
enum has been updated to include bothFillTypeOrder
andFillTypeSystem
. This consolidation is necessary to handle cases where a fill could belong to either category. Ensure that this combined enum is used appropriately in contexts where a distinction between system and order fills is not required.src/types/webSocket/response/orders.ts (7)
2-3
: The imports have been updated to reflect the new enum and type definitions. This change is necessary to ensure that the interfaces in this file use the correct types from the updated enums.
Line range hint
65-75
: TheIDEXOrderEventDataBase
interface has been updated to make thetype
property optional and read-only, reflecting its use in system fill scenarios where the type might not be defined. This change is appropriate and aligns with the new data handling strategy for order events.
86-89
: TheIDEXOrderEventDataSystemFill
interface has been introduced to handle system fill updates specifically. This interface correctly extendsIDEXOrderEventDataBase
and makes thetype
property undefined, which is suitable for system fill scenarios.
Line range hint
103-116
: TheIDEXOrderEventDataGeneral
interface has been updated to include properties fromIDEXOrder
except for those already included inIDEXOrderEventDataBase
. This restructuring helps in maintaining a clear separation between general and system-specific order data.
159-160
: The union typeIDEXOrderEventData
has been updated to include bothIDEXOrderEventDataSystemFill
andIDEXOrderEventDataGeneral
. This change is crucial for handling different types of order events correctly in the WebSocket responses.
Line range hint
173-219
: TheWebSocketResponseOrderShortSystem
interface has been updated to handle system-specific order shorts. This interface correctly extendsWebSocketResponseOrderShortBase
and sets theo
property to undefined, which is appropriate for system fill scenarios.
Line range hint
228-354
: TheWebSocketResponseOrderShortGeneral
interface has been updated to include additional properties that are relevant for general order types. This comprehensive inclusion of properties ensures that all necessary data is available for general order processing.
🎉 This PR is included in version 4.0.0-beta.12 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 4.0.0-alpha.9 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Summary by CodeRabbit
Refactor
Documentation