mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 23:05:15 +00:00
support: move property configuration to the top
This commit is contained in:
parent
3539047a39
commit
1091010f64
|
@ -246,6 +246,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
||||||
s.MovingAverageWindow = 99
|
s.MovingAverageWindow = 99
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if s.Sensitivity > 0 {
|
if s.Sensitivity > 0 {
|
||||||
volRange, err := s.ScaleQuantity.ByVolumeRule.Range()
|
volRange, err := s.ScaleQuantity.ByVolumeRule.Range()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -281,15 +282,16 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
||||||
return fmt.Errorf("standardIndicatorSet is nil, symbol %s", s.Symbol)
|
return fmt.Errorf("standardIndicatorSet is nil, symbol %s", s.Symbol)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var zeroiw = types.IntervalWindow{}
|
||||||
|
if s.LongTermMovingAverage != zeroiw {
|
||||||
|
s.longTermEMA = standardIndicatorSet.EWMA(s.LongTermMovingAverage)
|
||||||
|
}
|
||||||
|
|
||||||
s.orderStore = bbgo.NewOrderStore(s.Symbol)
|
s.orderStore = bbgo.NewOrderStore(s.Symbol)
|
||||||
s.orderStore.BindStream(session.UserDataStream)
|
s.orderStore.BindStream(session.UserDataStream)
|
||||||
|
|
||||||
s.triggerEMA = standardIndicatorSet.EWMA(types.IntervalWindow{Interval: s.Interval, Window: s.MovingAverageWindow})
|
s.triggerEMA = standardIndicatorSet.EWMA(types.IntervalWindow{Interval: s.Interval, Window: s.MovingAverageWindow})
|
||||||
|
|
||||||
var zeroiw = types.IntervalWindow{}
|
|
||||||
if s.LongTermMovingAverage != zeroiw {
|
|
||||||
s.longTermEMA = standardIndicatorSet.EWMA(s.LongTermMovingAverage)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := s.LoadState(); err != nil {
|
if err := s.LoadState(); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue
Block a user