Refactor trade order handling and enhance market risk statistics#43
Merged
Conversation
- Updated the `settle_trade_order` function in both `private_methods.rs` and `public_methods.rs` to first attempt deserialization of the `ExecuteTraderOrderZkosSlTp` variant before falling back to the standard `ExecuteTraderOrderZkos`. - Enhanced error handling for invalid bincode and order parameters. - Adjusted the creation of the RPC command and record key based on the presence of the SlTp variant, improving the flexibility of order processing.
- Updated the `compute_market_risk_stats` function to include funding rate and its timestamp in the calculations. - Introduced a new `FundingRateResponse` struct to encapsulate funding rate information in the `MarketRiskStatsResponse`. - Adjusted the `get_market_stats` function to retrieve funding rate data, improving the accuracy of market risk assessments.
- Enhanced the description of the market risk statistics endpoint to incorporate current and estimated funding rates, along with their timestamps. - This update improves clarity for developers regarding the additional data provided in the market risk statistics response.
- Added a new section for the funding rate object in the market stats documentation, detailing fields such as last applied funding rate, estimated funding rate, and their respective timestamps. - This enhancement improves the clarity and completeness of the API documentation for developers.
- Updated the `get_market_stats` function to retrieve the latest position size, including total long and short values. - Modified the `compute_market_risk_stats` function to accept total long and short values in USD, improving the accuracy of funding rate estimations. - These changes enhance the market risk assessment by incorporating position size into the calculations.
- Updated the `cancel_trader_order` function in both `private_methods.rs` and `public_methods.rs` to first attempt deserialization of the `CancelTraderOrderZkosSlTp` variant before falling back to the standard `CancelTraderOrderZkos`. - Enhanced error handling for invalid bincode and order parameters. - Adjusted the creation of the RPC command and record key based on the presence of the SL/TP variant, improving the flexibility of order cancellation processing. - Updated API documentation to reflect support for SL/TP in both settlement and cancellation processes, enhancing clarity for developers.
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.
No description provided.