mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 06:53:52 +00:00
xmaker: set profitChanged only when Hedge is called
This commit is contained in:
parent
652c9b62e8
commit
6011fd5157
|
@ -677,12 +677,6 @@ func (s *Strategy) Hedge(ctx context.Context, pos fixedpoint.Value) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
notional := quantity.Mul(lastPrice)
|
|
||||||
if notional.Compare(s.sourceMarket.MinNotional) <= 0 {
|
|
||||||
log.Warnf("%s %v less than min notional, skipping hedge", s.Symbol, notional)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// adjust quantity according to the balances
|
// adjust quantity according to the balances
|
||||||
account := s.sourceSession.GetAccount()
|
account := s.sourceSession.GetAccount()
|
||||||
switch side {
|
switch side {
|
||||||
|
@ -934,10 +928,9 @@ 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 {
|
||||||
if s.reportProfitStatsRateLimiter.Allow() {
|
if s.reportProfitStatsRateLimiter.Allow() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user