Fixed errors relating to commit: ed1543f7.

This commit is contained in:
Adrian Gallagher
2015-10-28 18:04:22 +11:00
parent 611f317f80
commit 0cdd5b3213
2 changed files with 18 additions and 3 deletions

View File

@@ -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)
}()

View File

@@ -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 {