Skip to content

Commit

Permalink
session: initialize a empty price solver
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Dec 14, 2024
1 parent 30b275d commit f86fc8c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/bbgo/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ func NewExchangeSession(name string, exchange types.Exchange) *ExchangeSession {
usedSymbols: make(map[string]struct{}),
initializedSymbols: make(map[string]struct{}),
logger: log.WithField("session", name),
priceSolver: pricesolver.NewSimplePriceResolver(nil),
}

session.OrderExecutor = &ExchangeOrderExecutor{
Expand Down
4 changes: 4 additions & 0 deletions pkg/pricesolver/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ type SimplePriceSolver struct {
}

func NewSimplePriceResolver(markets types.MarketMap) *SimplePriceSolver {
if markets == nil {
markets = make(types.MarketMap)
}

return &SimplePriceSolver{
markets: markets,
symbolPrices: make(map[string]fixedpoint.Value),
Expand Down

0 comments on commit f86fc8c

Please sign in to comment.