Moved ticker fetching from main into the relative exchange.

This commit is contained in:
Adrian Gallagher
2015-03-18 16:36:01 +11:00
parent 8fdcb81924
commit b23070d7be
12 changed files with 260 additions and 215 deletions

View File

@@ -2,6 +2,7 @@ package main
import (
"log"
"time"
"fmt"
"strconv"
"net/url"
@@ -108,6 +109,17 @@ func (c *Coinbase) GetFee(maker bool) (float64) {
}
}
func (c *Coinbase) Run() {
for c.Enabled {
go func() {
CoinbaseStats := c.GetStats("BTC-USD")
CoinbaseTicker := c.GetTicker("BTC-USD")
log.Printf("Coinbase BTC: Last %f High %f Low %f Volume %f\n", CoinbaseTicker.Price, CoinbaseStats.High, CoinbaseStats.Low, CoinbaseStats.Volume)
}()
time.Sleep(time.Second * 10)
}
}
func (c *Coinbase) SetAPIKeys(password, apiKey, apiSecret string) {
c.Password = password
c.APIKey = apiKey