bbgo_origin/pkg/strategy/rebalance/profit_stats_map.go
2023-10-31 13:53:12 +08:00

20 lines
410 B
Go

package rebalance
import (
"github.com/c9s/bbgo/pkg/types"
)
type ProfitStatsMap map[string]*types.ProfitStats
func (m ProfitStatsMap) CreateProfitStats(markets map[string]types.Market) ProfitStatsMap {
for symbol, market := range markets {
if _, ok := m[symbol]; ok {
continue
}
log.Infof("creating profit stats for symbol %s", symbol)
m[symbol] = types.NewProfitStats(market)
}
return m
}