elliottwave: use AverageCost instead

This commit is contained in:
c9s 2024-08-22 11:26:46 +08:00
parent a900c72032
commit 72575e3cd8
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -354,12 +354,12 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
s.highestPrice = 0
s.lowestPrice = 0
} else if s.Position.IsLong() {
s.buyPrice = s.Position.ApproximateAverageCost.Float64()
s.buyPrice = s.Position.AverageCost.Float64()
s.sellPrice = 0
s.highestPrice = math.Max(s.buyPrice, s.highestPrice)
s.lowestPrice = 0
} else {
s.sellPrice = s.Position.ApproximateAverageCost.Float64()
s.sellPrice = s.Position.AverageCost.Float64()
s.buyPrice = 0
s.highestPrice = 0
if s.lowestPrice == 0 {