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