Skip to content

Instantly share code, notes, and snippets.

@odeke-em
Created September 3, 2017 10:31
Show Gist options
  • Save odeke-em/73f52c4c8a3d3f144aee15a96ac0bb4d to your computer and use it in GitHub Desktop.
Save odeke-em/73f52c4c8a3d3f144aee15a96ac0bb4d to your computer and use it in GitHub Desktop.
GDAX/Coinbase Websocket Feed
package main
import (
"log"
"github.com/orijtech/coinbase/v2"
)
func main() {
client, err := coinbase.NewDefaultClient()
if err != nil {
log.Fatal(err)
}
sres, err := client.Subscribe(&coinbase.Subscription{
Currencies: []string{"BTC-USD", "ETH-USD", "LTC-USD"},
Authenticate: true,
})
if err != nil {
log.Fatal(err)
}
for msg := range sres.MessagesChan {
log.Printf("msg: %+v\n", msg)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment