mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 23:05:15 +00:00
rename method
This commit is contained in:
parent
d953a6d7b8
commit
9fa647ed65
|
@ -12,7 +12,7 @@ import (
|
|||
"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)
|
||||
// if the exchange doesn't support ExchangeTradeHistoryService, do not run recover
|
||||
if !implemented {
|
||||
|
@ -64,14 +64,14 @@ func (s *Strategy) recoverGridByScanningTrades(ctx context.Context, session *bbg
|
|||
}
|
||||
|
||||
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 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 {
|
||||
return fmt.Errorf("orderQueryService is nil, it can't get orders by trade")
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
if s.RecoverGridByScanningTrades {
|
||||
s.debugLog("recover grid by scanning trades")
|
||||
return s.recoverGridByScanningTrades(ctx, session)
|
||||
return s.recoverByScanningTrades(ctx, session)
|
||||
}
|
||||
|
||||
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)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue
Block a user