Skip to content

Go library for Kraken Websocket and REST API

License

Notifications You must be signed in to change notification settings

benlad/go_kraken

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status codecov

Kraken WebSocket

Go library for Kraken Websocket

Installation

go get github.com/aopoltorzhicky/go_kraken/websocket

Usage

To learn how you can use the package read examples.

For quick start read the one below:

package main

import (
	"log"

	ws "github.com/aopoltorzhicky/go_kraken/websocket"
)

func main() {
	c := ws.New(false)
	err := c.Connect()
	if err != nil {
		log.Fatal("Error connecting to web socket : ", err)
	}

	err = c.Ping()
	if err != nil {
		log.Fatal(err)
	}

	// subscribe to BTCUSD, XLMUSD, ADACAD spread
	err = c.SubscribeSpread([]string{ws.ADABTC, ws.XTZBTC, ws.XLMBTC})
	if err != nil {
		log.Fatal(err)
	}

	for obj := range c.Listen() {
		switch obj.(type) {
		case error:
			log.Printf("channel closed: %s", obj)
		default:
		}
		log.Printf("MSG RECV: %#v", obj)
	}
}

About

Go library for Kraken Websocket and REST API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%