mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
grid2: fix quantity, amount, quoteInvestment validation
This commit is contained in:
parent
df6187dc98
commit
9215e401d0
|
@ -133,17 +133,11 @@ func (s *Strategy) Validate() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.checkSpread(); err != nil {
|
if err := s.checkSpread(); err != nil {
|
||||||
return err
|
return errors.Wrapf(err, "spread is too small, please try to reduce your gridNum or increase the price range (upperPrice and lowerPrice)")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.QuantityOrAmount.Validate(); err != nil {
|
if !s.QuantityOrAmount.IsSet() && s.QuoteInvestment.IsZero() {
|
||||||
if s.QuoteInvestment.IsZero() && s.BaseInvestment.IsZero() {
|
return fmt.Errorf("either quantity, amount or quoteInvestment must be set")
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !s.QuantityOrAmount.IsSet() && s.QuoteInvestment.IsZero() && s.BaseInvestment.IsZero() {
|
|
||||||
return fmt.Errorf("one of quantity, amount, quoteInvestment must be set")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue
Block a user