From 1fa51860028a0a35046cb7ef1c81d5d9dc8d7761 Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 9 Nov 2022 16:25:00 +0800 Subject: [PATCH] grid2: allocate grid object --- pkg/strategy/grid2/strategy.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/strategy/grid2/strategy.go b/pkg/strategy/grid2/strategy.go index 66613b53b..68d9eec3f 100644 --- a/pkg/strategy/grid2/strategy.go +++ b/pkg/strategy/grid2/strategy.go @@ -45,6 +45,8 @@ type Strategy struct { LowerPrice fixedpoint.Value `json:"lowerPrice" yaml:"lowerPrice"` + grid *Grid + bbgo.QuantityOrAmount ProfitStats *types.ProfitStats `persistence:"profit_stats"` @@ -123,6 +125,8 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se s.Position = types.NewPositionFromMarket(s.Market) } + s.grid = NewGrid(s.LowerPrice, s.UpperPrice, fixedpoint.NewFromInt(s.GridNum), s.Market.TickSize) + s.orderStore = bbgo.NewOrderStore(s.Symbol) s.orderStore.BindStream(session.UserDataStream)