From a9db21adfa25518a39d4af01724391a6a672b9da Mon Sep 17 00:00:00 2001 From: c9s Date: Mon, 22 Apr 2024 14:42:52 +0800 Subject: [PATCH] limit adjustment order quantity --- pkg/strategy/liquiditymaker/strategy.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/strategy/liquiditymaker/strategy.go b/pkg/strategy/liquiditymaker/strategy.go index 187082d79..951189595 100644 --- a/pkg/strategy/liquiditymaker/strategy.go +++ b/pkg/strategy/liquiditymaker/strategy.go @@ -41,7 +41,8 @@ type Strategy struct { LiquidityUpdateInterval types.Interval `json:"liquidityUpdateInterval"` - AdjustmentUpdateInterval types.Interval `json:"adjustmentUpdateInterval"` + AdjustmentUpdateInterval types.Interval `json:"adjustmentUpdateInterval"` + MaxAdjustmentOrderQuantity fixedpoint.Value `json:"maxAdjustmentOrderQuantity"` NumOfLiquidityLayers int `json:"numOfLiquidityLayers"` LiquiditySlideRule *bbgo.SlideRule `json:"liquidityScale"` @@ -171,6 +172,11 @@ func (s *Strategy) placeAdjustmentOrders(ctx context.Context) { var adjOrders []types.SubmitOrder posSize := s.Position.Base.Abs() + + if !s.MaxAdjustmentOrderQuantity.IsZero() { + posSize = fixedpoint.Min(posSize, s.MaxAdjustmentOrderQuantity) + } + tickSize := s.Market.TickSize if s.Position.IsShort() {