bbgo
bbgo copied to clipboard
REFACTOR: daily data tracker
This pull request refactors the FeeBudget class to replace the State structure with a new DailyDataTracker utility class for better code organization and functionality. The changes also include updates to the corresponding test cases to align with the new structure.
Refactoring FeeBudget class:
- Replaced the
Statestructure with theDailyDataTrackerclass for tracking daily fee budgets and accumulated fees. (pkg/strategy/common/fee_budget.go) - Updated methods in
FeeBudgetto useDailyDataTrackerfor checking and resetting fee data. (pkg/strategy/common/fee_budget.go) [1] [2]
Test updates:
- Modified test cases to use
DailyDataTrackerinstead ofStatefor validating fee budget logic. (pkg/strategy/common/fee_budget_test.go)
New utility class:
- Introduced
DailyDataTrackerclass inpkg/util/daily_data_tracker.goto encapsulate the logic for tracking and resetting daily data. (pkg/util/daily_data_tracker.go)