From f19e1fdf873592130cd0d3a8e42ea384ccda2eb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AA=E3=82=8B=E3=81=BF?= Date: Wed, 15 Jun 2022 21:34:42 +0800 Subject: [PATCH] rebalance: rename methods --- pkg/strategy/rebalance/strategy.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/strategy/rebalance/strategy.go b/pkg/strategy/rebalance/strategy.go index 9a2f3baa9..f87f45f6c 100644 --- a/pkg/strategy/rebalance/strategy.go +++ b/pkg/strategy/rebalance/strategy.go @@ -75,14 +75,14 @@ func (s *Strategy) Validate() error { } func (s *Strategy) Subscribe(session *bbgo.ExchangeSession) { - for _, symbol := range s.getSymbols() { + for _, symbol := range s.symbols() { session.Subscribe(types.KLineChannel, symbol, types.SubscribeOptions{Interval: s.Interval}) } } func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, session *bbgo.ExchangeSession) error { s.activeOrderBooks = make(map[string]*bbgo.ActiveOrderBook) - for _, symbol := range s.getSymbols() { + for _, symbol := range s.symbols() { activeOrderBook := bbgo.NewActiveOrderBook(symbol) activeOrderBook.BindStream(session.UserDataStream) s.activeOrderBooks[symbol] = activeOrderBook @@ -106,7 +106,7 @@ func (s *Strategy) rebalance(ctx context.Context, orderExecutor bbgo.OrderExecut } } - prices, err := s.getPrices(ctx, session) + prices, err := s.prices(ctx, session) if err != nil { return } @@ -135,7 +135,7 @@ func (s *Strategy) rebalance(ctx context.Context, orderExecutor bbgo.OrderExecut } } -func (s *Strategy) getPrices(ctx context.Context, session *bbgo.ExchangeSession) (prices types.Float64Slice, err error) { +func (s *Strategy) prices(ctx context.Context, session *bbgo.ExchangeSession) (prices types.Float64Slice, err error) { for _, currency := range s.currencies { if currency == s.BaseCurrency { prices = append(prices, 1.0) @@ -232,7 +232,7 @@ func (s *Strategy) generateSubmitOrders(prices, marketValues types.Float64Slice) return submitOrders } -func (s *Strategy) getSymbols() (symbols []string) { +func (s *Strategy) symbols() (symbols []string) { for _, currency := range s.currencies { if currency == s.BaseCurrency { continue