Fix Claw402 autopilot launch and accounting

This commit is contained in:
tinkle-community
2026-06-28 11:36:56 +08:00
parent a4983d2cb0
commit c4e79d9579
12 changed files with 724 additions and 205 deletions

View File

@@ -524,9 +524,6 @@ func (at *AutoTrader) Run() error {
}
}
ticker := time.NewTicker(at.config.ScanInterval)
defer ticker.Stop()
// Check if this is a grid trading strategy
isGridStrategy := at.IsGridStrategy()
if isGridStrategy {
@@ -538,6 +535,7 @@ func (at *AutoTrader) Run() error {
}
// Execute immediately on first run
at.logInfof("▶️ Running first trading cycle immediately; next cycle starts after %v", at.config.ScanInterval)
if isGridStrategy {
if err := at.RunGridCycle(); err != nil {
at.logErrorf("❌ Grid execution failed: %v", err)
@@ -548,6 +546,9 @@ func (at *AutoTrader) Run() error {
}
}
ticker := time.NewTicker(at.config.ScanInterval)
defer ticker.Stop()
for {
at.isRunningMutex.RLock()
running := at.isRunning