grid: fix order generator checking

This commit is contained in:
c9s 2021-05-08 01:00:57 +08:00
parent a94c42d9c2
commit 13d9f2ba49

View File

@ -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 len(orderForms) == 0 {
if err != nil {
return err
}
if len(orderForms) == 0 {
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 len(orderForms) == 0 {
if err != nil {
return err
}
if len(orderForms) == 0 {
return errors.New("none of buy order is generated")
}