cryptopia

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

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

Go to latest
Published: Oct 2, 2017 License: MIT Imports: 15 Imported by: 0

README

go-cryptopia

go-cryptopia is an implementation of the Cryptopia API (public and private) in Golang.

Based off of https://github.com/toorop/go-bittrex/

This library is more of a framework for some bots I use so it is expected that a lot of things don't work but pull requests are excepted.

Import

import "github.com/jyap808/go-cryptopia"

Usage

package main

import (
    "fmt"
    "github.com/jyap808/go-cryptopia"
)

const (
    API_KEY    = "YOUR_API_KEY"
    API_SECRET = "YOUR_API_SECRET"
)

func main() {
    // Cryptopia client
    cryptopia := cryptopia.New(API_KEY, API_SECRET)

    // Get tickers
    tickers, err := cryptopia.GetTickers()
    fmt.Println(err, tickers)
}

See "Examples" folder for more... examples

Stay tuned

Follow me on Twitter

Documentation

Overview

Package Cryptopia is an implementation of the Cryptopia API in Golang.

Index

Constants

View Source
const (
	API_BASE                   = "https://www.cryptopia.co.nz/api/" // Cryptopia API endpoint
	API_VERSION                = "v1.1"                             // Cryptopia API version
	DEFAULT_HTTPCLIENT_TIMEOUT = 30                                 // HTTP client timeout
)
View Source
const TIME_FORMAT = "2006-01-02T15:04:05"

Variables

This section is empty.

Functions

func NewClient

func NewClient(apiKey, apiSecret string) (c *client)

NewClient return a new Bittrex HTTP client

Types

type Balance

type Balance struct {
	CurrencyId      int
	Symbol          string
	Total           float64
	Available       float64
	Unconfirmed     float64
	HeldForTrades   float64
	PendingWithdraw float64
	Address         string
	Status          string
	StatusMessage   string
	BaseAddress     string
}

type BalanceParams

type BalanceParams struct {
	Currency   string `json:",omitempty"`
	CurrencyId int    `json:",omitempty"`
}

type Cryptopia

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

cryptopia represent a cryptopia client

func New

func New(apiKey, apiSecret string) *Cryptopia

New return a instanciate cryptopia struct

func (*Cryptopia) GetBalance

func (b *Cryptopia) GetBalance(params BalanceParams) (balances []Balance, err error)

GetBalance Returns all balances or a specific currency balance

func (*Cryptopia) GetTradeHistory

func (b *Cryptopia) GetTradeHistory(params TradeHistoryParams) (trades []Trade, err error)

GetTradeHistory Returns all trade history data

func (*Cryptopia) GetTradePairs

func (b *Cryptopia) GetTradePairs() (pairs []Pair, err error)

GetTradePairs Returns all trade pair data

func (*Cryptopia) GetTransactions

func (b *Cryptopia) GetTransactions(params TransactionsParams) (transactions []Transaction, err error)

GetTransactions Returns a list of transactions

func (*Cryptopia) SetDebug

func (c *Cryptopia) SetDebug(enable bool)

set enable/disable http request/response dump

type Pair

type Pair struct {
	Id           int    `json:"Id"`
	Label        string `json:"Label"`
	Currency     string `json:"Currency"`
	Symbol       string `json:"Symbol"`
	BaseCurrency string `json:"BaseCurrency"`
	BaseSymbol   string `json:"BaseSymbol"`
	Status       string `json:"Status"`
}

type Timestamp

type Timestamp time.Time

func (Timestamp) Format

func (t Timestamp) Format(layout string) string

func (Timestamp) MarshalJSON

func (t Timestamp) MarshalJSON() ([]byte, error)

func (Timestamp) String

func (t Timestamp) String() string

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(body []byte) (err error)

type Trade

type Trade struct {
	TradeID     int
	TradePairID int
	Market      string
	Type        string
	Rate        float64
	Amount      float64
	Total       float64
	Fee         float64
	TimeStamp   Timestamp
}

type TradeHistoryParams

type TradeHistoryParams struct {
	Market      string `json:",omitempty"`
	TradePairId int    `json:",omitempty"`
	Count       uint32 `json:",omitempty"`
}

type Transaction

type Transaction struct {
	Id            int
	Currency      string
	TxId          string
	Type          string
	Amount        float64
	Fee           float64
	Status        string
	Confirmations int
	TimeStamp     Timestamp
	Address       string
}

type TransactionsParams

type TransactionsParams struct {
	Type  string `json:",omitempty"`
	Count uint32 `json:",omitempty"`
}

type Uuid

type Uuid struct {
	Id string `json:"uuid"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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