fix profit stats and position

This commit is contained in:
narumi 2023-12-20 20:21:34 +08:00
parent a4f996c963
commit da02c926be
2 changed files with 6 additions and 3 deletions

View File

@ -11,8 +11,8 @@ type MultiMarketStrategy struct {
Environ *bbgo.Environment
Session *bbgo.ExchangeSession
PositionMap PositionMap `persistence:"positionMap"`
ProfitStatsMap ProfitStatsMap `persistence:"profitStatsMap"`
PositionMap PositionMap `persistence:"position_map"`
ProfitStatsMap ProfitStatsMap `persistence:"profit_stats_map"`
OrderExecutorMap GeneralOrderExecutorMap
parent, ctx context.Context

View File

@ -54,6 +54,10 @@ func (s *Strategy) Defaults() error {
}
func (s *Strategy) Initialize() error {
if s.MultiMarketStrategy == nil {
s.MultiMarketStrategy = &MultiMarketStrategy{}
}
for currency := range s.TargetWeights {
if currency == s.QuoteCurrency {
continue
@ -105,7 +109,6 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.
s.markets[symbol] = market
}
s.MultiMarketStrategy = &MultiMarketStrategy{}
s.MultiMarketStrategy.Initialize(ctx, s.Environment, session, s.markets, ID)
s.activeOrderBook = bbgo.NewActiveOrderBook("")