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

nill response from Trades #63

Open
drakos74 opened this issue Feb 15, 2021 · 1 comment
Open

nill response from Trades #63

drakos74 opened this issue Feb 15, 2021 · 1 comment

Comments

@drakos74
Copy link

Sometimes lately, when making a Trades request i am getting the following error

panic: interface conversion: interface {} is nil, not []interface {}

goroutine 56 [running]:
github.com/beldur/kraken-go-api-client.(*KrakenAPI).Trades(0xc00007dda0, 0x9a6067, 0x6, 0x1663c1ef0f0ae825, 0x0, 0x0, 0x0)
	/home/ec2-user/Projects/free-coin/vendor/github.com/beldur/kraken-go-api-client/krakenapi.go:251 +0xa30

It seems it would be better to do a nil check, before casting the response ...

if v[pair] == nil {
    return nil, err
}
trades := v[pair].([]interface{})

Would it make sense to create a PR for this fix ?

Did anyone else encounter this one ?

@beldur
Copy link
Owner

beldur commented Feb 17, 2022

Hi drakos74, a pull request would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants