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

@@ -108,6 +108,18 @@ func (b *Bitstamp) SetAPIKeys(clientID, apiKey, apiSecret string) {
b.APISecret = apiSecret
}
func (b *Bitstamp) Run() {
b.GetBalance()
for b.Enabled {
go func() {
BitstampBTC := b.GetTicker()
log.Printf("Bitstamp BTC: Last %f High %f Low %f Volume %f\n", BitstampBTC.Last, BitstampBTC.High, BitstampBTC.Low, BitstampBTC.Volume)
}()
time.Sleep(time.Second * 10)
}
}
func (b *Bitstamp) GetTicker() (BitstampTicker) {
err := SendHTTPGetRequest(BITSTAMP_API_URL + BITSTAMP_API_TICKER, true, &b.Ticker)