mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-15 03:23:52 +00:00
xmaker: improve if condition
This commit is contained in:
parent
59862303aa
commit
1210a79fc7
|
@ -1467,7 +1467,11 @@ func (s *Strategy) hedgeWorker(ctx context.Context) {
|
||||||
coveredPosition := s.CoveredPosition.Get()
|
coveredPosition := s.CoveredPosition.Get()
|
||||||
uncoverPosition := position.Sub(coveredPosition)
|
uncoverPosition := position.Sub(coveredPosition)
|
||||||
absPos := uncoverPosition.Abs()
|
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.logger.Infof("%s base position %v coveredPosition: %v uncoverPosition: %v",
|
||||||
s.Symbol,
|
s.Symbol,
|
||||||
position,
|
position,
|
||||||
|
@ -1477,7 +1481,6 @@ func (s *Strategy) hedgeWorker(ctx context.Context) {
|
||||||
|
|
||||||
s.Hedge(ctx, uncoverPosition.Neg())
|
s.Hedge(ctx, uncoverPosition.Neg())
|
||||||
profitChanged = true
|
profitChanged = true
|
||||||
}
|
|
||||||
|
|
||||||
case <-reportTicker.C:
|
case <-reportTicker.C:
|
||||||
if profitChanged {
|
if profitChanged {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user