-
-
Notifications
You must be signed in to change notification settings - Fork 309
FEATURE: [dca2] UpdateProfitStatsUntilSuccess -> UpdateProfitStatsUnt… #2032
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR refactors the profit stats update functionality in the DCA strategy to avoid infinite retries by renaming the function and adding a duration-based retry mechanism with exponential backoff, while also adding extra logging.
- Renamed UpdateProfitStatsUntilSuccessful to UpdateProfitStatsUntilDuration and adjusted backoff settings
- Added a constant for maximum retry duration in the state file
- Improved logging messages in both grid2 and dca2 strategy files to indicate when cancel-all orders API is used
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
pkg/strategy/grid2/strategy.go | Added logging for the cancel-all orders API usage |
pkg/strategy/dca2/strategy.go | Renamed and refactored profit stats update function and updated backoff settings; added logging improvements |
pkg/strategy/dca2/state.go | Introduced a constant for max retry duration and updated the call to profit stats update |
pkg/strategy/dca2/profit_stats.go | Added a comment describing the AddTrade function |
@@ -980,6 +980,7 @@ func (s *Strategy) cancelAll(ctx context.Context) error { | |||
|
|||
var err error | |||
if s.UseCancelAllOrdersApiWhenClose { | |||
s.logger.Info("UseCancelAllOrdersApiWhenClose is set, will cancel all orders by cancel all orders API") |
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.
[nitpick] Consider rewording the logging message for clarity. For instance, 'UseCancelAllOrdersApiWhenClose is enabled; canceling all orders using the CancelAllOrders API' may be clearer.
Copilot uses AI. Check for mistakes.
@@ -366,6 +366,7 @@ func (s *Strategy) Close(ctx context.Context) error { | |||
|
|||
var err error | |||
if s.UseCancelAllOrdersApiWhenClose { | |||
s.logger.Info("UseCancelAllOrdersApiWhenClose is set, will cancel all orders by cancel all orders API") |
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.
[nitpick] Consider rewording this log message for improved clarity. A suggestion is: 'UseCancelAllOrdersApiWhenClose is enabled; canceling all orders using the CancelAllOrders API'.
Copilot uses AI. Check for mistakes.
…ilDuration to avoid it infinity trying
23fc45c
to
50d6a23
Compare
…ilDuration to avoid it infinity trying