pivotshort: rename place order method

This commit is contained in:
c9s 2022-06-05 12:40:41 +08:00
parent 46b766857a
commit f0578c5fa2
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -165,7 +165,7 @@ func (s *Strategy) getValidPivotLow(price fixedpoint.Value) fixedpoint.Value {
return price
}
func (s *Strategy) placeLayerOrder(ctx context.Context, lastLow fixedpoint.Value, limitPrice fixedpoint.Value, currentPrice fixedpoint.Value, orderExecutor bbgo.OrderExecutor) {
func (s *Strategy) placeBounceSellOrders(ctx context.Context, lastLow fixedpoint.Value, limitPrice fixedpoint.Value, currentPrice fixedpoint.Value, orderExecutor bbgo.OrderExecutor) {
futuresMode := s.session.Futures || s.session.IsolatedFutures
numLayers := fixedpoint.NewFromInt(int64(s.Entry.NumLayers))
d := s.Entry.CatBounceRatio.Div(numLayers)
@ -267,7 +267,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
if price, ok := session.LastPrice(s.Symbol); ok {
limitPrice := s.getValidPivotLow(price)
log.Infof("init %s place limit sell start from %f adds up to %f percent with %d layers of orders", s.Symbol, limitPrice.Float64(), s.Entry.CatBounceRatio.Mul(fixedpoint.NewFromInt(100)).Float64(), s.Entry.NumLayers)
s.placeLayerOrder(ctx, s.LastLow, limitPrice, price, orderExecutor)
s.placeBounceSellOrders(ctx, s.LastLow, limitPrice, price, orderExecutor)
}
})
@ -311,7 +311,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
limitPrice := s.getValidPivotLow(kline.Close)
log.Infof("%s place limit sell start from %f adds up to %f percent with %d layers of orders", s.Symbol, limitPrice.Float64(), s.Entry.CatBounceRatio.Mul(fixedpoint.NewFromInt(100)).Float64(), s.Entry.NumLayers)
s.placeLayerOrder(ctx, s.LastLow, limitPrice, kline.Close, orderExecutor)
s.placeBounceSellOrders(ctx, s.LastLow, limitPrice, kline.Close, orderExecutor)
// s.placeOrder(ctx, lastLow.Mul(fixedpoint.One.Add(s.CatBounceRatio)), s.Quantity, orderExecutor)
}
})