mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
Added Coinbase GBP support.
This commit is contained in:
@@ -137,9 +137,15 @@ func (c *Coinbase) Run() {
|
||||
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)
|
||||
log.Printf("Coinbase BTC: Last $%f High $%f Low $%f Volume %f\n", CoinbaseTicker.Price, CoinbaseStats.High, CoinbaseStats.Low, CoinbaseStats.Volume)
|
||||
AddExchangeInfo(c.GetName(), "BTC", CoinbaseTicker.Price, CoinbaseStats.Volume)
|
||||
}()
|
||||
go func() {
|
||||
CoinbaseStats := c.GetStats("BTC-GBP")
|
||||
CoinbaseTicker := c.GetTicker("BTC-GBP")
|
||||
log.Printf("Coinbase BTC: Last £%f High £%f Low £%f Volume %f\n", CoinbaseTicker.Price, CoinbaseStats.High, CoinbaseStats.Low, CoinbaseStats.Volume)
|
||||
AddExchangeInfo(c.GetName(), "BTC-GDP", CoinbaseTicker.Price, CoinbaseStats.Volume)
|
||||
}()
|
||||
time.Sleep(time.Second * c.RESTPollingDelay)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ type CoinbaseWebsocketChange struct {
|
||||
}
|
||||
|
||||
func (c *Coinbase) WebsocketSubscribe(product string, conn *websocket.Conn) error {
|
||||
subscribe := CoinbaseWebsocketSubscribe{"subscribe", "BTC-USD"}
|
||||
subscribe := CoinbaseWebsocketSubscribe{"subscribe", product}
|
||||
json, err := JSONEncode(subscribe)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -96,10 +96,14 @@ func (c *Coinbase) WebsocketClient() {
|
||||
|
||||
log.Printf("%s Connected to Websocket.\n", c.GetName())
|
||||
|
||||
err = c.WebsocketSubscribe("BTC-USD", conn)
|
||||
if err != nil {
|
||||
log.Printf("%s Websocket subscription error: %s\n", c.GetName(), err)
|
||||
continue
|
||||
currencies := []string{"BTC-USD", "BTC-GBP"}
|
||||
|
||||
for _, x := range currencies {
|
||||
err = c.WebsocketSubscribe(x, conn)
|
||||
if err != nil {
|
||||
log.Printf("%s Websocket subscription error: %s\n", c.GetName(), err)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if c.Verbose {
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
"ClientID": "Password",
|
||||
"APIKey": "Key",
|
||||
"APISecret": "Secret",
|
||||
"BaseCurrencies": "USD",
|
||||
"BaseCurrencies": "USD,GBP",
|
||||
"Enabled": true,
|
||||
"Verbose": false,
|
||||
"Websocket": true,
|
||||
|
||||
Reference in New Issue
Block a user