From 0f9319a2f5e3d57cea6462e957eb6148b2705d22 Mon Sep 17 00:00:00 2001 From: narumi Date: Wed, 15 Mar 2023 16:01:13 +0800 Subject: [PATCH] make CreatePositions and CreateProfitStats public --- pkg/strategy/rebalance/position_map.go | 2 +- pkg/strategy/rebalance/profit_stats_map.go | 2 +- pkg/strategy/rebalance/strategy.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/strategy/rebalance/position_map.go b/pkg/strategy/rebalance/position_map.go index 5bbbfeb9c..772d1726c 100644 --- a/pkg/strategy/rebalance/position_map.go +++ b/pkg/strategy/rebalance/position_map.go @@ -6,7 +6,7 @@ import ( type PositionMap map[string]*types.Position -func (m PositionMap) createPositions(markets []types.Market) PositionMap { +func (m PositionMap) CreatePositions(markets []types.Market) PositionMap { for _, market := range markets { if _, ok := m[market.Symbol]; ok { continue diff --git a/pkg/strategy/rebalance/profit_stats_map.go b/pkg/strategy/rebalance/profit_stats_map.go index b7db6c2fb..a84bf5cc9 100644 --- a/pkg/strategy/rebalance/profit_stats_map.go +++ b/pkg/strategy/rebalance/profit_stats_map.go @@ -4,7 +4,7 @@ import "github.com/c9s/bbgo/pkg/types" type ProfitStatsMap map[string]*types.ProfitStats -func (m ProfitStatsMap) createProfitStats(markets []types.Market) ProfitStatsMap { +func (m ProfitStatsMap) CreateProfitStats(markets []types.Market) ProfitStatsMap { for _, market := range markets { if _, ok := m[market.Symbol]; ok { continue diff --git a/pkg/strategy/rebalance/strategy.go b/pkg/strategy/rebalance/strategy.go index e9650b704..e15e2507f 100644 --- a/pkg/strategy/rebalance/strategy.go +++ b/pkg/strategy/rebalance/strategy.go @@ -101,12 +101,12 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo. if s.PositionMap == nil { s.PositionMap = make(PositionMap) } - s.PositionMap.createPositions(markets) + s.PositionMap.CreatePositions(markets) if s.ProfitStatsMap == nil { s.ProfitStatsMap = make(ProfitStatsMap) } - s.ProfitStatsMap.createProfitStats(markets) + s.ProfitStatsMap.CreateProfitStats(markets) s.orderExecutorMap = NewGeneralOrderExecutorMap(session, s.PositionMap) s.orderExecutorMap.BindEnvironment(s.Environment)