bbgo_origin/pkg/strategy/rebalance/profit_stats_map.go

18 lines
412 B
Go
Raw Normal View History

2023-03-12 15:48:26 +00:00
package rebalance
import "github.com/c9s/bbgo/pkg/types"
type ProfitStatsMap map[string]*types.ProfitStats
func (m ProfitStatsMap) CreateProfitStats(markets []types.Market) ProfitStatsMap {
2023-03-12 15:48:26 +00:00
for _, market := range markets {
2023-03-14 06:37:54 +00:00
if _, ok := m[market.Symbol]; ok {
continue
}
log.Infof("creating profit stats for symbol %s", market.Symbol)
2023-03-12 15:48:26 +00:00
m[market.Symbol] = types.NewProfitStats(market)
}
return m
}