luno

package module
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: May 10, 2018 License: MIT Imports: 11 Imported by: 39

README

Luno API GoDoc

This Go package provides a wrapper for the Luno API.

⚠️ WARNING This package is currently being tested, and should not be used in production.

Documentation

Please visit godoc.org for the full package documentation.

Installation
go get github.com/luno/luno-go
Authentication

Please visit the Settings page to generate an API key.

Example usage
import luno "github.com/luno/luno-go"

lunoClient := luno.NewClient()
lunoClient.SetAuth("api_key_id", "api_key_secret")

req := lunoClient.GetOrderBookRequest{
  Pair: "XBTZAR",
}
res, err := lunoClient.GetOrderBook(&req)
if err != nil {
  log.Fatal(err)
}
log.Println(res)
License

MIT

Documentation

Overview

Package luno is a wrapper for the Luno API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalance

type AccountBalance struct {
	AccountId   string `json:"account_id"`
	Asset       string `json:"asset"`
	Balance     string `json:"balance"`
	Name        string `json:"name"`
	Reserved    string `json:"reserved"`
	Unconfirmed string `json:"unconfirmed"`
}

type AccountCapabilities

type AccountCapabilities struct {
	CanBuy        bool `json:"can_buy"`
	CanDeposit    bool `json:"can_deposit"`
	CanReceive    bool `json:"can_receive"`
	CanSell       bool `json:"can_sell"`
	CanSend       bool `json:"can_send"`
	CanSocialSend bool `json:"can_social_send"`
	CanWithdraw   bool `json:"can_withdraw"`
}

type AppExt

type AppExt struct {
	ApproxCurrency  string `json:"approx_currency"`
	ApproxValue     string `json:"approx_value"`
	CancelToken     string `json:"cancel_token"`
	PrimaryCategory string `json:"primary_category"`
}

type CancelWithdrawalRequest

type CancelWithdrawalRequest struct {
	// ID of the withdrawal to cancel.
	Id int64 `json:"id" url:"id"`
}

type CancelWithdrawalResponse

type CancelWithdrawalResponse struct {
	Amount    string `json:"amount"`
	CreatedAt int64  `json:"created_at"`
	Currency  string `json:"currency"`
	Fee       string `json:"fee"`
	Id        string `json:"id"`
	Status    string `json:"status"`
	Type      string `json:"type"`
}

type Client

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

Client is a Luno API client.

func NewClient

func NewClient() *Client

NewClient creates a new Luno API client with the default base URL.

func (*Client) CancelWithdrawal

func (cl *Client) CancelWithdrawal(ctx context.Context, req *CancelWithdrawalRequest) (*CancelWithdrawalResponse, error)

CancelWithdrawal makes a call to DELETE /api/1/withdrawals/{id}.

Cancel a withdrawal request. This can only be done if the request is still in state <code>PENDING</code>.

Permissions required: <code>Perm_W_Withdrawals</code>

func (*Client) CreateAccount

func (cl *Client) CreateAccount(ctx context.Context, req *CreateAccountRequest) (*CreateAccountResponse, error)

CreateAccount makes a call to POST /api/1/accounts.

Create an additional account for the specified currency.

Permissions required: <code>Perm_W_Addresses</code>

func (*Client) CreateFundingAddress

func (cl *Client) CreateFundingAddress(ctx context.Context, req *CreateFundingAddressRequest) (*CreateFundingAddressResponse, error)

CreateFundingAddress makes a call to POST /api/1/funding_address.

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. Only 1 Ethereum receive address can be created.

Permissions required: <code>Perm_W_Addresses</code>

func (*Client) CreateQuote

func (cl *Client) CreateQuote(ctx context.Context, req *CreateQuoteRequest) (*CreateQuoteResponse, error)

CreateQuote makes a call to POST /api/1/quotes.

Creates a new quote to buy or sell a particular amount.

You can specify either the exact amount that you want to pay or the exact amount that you want too receive.

For example, to buy exactly 0.1 Bitcoin using ZAR, you would create a quote to BUY 0.1 XBTZAR. The returned quote includes the appropriate ZAR amount. To buy Bitcoin using exactly ZAR 100, you would create a quote to SELL 100 ZARXBT. The returned quote specifies the Bitcoin as the counter amount that will be returned.

An error is returned if your account is not verified for the currency pair, or if your account would have insufficient balance to ever exercise the quote.

Permissions required: <code>Perm_W_Orders</code>

func (*Client) CreateWithdrawal

func (cl *Client) CreateWithdrawal(ctx context.Context, req *CreateWithdrawalRequest) (*CreateWithdrawalResponse, error)

CreateWithdrawal makes a call to POST /api/1/withdrawals.

Creates a new withdrawal request.

Permissions required: <code>Perm_W_Withdrawals</code>

func (*Client) DiscardQuote

func (cl *Client) DiscardQuote(ctx context.Context, req *DiscardQuoteRequest) (*DiscardQuoteResponse, error)

DiscardQuote makes a call to DELETE /api/1/quotes/{id}.

Discard a quote. Once a quote has been discarded, it cannot be exercised even if it has not expired yet.

Permissions required: <code>Perm_W_Orders</code>

func (*Client) ExerciseQuote

func (cl *Client) ExerciseQuote(ctx context.Context, req *ExerciseQuoteRequest) (*ExerciseQuoteResponse, error)

ExerciseQuote makes a call to PUT /api/1/quotes/{id}.

Exercise a quote to perform the trade. If there is sufficient balance available in your account, it will be debited and the counter amount credited.

An error is returned if the quote has expired or if you have insufficient available balance.

Permissions required: <code>Perm_W_Orders</code>

func (*Client) GetBalances

func (cl *Client) GetBalances(ctx context.Context, req *GetBalancesRequest) (*GetBalancesResponse, error)

GetBalances makes a call to GET /api/1/balance.

Return the list of all accounts and their respective balances.

Permissions required: <code>Perm_R_Balance</code>

func (*Client) GetFeeInfo

func (cl *Client) GetFeeInfo(ctx context.Context, req *GetFeeInfoRequest) (*GetFeeInfoResponse, error)

GetFeeInfo makes a call to GET /api/1/fee_info.

Returns your fees and 30 day trading volume (as of midnight) for a given pair.

Permissions required: <code>Perm_R_Orders</code>

func (*Client) GetFundingAddress

func (cl *Client) GetFundingAddress(ctx context.Context, req *GetFundingAddressRequest) (*GetFundingAddressResponse, error)

GetFundingAddress makes a call to GET /api/1/funding_address.

Returns the default receive address associated with your account and the amount received via the address. You can specify an optional address parameter to return information for a non-default receive address. In the response, total_received is the total confirmed Bitcoin amount received excluding unconfirmed transactions. total_unconfirmed is the total sum of unconfirmed receive transactions.

Permissions required: <code>Perm_R_Addresses</code>

func (*Client) GetOrder

func (cl *Client) GetOrder(ctx context.Context, req *GetOrderRequest) (*GetOrderResponse, error)

GetOrder makes a call to GET /api/1/orders/{id}.

Get an order by its ID.

Permissions required: <code>Perm_R_Orders</code>

func (*Client) GetOrderBook

func (cl *Client) GetOrderBook(ctx context.Context, req *GetOrderBookRequest) (*GetOrderBookResponse, error)

GetOrderBook makes a call to GET /api/1/orderbook.

Returns a list of bids and asks in the order book. Ask orders are sorted by price ascending. Bid orders are sorted by price descending. Note that multiple orders at the same price are not necessarily conflated.

func (*Client) GetQuote

func (cl *Client) GetQuote(ctx context.Context, req *GetQuoteRequest) (*GetQuoteResponse, error)

GetQuote makes a call to GET /api/1/quotes/{id}.

Get the latest status of a quote.

Permissions required: <code>Perm_R_Orders</code>

func (*Client) GetTicker

func (cl *Client) GetTicker(ctx context.Context, req *GetTickerRequest) (*GetTickerResponse, error)

GetTicker makes a call to GET /api/1/ticker.

Returns the latest ticker indicators.

func (*Client) GetTickers

func (cl *Client) GetTickers(ctx context.Context, req *GetTickersRequest) (*GetTickersResponse, error)

GetTickers makes a call to GET /api/1/tickers.

Returns the latest ticker indicators from all active Luno exchanges.

func (*Client) GetWithdrawal

func (cl *Client) GetWithdrawal(ctx context.Context, req *GetWithdrawalRequest) (*GetWithdrawalResponse, error)

GetWithdrawal makes a call to GET /api/1/withdrawals/{id}.

Returns the status of a particular withdrawal request.

Permissions required: <code>Perm_R_Withdrawals</code>

func (*Client) GetWithdrawals

func (cl *Client) GetWithdrawals(ctx context.Context, req *GetWithdrawalsRequest) (*GetWithdrawalsResponse, error)

GetWithdrawals makes a call to GET /api/1/withdrawals.

Returns a list of withdrawal requests.

Permissions required: <code>Perm_R_Withdrawals</code>

func (*Client) ListOrders

func (cl *Client) ListOrders(ctx context.Context, req *ListOrdersRequest) (*ListOrdersResponse, error)

ListOrders makes a call to GET /api/1/listorders.

Returns a list of the most recently placed orders. You can specify an optional <code>state=PENDING</code> parameter to restrict the results to only open orders. You can also specify the market by using the optional pair parameter. The list is truncated after 100 items.

Permissions required: <code>Perm_R_Orders</code>

func (*Client) ListPendingTransactions

ListPendingTransactions makes a call to GET /api/1/accounts/{id}/pending.

Return a list of all pending transactions related to the account.

Unlike account entries, pending transactions are not numbered, and may be reordered, deleted or updated at any time.

Permissions required: <code>Perm_R_Transactions</code>

func (*Client) ListTrades

func (cl *Client) ListTrades(ctx context.Context, req *ListTradesRequest) (*ListTradesResponse, error)

ListTrades makes a call to GET /api/1/trades.

Returns a list of the most recent trades. At most 100 results are returned per call.

func (*Client) ListTransactions

func (cl *Client) ListTransactions(ctx context.Context, req *ListTransactionsRequest) (*ListTransactionsResponse, error)

ListTransactions makes a call to GET /api/1/{id}/transactions.

Return a list of transaction entries from an account.

Transaction entry rows are numbered sequentially starting from 1, where 1 is the oldest entry. The range of rows to return are specified with the <code>min_row</code> (inclusive) and <code>max_row</code> (exclusive) parameters. At most 1000 rows can be requested per call.

If <code>min_row</code> or <code>max_row</code> is non-positive, the range wraps around the most recent row. For example, to fetch the 100 most recent rows, use <code>min_row=-100</code> and <code>max_row=0</code>.

Permissions required: <code>Perm_R_Transactions</code>

func (*Client) ListUserTrades

func (cl *Client) ListUserTrades(ctx context.Context, req *ListUserTradesRequest) (*ListUserTradesResponse, error)

ListUserTrades makes a call to GET /api/1/listtrades.

Returns a list of your recent trades for a given pair, sorted by oldest first.

<code>type</code> in the response indicates the type of order that you placed in order to participate in the trade. Possible types: <code>BID</code>, <code>ASK</code>.

If <code>is_buy</code> in the response is true, then the order which completed the trade (market taker) was a bid order.

Results of this query may lag behind the latest data.

Permissions required: <code>Perm_R_Orders</code>

func (*Client) PostLimitOrder

func (cl *Client) PostLimitOrder(ctx context.Context, req *PostLimitOrderRequest) (*PostLimitOrderResponse, error)

PostLimitOrder makes a call to POST /api/1/postorder.

Create a new trade order.

Warning! Orders cannot be reversed once they have executed. Please ensure your program has been thoroughly tested before submitting orders.

If no <code>base_account_id</code> or <code>counter_account_id</code> are specified, your default base currency or counter currency account will be used. You can find your account IDs by calling the <a href="#operation/getBalances">Balances</a> API.

Permissions required: <code>Perm_W_Orders</code>

func (*Client) PostMarketOrder

func (cl *Client) PostMarketOrder(ctx context.Context, req *PostMarketOrderRequest) (*PostMarketOrderResponse, error)

PostMarketOrder makes a call to POST /api/1/marketorder.

Create a new market order.

A market order executes immediately, and either buys as much Bitcoin or Ethereum that can be bought for a set amount of fiat currency, or sells a set amount of Bitcoin or Ethereum for as much fiat as possible.

Warning! Orders cannot be reversed once they have executed. Please ensure your program has been thoroughly tested before submitting orders.

If no base_account_id or counter_account_id are specified, your default base currency or counter currency account will be used. You can find your account IDs by calling the <a href="#operation/getBalances">Balances</a> API.

Permissions required: <code>Perm_W_Orders</code>

func (*Client) Send

func (cl *Client) Send(ctx context.Context, req *SendRequest) (*SendResponse, error)

Send makes a call to POST /api/1/send.

Send Bitcoin from your account to a Bitcoin address or email address. Send Ethereum from your account to an Ethereum address.

If the email address is not associated with an existing Luno account, an invitation to create an account and claim the funds will be sent.

Warning! Digital currency transactions are irreversible. Please ensure your program has been thoroughly tested before using this call.

Permissions required: <code>Perm_W_Send</code>

func (*Client) SetAuth

func (cl *Client) SetAuth(apiKeyID, apiKeySecret string) error

SetAuth provides the client with an API key and secret.

func (*Client) SetBaseURL

func (cl *Client) SetBaseURL(baseURL string)

SetBaseURL overrides the default base URL. For internal use.

func (*Client) SetTimeout

func (cl *Client) SetTimeout(timeout time.Duration)

SetTimeout sets the timeout for requests made by this client.

func (*Client) StopOrder

func (cl *Client) StopOrder(ctx context.Context, req *StopOrderRequest) (*StopOrderResponse, error)

StopOrder makes a call to POST /api/1/stoporder.

Request to stop an order.

Permissions required: <code>Perm_W_Orders</code>

type CreateAccountRequest

type CreateAccountRequest struct {
	// The currency code for the account you want to create
	//
	// You must be verified to trade currency in order to be able to create an
	// account. A user has a limit of 4 accounts per currency.
	Currency string `json:"currency" url:"currency"`

	// The label to use for this account
	Name string `json:"name" url:"name"`
}

type CreateAccountResponse

type CreateAccountResponse struct {
	Balance          AccountBalance      `json:"balance"`
	Capabilities     AccountCapabilities `json:"capabilities"`
	Currency         string              `json:"currency"`
	Icon             string              `json:"icon"`
	Id               string              `json:"id"`
	IsDefault        bool                `json:"is_default"`
	Name             string              `json:"name"`
	Pending          []Transaction       `json:"pending"`
	ReceiveAddresses []ReceiveAddress    `json:"receive_addresses"`
	Transactions     []Transaction       `json:"transactions"`
}

type CreateFundingAddressRequest

type CreateFundingAddressRequest struct {
	// Currency code of the asset.
	Asset string `json:"asset" url:"asset"`

	// An optional name for the new address
	Name string `json:"name" url:"name"`
}

type CreateFundingAddressResponse

type CreateFundingAddressResponse struct {
	AccountId        string `json:"account_id"`
	Address          string `json:"address"`
	Asset            string `json:"asset"`
	AssignedAt       int64  `json:"assigned_at"`
	Name             string `json:"name"`
	ReceiveFee       string `json:"receive_fee"`
	TotalReceived    string `json:"total_received"`
	TotalUnconfirmed string `json:"total_unconfirmed"`
}

type CreateQuoteRequest

type CreateQuoteRequest struct {
	// Amount to buy or sell in the pair base currency.
	BaseAmount float64 `json:"base_amount,string" url:"base_amount"`

	// Currency pair to trade. The pair can also be flipped if you want to buy
	// or sell the counter currency (e.g. ZARXBT).
	Pair string `json:"pair" url:"pair"`

	// <code>BUY</code> or <code>SELL</code>.
	Type string `json:"type" url:"type"`

	// Optional account for the pair's base currency.
	BaseAccountId int64 `json:"base_account_id" url:"base_account_id"`

	// Optional account for the pair's counter currency.
	CounterAccountId int64 `json:"counter_account_id" url:"counter_account_id"`
}

type CreateQuoteResponse

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

type CreateWithdrawalRequest

type CreateWithdrawalRequest struct {
	// Amount to withdraw. The currency depends on the type.
	Amount float64 `json:"amount,string" url:"amount"`

	// Withdrawal type.
	Type string `json:"type" url:"type"`

	// The beneficiary ID of the bank account the withdrawal will be paid out
	// to. This parameter is required if you have multiple bank accounts. Your
	// bank account beneficiary ID can be found by clicking on the beneficiary
	// name on the <a href="/wallet/beneficiaries">Beneficiaries</a> page.
	BeneficiaryId int64 `json:"beneficiary_id" url:"beneficiary_id"`

	// For internal use.
	Reference string `json:"reference" url:"reference"`
}

type CreateWithdrawalResponse

type CreateWithdrawalResponse struct {
	Amount    string `json:"amount"`
	CreatedAt int64  `json:"created_at"`
	Currency  string `json:"currency"`
	Fee       string `json:"fee"`
	Id        string `json:"id"`
	Status    string `json:"status"`
	Type      string `json:"type"`
}

type DiscardQuoteRequest

type DiscardQuoteRequest struct {
	// ID of the quote to discard.
	Id int64 `json:"id" url:"id"`
}

type DiscardQuoteResponse

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

type Error

type Error struct {
	// Code can be used to identify errors even if the error message is
	// localised.
	Code string `json:"error_code"`

	// Message may be localised for authenticated API calls.
	Message string `json:"error"`
}

Error is a Luno API error.

func (*Error) Error

func (e *Error) Error() string

type ExerciseQuoteRequest

type ExerciseQuoteRequest struct {
	// ID of the quote to exercise.
	Id int64 `json:"id" url:"id"`
}

type ExerciseQuoteResponse

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

type GetBalancesRequest

type GetBalancesRequest struct {
	// Only return balances for wallets with these currencies (if not provided,
	// all balances will be returned)
	Assets `json:"assets" url:"assets"`
}

type GetBalancesResponse

type GetBalancesResponse struct {
}

type GetFeeInfoRequest

type GetFeeInfoRequest struct {
	// Get fee information about this pair.
	Pair string `json:"pair" url:"pair"`
}

type GetFeeInfoResponse

type GetFeeInfoResponse struct {
	MakerFee        string `json:"maker_fee"`
	TakerFee        string `json:"taker_fee"`
	ThirtyDayVolume string `json:"thirty_day_volume"`
}

type GetFundingAddressRequest

type GetFundingAddressRequest struct {
	// Currency code of the asset.
	Asset string `json:"asset" url:"asset"`

	// Specific Bitcoin or Ethereum address to retrieve. If not provided, the
	// default address will be used.
	Address string `json:"address" url:"address"`
}

type GetFundingAddressResponse

type GetFundingAddressResponse struct {
	AccountId        string `json:"account_id"`
	Address          string `json:"address"`
	Asset            string `json:"asset"`
	AssignedAt       int64  `json:"assigned_at"`
	Name             string `json:"name"`
	ReceiveFee       string `json:"receive_fee"`
	TotalReceived    string `json:"total_received"`
	TotalUnconfirmed string `json:"total_unconfirmed"`
}

type GetOrderBookRequest

type GetOrderBookRequest struct {
	// Currency pair
	Pair string `json:"pair" url:"pair"`
}

type GetOrderBookResponse

type GetOrderBookResponse struct {
	Asks      []OrderBookEntry `json:"asks"`
	Bids      []OrderBookEntry `json:"bids"`
	Timestamp int64            `json:"timestamp"`
}

type GetOrderRequest

type GetOrderRequest struct {
	// The order ID.
	Id string `json:"id" url:"id"`
}

type GetOrderResponse

type GetOrderResponse struct {
	Base                string `json:"base"`
	Btc                 string `json:"btc"`
	CompletedTimestamp  int64  `json:"completed_timestamp"`
	Counter             string `json:"counter"`
	CreationTimestamp   int64  `json:"creation_timestamp"`
	ExpirationTimestamp int64  `json:"expiration_timestamp"`
	FeeBase             string `json:"fee_base"`
	FeeBtc              string `json:"fee_btc"`
	FeeCounter          string `json:"fee_counter"`
	FeeZar              string `json:"fee_zar"`
	LimitPrice          string `json:"limit_price"`
	LimitVolume         string `json:"limit_volume"`
	OrderId             string `json:"order_id"`

	// Specifies the market.
	Pair string `json:"pair"`

	// <code>PENDING</code> The order has been placed. Some trades may have
	// taken place but the order is not filled yet.<br>
	// <code>COMPLETE</code> The order is no longer active. It has been settled
	// or has been cancelled.
	State  string  `json:"state"`
	Trades []Trade `json:"trades"`

	// <code>BID</code> bid (buy) limit order.<br>
	// <code>ASK</code> ask (sell) limit order.
	Type string `json:"type"`
	Zar  string `json:"zar"`
}

type GetQuoteRequest

type GetQuoteRequest struct {
	// ID of the quote to retrieve.
	Id int64 `json:"id" url:"id"`
}

type GetQuoteResponse

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

type GetTickerRequest

type GetTickerRequest struct {
	// Currency pair
	Pair string `json:"pair" url:"pair"`
}

type GetTickerResponse

type GetTickerResponse struct {
	Ask                 string `json:"ask"`
	Bid                 string `json:"bid"`
	LastTrade           string `json:"last_trade"`
	Pair                string `json:"pair"`
	Rolling24HourVolume string `json:"rolling_24_hour_volume"`
	Timestamp           int64  `json:"timestamp"`
}

type GetTickersRequest

type GetTickersRequest struct {
}

type GetTickersResponse

type GetTickersResponse struct {
	Tickers []Ticker `json:"tickers"`
}

type GetWithdrawalRequest

type GetWithdrawalRequest struct {
	// Withdrawal ID to retrieve.
	Id int64 `json:"id" url:"id"`
}

type GetWithdrawalResponse

type GetWithdrawalResponse struct {
	Amount    string `json:"amount"`
	CreatedAt int64  `json:"created_at"`
	Currency  string `json:"currency"`
	Fee       string `json:"fee"`
	Id        string `json:"id"`
	Status    string `json:"status"`
	Type      string `json:"type"`
}

type GetWithdrawalsRequest

type GetWithdrawalsRequest struct {
}

type GetWithdrawalsResponse

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

type ListOrdersRequest

type ListOrdersRequest struct {
	// Filter to orders created before this timestamp (Unix milliseconds)
	CreatedBefore int64 `json:"created_before" url:"created_before"`

	// Limit to this many orders
	Limit int64 `json:"limit" url:"limit"`

	// Filter to only orders of this currency pair
	Pair string `json:"pair" url:"pair"`

	// Filter to only orders of this state
	//
	// Possible values: <code>PENDING</code>, <code>COMPLETE</code>
	State string `json:"state" url:"state"`
}

type ListOrdersResponse

type ListOrdersResponse struct {
	Orders []Order `json:"orders"`
}

type ListPendingTransactionsRequest

type ListPendingTransactionsRequest struct {
	// Account ID
	Id int64 `json:"id" url:"id"`
}

type ListPendingTransactionsResponse

type ListPendingTransactionsResponse struct {
	Balance          AccountBalance      `json:"balance"`
	Capabilities     AccountCapabilities `json:"capabilities"`
	Currency         string              `json:"currency"`
	Icon             string              `json:"icon"`
	Id               string              `json:"id"`
	IsDefault        bool                `json:"is_default"`
	Name             string              `json:"name"`
	Pending          []Transaction       `json:"pending"`
	ReceiveAddresses []ReceiveAddress    `json:"receive_addresses"`
	Transactions     []Transaction       `json:"transactions"`
}

type ListTradesRequest

type ListTradesRequest struct {
	// Currency pair
	Pair string `json:"pair" url:"pair"`

	// Fetch trades executed after this time, specified as a Unix timestamp in
	// milliseconds.
	Since int64 `json:"since" url:"since"`
}

type ListTradesResponse

type ListTradesResponse struct {
	Currency string  `json:"currency"`
	Trades   []Trade `json:"trades"`
}

type ListTransactionsRequest

type ListTransactionsRequest struct {
	// Account ID
	Id int64 `json:"id" url:"id"`

	// Maximum of the row range to return (exclusive)
	MaxRow int64 `json:"max_row" url:"max_row"`

	// Minimum of the row range to return (inclusive)
	MinRow int64 `json:"min_row" url:"min_row"`
}

type ListTransactionsResponse

type ListTransactionsResponse struct {
	Balance          AccountBalance      `json:"balance"`
	Capabilities     AccountCapabilities `json:"capabilities"`
	Currency         string              `json:"currency"`
	Icon             string              `json:"icon"`
	Id               string              `json:"id"`
	IsDefault        bool                `json:"is_default"`
	Name             string              `json:"name"`
	Pending          []Transaction       `json:"pending"`
	ReceiveAddresses []ReceiveAddress    `json:"receive_addresses"`
	Transactions     []Transaction       `json:"transactions"`
}

type ListUserTradesRequest

type ListUserTradesRequest struct {
	// Filter to trades of this currency pair.
	Pair string `json:"pair" url:"pair"`

	// Limit to this number of trades (default 100).
	Limit int64 `json:"limit" url:"limit"`

	// Filter to trades on or after this timestamp.
	Since int64 `json:"since" url:"since"`
}

type ListUserTradesResponse

type ListUserTradesResponse struct {
	Trades []Trade `json:"trades"`
}

type Order

type Order struct {
	Base                string `json:"base"`
	Btc                 string `json:"btc"`
	CompletedTimestamp  int64  `json:"completed_timestamp"`
	Counter             string `json:"counter"`
	CreationTimestamp   int64  `json:"creation_timestamp"`
	ExpirationTimestamp int64  `json:"expiration_timestamp"`
	FeeBase             string `json:"fee_base"`
	FeeBtc              string `json:"fee_btc"`
	FeeCounter          string `json:"fee_counter"`
	FeeZar              string `json:"fee_zar"`
	LimitPrice          string `json:"limit_price"`
	LimitVolume         string `json:"limit_volume"`
	OrderId             string `json:"order_id"`

	// Specifies the market.
	Pair string `json:"pair"`

	// <code>PENDING</code> The order has been placed. Some trades may have
	// taken place but the order is not filled yet.<br>
	// <code>COMPLETE</code> The order is no longer active. It has been settled
	// or has been cancelled.
	State  string  `json:"state"`
	Trades []Trade `json:"trades"`

	// <code>BID</code> bid (buy) limit order.<br>
	// <code>ASK</code> ask (sell) limit order.
	Type string `json:"type"`
	Zar  string `json:"zar"`
}

type OrderBookEntry

type OrderBookEntry struct {
	Price  string `json:"price"`
	Volume string `json:"volume"`
}

type PostLimitOrderRequest

type PostLimitOrderRequest struct {
	// The currency pair to trade.
	Pair string `json:"pair" url:"pair"`

	// Limit price as a decimal string in units of ZAR/BTC.
	Price float64 `json:"price,string" url:"price"`

	// <code>BID</code> for a bid (buy) limit order<br>
	// <code>ASK</code> for ab ask (sell) limit order
	Type string `json:"type" url:"type"`

	// Amount of Bitcoin or Ethereum to buy or sell as a decimal string in units
	// of the currency.
	Volume float64 `json:"volume,string" url:"volume"`

	// The base currency account to use in the trade.
	BaseAccountId int64 `json:"base_account_id" url:"base_account_id"`

	// The counter currency account to use in the trade.
	CounterAccountId int64 `json:"counter_account_id" url:"counter_account_id"`
}

type PostLimitOrderResponse

type PostLimitOrderResponse struct {
	OrderId string `json:"order_id"`
}

type PostMarketOrderRequest

type PostMarketOrderRequest struct {
	// The currency pair to trade.
	Pair string `json:"pair" url:"pair"`

	// <code>BUY</code> to buy Bitcoin or Ethereum<br>
	// <code>SELL</code> to sell Bitcoin or Ethereum
	Type string `json:"type" url:"type"`

	// The base currency account to use in the trade.
	BaseAccountId int64 `json:"base_account_id" url:"base_account_id"`

	// For a <code>SELL</code> order: amount of Bitcoin to sell as a decimal
	// string in units of BTC or ETH.
	BaseVolume float64 `json:"base_volume,string" url:"base_volume"`

	// The counter currency account to use in the trade.
	CounterAccountId int64 `json:"counter_account_id" url:"counter_account_id"`

	// For a <code>BUY</code> order: amount of local currency (e.g. ZAR, MYR) to
	// spend as a decimal string in units of the local currency.
	CounterVolume float64 `json:"counter_volume,string" url:"counter_volume"`
}

type PostMarketOrderResponse

type PostMarketOrderResponse struct {
	OrderId string `json:"order_id"`
}

type ReceiveAddress

type ReceiveAddress struct {
	AccountId        string `json:"account_id"`
	Address          string `json:"address"`
	Asset            string `json:"asset"`
	AssignedAt       int64  `json:"assigned_at"`
	Name             string `json:"name"`
	ReceiveFee       string `json:"receive_fee"`
	TotalReceived    string `json:"total_received"`
	TotalUnconfirmed string `json:"total_unconfirmed"`
}

type SendRequest

type SendRequest struct {
	// Destination Bitcoin address or email address, or Ethereum address to send
	// to.
	//
	// Note:
	// <ul>
	// <li>Ethereum addresses must be
	// <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md" target="_blank" rel="nofollow">checksummed</a>.</li>
	// <li>Ethereum sends to email addresses are not supported.</li>
	// </ul>
	Address string `json:"address" url:"address"`

	// Amount to send as a decimal string.
	Amount float64 `json:"amount,string" url:"amount"`

	// Currency to send.
	Currency string `json:"currency" url:"currency"`

	// Description for the transaction to record on the account statement.
	Description string `json:"description" url:"description"`

	// Message to send to the recipient. This is only relevant when sending to
	// an email address.
	Message string `json:"message" url:"message"`
}

type SendResponse

type SendResponse struct {
	Success      bool   `json:"success"`
	WithdrawalId string `json:"withdrawal_id"`
}

type StopOrderRequest

type StopOrderRequest struct {
	// The order reference as a string.
	OrderId string `json:"order_id" url:"order_id"`
}

type StopOrderResponse

type StopOrderResponse struct {
	Success bool `json:"success"`
}

type Ticker

type Ticker struct {
	Ask                 string `json:"ask"`
	Bid                 string `json:"bid"`
	LastTrade           string `json:"last_trade"`
	Pair                string `json:"pair"`
	Rolling24HourVolume string `json:"rolling_24_hour_volume"`
	Timestamp           int64  `json:"timestamp"`
}

type Trade

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

type Transaction

type Transaction struct {
	AccountId      string  `json:"account_id"`
	AppExt         AppExt  `json:"app_ext"`
	Available      float64 `json:"available,string"`
	AvailableDelta float64 `json:"available_delta,string"`
	Balance        float64 `json:"balance,string"`

	// Transaction amounts computed for convenience.
	BalanceDelta float64 `json:"balance_delta,string"`
	Currency     string  `json:"currency"`

	// Human-readable description of the transaction.
	Description string `json:"description"`
	RowIndex    int64  `json:"row_index"`
	Timestamp   int64  `json:"timestamp"`
}

type Withdrawal

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

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