go get -u github.com/orijtech/coinbase/v2
Created
September 3, 2017 10:31
-
-
Save odeke-em/73f52c4c8a3d3f144aee15a96ac0bb4d to your computer and use it in GitHub Desktop.
GDAX/Coinbase Websocket Feed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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