Merge pull request #1111 from c9s/narumi/rebalance/public

strategy: rebalance: make CreatePositions and CreateProfitStats public
This commit is contained in:
なるみ 2023-03-15 16:55:43 +08:00 committed by GitHub
commit 94f2bcf6fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

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

View File

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

View File

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