mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 23:05:15 +00:00
Add validation for bollgrid strategy
This commit is contained in:
parent
dbf5d27f30
commit
2c41ec28ae
|
@ -88,6 +88,18 @@ func (s *Strategy) ID() string {
|
||||||
return ID
|
return ID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Strategy) Validate() error {
|
||||||
|
if s.ProfitSpread <= 0 {
|
||||||
|
// If profitSpread is empty or its value is negative
|
||||||
|
return fmt.Errorf("profit spread should bigger than 0")
|
||||||
|
}
|
||||||
|
if s.Quantity <= 0 {
|
||||||
|
// If quantity is empty or its value is negative
|
||||||
|
return fmt.Errorf("quantity should bigger than 0")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Strategy) Subscribe(session *bbgo.ExchangeSession) {
|
func (s *Strategy) Subscribe(session *bbgo.ExchangeSession) {
|
||||||
if s.Interval == "" {
|
if s.Interval == "" {
|
||||||
panic("bollgrid interval can not be empty")
|
panic("bollgrid interval can not be empty")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user