luno

package module
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: MIT Imports: 16 Imported by: 39

README

Luno API GoDoc Build Status

This Go package provides a wrapper for the Luno API.

Documentation

Please visit godoc.org for the full package documentation.

Authentication

Please visit the Settings page to generate an API key.

Installation

go get github.com/luno/luno-go
Example usage

A full working example of this library in action.

package main

import (
  "log"
  "context"
  "time"
  "github.com/luno/luno-go"
)

func main() {
  lunoClient := luno.NewClient()
  lunoClient.SetAuth("<id>", "<secret>")

  req := luno.GetOrderBookRequest{Pair: "XBTZAR"}
  ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(10 * time.Second))
  defer cancel()

  res, err := lunoClient.GetOrderBook(ctx, &req)
  if err != nil {
    log.Fatal(err)
  }
  log.Println(res)
}

Remember to substitute <id> and <secret> for your own Id and Secret.

We recommend using environment variables rather than including your credentials in plaintext. In Bash you do so as follows:

$ export LUNO_API_ID="<id>"
$ export LUNO_API_SECRET="<secret>"

And then access them in Go like so:

import "os"

var API_KEY_ID string = os.Getenv("LUNO_API_ID")
var API_KEY_SECRET string = os.Getenv("LUNO_API_SECRET")

License

MIT

Documentation

Overview

Package luno is a wrapper for the Luno API.

Index

Constants

View Source
const Version = "0.0.16"

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     decimal.Decimal `json:"balance"`
	Name        string          `json:"name"`
	Reserved    decimal.Decimal `json:"reserved"`
	Unconfirmed decimal.Decimal `json:"unconfirmed"`
}

type AddressMeta added in v0.0.12

type AddressMeta struct {
	Label string `json:"label"`
	Value string `json:"value"`
}

type CancelWithdrawalRequest

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

CancelWithdrawalRequest is the request struct for CancelWithdrawal.

type CancelWithdrawalResponse

type CancelWithdrawalResponse struct {
	Amount     decimal.Decimal `json:"amount"`
	CreatedAt  Time            `json:"created_at"`
	Currency   string          `json:"currency"`
	ExternalId string          `json:"external_id"`
	Fee        decimal.Decimal `json:"fee"`
	Id         string          `json:"id"`
	Status     string          `json:"status"`
	Type       string          `json:"type"`
}

CancelWithdrawalResponse is the response struct for CancelWithdrawal.

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.

This request creates an Account for the specified currency. Please note that the balances for the Account will be displayed based on the <code>asset</code> value, which is the currency the Account is based on.

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 of a base currency for a counter currency.

Users can specify either the exact amount to pay or the exact amount to 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, create a quote to SELL 100 ZARXBT. The returned quote specifies the Bitcoin as the counter amount returned.

An error is returned if the Account is not verified for the currency pair, or if the 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 to the specified beneficiary.

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.

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 the Account, it will be debited and the counter amount credited.

An error is returned if the quote has expired or if the Account has 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.

The list of all Accounts and their respective balances for the requesting user.

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 the fees and 30 day trading volume (as of midnight) for a given currency pair. For complete details, please see <a href="en/countries">Fees & Features</a>.

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. Users can specify an optional address parameter to return information for a non-default receive address.

In the response, <code>total_received</code> is the total confirmed amount received excluding unconfirmed transactions. <code>total_unconfirmed</code> 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's details 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_top.

Returns a list of the top 100 <em>bids</em> and <em>asks</em> for the currency pair specified in the Order Book.

Ask Orders are sorted by price ascending.

Bid Orders are sorted by price descending.

Orders of the same price are aggregated.

func (*Client) GetOrderBookFull added in v0.0.3

func (cl *Client) GetOrderBookFull(ctx context.Context, req *GetOrderBookFullRequest) (*GetOrderBookFullResponse, error)

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

This request returns a list of all <em>bids</em> and <em>asks</em> for the currency pair specified in the Order Book.

Ask orders are sorted by price ascending.

Bid orders are sorted by price descending.

Multiple orders at the same price are not aggregated.

<b>Warning:</b> This may return a large amount of data. Users are recommended to use the <a href="#operation/getOrderBook">top 100 bids and asks</a> or the <a href="#tag/streaming-API-(beta)">Streaming API</a>.

func (*Client) GetOrderV2 added in v0.0.16

func (cl *Client) GetOrderV2(ctx context.Context, req *GetOrderV2Request) (*GetOrderV2Response, error)

GetOrderV2 makes a call to GET /api/exchange/2/orders/{id}.

Get the details for an order.<br> This endpoint is in BETA, behaviour and specification may change without any previous notice.

Permissions required: <code>Perm_R_Orders</code>

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 by its id.

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 for the specified currency pair.

Please see the <a href="#tag/currency ">Currency list</a> for the complete list of supported currency pairs.

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.

Please see the <a href="#tag/currency ">Currency list</a> for the complete list of supported currency pairs.

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) ListBeneficiariesResponse added in v0.0.12

ListBeneficiariesResponse makes a call to GET /api/1/beneficiaries.

Returns a list of bank beneficiaries.

Permissions required: <code>Perm_R_Beneficiaries</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. Users can specify an optional <code>state=PENDING</code> parameter to restrict the results to only open Orders. Users can also specify the market by using the optional currency pair parameter. The list is truncated after 100 items.

Permissions required: <code>Perm_R_Orders</code>

func (*Client) ListOrdersV2 added in v0.0.16

func (cl *Client) ListOrdersV2(ctx context.Context, req *ListOrdersV2Request) (*ListOrdersV2Response, error)

ListOrdersV2 makes a call to GET /api/exchange/2/listorders.

Returns a list of the most recently placed orders. This endpoint will list up to 100 open orders by default.<br> This endpoint is in BETA, behaviour and specification may change without any previous notice.

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 transactions that have not completed for the Account.

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 for the specified currency pair in the last 24 hours. At most 100 results are returned per call.

Please see the <a href="#tag/currency ">Currency list</a> for the complete list of supported currency pairs.

func (*Client) ListTransactions

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

ListTransactions makes a call to GET /api/1/accounts/{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 the recent Trades for a given currency pair for this user, sorted by oldest first. If <code>before</code> is specified, then Trades are returned sorted by most-recent first.

<code>type</code> in the response indicates the type of Order that was placed 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) ListWithdrawals

func (cl *Client) ListWithdrawals(ctx context.Context, req *ListWithdrawalsRequest) (*ListWithdrawalsResponse, error)

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

Returns a list of withdrawal requests.

Permissions required: <code>Perm_R_Withdrawals</code>

func (*Client) Markets added in v0.0.16

func (cl *Client) Markets(ctx context.Context, req *MarketsRequest) (*MarketsResponse, error)

Markets makes a call to GET /api/exchange/1/markets.

Get all supported markets parameter information like price scale, min and max volumes and market ID.

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.

<b>Warning!</b> 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 of the asset that can be bought for a set amount of fiat currency, or sells a set amount of the asset for as much as possible.

<b>Warning!</b> 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, the default base currency or counter currency account will be used. Users can find their account IDs by calling the <a href="#operation/getBalances">Balances</a> request.

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 assets from an Account. Please note that the asset type sent must match the receive address of the same cryptocurrency of the same type - Bitcoin to Bitcoin, Ethereum to Ethereum, etc.

Sends can be to a cryptocurrency receive address, or the email address of another Luno platform user.

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) SetDebug

func (cl *Client) SetDebug(debug bool)

SetDebug enables or disables debug mode. In debug mode, HTTP requests and responses will be logged.

func (*Client) SetHTTPClient added in v0.0.3

func (cl *Client) SetHTTPClient(httpClient *http.Client)

SetHTTPClient sets the HTTP client that will be used for API calls.

func (*Client) SetTimeout

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

SetTimeout sets the timeout for requests made by this client. Note: if you set a timeout and then call .SetHTTPClient(), the timeout in the new HTTP client will be used.

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.

<b>Note!</b>: Once an Order has been completed, it can not be reversed. The return value from this request will indicate if the Stop request was successful or not.

Permissions required: <code>Perm_W_Orders</code>

func (*Client) UpdateAccountName added in v0.0.12

func (cl *Client) UpdateAccountName(ctx context.Context, req *UpdateAccountNameRequest) (*UpdateAccountNameResponse, error)

UpdateAccountName makes a call to PUT /api/1/accounts/{id}/name.

Update the name of an account with a given ID.

Permissions required: <code>Perm_W_Addresses</code>

type CreateAccountRequest

type CreateAccountRequest struct {
	// The currency code for the Account you want to create.  Please see the Currency section for a detailed list of currencies supported by the Luno platform.
	//
	// Users must be verified to trade currency in order to be able to create an Account.  For more information on the verification process, please see <a href="/help/en/articles/1000168396">How do I verify my identity?</a>.
	//
	// Users have a limit of 4 accounts per currency.
	//
	// required: true
	Currency string `json:"currency" url:"currency"`

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

CreateAccountRequest is the request struct for CreateAccount.

type CreateAccountResponse

type CreateAccountResponse struct {
	Currency     string        `json:"currency"`
	Id           string        `json:"id"`
	Name         string        `json:"name"`
	Pending      []Transaction `json:"pending"`
	Transactions []Transaction `json:"transactions"`
}

CreateAccountResponse is the response struct for CreateAccount.

type CreateFundingAddressRequest

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

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

CreateFundingAddressRequest is the request struct for CreateFundingAddress.

type CreateFundingAddressResponse

type CreateFundingAddressResponse struct {
	AccountId        string          `json:"account_id"`
	Address          string          `json:"address"`
	AddressMeta      []AddressMeta   `json:"address_meta"`
	Asset            string          `json:"asset"`
	AssignedAt       Time            `json:"assigned_at"`
	Name             string          `json:"name"`
	QrCodeUri        string          `json:"qr_code_uri"`
	ReceiveFee       decimal.Decimal `json:"receive_fee"`
	TotalReceived    decimal.Decimal `json:"total_received"`
	TotalUnconfirmed decimal.Decimal `json:"total_unconfirmed"`
}

CreateFundingAddressResponse is the response struct for CreateFundingAddress.

type CreateQuoteRequest

type CreateQuoteRequest struct {
	// Amount to buy or sell in the pair base currency.
	//
	// required: true
	BaseAmount decimal.Decimal `json:"base_amount" 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).
	//
	// required: true
	Pair string `json:"pair" url:"pair"`

	// <code>BUY</code> or <code>SELL</code>.
	//
	// required: true
	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"`
}

CreateQuoteRequest is the request struct for CreateQuote.

type CreateQuoteResponse

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

CreateQuoteResponse is the response struct for CreateQuote.

type CreateWithdrawalRequest

type CreateWithdrawalRequest struct {
	// Amount to withdraw. The currency withdrawn depends on the type setting.
	//
	// required: true
	Amount decimal.Decimal `json:"amount" url:"amount"`

	// Withdrawal type.
	//
	// required: true
	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 the user has set up multiple beneficiaries.
	// The beneficiary ID can be found by selecting on the beneficiary name on the user’s <a href="/wallet/beneficiaries">Beneficiaries</a> page.
	BeneficiaryId int64 `json:"beneficiary_id" url:"beneficiary_id"`

	// Optional unique ID to associate with this withdrawal.
	// Useful to prevent duplicate sends.
	// This field supports all alphanumeric characters including "-" and "_".
	ExternalId string `json:"external_id" url:"external_id"`

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

CreateWithdrawalRequest is the request struct for CreateWithdrawal.

type CreateWithdrawalResponse

type CreateWithdrawalResponse struct {
	Amount     decimal.Decimal `json:"amount"`
	CreatedAt  Time            `json:"created_at"`
	Currency   string          `json:"currency"`
	ExternalId string          `json:"external_id"`
	Fee        decimal.Decimal `json:"fee"`
	Id         string          `json:"id"`
	Status     string          `json:"status"`
	Type       string          `json:"type"`
}

CreateWithdrawalResponse is the response struct for CreateWithdrawal.

type CryptoDetails added in v0.0.9

type CryptoDetails struct {
	Address string `json:"address"`
	Txid    string `json:"txid"`
}

type DetailFields added in v0.0.9

type DetailFields struct {
	CryptoDetails CryptoDetails `json:"crypto_details"`
	TradeDetails  TradeDetails  `json:"trade_details"`
}

type DiscardQuoteRequest

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

DiscardQuoteRequest is the request struct for DiscardQuote.

type DiscardQuoteResponse

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

DiscardQuoteResponse is the response struct for DiscardQuote.

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.
	//
	// required: true
	Id int64 `json:"id" url:"id"`
}

ExerciseQuoteRequest is the request struct for ExerciseQuote.

type ExerciseQuoteResponse

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

ExerciseQuoteResponse is the response struct for ExerciseQuote.

type GetBalancesRequest

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

GetBalancesRequest is the request struct for GetBalances.

type GetBalancesResponse

type GetBalancesResponse struct {
	Balance []AccountBalance `json:"balance"`
}

GetBalancesResponse is the response struct for GetBalances.

type GetFeeInfoRequest

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

GetFeeInfoRequest is the request struct for GetFeeInfo.

type GetFeeInfoResponse

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

GetFeeInfoResponse is the response struct for GetFeeInfo.

type GetFundingAddressRequest

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

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

GetFundingAddressRequest is the request struct for GetFundingAddress.

type GetFundingAddressResponse

type GetFundingAddressResponse struct {
	AccountId        string          `json:"account_id"`
	Address          string          `json:"address"`
	AddressMeta      []AddressMeta   `json:"address_meta"`
	Asset            string          `json:"asset"`
	AssignedAt       Time            `json:"assigned_at"`
	Name             string          `json:"name"`
	QrCodeUri        string          `json:"qr_code_uri"`
	ReceiveFee       decimal.Decimal `json:"receive_fee"`
	TotalReceived    decimal.Decimal `json:"total_received"`
	TotalUnconfirmed decimal.Decimal `json:"total_unconfirmed"`
}

GetFundingAddressResponse is the response struct for GetFundingAddress.

type GetOrderBookFullRequest added in v0.0.3

type GetOrderBookFullRequest struct {
	// Currency pair of the Orders to retrieve
	//
	// required: true
	Pair string `json:"pair" url:"pair"`
}

GetOrderBookFullRequest is the request struct for GetOrderBookFull.

type GetOrderBookFullResponse added in v0.0.3

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

GetOrderBookFullResponse is the response struct for GetOrderBookFull.

type GetOrderBookRequest

type GetOrderBookRequest struct {
	// Currency pair of the Orders to retrieve
	//
	// required: true
	Pair string `json:"pair" url:"pair"`
}

GetOrderBookRequest is the request struct for GetOrderBook.

type GetOrderBookResponse

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

GetOrderBookResponse is the response struct for GetOrderBook.

type GetOrderRequest

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

GetOrderRequest is the request struct for GetOrder.

type GetOrderResponse

type GetOrderResponse struct {
	Base                decimal.Decimal `json:"base"`
	CompletedTimestamp  Time            `json:"completed_timestamp"`
	Counter             decimal.Decimal `json:"counter"`
	CreationTimestamp   Time            `json:"creation_timestamp"`
	ExpirationTimestamp Time            `json:"expiration_timestamp"`
	FeeBase             decimal.Decimal `json:"fee_base"`
	FeeCounter          decimal.Decimal `json:"fee_counter"`
	LimitPrice          decimal.Decimal `json:"limit_price"`
	LimitVolume         decimal.Decimal `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 OrderState `json:"state"`

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

GetOrderResponse is the response struct for GetOrder.

type GetOrderV2Request added in v0.0.16

type GetOrderV2Request struct {
	// Order reference
	//
	// required: true
	Id string `json:"id" url:"id"`
}

GetOrderV2Request is the request struct for GetOrderV2.

type GetOrderV2Response added in v0.0.16

type GetOrderV2Response struct {
	// Amount of base filled
	Base decimal.Decimal `json:"base"`

	// Time of order completion in milliseconds
	CompletedTimestamp Time `json:"completed_timestamp"`

	// Amount of counter filled
	Counter decimal.Decimal `json:"counter"`

	// Time of order creation in milliseconds
	CreationTimestamp Time `json:"creation_timestamp"`

	// Time of order expiration in milliseconds
	ExpirationTimestamp Time `json:"expiration_timestamp"`

	// Base amount of fees to be charged
	FeeBase decimal.Decimal `json:"fee_base"`

	// Counter amount of fees to be charged
	FeeCounter decimal.Decimal `json:"fee_counter"`

	// Limit price to transact
	LimitPrice decimal.Decimal `json:"limit_price"`

	// Limit volume to transact
	LimitVolume decimal.Decimal `json:"limit_volume"`

	// The order reference
	OrderId string `json:"order_id"`

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

	// The order intention
	Side Side `json:"side"`

	// The current state of the order
	//
	// Status meaning:<br>
	// <code>AWAITING</code> The order is awaiting to enter the order book.<br>
	// <code>PENDING</code> The order is in the order book. Some trades may
	// have taken place but the order is not filled yet.<br>
	// <code>COMPLETE</code> The order is no longer in the order book. It has
	// been settled/filled or has been cancelled.
	Status Status `json:"status"`

	// Direction to trigger the order
	StopDirection StopDirection `json:"stop_direction"`

	// Price to trigger the order
	StopPrice decimal.Decimal `json:"stop_price"`

	// The order type
	Type Type `json:"type"`
}

GetOrderV2Response is the response struct for GetOrderV2.

type GetQuoteRequest

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

GetQuoteRequest is the request struct for GetQuote.

type GetQuoteResponse

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

GetQuoteResponse is the response struct for GetQuote.

type GetTickerRequest

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

GetTickerRequest is the request struct for GetTicker.

type GetTickerResponse

type GetTickerResponse struct {
	Ask                 decimal.Decimal `json:"ask"`
	Bid                 decimal.Decimal `json:"bid"`
	LastTrade           decimal.Decimal `json:"last_trade"`
	Pair                string          `json:"pair"`
	Rolling24HourVolume decimal.Decimal `json:"rolling_24_hour_volume"`

	// <code>ACTIVE</code> when the market is trading normally
	//
	// <code>POSTONLY</code> when the market has been suspended and only post-only orders will be accepted
	//
	// <code>DISABLED</code> when the market is shutdown and no orders can be accepted
	Status    Status `json:"status"`
	Timestamp Time   `json:"timestamp"`
}

GetTickerResponse is the response struct for GetTicker.

type GetTickersRequest

type GetTickersRequest struct {
}

GetTickersRequest is the request struct for GetTickers.

type GetTickersResponse

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

GetTickersResponse is the response struct for GetTickers.

type GetWithdrawalRequest

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

GetWithdrawalRequest is the request struct for GetWithdrawal.

type GetWithdrawalResponse

type GetWithdrawalResponse struct {
	Amount     decimal.Decimal `json:"amount"`
	CreatedAt  Time            `json:"created_at"`
	Currency   string          `json:"currency"`
	ExternalId string          `json:"external_id"`
	Fee        decimal.Decimal `json:"fee"`
	Id         string          `json:"id"`
	Status     string          `json:"status"`
	Type       string          `json:"type"`
}

GetWithdrawalResponse is the response struct for GetWithdrawal.

type Kind added in v0.0.16

type Kind string
const (
	KindExchange Kind = "EXCHANGE"
	KindFee      Kind = "FEE"
	KindInterest Kind = "INTEREST"
	KindTransfer Kind = "TRANSFER"
)

type ListBeneficiariesResponseRequest added in v0.0.12

type ListBeneficiariesResponseRequest struct {
}

ListBeneficiariesResponseRequest is the request struct for ListBeneficiariesResponse.

type ListBeneficiariesResponseResponse added in v0.0.12

type ListBeneficiariesResponseResponse struct {
	Beneficiaries []beneficiary `json:"beneficiaries"`
}

ListBeneficiariesResponseResponse is the response struct for ListBeneficiariesResponse.

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
	State OrderState `json:"state" url:"state"`
}

ListOrdersRequest is the request struct for ListOrders.

type ListOrdersResponse

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

ListOrdersResponse is the response struct for ListOrders.

type ListOrdersV2Request added in v0.0.16

type ListOrdersV2Request struct {
	// If true, will return closed orders instead of open orders.
	Closed bool `json:"closed" url:"closed"`

	// 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"`
}

ListOrdersV2Request is the request struct for ListOrdersV2.

type ListOrdersV2Response added in v0.0.16

type ListOrdersV2Response struct {
	Orders []OrderV2 `json:"orders"`
}

ListOrdersV2Response is the response struct for ListOrdersV2.

type ListPendingTransactionsRequest

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

ListPendingTransactionsRequest is the request struct for ListPendingTransactions.

type ListPendingTransactionsResponse

type ListPendingTransactionsResponse struct {
	Currency     string        `json:"currency"`
	Id           string        `json:"id"`
	Name         string        `json:"name"`
	Pending      []Transaction `json:"pending"`
	Transactions []Transaction `json:"transactions"`
}

ListPendingTransactionsResponse is the response struct for ListPendingTransactions.

type ListTradesRequest

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

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

ListTradesRequest is the request struct for ListTrades.

type ListTradesResponse

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

ListTradesResponse is the response struct for ListTrades.

type ListTransactionsRequest

type ListTransactionsRequest struct {
	// Account ID - the unique identifier for the specific Account.
	//
	// required: true
	Id int64 `json:"id" url:"id"`

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

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

ListTransactionsRequest is the request struct for ListTransactions.

type ListTransactionsResponse

type ListTransactionsResponse struct {
	Currency     string        `json:"currency"`
	Id           string        `json:"id"`
	Name         string        `json:"name"`
	Pending      []Transaction `json:"pending"`
	Transactions []Transaction `json:"transactions"`
}

ListTransactionsResponse is the response struct for ListTransactions.

type ListUserTradesRequest

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

	// Filter to trades from (including) this sequence number.
	// Default behaviour is not to include this filter.
	AfterSeq int64 `json:"after_seq" url:"after_seq"`

	// Filter to trades before this timestamp.
	Before Time `json:"before" url:"before"`

	// Filter to trades before (excluding) this sequence number.
	// Default behaviour is not to include this filter.
	BeforeSeq int64 `json:"before_seq" url:"before_seq"`

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

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

	// If set to true, sorts trades in descending order, otherwise ascending
	// order will be assumed.
	SortDesc bool `json:"sort_desc" url:"sort_desc"`
}

ListUserTradesRequest is the request struct for ListUserTrades.

type ListUserTradesResponse

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

ListUserTradesResponse is the response struct for ListUserTrades.

type ListWithdrawalsRequest

type ListWithdrawalsRequest struct {
}

ListWithdrawalsRequest is the request struct for ListWithdrawals.

type ListWithdrawalsResponse

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

ListWithdrawalsResponse is the response struct for ListWithdrawals.

type MarketInfo added in v0.0.16

type MarketInfo struct {
	// Maximum order price
	MaxPrice decimal.Decimal `json:"MaxPrice"`

	// Minimum order price
	MinPrice decimal.Decimal `json:"MinPrice"`

	// Base currency code
	BaseCurrency string `json:"base_currency"`

	// Counter currency code
	CounterCurrency string `json:"counter_currency"`

	// Fee decimal places
	FeeScale int64 `json:"fee_scale"`

	// Unique identifier for the market
	MarketId string `json:"market_id"`

	// Maximum order volume
	MaxVolume decimal.Decimal `json:"max_volume"`

	// Minimum order volume
	MinVolume decimal.Decimal `json:"min_volume"`

	// Price decimal places
	PriceScale int64 `json:"price_scale"`

	// Current market trading status:<br>
	// <code>POST_ONLY</code> Trading is indefinitely suspended. This state is
	// commonly used when new markets are being launched to give traders enough
	// time to setup their orders before trading begins. When in this status,
	// orders can only be posted as post-only.<br>
	// <code>ACTIVE</code> Trading is fully enabled.<br>
	// <code>SUSPENDED</code> Trading has been temporarily suspended due to very
	// high volatility. When in this status, orders can only be posted as
	// post-only.<br>
	TradingStatus TradingStatus `json:"trading_status"`

	// Volume decimal places
	VolumeScale int64 `json:"volume_scale"`
}

type MarketsRequest added in v0.0.16

type MarketsRequest struct {
}

MarketsRequest is the request struct for Markets.

type MarketsResponse added in v0.0.16

type MarketsResponse struct {
	Markets []MarketInfo `json:"markets"`
}

MarketsResponse is the response struct for Markets.

type Order

type Order struct {
	Base                decimal.Decimal `json:"base"`
	CompletedTimestamp  Time            `json:"completed_timestamp"`
	Counter             decimal.Decimal `json:"counter"`
	CreationTimestamp   Time            `json:"creation_timestamp"`
	ExpirationTimestamp Time            `json:"expiration_timestamp"`
	FeeBase             decimal.Decimal `json:"fee_base"`
	FeeCounter          decimal.Decimal `json:"fee_counter"`
	LimitPrice          decimal.Decimal `json:"limit_price"`
	LimitVolume         decimal.Decimal `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 OrderState `json:"state"`

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

type OrderBookEntry

type OrderBookEntry struct {
	Price  decimal.Decimal `json:"price"`
	Volume decimal.Decimal `json:"volume"`
}

type OrderState

type OrderState string
const (
	OrderStateComplete OrderState = "COMPLETE"
	OrderStatePending  OrderState = "PENDING"
)

type OrderType

type OrderType string
const (
	OrderTypeAsk  OrderType = "ASK"
	OrderTypeBid  OrderType = "BID"
	OrderTypeBuy  OrderType = "BUY"
	OrderTypeSell OrderType = "SELL"
)

type OrderV2 added in v0.0.16

type OrderV2 struct {
	// Amount of base filled
	Base decimal.Decimal `json:"base"`

	// Time of order completion in milliseconds
	CompletedTimestamp Time `json:"completed_timestamp"`

	// Amount of counter filled
	Counter decimal.Decimal `json:"counter"`

	// Time of order creation in milliseconds
	CreationTimestamp Time `json:"creation_timestamp"`

	// Time of order expiration in milliseconds
	ExpirationTimestamp Time `json:"expiration_timestamp"`

	// Base amount of fees to be charged
	FeeBase decimal.Decimal `json:"fee_base"`

	// Counter amount of fees to be charged
	FeeCounter decimal.Decimal `json:"fee_counter"`

	// Limit price to transact
	LimitPrice decimal.Decimal `json:"limit_price"`

	// Limit volume to transact
	LimitVolume decimal.Decimal `json:"limit_volume"`

	// The order reference
	OrderId string `json:"order_id"`

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

	// The order intention
	Side Side `json:"side"`

	// The current state of the order
	//
	// Status meaning:<br>
	// <code>AWAITING</code> The order is awaiting to enter the order book.<br>
	// <code>PENDING</code> The order is in the order book. Some trades may
	// have taken place but the order is not filled yet.<br>
	// <code>COMPLETE</code> The order is no longer in the order book. It has
	// been settled/filled or has been cancelled.
	Status Status `json:"status"`

	// Direction to trigger the order
	StopDirection StopDirection `json:"stop_direction"`

	// Price to trigger the order
	StopPrice decimal.Decimal `json:"stop_price"`

	// The order type
	Type Type `json:"type"`
}

type PostLimitOrderRequest

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

	// Limit price as a decimal string in units of ZAR/BTC.
	//
	// required: true
	Price decimal.Decimal `json:"price" url:"price"`

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

	// Amount of cryptocurrency to buy or sell as a decimal string in units of the currency.
	//
	// required: true
	Volume decimal.Decimal `json:"volume" 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"`

	// Post-only Orders will be cancelled if they would otherwise have traded
	// immediately.
	// For example, if there's a bid at ZAR 100,000 and you place a post-only ask at ZAR 100,000,
	// your order will be cancelled instead of trading.
	// If the best bid is ZAR 100,000 and you place a post-only ask at ZAR 101,000,
	// your order won't trade but will go into the order book.
	PostOnly bool `json:"post_only" url:"post_only"`

	// Side of the trigger price to activate the order. This should be set if `stop_price` is also
	// set.
	//
	// `RELATIVE_LAST_TRADE` will automatically infer the direction based on the last
	// trade price and the stop price. If last trade price is less than stop price then stop
	// direction is ABOVE otherwise is BELOW.
	StopDirection StopDirection `json:"stop_direction" url:"stop_direction"`

	// Trigger trade price to activate this order as a decimal string. If this
	// is set then this is treated as a Stop Limit Order and `stop_direction`
	// is expected to be set too.
	StopPrice decimal.Decimal `json:"stop_price" url:"stop_price"`
}

PostLimitOrderRequest is the request struct for PostLimitOrder.

type PostLimitOrderResponse

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

PostLimitOrderResponse is the response struct for PostLimitOrder.

type PostMarketOrderRequest

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

	// <code>BUY</code> to buy an asset<br>
	// <code>SELL</code> to sell an asset
	//
	// required: true
	Type OrderType `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 the base currency to use (e.g. how much BTC to sell for EUR in the BTC/EUR market)
	BaseVolume decimal.Decimal `json:"base_volume" 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 the counter currency to use (e.g. how much EUR to use to buy BTC in the BTC/EUR market)
	CounterVolume decimal.Decimal `json:"counter_volume" url:"counter_volume"`
}

PostMarketOrderRequest is the request struct for PostMarketOrder.

type PostMarketOrderResponse

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

PostMarketOrderResponse is the response struct for PostMarketOrder.

type QueryValuer added in v0.0.12

type QueryValuer interface {
	QueryValue() string
}

type SendRequest

type SendRequest struct {
	// Destination address or email address.
	//
	// <b>Note</b>:
	// <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>
	//
	// required: true
	Address string `json:"address" url:"address"`

	// Amount to send as a decimal string.
	//
	// required: true
	Amount decimal.Decimal `json:"amount" url:"amount"`

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

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

	// Optional XRP destination tag. Note that HasDestinationTag must be true if this value is provided.
	DestinationTag int64 `json:"destination_tag" url:"destination_tag"`

	// Optional unique ID to associate with this withdrawal.
	// Useful to prevent duplicate sends in case of failure.
	// This supports all alphanumeric characters, as well as "-" and "_".
	ExternalId string `json:"external_id" url:"external_id"`

	// Optional boolean flag indicating that a XRP destination tag is provided (even if zero).
	HasDestinationTag bool `json:"has_destination_tag" url:"has_destination_tag"`

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

SendRequest is the request struct for Send.

type SendResponse

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

SendResponse is the response struct for Send.

type Side added in v0.0.16

type Side string
const (
	SideBuy  Side = "BUY"
	SideSell Side = "SELL"
)

type Status added in v0.0.8

type Status string
const (
	StatusActive   Status = "ACTIVE"
	StatusAwaiting Status = "AWAITING"
	StatusComplete Status = "COMPLETE"
	StatusDisabled Status = "DISABLED"
	StatusPending  Status = "PENDING"
	StatusPostonly Status = "POSTONLY"
)

type StopDirection added in v0.0.16

type StopDirection string
const (
	StopDirectionAbove               StopDirection = "ABOVE"
	StopDirectionBelow               StopDirection = "BELOW"
	StopDirectionRelative_last_trade StopDirection = "RELATIVE_LAST_TRADE"
)

type StopOrderRequest

type StopOrderRequest struct {
	// The Order identifier as a string.
	//
	// required: true
	OrderId string `json:"order_id" url:"order_id"`
}

StopOrderRequest is the request struct for StopOrder.

type StopOrderResponse

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

StopOrderResponse is the response struct for StopOrder.

type Ticker

type Ticker struct {
	Ask                 decimal.Decimal `json:"ask"`
	Bid                 decimal.Decimal `json:"bid"`
	LastTrade           decimal.Decimal `json:"last_trade"`
	Pair                string          `json:"pair"`
	Rolling24HourVolume decimal.Decimal `json:"rolling_24_hour_volume"`

	// <code>ACTIVE</code> when the market is trading normally
	//
	// <code>POSTONLY</code> when the market has been suspended and only post-only orders will be accepted
	//
	// <code>DISABLED</code> when the market is shutdown and no orders can be accepted
	Status    Status `json:"status"`
	Timestamp Time   `json:"timestamp"`
}

type Time

type Time time.Time

func (Time) MarshalJSON

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

func (Time) QueryValue added in v0.0.12

func (t Time) QueryValue() string

func (Time) String

func (t Time) String() string

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(b []byte) error

type Trade

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

type TradeDetails added in v0.0.16

type TradeDetails struct {
	// Pair of the market
	Pair string `json:"pair"`

	// Price at which the volume traded for
	Price decimal.Decimal `json:"price"`

	// Sequence identifies the trade within a market
	Sequence int64 `json:"sequence"`

	// Volume is the amount of base traded
	Volume decimal.Decimal `json:"volume"`
}

type TradingStatus added in v0.0.16

type TradingStatus string
const (
	TradingStatusPost_only TradingStatus = "POST_ONLY"
	TradingStatusActive    TradingStatus = "ACTIVE"
	TradingStatusSuspended TradingStatus = "SUSPENDED"
)

type Transaction

type Transaction struct {
	AccountId      string          `json:"account_id"`
	Available      decimal.Decimal `json:"available"`
	AvailableDelta decimal.Decimal `json:"available_delta"`
	Balance        decimal.Decimal `json:"balance"`

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

	// Human-readable description of the transaction.
	Description  string       `json:"description"`
	DetailFields DetailFields `json:"detail_fields"`

	// Human-readable label-value attributes.
	Details map[string]string `json:"details"`

	// The kind of the transaction indicates the transaction flow
	//
	// Kinds explained:<br>
	// <code>FEE</code> when transaction is towards Luno fees<br>
	// <code>TRANSFER</code> when the transaction is a one way flow of funds, e.g. a deposit or crypto send<br>
	// <code>EXCHANGE</code> when the transaction is part of a two way exchange, e.g. a trade or instant buy
	Kind      Kind  `json:"kind"`
	RowIndex  int64 `json:"row_index"`
	Timestamp Time  `json:"timestamp"`
}

type Type added in v0.0.16

type Type string
const (
	TypeLimit      Type = "LIMIT"
	TypeMarket     Type = "MARKET"
	TypeStop_limit Type = "STOP_LIMIT"
)

type UpdateAccountNameRequest added in v0.0.12

type UpdateAccountNameRequest struct {
	// Account ID - the unique identifier for the specific Account.
	//
	// required: true
	Id int64 `json:"id" url:"id"`

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

UpdateAccountNameRequest is the request struct for UpdateAccountName.

type UpdateAccountNameResponse added in v0.0.12

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

UpdateAccountNameResponse is the response struct for UpdateAccountName.

type Withdrawal

type Withdrawal struct {
	Amount     decimal.Decimal `json:"amount"`
	CreatedAt  Time            `json:"created_at"`
	Currency   string          `json:"currency"`
	ExternalId string          `json:"external_id"`
	Fee        decimal.Decimal `json:"fee"`
	Id         string          `json:"id"`
	Status     string          `json:"status"`
	Type       string          `json:"type"`
}

Directories

Path Synopsis
examples
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