bollmaker: make detectPriceTrend simple function

This commit is contained in:
c9s 2022-06-03 02:12:43 +08:00
parent 89c2e7de1e
commit 1a85299204
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -407,7 +407,7 @@ func (s *Strategy) placeOrders(ctx context.Context, orderExecutor bbgo.OrderExec
} }
} }
trend := s.detectPriceTrend(s.neutralBoll, midPrice.Float64()) trend := detectPriceTrend(s.neutralBoll, midPrice.Float64())
switch trend { switch trend {
case NeutralTrend: case NeutralTrend:
// do nothing // do nothing
@ -505,7 +505,7 @@ const (
UnknownTrend PriceTrend = "unknown" UnknownTrend PriceTrend = "unknown"
) )
func (s *Strategy) detectPriceTrend(inc *indicator.BOLL, price float64) PriceTrend { func detectPriceTrend(inc *indicator.BOLL, price float64) PriceTrend {
if inBetween(price, inc.LastDownBand(), inc.LastUpBand()) { if inBetween(price, inc.LastDownBand(), inc.LastUpBand()) {
return NeutralTrend return NeutralTrend
} }