Skip to content

Commit

Permalink
fix doc
Browse files Browse the repository at this point in the history
  • Loading branch information
larscom committed Jul 20, 2024
1 parent d14412a commit 1c45b85
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 19 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.env
bin/
bin/
.idea/
2 changes: 1 addition & 1 deletion pkg/bitvavo/candles_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (l *CandlesListener) Unsubscribe(markets []string, intervals []Interval) er
return l.ws.Unsubscribe([]Subscription{NewSubscription(l.channel, markets, intervals...)})
}

// Graceful shutdown.
// Close everything, graceful shutdown.
func (l *CandlesListener) Close() error {
if len(l.subscriptions) == 0 {
return ErrNoSubscriptions
Expand Down
2 changes: 1 addition & 1 deletion pkg/bitvavo/deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type DepositHistory struct {
// The identifier for the account you sent amount of symbol from. For example, NL89BANK0123456789 or a digital address (e.g: 14qViLJfdGaP4EeHnDyJbEGQysnCpwk3gd).
Address string `json:"address"`

// The identifier for this deposit. If you did not set a ID when you made this deposit, this parameter is not included in the response.
// The identifier for this deposit. If you did not set an ID when you made this deposit, this parameter is not included in the response.
//
// NOTICE: digital currency only
PaymentId string `json:"paymentId"`
Expand Down
4 changes: 2 additions & 2 deletions pkg/bitvavo/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"github.com/larscom/bitvavo-go/internal/util"
)

// Complete list of errorCodes: https://docs.bitvavo.com/#tag/Error-messages
// ApiError Complete list of errorCodes: https://docs.bitvavo.com/#tag/Error-messages
type ApiError = WebSocketError

// Complete list of errorCodes: https://docs.bitvavo.com/#tag/Error-messages
// WebSocketError Complete list of errorCodes: https://docs.bitvavo.com/#tag/Error-messages
type WebSocketError struct {
Code int `json:"errorCode"`
Message string `json:"error"`
Expand Down
10 changes: 5 additions & 5 deletions pkg/bitvavo/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,27 +117,27 @@ func httpDo[T any](

func unwrapBody[T any](response *http.Response) (T, error) {
var data T
bytes, err := io.ReadAll(response.Body)
b, err := io.ReadAll(response.Body)
if err != nil {
return data, err
}

if err := json.Unmarshal(bytes, &data); err != nil {
if err := json.Unmarshal(b, &data); err != nil {
return data, err
}

return data, nil
}

func unwrapErr(response *http.Response) error {
bytes, err := io.ReadAll(response.Body)
b, err := io.ReadAll(response.Body)
if err != nil {
return err
}

var apiError *ApiError
if err := json.Unmarshal(bytes, &apiError); err != nil {
return ErrNOKResponse(response.StatusCode, bytes)
if err := json.Unmarshal(b, &apiError); err != nil {
return ErrNOKResponse(response.StatusCode, b)
}
return apiError
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/bitvavo/http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type PublicAPI interface {
// available order types.
GetMarkets(ctx context.Context) ([]Market, error)

// GetMarkets returns the available markets with their status (trading,halted,auction) and
// GetMarket returns the available markets with their status (trading,halted,auction) and
// available order types for a single market (e.g: ETH-EUR)
GetMarket(ctx context.Context, market string) (Market, error)

Expand Down Expand Up @@ -103,7 +103,7 @@ type PrivateAPI interface {
// GetAccount returns trading volume and fees for account.
GetAccount(ctx context.Context) (Account, error)

// GetTrades returns historic trades for your account for market (e.g: ETH-EUR)
// GetTradesHistoric returns historic trades for your account for market (e.g: ETH-EUR)
//
// Optionally provide extra params (see: TradeParams)
GetTradesHistoric(ctx context.Context, market string, params ...Params) ([]TradeHistoric, error)
Expand Down
10 changes: 5 additions & 5 deletions pkg/bitvavo/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Unsubscriber interface {
}

type Closer interface {
// Graceful shutdown
// Close everything, graceful shutdown.
Close() error
}

Expand All @@ -41,8 +41,8 @@ type ListenerEvent[T any] struct {

type listener[T any] struct {
ws *WebSocket
chn chan (T)
rchn chan (struct{})
chn chan T
rchn chan struct{}
once *sync.Once
channel Channel
subscriptions []Subscription
Expand All @@ -53,6 +53,6 @@ type authListener[T any] struct {
listener[T]
apiKey string
apiSecret string
authchn chan (bool)
pendingsubs chan ([]Subscription)
authchn chan bool
pendingsubs chan []Subscription
}
2 changes: 1 addition & 1 deletion pkg/bitvavo/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type Market struct {
// The minimum amount in base currency for valid orders.
MinOrderInQuoteAsset float64 `json:"minOrderInQuoteAsset"`

// // The maximum amount in quote currency (amountQuote or amount * price) for valid orders.
// The maximum amount in quote currency (amountQuote or amount * price) for valid orders.
MaxOrderInBaseAsset float64 `json:"maxOrderInBaseAsset"`

// The maximum amount in base currency for valid orders.
Expand Down
2 changes: 1 addition & 1 deletion pkg/bitvavo/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package bitvavo

import "testing"

func assert(t *testing.T, expected any, actual any) {
func assert[T comparable](t *testing.T, expected T, actual T) {
if expected != actual {
t.Errorf("\nexpected: %v\nactual: %v\n", expected, actual)
}
Expand Down

0 comments on commit 1c45b85

Please sign in to comment.