xmaker: solve scale in the Initialize() call

This commit is contained in:
c9s 2024-11-20 15:09:18 +08:00
parent c0ee183426
commit f1f5f1ff3a
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -320,6 +320,29 @@ func (s *Strategy) Initialize() error {
"exchange": s.MakerExchange,
"symbol": s.Symbol,
}
if s.SignalReverseSideMarginScale != nil {
scale, err := s.SignalReverseSideMarginScale.Scale()
if err != nil {
return err
}
if solveErr := scale.Solve(); solveErr != nil {
return solveErr
}
}
if s.SignalTrendSideMarginScale != nil {
scale, err := s.SignalTrendSideMarginScale.Scale()
if err != nil {
return err
}
if solveErr := scale.Solve(); solveErr != nil {
return solveErr
}
}
return nil
}
@ -1805,10 +1828,6 @@ func (s *Strategy) CrossRun(
return err
}
if solveErr := scale.Solve(); solveErr != nil {
return solveErr
}
minAdditionalMargin := scale.Call(0.0)
middleAdditionalMargin := scale.Call(1.0)
maxAdditionalMargin := scale.Call(2.0)