Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the symbol and symbols parameters to the /api/v3/exchangeInfo endpoint #38

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion market.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,21 @@ type ServerTimeResponse struct {

// Binance Exchange Information endpoint (GET /api/v3/exchangeInfo)
type ExchangeInfo struct {
c *Client
c *Client
symbol *string
symbols *[]string
}

// Symbol set symbol
func (s *ExchangeInfo) Symbol(symbol string) *ExchangeInfo {
s.symbol = &symbol
return s
}

// Symbols set symbols
func (s *ExchangeInfo) Symbols(symbols []string) *ExchangeInfo {
s.symbols = &symbols
return s
}

// Send the request
Expand All @@ -67,6 +81,12 @@ func (s *ExchangeInfo) Do(ctx context.Context, opts ...RequestOption) (res *Exch
endpoint: "/api/v3/exchangeInfo",
secType: secTypeNone,
}
if s.symbol != nil {
r.setParam("symbol", *s.symbol)
}
if s.symbols != nil {
r.setParam("symbols", *s.symbols)
}
data, err := s.c.callAPI(ctx, r, opts...)
if err != nil {
return nil, err
Expand Down
Loading