diff --git a/pkg/bbgo/environment.go b/pkg/bbgo/environment.go index c8aaff93f..0f88e6b7a 100644 --- a/pkg/bbgo/environment.go +++ b/pkg/bbgo/environment.go @@ -190,7 +190,16 @@ 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 { - position := &Position{Symbol: symbol} + market, ok := markets[symbol] + if !ok { + return fmt.Errorf("market %s is not defined", symbol) + } + + position := &Position{ + Symbol: symbol, + BaseCurrency: market.BaseCurrency, + QuoteCurrency: market.QuoteCurrency, + } var trades []types.Trade diff --git a/pkg/bbgo/position.go b/pkg/bbgo/position.go index 563fd3930..452cbb8b2 100644 --- a/pkg/bbgo/position.go +++ b/pkg/bbgo/position.go @@ -6,7 +6,10 @@ import ( ) type Position struct { - Symbol string `json:"symbol"` + Symbol string `json:"symbol"` + BaseCurrency string `json:"baseCurrency"` + QuoteCurrency string `json:"quoteCurrency"` + Base fixedpoint.Value `json:"base"` Quote fixedpoint.Value `json:"quote"` AverageCost fixedpoint.Value `json:"averageCost"`