limit adjustment order quantity

This commit is contained in:
c9s 2024-04-22 14:42:52 +08:00
parent 489889d1e6
commit a9db21adfa
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -42,6 +42,7 @@ type Strategy struct {
LiquidityUpdateInterval types.Interval `json:"liquidityUpdateInterval"` LiquidityUpdateInterval types.Interval `json:"liquidityUpdateInterval"`
AdjustmentUpdateInterval types.Interval `json:"adjustmentUpdateInterval"` AdjustmentUpdateInterval types.Interval `json:"adjustmentUpdateInterval"`
MaxAdjustmentOrderQuantity fixedpoint.Value `json:"maxAdjustmentOrderQuantity"`
NumOfLiquidityLayers int `json:"numOfLiquidityLayers"` NumOfLiquidityLayers int `json:"numOfLiquidityLayers"`
LiquiditySlideRule *bbgo.SlideRule `json:"liquidityScale"` LiquiditySlideRule *bbgo.SlideRule `json:"liquidityScale"`
@ -171,6 +172,11 @@ func (s *Strategy) placeAdjustmentOrders(ctx context.Context) {
var adjOrders []types.SubmitOrder var adjOrders []types.SubmitOrder
posSize := s.Position.Base.Abs() posSize := s.Position.Base.Abs()
if !s.MaxAdjustmentOrderQuantity.IsZero() {
posSize = fixedpoint.Min(posSize, s.MaxAdjustmentOrderQuantity)
}
tickSize := s.Market.TickSize tickSize := s.Market.TickSize
if s.Position.IsShort() { if s.Position.IsShort() {