Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

bot crashes with a panic when it cannot parse results from CCXT #31

Closed
nikhilsaraf opened this issue Oct 22, 2018 · 0 comments
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@nikhilsaraf
Copy link
Contributor

Describe the bug

The bot crashes when it cannot handle the response from CCXT. This should be handled more gracefully

Expected behavior

I think the correct behavior in this situation is for the bot to check the type of the returned value and its existence before forcing a cast

Frequency

The frequency is: Sometimes

Steps To Reproduce

Here are the steps to reproduce the issue (see attachments in section below):

  1. Set up your configuration to use an exchange from the CCXT integration
  2. Set up the CCXT endpoint in such a way that it does not return a valid value for the get ticker information (or maybe even mock it out in the code that parses it)
  3. run the bot, it will crash.

Possible Solution

This bug can be fixed by checking the returned value before forcing a type assertion

Your Environment

version: v1.1.0
git hash: 1a62077
build date: 20181022T210554Z
GOOS: linux
GOARCH: amd64

Context

I am unable to run the bot reliably because of this bug.

Attachments

panic: interface conversion: interface {} is nil, not float64

goroutine 1 [running]:
github.com/lightyeario/kelp/plugins.ccxtExchange.GetTickerPrice(0xc42002b070, 0x8b51f5, 0x1, 0xc42041a080, 0x7, 0xc42054e320, 0x1, 0x1, 0xa7, 0x280, ...)
        ~/dev/go/src/github.com/lightyeario/kelp/plugins/ccxtExchange.go:53 +0x693
github.com/lightyeario/kelp/plugins.(*exchangeFeed).GetPrice(0xc4202664b0, 0x280, 0xa7, 0x1aa3b6c4c6f1)
        ~/dev/go/src/github.com/lightyeario/kelp/plugins/exchangeFeed.go:32 +0x67
@nikhilsaraf nikhilsaraf added this to the v1.1.1 milestone Oct 22, 2018
@nikhilsaraf nikhilsaraf added the bug Something isn't working label Oct 22, 2018
@nikhilsaraf nikhilsaraf self-assigned this Oct 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant