Skip to content
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

[WIP] Jupiter DCA support #20

Merged
merged 8 commits into from
Oct 16, 2024
Merged

[WIP] Jupiter DCA support #20

merged 8 commits into from
Oct 16, 2024

Conversation

skynetcap
Copy link
Owner

  • Read all Jupiter DCA accounts

Changed long to double for financial fields in JupiterPerpPosition and introduced POSITION_DIVISOR for conversion. Enhanced testGetAllJupiterPerpPositions to log formatted, comprehensive position details including entry price and leverage.

(cherry picked from commit fe05a02)
Introduce the `JupiterDca` model to represent Dollar-Cost Averaging accounts. Added methods for deserialization and retrieving all DCA accounts. Updated Maven version across various modules to 1.33.0-SNAPSHOT. Enhanced `OpenBookManager` and `JupiterManager` with new methods and constants for improved functionality.
Refactored getAllDcaAccounts to handle RpcException, ensuring it returns an empty list and logs a warning in case of failure. Added a new test method getMostRecentJupiterDcaAccounts to fetch and log the most recent DCA accounts based on their index.
Updated the sorting criterion in `getMostRecentJupiterDcaAccounts` to use creation timestamp and enhanced logging details. Added filtering to display only active JupiterDca accounts based on specific conditions and included the size of the filtered list in the logs.
Introduced a new unit test `testGetOpenDcaOrders` to validate the filtering criteria for active DCA orders based on provided constraints such as next cycle, usage, and in-range amounts. This ensures proper functionality by using mock token prices and asserting the resultant order properties.
Refactor the DCA program ID from string to PublicKey type for consistency. Added a new method to retrieve DCA accounts filtered by user and updated tests to validate new functionality.
Renamed `getAllDcaAccounts` to `getDcaAccounts` in `JupiterManager` for consistency. Disabled several tests due to reliance on hardcoded accounts and potential flakiness.
Introduced JupiterUserDcaStats class for aggregating user's DCA statistics. Enhanced JupiterManager with methods for DCA order filtering, aggregation, and detailed statistics. Updated test cases to validate these new functionalities.
@skynetcap skynetcap merged commit f24749f into master Oct 16, 2024
1 check 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