Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.
This repository was archived by the owner on Apr 7, 2026. It is now read-only.

bitvavo.Markets(map[string]string{"market": "BTC-EUR"}) fails to decode json response #4

@pavelsmolensky

Description

@pavelsmolensky

Version: github.com/bitvavo/go-bitvavo-api v1.2.0

b = bitvavo.Bitvavo{
		ApiKey:       "***",
		ApiSecret:    "***",
		RestUrl:      "https://api.bitvavo.com/v2",
		WsUrl:        "wss://ws.bitvavo.com/v2/",
		AccessWindow: 10000,
		Debugging:    false,
	}

_, err := b.Markets(map[string]string{"market": "BTC-EUR"})
if err != nil {
	log.Fatal(err)
}

Results in

Error returned by API: errorCode:0, Message:

The root cause is that response for /markets?market=BTC-EUR contains json object, instead of json array expected by the lib:
https://github.com/bitvavo/go-bitvavo-api/blob/master/bitvavo.go#L716

Underlying error is
json: cannot unmarshal object into Go value of type []bitvavo.Markets

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions