diff --git a/pkg/bbgo/environment.go b/pkg/bbgo/environment.go index b37658c0d..eedda441e 100644 --- a/pkg/bbgo/environment.go +++ b/pkg/bbgo/environment.go @@ -190,6 +190,8 @@ func (environ *Environment) Init(ctx context.Context) (err error) { // trade sync and market data store depends on subscribed symbols so we have to do this here. for symbol := range session.loadedSymbols { + session.positions[symbol] = &Position{Symbol: symbol} + var trades []types.Trade if environ.TradeSync != nil { diff --git a/pkg/bbgo/position.go b/pkg/bbgo/position.go index 82b63443b..90577027b 100644 --- a/pkg/bbgo/position.go +++ b/pkg/bbgo/position.go @@ -6,6 +6,7 @@ import ( ) type Position struct { + Symbol string `json:"symbol"` Base fixedpoint.Value `json:"base"` Quote fixedpoint.Value `json:"quote"` AverageCost fixedpoint.Value `json:"averageCost"`