rename method

This commit is contained in:
chiahung 2023-04-06 16:12:19 +08:00
parent d953a6d7b8
commit 9fa647ed65
2 changed files with 6 additions and 6 deletions

View File

@ -12,7 +12,7 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
) )
func (s *Strategy) recoverGridByScanningTrades(ctx context.Context, session *bbgo.ExchangeSession) error { func (s *Strategy) recoverByScanningTrades(ctx context.Context, session *bbgo.ExchangeSession) error {
historyService, implemented := session.Exchange.(types.ExchangeTradeHistoryService) historyService, implemented := session.Exchange.(types.ExchangeTradeHistoryService)
// if the exchange doesn't support ExchangeTradeHistoryService, do not run recover // if the exchange doesn't support ExchangeTradeHistoryService, do not run recover
if !implemented { if !implemented {
@ -64,14 +64,14 @@ func (s *Strategy) recoverGridByScanningTrades(ctx context.Context, session *bbg
} }
s.logger.Infof("start to recover") s.logger.Infof("start to recover")
if err := s.recoverGridWithOpenOrdersByScanningTrades(ctx, historyService, openOrdersOnGrid); err != nil { if err := s.recoverWithOpenOrdersByScanningTrades(ctx, historyService, openOrdersOnGrid); err != nil {
return errors.Wrap(err, "grid recover error") return errors.Wrap(err, "grid recover error")
} }
return nil return nil
} }
func (s *Strategy) recoverGridWithOpenOrdersByScanningTrades(ctx context.Context, historyService types.ExchangeTradeHistoryService, openOrdersOnGrid []types.Order) error { func (s *Strategy) recoverWithOpenOrdersByScanningTrades(ctx context.Context, historyService types.ExchangeTradeHistoryService, openOrdersOnGrid []types.Order) error {
if s.orderQueryService == nil { if s.orderQueryService == nil {
return fmt.Errorf("orderQueryService is nil, it can't get orders by trade") return fmt.Errorf("orderQueryService is nil, it can't get orders by trade")
} }

View File

@ -1942,14 +1942,14 @@ func (s *Strategy) startProcess(ctx context.Context, session *bbgo.ExchangeSessi
func (s *Strategy) recoverGrid(ctx context.Context, session *bbgo.ExchangeSession) error { func (s *Strategy) recoverGrid(ctx context.Context, session *bbgo.ExchangeSession) error {
if s.RecoverGridByScanningTrades { if s.RecoverGridByScanningTrades {
s.debugLog("recover grid by scanning trades") s.debugLog("recover grid by scanning trades")
return s.recoverGridByScanningTrades(ctx, session) return s.recoverByScanningTrades(ctx, session)
} }
s.debugLog("recover grid by scanning orders") s.debugLog("recover grid by scanning orders")
return s.recoverGridByScanningOrders(ctx, session) return s.recoverByScanningOrders(ctx, session)
} }
func (s *Strategy) recoverGridByScanningOrders(ctx context.Context, session *bbgo.ExchangeSession) error { func (s *Strategy) recoverByScanningOrders(ctx context.Context, session *bbgo.ExchangeSession) error {
openOrders, err := queryOpenOrdersUntilSuccessful(ctx, session.Exchange, s.Symbol) openOrders, err := queryOpenOrdersUntilSuccessful(ctx, session.Exchange, s.Symbol)
if err != nil { if err != nil {
return err return err