mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
fix profit stats and position
This commit is contained in:
parent
a4f996c963
commit
da02c926be
|
@ -11,8 +11,8 @@ type MultiMarketStrategy struct {
|
||||||
Environ *bbgo.Environment
|
Environ *bbgo.Environment
|
||||||
Session *bbgo.ExchangeSession
|
Session *bbgo.ExchangeSession
|
||||||
|
|
||||||
PositionMap PositionMap `persistence:"positionMap"`
|
PositionMap PositionMap `persistence:"position_map"`
|
||||||
ProfitStatsMap ProfitStatsMap `persistence:"profitStatsMap"`
|
ProfitStatsMap ProfitStatsMap `persistence:"profit_stats_map"`
|
||||||
OrderExecutorMap GeneralOrderExecutorMap
|
OrderExecutorMap GeneralOrderExecutorMap
|
||||||
|
|
||||||
parent, ctx context.Context
|
parent, ctx context.Context
|
||||||
|
|
|
@ -54,6 +54,10 @@ func (s *Strategy) Defaults() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Strategy) Initialize() error {
|
func (s *Strategy) Initialize() error {
|
||||||
|
if s.MultiMarketStrategy == nil {
|
||||||
|
s.MultiMarketStrategy = &MultiMarketStrategy{}
|
||||||
|
}
|
||||||
|
|
||||||
for currency := range s.TargetWeights {
|
for currency := range s.TargetWeights {
|
||||||
if currency == s.QuoteCurrency {
|
if currency == s.QuoteCurrency {
|
||||||
continue
|
continue
|
||||||
|
@ -105,7 +109,6 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.
|
||||||
s.markets[symbol] = market
|
s.markets[symbol] = market
|
||||||
}
|
}
|
||||||
|
|
||||||
s.MultiMarketStrategy = &MultiMarketStrategy{}
|
|
||||||
s.MultiMarketStrategy.Initialize(ctx, s.Environment, session, s.markets, ID)
|
s.MultiMarketStrategy.Initialize(ctx, s.Environment, session, s.markets, ID)
|
||||||
|
|
||||||
s.activeOrderBook = bbgo.NewActiveOrderBook("")
|
s.activeOrderBook = bbgo.NewActiveOrderBook("")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user