mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +00:00
xmaker: improve if condition
This commit is contained in:
parent
59862303aa
commit
1210a79fc7
|
@ -1467,18 +1467,21 @@ 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 {
|
||||
s.logger.Infof("%s base position %v coveredPosition: %v uncoverPosition: %v",
|
||||
s.Symbol,
|
||||
position,
|
||||
coveredPosition,
|
||||
uncoverPosition,
|
||||
)
|
||||
|
||||
s.Hedge(ctx, uncoverPosition.Neg())
|
||||
profitChanged = true
|
||||
if !s.DisableHedge {
|
||||
continue
|
||||
}
|
||||
|
||||
s.logger.Infof("%s base position %v coveredPosition: %v uncoverPosition: %v",
|
||||
s.Symbol,
|
||||
position,
|
||||
coveredPosition,
|
||||
uncoverPosition,
|
||||
)
|
||||
|
||||
s.Hedge(ctx, uncoverPosition.Neg())
|
||||
profitChanged = true
|
||||
|
||||
case <-reportTicker.C:
|
||||
if profitChanged {
|
||||
if s.reportProfitStatsRateLimiter.Allow() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user