bitx

package module
v0.0.0-...-61535d4 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2018 License: MIT Imports: 11 Imported by: 1

README

NOTE: This SDK is being replaced by https://github.com/luno/luno-go. For more information, please see https://www.luno.com/blog/en/post/new-luno-api-sdks.

bitx-go

This Go package providers a wrapper for the Luno API.

Usage

Please visit https://godoc.org/github.com/bitx/bitx-go for the full package documentation.

Installation

go get github.com/bitx/bitx-go

Documentation

Overview

Go wrapper for the Luno API. The API is documented here: https://www.luno.com/api

Index

Constants

View Source
const ASK = OrderType("ASK")
View Source
const BID = OrderType("BID")
View Source
const Complete = OrderState("COMPLETE")
View Source
const Pending = OrderState("PENDING")

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Asset            string
	Address          string
	TotalReceived    float64
	TotalUnconfirmed float64
}

type Balance

type Balance struct {
	AccountID   string `json:"account_id"`
	Asset       string
	Balance     float64
	Reserved    float64
	Unconfirmed float64
}

type Client

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

func NewClient

func NewClient(apiKeyID, apiKeySecret string) *Client

Pass an empty string for the api_key_id if you will only access the public API.

func (*Client) Balance

func (c *Client) Balance(asset string) (
	balance float64, reserved float64, err error)

Returns the trading account balance and reserved funds.

func (*Client) Balances

func (c *Client) Balances() ([]Balance, error)

Balances return the balances of all accounts.

func (*Client) CreateQuote

func (c *Client) CreateQuote(quoteType, baseAmount, pair string) (QuoteResponse, error)

CreateQuote creates a quote of the given type (BUY or SELL) for the given baseAmount of a specific pair (like XBTZAR)

func (*Client) DeleteQuote

func (c *Client) DeleteQuote(id string) (QuoteResponse, error)

DeleteQuote rejects a quote

func (*Client) ExerciseQuote

func (c *Client) ExerciseQuote(id string) (QuoteResponse, error)

ExerciseQuote accepts the given quote

func (*Client) GetFeeInfo

func (c *Client) GetFeeInfo(pair string) (FeeInfo, error)

GetFeeInfo returns information about the user's fees and trading volume.

func (*Client) GetOrder

func (c *Client) GetOrder(id string) (*Order, error)

Get an order by its id.

func (*Client) GetQuote

func (c *Client) GetQuote(id string) (QuoteResponse, error)

GetQuote returns the details of the specified quote

func (*Client) GetReceiveAddress

func (c *Client) GetReceiveAddress(asset string, receiveAddress string) (Address, error)

GetReceiveAddress returns the default receive address associated with your account and the amount received via the address, but can take optional parameter to check non-default address

func (*Client) GetWithdrawal

func (c *Client) GetWithdrawal(id string) (*Withdrawal, error)

func (*Client) GetWithdrawals

func (c *Client) GetWithdrawals() (*WithdrawalList, error)

func (*Client) ListOrders

func (c *Client) ListOrders(pair string, state OrderState) ([]Order, error)

Returns a list of placed orders. The list is truncated after 100 items. If state is an empty string, the list won't be filtered by state.

func (*Client) ListTrades

func (c *Client) ListTrades(pair string, since int64) ([]OrderTrade, error)

ListTrades returns trades in your account for the given pair, sortest by oldest first, since the given timestamp.

func (*Client) NewReceiveAddress

func (c *Client) NewReceiveAddress(asset string) (Address, error)

NewReceiveAddress allocates a new receive address to your account. There is a rate limit of 1 address per hour, but bursts of up to 10 addresses are allowed.

func (*Client) OrderBook

func (c *Client) OrderBook(pair string) (
	bids, asks []OrderBookEntry, err error)

Returns a list of bids and asks in the order book for the given currency pair.

func (*Client) PostOrder

func (c *Client) PostOrder(pair string, order_type OrderType,
	volume, price float64,
	baseAccountID, counterAccountID string) (string, error)

Create a new trade order. Specify zero for baseAccountID and counterAccountID to use your default accounts.

func (*Client) Send

func (c *Client) Send(amount, currency, address, desc, message string) (string, error)

func (*Client) SetBaseURL

func (c *Client) SetBaseURL(url url.URL)

For internal use.

func (*Client) StopOrder

func (c *Client) StopOrder(id string) error

Request to stop an order.

func (*Client) Ticker

func (c *Client) Ticker(pair string) (Ticker, error)

Returns the latest ticker indicators for the given currency pair..

func (*Client) Trades

func (c *Client) Trades(pair string) ([]Trade, error)

Returns a list of the most recent trades for the given currency pair.

type FeeInfo

type FeeInfo struct {
	ThirtyDayVolume float64 `json:"thirty_day_volume,string"`
	MakerFee        float64 `json:"maker_fee,string"`
	TakerFee        float64 `json:"taker_fee,string"`
}

FeeInfo hold information about the user's fees and trading volume.

type Order

type Order struct {
	Id                  string
	CreatedAt           time.Time
	Type                OrderType
	State               OrderState
	LimitPrice          float64
	LimitVolume         float64
	Base, Counter       float64
	FeeBase, FeeCounter float64
}

type OrderBookEntry

type OrderBookEntry struct {
	Price, Volume float64
}

type OrderState

type OrderState string

type OrderTrade

type OrderTrade struct {
	Base       float64   `json:"base,string"`
	Counter    float64   `json:"counter,string"`
	FeeBase    float64   `json:"fee_base,string"`
	FeeCounter float64   `json:"fee_counter,string"`
	IsBuy      bool      `json:"is_buy"`
	OrderID    string    `json:"order_id"`
	Pair       string    `json:"pair"`
	Price      float64   `json:"price,string"`
	Timestamp  int64     `json:"timestamp"`
	Type       OrderType `json:"type"`
	Volume     float64   `json:"volume,string"`
}

type OrderType

type OrderType string

type QuoteResponse

type QuoteResponse struct {
	ID            int64   `json:"id,string"`
	Type          string  `json:"type"`
	Pair          string  `json:"pair"`
	BaseAmount    float64 `json:"base_amount,string"`
	CounterAmount float64 `json:"counter_amount,string"`
	CreatedAt     int64   `json:"created_at"`
	ExpiresAt     int64   `json:"expires_at"`
	Discarded     bool    `json:"discarded"`
	Exercised     bool    `json:"exercised"`
}

QuoteResponse contains information about a specific quote

type Ticker

type Ticker struct {
	Timestamp                 time.Time
	Bid, Ask, Last, Volume24H float64
}

type Trade

type Trade struct {
	Timestamp     time.Time
	Price, Volume float64
}

type Withdrawal

type Withdrawal struct {
	ID        string  `json:"id"`
	Status    string  `json:"status"`
	CreatedAt int64   `json:"created_at"`
	Type      string  `json:"type"`
	Currency  string  `json:"currency"`
	Amount    float64 `json:"amount,string"`
	Fee       float64 `json:"fee,string"`
}

type WithdrawalList

type WithdrawalList struct {
	Withdrawals []Withdrawal `json:"withdrawals"`
}

Directories

Path Synopsis
Package streaming implements a client for the Luno Streaming API.
Package streaming implements a client for the Luno Streaming API.

Jump to

Keyboard shortcuts

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