mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
grid2: fix InstanceID for autoRange
This commit is contained in:
parent
8af7d6f457
commit
2d2d194bda
|
@ -179,7 +179,15 @@ func (s *Strategy) Subscribe(session *bbgo.ExchangeSession) {
|
|||
|
||||
// InstanceID returns the instance identifier from the current grid configuration parameters
|
||||
func (s *Strategy) InstanceID() string {
|
||||
return fmt.Sprintf("%s-%s-%d-%d-%d", ID, s.Symbol, s.GridNum, s.UpperPrice.Int(), s.LowerPrice.Int())
|
||||
id := fmt.Sprintf("%s-%s-size-%d", ID, s.Symbol, s.GridNum)
|
||||
|
||||
if s.AutoRange != nil {
|
||||
id += "-autoRange-" + s.AutoRange.String()
|
||||
} else {
|
||||
id += "-" + s.UpperPrice.String() + "-" + s.LowerPrice.String()
|
||||
}
|
||||
|
||||
return id
|
||||
}
|
||||
|
||||
func (s *Strategy) checkSpread() error {
|
||||
|
|
|
@ -20,6 +20,10 @@ type SimpleDuration struct {
|
|||
Duration Duration
|
||||
}
|
||||
|
||||
func (d *SimpleDuration) String() string {
|
||||
return fmt.Sprintf("%d%s", d.Num, d.Unit)
|
||||
}
|
||||
|
||||
func (d *SimpleDuration) Interval() Interval {
|
||||
switch d.Unit {
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user