kraken

package module
v0.0.0-...-c22331a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 29, 2016 License: MIT Imports: 12 Imported by: 0

README

Client for Kraken API

A simple Kraken API client.

Example of usage:

package main

import (
    "fmt"
    "github.com/ivanlemeshev/kraken"
)

const (
    KrakenAPIKey = "KEY"
    KrakenAPISecret = "SECRET"
)

func main() {
    api := kraken.New(KrakenAPIKey, KrakenAPISecret)
    result, err := api.Query("Ticker", map[string]string{
        "pair": "XXBTZUSD",
    })

    if err != nil {
        fmt.Println("Error:", err.Error())
        return
    }

    fmt.Printf("Result: %+v\n", result)
}

Documentation

Index

Constants

View Source
const (
	// URL is a Kraken API URL
	URL = "https://api.kraken.com"
	// Version is a Kraken API version
	Version = "0"
)

Variables

This section is empty.

Functions

func GetDepthAmount

func GetDepthAmount(result interface{}, pair, operation string, index int) (float64, error)

GetDepthAmount returns Kraken Depth amount

func GetDepthRate

func GetDepthRate(result interface{}, pair, operation string, index int) (float64, error)

GetDepthRate returns Kraken Depth rate

Types

type APIClient

type APIClient struct {
	// contains filtered or unexported fields
}

APIClient struct represents Kraken API client

func New

func New(key, secret string) *APIClient

New creates a new Kraken API struct

func (*APIClient) Query

func (api *APIClient) Query(method string, data map[string]string) (interface{}, error)

Query sends a query to Kraken API for given method and parameters

type Response

type Response struct {
	Error  []string    `json:error`
	Result interface{} `json:result`
}

Response struct represents Kraken API response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL