Git Product home page Git Product logo

valr's Introduction

VALR

Unofficial Go Client for VALR

This is currently a work-in-progress and not fully tested.

Build Status Go Report Card GoDoc License

Installation

To install valr, use go get:

go get github.com/nickcorin/valr

Import the valr package into your code:

package main

import "github.com/nickcorin/valr"

func main() {
	client := valr.DefaultClient
}

Usage

Using the DefaultClient.

// The default (public) client can access all public endpoints without
// providing authentication.
ctx := context.Background()
book, err := valr.DefaultClient.OrderBook(ctx, "BTCZAR")
if err != nil {
  log.Fatal(err)
}

Accessing authenticated endpoints.

// To access authentiated endpoints, you need to construct a (private)
// client.
client := valr.NewClient("my-api-key", "my-api-secret")

ctx := context.Background()
orderID, err := client.LimitOrder(ctx, valr.LimitOrderRequest{
  CustomerOrderID:  "1234",
  Pair:             "BTCZAR",
  PostOnly:         true,
  Price:            "200000",
  Quantity:         "0.100000",
  Side:             "SELL",
})
if err != nil {
  log.Fatal(err)
}

Public vs Private clients.

// Public clients are only able to access public endpoints.
public := valr.NewPublicClient()

// A normal (or private) client is able to access all endpoints.
private := valr.NewClient("my-api-key", "my-api-secret")

// You can convert a public client to a private client if ou want to.
private = valr.ToPrivateClient(public, "my-api-key", "my-api-secret")

// ...or vice versa.
public = valr.ToPublicClient(private)

Contributing

Please feel free to submit issues, fork the repositoy and send pull requests!

License

This project is licensed under the terms of the MIT license.

valr's People

Contributors

nickcorin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.