diff --git a/coinbasehttp.go b/coinbasehttp.go index 5aa69020..29bd2c1c 100644 --- a/coinbasehttp.go +++ b/coinbasehttp.go @@ -189,8 +189,18 @@ func (c *Coinbase) Run() { for _, x := range c.EnabledPairs { currency := x[0:3] + "-" + x[3:] go func() { - stats := c.GetStats(currency) - ticker := c.GetTicker(currency) + stats, err := c.GetStats(currency) + + if err != nil { + log.Println(err) + return + } + ticker, err := c.GetTicker(currency) + + if err != nil { + log.Println(err) + return + } log.Printf("Coinbase %s: Last %f High %f Low %f Volume %f\n", currency, ticker.Price, stats.High, stats.Low, stats.Volume) AddExchangeInfo(c.GetName(), currency[0:3], currency[4:], ticker.Price, stats.Volume) }() diff --git a/events.go b/events.go index d8ddb17e..ab018c26 100644 --- a/events.go +++ b/events.go @@ -130,7 +130,12 @@ func (e *Event) CheckCondition() bool { lastPrice = result.Last } } else if bot.exchange.coinbase.GetName() == e.Exchange { - lastPrice = bot.exchange.coinbase.GetTicker("BTC-USD").Price + result, err := bot.exchange.coinbase.GetTicker("BTC-USD") + if err != nil { + lastPrice = 0 + } else { + lastPrice = result.Price + } } else if bot.exchange.cryptsy.GetName() == e.Exchange { lastPrice = bot.exchange.cryptsy.Market["BTCUSD"].LastTrade.Price } else if bot.exchange.dwvx.GetName() == e.Exchange {