fix persistence key

This commit is contained in:
c9s 2021-03-25 13:18:38 +08:00
parent 89c01adf60
commit 129b25d86e

View File

@ -404,7 +404,7 @@ func (s *Strategy) CrossRun(ctx context.Context, _ bbgo.OrderExecutionRouter, se
var state State var state State
// load position // load position
if err := s.Persistence.Load(&state, stateKey); err != nil { if err := s.Persistence.Load(&state, ID, s.Symbol, stateKey); err != nil {
if err != service.ErrPersistenceNotExists { if err != service.ErrPersistenceNotExists {
return err return err
} }
@ -467,7 +467,7 @@ func (s *Strategy) CrossRun(ctx context.Context, _ bbgo.OrderExecutionRouter, se
close(s.stopC) close(s.stopC)
if err := s.Persistence.Save(s.state, stateKey); err != nil { if err := s.Persistence.Save(s.state, ID, s.Symbol, stateKey); err != nil {
log.WithError(err).Errorf("can not save state: %+v", s.state) log.WithError(err).Errorf("can not save state: %+v", s.state)
} else { } else {
log.Infof("state is saved => %+v", s.state) log.Infof("state is saved => %+v", s.state)