plus a quantity jitter

This commit is contained in:
c9s 2022-01-14 11:59:40 +08:00
parent 42430fde4b
commit 1f6076ae18

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"fmt" "fmt"
"math" "math"
"math/rand"
"sync" "sync"
"time" "time"
@ -312,6 +313,9 @@ func (s *Strategy) CrossRun(ctx context.Context, _ bbgo.OrderExecutionRouter, se
} }
} }
s.mu.Unlock() s.mu.Unlock()
} else {
// plus a 2% quantity jitter
quantity *= 1.0 + math.Max(0.02, rand.Float64())
} }
var quoteAmount = price * quantity var quoteAmount = price * quantity