Skip to content

Commit 4e13f0d

Browse files
committed
bbgo: remove order store from session struct since it's not used
1 parent 5878fd8 commit 4e13f0d

File tree

2 files changed

+2
-33
lines changed

2 files changed

+2
-33
lines changed

pkg/bbgo/session.go

-19
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"github.com/spf13/viper"
1515

1616
"github.com/c9s/bbgo/pkg/cache"
17-
"github.com/c9s/bbgo/pkg/core"
1817
"github.com/c9s/bbgo/pkg/exchange/retry"
1918
"github.com/c9s/bbgo/pkg/util/templateutil"
2019

@@ -120,8 +119,6 @@ type ExchangeSession struct {
120119
// indicators is the v2 api indicators
121120
indicators map[string]*IndicatorSet
122121

123-
orderStores map[string]*core.OrderStore
124-
125122
usedSymbols map[string]struct{}
126123
initializedSymbols map[string]struct{}
127124

@@ -150,7 +147,6 @@ func NewExchangeSession(name string, exchange types.Exchange) *ExchangeSession {
150147
marketDataStores: make(map[string]*MarketDataStore),
151148
standardIndicatorSets: make(map[string]*StandardIndicatorSet),
152149
indicators: make(map[string]*IndicatorSet),
153-
orderStores: make(map[string]*core.OrderStore),
154150
usedSymbols: make(map[string]struct{}),
155151
initializedSymbols: make(map[string]struct{}),
156152
logger: log.WithField("session", name),
@@ -439,11 +435,6 @@ func (session *ExchangeSession) initSymbol(ctx context.Context, environ *Environ
439435
position.BindStream(session.UserDataStream)
440436
session.positions[symbol] = position
441437

442-
orderStore := core.NewOrderStore(symbol)
443-
orderStore.AddOrderUpdate = true
444-
orderStore.BindStream(session.UserDataStream)
445-
session.orderStores[symbol] = orderStore
446-
447438
marketDataStore := NewMarketDataStore(symbol)
448439
if !disableMarketDataStore {
449440
if _, ok := session.marketDataStores[symbol]; !ok {
@@ -665,15 +656,6 @@ func (session *ExchangeSession) SetMarkets(markets types.MarketMap) {
665656
session.markets = markets
666657
}
667658

668-
func (session *ExchangeSession) OrderStore(symbol string) (store *core.OrderStore, ok bool) {
669-
store, ok = session.orderStores[symbol]
670-
return store, ok
671-
}
672-
673-
func (session *ExchangeSession) OrderStores() map[string]*core.OrderStore {
674-
return session.orderStores
675-
}
676-
677659
// Subscribe save the subscription info, later it will be assigned to the stream
678660
func (session *ExchangeSession) Subscribe(
679661
channel types.Channel, symbol string, options types.SubscribeOptions,
@@ -876,7 +858,6 @@ func (session *ExchangeSession) InitExchange(name string, ex types.Exchange) err
876858
session.positions = make(map[string]*types.Position)
877859
session.standardIndicatorSets = make(map[string]*StandardIndicatorSet)
878860
session.indicators = make(map[string]*IndicatorSet)
879-
session.orderStores = make(map[string]*core.OrderStore)
880861
session.OrderExecutor = &ExchangeOrderExecutor{
881862
// copy the notification system so that we can route
882863
Session: session,

pkg/server/routes.go

+2-14
Original file line numberDiff line numberDiff line change
@@ -405,20 +405,8 @@ func (s *Server) getSessionAccountBalance(c *gin.Context) {
405405
}
406406

407407
func (s *Server) listSessionOpenOrders(c *gin.Context) {
408-
sessionName := c.Param("session")
409-
session, ok := s.Environ.Session(sessionName)
410-
411-
if !ok {
412-
c.JSON(http.StatusNotFound, gin.H{"error": fmt.Sprintf("session %s not found", sessionName)})
413-
return
414-
}
415-
416-
marketOrders := make(map[string][]types.Order)
417-
for symbol, orderStore := range session.OrderStores() {
418-
marketOrders[symbol] = orderStore.Orders()
419-
}
420-
421-
c.JSON(http.StatusOK, gin.H{"orders": marketOrders})
408+
// FIXME
409+
c.JSON(http.StatusOK, gin.H{"orders": nil})
422410
}
423411

424412
func genFakeAssets() types.AssetMap {

0 commit comments

Comments
 (0)