This commit is contained in:
chiahung 2023-11-07 13:30:58 +08:00
parent c8becbe4f5
commit 7de49155eb
3 changed files with 7 additions and 1 deletions

View File

@ -44,6 +44,9 @@ func newGridProfitStats(market types.Market) *GridProfitStats {
} }
func (s *GridProfitStats) SetTTL(ttl time.Duration) { func (s *GridProfitStats) SetTTL(ttl time.Duration) {
if ttl.Nanoseconds() <= 0 {
return
}
s.ttl = ttl s.ttl = ttl
} }

View File

@ -1836,7 +1836,7 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.
s.ProfitSpread = s.Market.TruncatePrice(s.ProfitSpread) s.ProfitSpread = s.Market.TruncatePrice(s.ProfitSpread)
} }
s.logger.Infof("ttl: %s", s.PersistenceTTL.Duration()) s.logger.Infof("persistence ttl: %s", s.PersistenceTTL.Duration())
if s.GridProfitStats == nil { if s.GridProfitStats == nil {
s.GridProfitStats = newGridProfitStats(s.Market) s.GridProfitStats = newGridProfitStats(s.Market)

View File

@ -71,6 +71,9 @@ type Position struct {
} }
func (s *Position) SetTTL(ttl time.Duration) { func (s *Position) SetTTL(ttl time.Duration) {
if ttl.Nanoseconds() <= 0 {
return
}
s.ttl = ttl s.ttl = ttl
} }