Skip to content

Commit 6e29359

Browse files
committed
strategy:irr: fix logical error
1 parent 778a3d8 commit 6e29359

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/strategy/irr/strategy.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -377,18 +377,18 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
377377

378378
if s.currentTradePrice > 0 {
379379
s.closePrice = float64(s.currentTradePrice)
380-
log.Infof("Close Price: %f", float64(s.closePrice))
380+
log.Infof("Close Price: %f", s.closePrice)
381381
if s.closePrice > 0 && s.openPrice > 0 {
382382
direction := s.closePrice - s.openPrice
383-
klinDirections.Update(float64(direction))
383+
klinDirections.Update(direction)
384384
regimeShift := klinDirections.Index(0)*klinDirections.Index(1) < 0
385385
if regimeShift && !started {
386-
boxOpenPrice = float64(s.openPrice)
386+
boxOpenPrice = s.openPrice
387387
started = true
388388
boxCounter = 0
389389
log.Infof("box started at price: %f", boxOpenPrice)
390390
} else if regimeShift && started {
391-
boxClosePrice = float64(s.openPrice)
391+
boxClosePrice = s.closePrice
392392
started = false
393393
log.Infof("box ended at price: %f with time length: %d", boxClosePrice, boxCounter)
394394
// box ending, should re-balance position

0 commit comments

Comments
 (0)