mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 08:45:16 +00:00
support: fix sensitivity calculation
This commit is contained in:
parent
5fecccedd6
commit
811319fa25
|
@ -148,7 +148,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
s.MinVolume = fixedpoint.NewFromFloat(volRange[1]).Mul(fixedpoint.NewFromFloat(1.0) - s.Sensitivity)
|
s.MinVolume = fixedpoint.NewFromFloat(volRange[0]) + fixedpoint.NewFromFloat(volRange[1] - volRange[0]).Mul(fixedpoint.NewFromFloat(1.0) - s.Sensitivity)
|
||||||
log.Infof("adjusted minimal support volume to %f according to sensitivity %f", s.MinVolume.Float64(), s.Sensitivity.Float64())
|
log.Infof("adjusted minimal support volume to %f according to sensitivity %f", s.MinVolume.Float64(), s.Sensitivity.Float64())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
s.ResistanceMinVolume = fixedpoint.NewFromFloat(volRange[1]).Mul(fixedpoint.NewFromFloat(1.0) - s.ResistanceSensitivity)
|
s.ResistanceMinVolume = fixedpoint.NewFromFloat(volRange[0]) + fixedpoint.NewFromFloat(volRange[1] - volRange[0]).Mul(fixedpoint.NewFromFloat(1.0) - s.ResistanceSensitivity)
|
||||||
log.Infof("adjusted minimal resistance volume to %f according to sensitivity %f", s.ResistanceMinVolume.Float64(), s.ResistanceSensitivity.Float64())
|
log.Infof("adjusted minimal resistance volume to %f according to sensitivity %f", s.ResistanceMinVolume.Float64(), s.ResistanceSensitivity.Float64())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,12 +218,11 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
||||||
|
|
||||||
takerBuyBaseVolumeThreshold := kline.Volume * s.ResistanceTakerBuyRatio.Float64()
|
takerBuyBaseVolumeThreshold := kline.Volume * s.ResistanceTakerBuyRatio.Float64()
|
||||||
if kline.TakerBuyBaseAssetVolume < takerBuyBaseVolumeThreshold {
|
if kline.TakerBuyBaseAssetVolume < takerBuyBaseVolumeThreshold {
|
||||||
s.Notify("%s: resistance detected, taker buy base volume %f > threshold %f (volume %f) at price %f",
|
s.Notify("%s: resistance detected, taker buy base volume %f < threshold %f (volume %f) at price %f",
|
||||||
s.Symbol,
|
s.Symbol,
|
||||||
kline.TakerBuyBaseAssetVolume,
|
kline.TakerBuyBaseAssetVolume,
|
||||||
takerBuyBaseVolumeThreshold,
|
takerBuyBaseVolumeThreshold,
|
||||||
kline.Volume,
|
kline.Volume,
|
||||||
s.TakerBuyRatio.Float64(),
|
|
||||||
closePriceF,
|
closePriceF,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue
Block a user