mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
bollmaker: add more logs
This commit is contained in:
parent
aea8f97ab9
commit
4f6e04323f
|
@ -346,12 +346,16 @@ func (s *Strategy) placeOrders(ctx context.Context, orderExecutor bbgo.OrderExec
|
|||
log.Infof("bollinger band: up %f sma %f down %f", upBand, sma, downBand)
|
||||
|
||||
bandPercentage := calculateBandPercentage(upBand, downBand, sma, midPrice.Float64())
|
||||
log.Infof("mid price band percentage: %f", bandPercentage)
|
||||
|
||||
maxExposurePosition, err := s.getCurrentAllowedExposurePosition(bandPercentage)
|
||||
if err != nil {
|
||||
log.WithError(err).Errorf("can not calculate CurrentAllowedExposurePosition")
|
||||
return
|
||||
}
|
||||
|
||||
log.Infof("calculated max exposure position: %f", maxExposurePosition.Float64())
|
||||
|
||||
canBuy := hasQuoteBalance && quoteBalance.Available > s.Quantity.Mul(midPrice) && (maxExposurePosition > 0 && base < maxExposurePosition)
|
||||
canSell := hasBaseBalance && baseBalance.Available > s.Quantity && (maxExposurePosition > 0 && base > -maxExposurePosition)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user