Skip to content

remiroz/luno-go

This branch is 76 commits behind luno/luno-go:main.

Folders and files

NameName
Last commit message
Last commit date
Apr 20, 2021
Feb 28, 2020
Dec 11, 2019
Apr 18, 2021
May 10, 2018
Jul 13, 2020
Nov 2, 2020
Jul 4, 2019
Jul 4, 2019
Jun 18, 2020
May 10, 2018
May 22, 2018
Jan 10, 2020
Jan 10, 2020
Nov 5, 2020
Jan 10, 2020
Feb 28, 2020
Nov 5, 2020

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%