xmaker: improve if condition

This commit is contained in:
c9s 2024-10-15 18:45:16 +08:00
parent 59862303aa
commit 1210a79fc7
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -1467,7 +1467,11 @@ func (s *Strategy) hedgeWorker(ctx context.Context) {
coveredPosition := s.CoveredPosition.Get()
uncoverPosition := position.Sub(coveredPosition)
absPos := uncoverPosition.Abs()
if !s.DisableHedge && absPos.Compare(s.sourceMarket.MinQuantity) > 0 {
if !s.DisableHedge {
continue
}
s.logger.Infof("%s base position %v coveredPosition: %v uncoverPosition: %v",
s.Symbol,
position,
@ -1477,7 +1481,6 @@ func (s *Strategy) hedgeWorker(ctx context.Context) {
s.Hedge(ctx, uncoverPosition.Neg())
profitChanged = true
}
case <-reportTicker.C:
if profitChanged {