From 13d9f2ba496082b44f175ce646fc7fd8ba6500db Mon Sep 17 00:00:00 2001 From: c9s Date: Sat, 8 May 2021 01:00:57 +0800 Subject: [PATCH] grid: fix order generator checking --- pkg/strategy/grid/strategy.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pkg/strategy/grid/strategy.go b/pkg/strategy/grid/strategy.go index 9d0c78bac..e21b80004 100644 --- a/pkg/strategy/grid/strategy.go +++ b/pkg/strategy/grid/strategy.go @@ -311,11 +311,12 @@ func (s *Strategy) generateGridBuyOrders(session *bbgo.ExchangeSession) ([]types func (s *Strategy) placeGridSellOrders(orderExecutor bbgo.OrderExecutor, session *bbgo.ExchangeSession) error { orderForms, err := s.generateGridSellOrders(session) - if err != nil { - return err - } if len(orderForms) == 0 { + if err != nil { + return err + } + return errors.New("none of sell order is generated") } @@ -327,11 +328,12 @@ func (s *Strategy) placeGridSellOrders(orderExecutor bbgo.OrderExecutor, session func (s *Strategy) placeGridBuyOrders(orderExecutor bbgo.OrderExecutor, session *bbgo.ExchangeSession) error { orderForms, err := s.generateGridBuyOrders(session) - if err != nil { - return err - } if len(orderForms) == 0 { + if err != nil { + return err + } + return errors.New("none of buy order is generated") }