mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
Merge pull request #1111 from c9s/narumi/rebalance/public
strategy: rebalance: make CreatePositions and CreateProfitStats public
This commit is contained in:
commit
94f2bcf6fb
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user