mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 01:01:56 +00:00
validate parameters
This commit is contained in:
parent
b820fccce1
commit
1b06fcc961
|
@ -65,6 +65,18 @@ func (s *Strategy) InstanceID() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Strategy) Validate() error {
|
func (s *Strategy) Validate() error {
|
||||||
|
if s.Symbol == "" {
|
||||||
|
return fmt.Errorf("symbol is required")
|
||||||
|
}
|
||||||
|
|
||||||
|
if s.Schedule == "" {
|
||||||
|
return fmt.Errorf("schedule is required")
|
||||||
|
}
|
||||||
|
|
||||||
|
if s.MinBaseBalance.Sign() <= 0 {
|
||||||
|
return fmt.Errorf("minBaseBalance must be greater than 0")
|
||||||
|
}
|
||||||
|
|
||||||
if err := s.QuantityOrAmount.Validate(); err != nil {
|
if err := s.QuantityOrAmount.Validate(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user