Skip to content

Commit

Permalink
Fix error on getting exchange info with multiple symbols (issue #269) (
Browse files Browse the repository at this point in the history
…#315)

* fix multiple symbols concatenation

Fixes #267

* Update exchange_info_service_test.go
  • Loading branch information
icamys committed Oct 13, 2021
1 parent caa1c40 commit 7ef5265
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions v2/exchange_info_service.go
Expand Up @@ -4,13 +4,14 @@ import (
"context"
"encoding/json"
"net/http"
"strings"
)

// ExchangeInfoService exchange info service
type ExchangeInfoService struct {
c *Client
symbol string
symbols []string
symbols string
}

// Symbol set symbol
Expand All @@ -21,7 +22,11 @@ func (s *ExchangeInfoService) Symbol(symbol string) *ExchangeInfoService {

// Symbols set symbol
func (s *ExchangeInfoService) Symbols(symbols ...string) *ExchangeInfoService {
s.symbols = symbols
if len(symbols) == 0 {
s.symbols = "[]"
} else {
s.symbols = "[\"" + strings.Join(symbols, "\",\"") + "\"]"
}
return s
}

Expand Down
2 changes: 1 addition & 1 deletion v2/exchange_info_service_test.go
Expand Up @@ -63,7 +63,7 @@ func (s *exchangeInfoServiceTestSuite) TestExchangeInfo() {
s.assertReq(func(r *request) {
e := newRequest().setParams(map[string]interface{}{
"symbol": symbol,
"symbols": symbols,
"symbols": `["ETHBTC","LTCBTC"]`,
})
s.assertRequestEqual(e, r)
})
Expand Down

0 comments on commit 7ef5265

Please sign in to comment.