From 288f7257ebf9a715c87cd6e0129021b7300c7de1 Mon Sep 17 00:00:00 2001 From: ycchen Date: Sat, 6 Feb 2021 19:39:43 +0100 Subject: [PATCH] fix testcases --- pkg/backtest/exchange.go | 5 +++++ pkg/exchange/binance/ticker_test.go | 3 --- pkg/exchange/max/exchange.go | 2 +- pkg/exchange/max/ticker_test.go | 3 --- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/backtest/exchange.go b/pkg/backtest/exchange.go index 82a5381c1..9c3b4b533 100644 --- a/pkg/backtest/exchange.go +++ b/pkg/backtest/exchange.go @@ -208,6 +208,11 @@ func (e Exchange) QueryTrades(ctx context.Context, symbol string, options *types return nil, nil } +func (e Exchange) QueryTickers(ctx context.Context, symbol ...string) (map[string]types.Ticker, error) { + // Not using Tickers in back test (yet) + return nil, nil +} + func (e Exchange) Name() types.ExchangeName { return e.publicExchange.Name() } diff --git a/pkg/exchange/binance/ticker_test.go b/pkg/exchange/binance/ticker_test.go index 2b8d3958b..629585eb3 100644 --- a/pkg/exchange/binance/ticker_test.go +++ b/pkg/exchange/binance/ticker_test.go @@ -2,7 +2,6 @@ package binance import ( "context" - "fmt" "testing" ) @@ -28,7 +27,6 @@ func TestSomeSymbols(t *testing.T) { } if len(got) != 2 { - fmt.Println(got) t.Errorf("Binance Exchange: Attempting to get two symbols, but number of tickers do not match") } @@ -42,7 +40,6 @@ func TestSingleSymbol(t *testing.T) { } if len(got) != 1 { - fmt.Println(got) t.Errorf("Binance Exchange: Attempting to get one symbol, but number of tickers do not match") } diff --git a/pkg/exchange/max/exchange.go b/pkg/exchange/max/exchange.go index 44b2e7a6d..3500f575d 100644 --- a/pkg/exchange/max/exchange.go +++ b/pkg/exchange/max/exchange.go @@ -74,7 +74,7 @@ func (e *Exchange) QueryTickers(ctx context.Context, symbol ...string) (map[stri } for k, v := range tickers { - if _, ok := m[strings.ToUpper(k)]; !ok { + if _, ok := m[strings.ToUpper(k)]; len(symbol) != 0 && !ok { continue } ret[strings.ToUpper(k)] = types.Ticker{ diff --git a/pkg/exchange/max/ticker_test.go b/pkg/exchange/max/ticker_test.go index 21532a109..f8d26142f 100644 --- a/pkg/exchange/max/ticker_test.go +++ b/pkg/exchange/max/ticker_test.go @@ -2,7 +2,6 @@ package max import ( "context" - "fmt" "testing" ) @@ -27,7 +26,6 @@ func TestSomeSymbols(t *testing.T) { } if len(got) != 2 { - fmt.Println(got) t.Errorf("Max Exchange: Attempting to get two symbols, but number of tickers do not match") } @@ -41,7 +39,6 @@ func TestSingleSymbol(t *testing.T) { } if len(got) != 1 { - fmt.Println(got) t.Errorf("Max Exchange: Attempting to get one symbol, but number of tickers do not match") }