Skip to content

Refactor trade order handling and enhance market risk statistics#43

Merged
shanu516516 merged 7 commits into
mainfrom
sltp-methods
Apr 9, 2026
Merged

Refactor trade order handling and enhance market risk statistics#43
shanu516516 merged 7 commits into
mainfrom
sltp-methods

Conversation

@shanu516516
Copy link
Copy Markdown
Collaborator

No description provided.

- 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.
@shanu516516 shanu516516 merged commit f9d8562 into main Apr 9, 2026
0 of 3 checks passed
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.

1 participant