Skip to content

Bfines/luno-go

 
 

Repository files navigation

Luno API GoDoc Build Status

This Go package provides a wrapper for the Luno API.

Documentation

Please visit godoc.org for the full package documentation.

Authentication

Please visit the Settings page to generate an API key.

Installation

go get github.com/luno/luno-go

Example usage

A full working example of this library in action.

package main

import (
  "log"
  "context"
  "time"
  "github.com/luno/luno-go"
)

func main() {
  lunoClient := luno.NewClient()
  lunoClient.SetAuth("<id>", "<secret>")

  req := luno.GetOrderBookRequest{Pair: "XBTZAR"}
  ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(10 * time.Second))
  defer cancel()

  res, err := lunoClient.GetOrderBook(ctx, &req)
  if err != nil {
    log.Fatal(err)
  }
  log.Println(res)
}

Remember to substitute <id> and <secret> for your own Id and Secret.

We recommend using environment variables rather than including your credentials in plaintext. In Bash you do so as follows:

$ export LUNO_API_ID="<id>"
$ export LUNO_API_SECRET="<secret>"

And then access them in Go like so:

import "os"

var API_KEY_ID string = os.Getenv("LUNO_API_ID")
var API_KEY_SECRET string = os.Getenv("LUNO_API_SECRET")

License

MIT

About

Go SDK for the Luno API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.8%
  • Shell 0.2%