grid2: allocate grid object

This commit is contained in:
c9s 2022-11-09 16:25:00 +08:00
parent 84c3d386ca
commit 1fa5186002
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -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)