Documentation ¶
Index ¶
- type Balance
- type BankAccountsRequest
- type CancelOrderRequest
- type Client
- type CryptoDepositAddressRequest
- type CryptoDepositHistoryRequest
- type CryptoWithdrawalHistoryRequest
- type CryptoWithdrawalInfoRequest
- type CryptoWithdrawalRequest
- type CryptoWithdrawalResponse
- type CryptoWithdrawalStatusRequest
- type CryptoWithdrawalStatusResponse
- type Currency
- type CurrencyPair
- type DepositAddress
- type FiatWithdrawalRequest
- type LimitOrderRequest
- type MarketOrderRequest
- type MarketSummary
- type MarketSummaryRequest
- type OrderBook
- type OrderBookEntry
- type OrderBookRequest
- type OrderHistoryDetailRequest
- type OrderHistoryRequest
- type OrderHistorySummaryRequest
- type OrderStatusRequest
- type OrderType
- type OrderTypesRequest
- type PrivateClient
- type PublicClient
- type ServerTime
- type SimpleOrderRequest
- type SimpleOrderStatusRequest
- type SimpleQuoteRequest
- type Status
- type Trade
- type TradeHistoryRequest
- type Transaction
- type TransactionHistoryRequest
- type TransactionInfo
- type TransactionType
- type TransactionTypeInfo
- type WithdrawalInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BankAccountsRequest ¶
type BankAccountsRequest struct {
Currency string
}
BankAccountsRequest contains the request parameters for getting a list of bank accounts that are linked to your VALR account.
GET /wallet/fiat/{currency}/accounts
type CancelOrderRequest ¶
type CancelOrderRequest struct { CustomerOrderID string `json:"customerOrderId"` OrderID string `json:"orderId"` Pair string `json:"pair"` }
CancelOrderRequest contains the request parameters for cancelling an open order on the exchange. Only one of the order ID types should be provided.
DELETE /orders/order
type Client ¶
type Client interface { PrivateClient PublicClient }
Client is an HTTP client wrapper for the VALR REST API. It is a combination of the PublicClient and PrivateClient.
type CryptoDepositAddressRequest ¶
type CryptoDepositAddressRequest struct {
Currency string
}
DepositAddressRequest contains the request paremeters for getting the default deposit address associated with a given currency.
GET /wallet/crypto/{currency}/deposit/address
type CryptoDepositHistoryRequest ¶
type CryptoDepositHistoryRequest struct { Currency string Limit int `schema:"limit,omitempty"` Offset int `schema:"skip,omitempty"` }
CryptoDepositHistoryRequest contains the request parameters for getting the deposit history records for a given currency.
GET /wallet/crypto/{currency}/deposit/history
type CryptoWithdrawalHistoryRequest ¶
type CryptoWithdrawalHistoryRequest struct { Currency string Limit int `schema:"limit,omitempty"` Offset int `schema:"skip,omitempty"` }
CryptoWithdrawalHistory contains the request parameters for getting the withdrawal history records for a given currency.
GET /wallet/crypto/{currency}/withdraw/history
type CryptoWithdrawalInfoRequest ¶
type CryptoWithdrawalInfoRequest struct {
Currency string
}
CryptoWithdrawalInfoRequest contains the request parameters for getting information about withdrawing a given currency from your VALR account.
GET /wallet/crypto/{currency}/withdraw
type CryptoWithdrawalRequest ¶
type CryptoWithdrawalRequest struct { Amount string `json:"amount"` Address string `json:"address"` Currency string }
CryptoWithdrawalRequest contains the request parameters for creating a crypto withdrawals.
POST /wallet/crypto/{currency}/withdrawal
type CryptoWithdrawalResponse ¶
type CryptoWithdrawalResponse struct {
ID string `json:"id"`
}
CryptoWithdrawalResponse contains the response values returned from creating a new crypto withdrawal.
POST /wallet/crypto/{currency}/withdrawal
type CryptoWithdrawalStatusRequest ¶
CryptoWithdrawalStatusRequest contains the request paremeters for getting the status of a crypto withdrawal.
GET /wallet/crypto/{currency}/withdrawal/{id}
type CryptoWithdrawalStatusResponse ¶
type CryptoWithdrawalStatusResponse struct { Address string `json:"address"` Amount string `json:"amount"` Confirmations string `json:"confirmations"` CreatedAt time.Time `json:"createdAt"` Currency string `json:"currency"` Fees string `json:"feeAmount"` ID string `json:"id"` LastConfirmedAt time.Time `json:"lastConfirmedAt"` Status string `json:"status"` TransactionHash string `json:"transactionHash"` Verified bool `json:"verified"` }
CryptoWithdrawalStatus contains the response values returned when creating a new crypto withdrawal.
GET /wallet/crypto/{currency}/withdrawal/{id}
type Currency ¶
type Currency struct { IsActive bool `json:"isActive"` LongName string `json:"longName"` ShortName string `json:"shortName"` Symbol string `json:"symbol"` }
Currency is a fiat or crypto currency supported by VALR.
type CurrencyPair ¶
type CurrencyPair struct { Active bool `json:"active"` BaseCurrency string `json:"baseCurrency"` MinBaseAmount string `json:"minBaseAmount"` MaxBaseAmount string `json:"maxBaseAmount"` MinQuoteAmount string `json:"minQuoteAmount"` MaxQuoteAmount string `json:"maxQuoteAmount"` QuoteCurrency string `json:"quoteCurrency"` ShortName string `json:"shortName"` Symbol string `json:"symbol"` }
CurrencyPair is a fiat/crypto or crypto/crypto pair supported by VALR.
type DepositAddress ¶
DepositAddress contains the default deposit address for a crypto wallet.
type FiatWithdrawalRequest ¶
type FiatWithdrawalRequest struct { Amount string `json:"amount"` BankAccount string `json:"linkedBankAccountId"` Currency string Fast bool `json:"fast"` }
FiatWithdrawalRequest contains the request parameters for withdrawing your ZAR funds into one of your linked bank accounts.
POST /wallet/fiat/{currency}/withdraw
type LimitOrderRequest ¶
type LimitOrderRequest struct { CustomerOrderID string `json:"customerOrderId"` Pair string `json:"pair"` PostOnly bool `json:"postOnly"` Price string `json:"price"` Quantity string `json:"quantity"` Side string `json:"side"` }
LimitOrderRequest contains the request parameters for placing a limit order on the exchange.
POST /orders/limit
type MarketOrderRequest ¶
type MarketOrderRequest struct { BaseAmount string `json:"baseAmount"` CustomerOrderID string `json:"customerOrderId"` Pair string `json:"pair"` Side string `json:"side"` }
MarketOrderRequest contains the request parameters for placing a market order on the exchange.
POST /orders/market
type MarketSummary ¶
type MarketSummary struct { AskPrice string `json:"askPrice"` BaseVolume string `json:"baseVolume"` BidPrice string `json:"bidPrice"` ChangeFromPrevious string `json:"changeFromPrevious"` CreatedAt time.Time `json:"created"` CurrencyPair string `json:"currencyPair"` HighPrice string `json:"highPrice"` LastTradedPrice string `json:"lastTradedPrice"` LowPrice string `json:"lowPrice"` PreviousClosePrice string `json:"previousClosePrice"` }
MarketSummary contains a summary of a particular market pair on the exchange.
type MarketSummaryRequest ¶
type MarketSummaryRequest struct {
Pair string
}
MarketSummaryRequest contains the request parameters for obtaining a market summary for a given currency pair.
GET /public/{pair}/marketsummary
type OrderBook ¶
type OrderBook struct { Asks []OrderBookEntry `json:"Asks"` Bids []OrderBookEntry `json:"Bids"` }
OrderBook contains a list of the top 20 bids and asks. Ask orders are sorted by priceascending. Bid orders are sorted by price descending. Orders of the same price are aggregated.
type OrderBookEntry ¶
type OrderBookEntry struct { CurrencyPair string `json:"currencyPair"` OrderCount int `json:"orderCount"` Price string `json:"price"` Quantity string `json:"quantity"` Side string `json:"side"` }
OrderBookEntry is a single entry in an order book.
type OrderBookRequest ¶
type OrderBookRequest struct {
Pair string
}
OrderBookRequest contains the request parameters for obtaining the order book for a given currency, or for a non-aggregated full order book.
GET /public/{pair}/orderbook GET /marketdata/{pair}/orderbook/full
type OrderHistoryDetailRequest ¶
OrderHistoryDetailRequest contains the request parameters for getting the detailed history of an order's statuses ordered by time descending. Only one of the order ID types should be provided.
GET /orders/history/detail/customerorderid/{orderId} GET /orders/history/detail/orderid/{orderId}
type OrderHistoryRequest ¶
OrderHistoryRequest contains the request parameters for getting your order history.
GET /orders/history
type OrderHistorySummaryRequest ¶
OrderHistorySummaryRequest contains the request parameters for getting a summary for an order with one of the following statuses: "Filled", "Cancelled" or "Failed". Only one of the order ID types should be provided.
GET /orders/history/summary/customerorderid/{orderId} GET /orders/history/summary/orderid/{orderId}
type OrderStatusRequest ¶
OrderStatusRequest contains the request parameters for getting the status of an order on the exchange, queried by the order ID. Only one of the order ID types should be provided.
GET /orders/{pair}/customerorderid/{orderId} GET /orders/{pair}/{orderId}
type OrderType ¶
type OrderType string
OrderType describes the kind of an order.
const ( // Place a limit order on the exchange that will either be added to the // order book or, should it match, be cancelled completely. OrderTypePostOnly OrderType = "post-only limit" // Place a limit order on the exchange. OrderTypeLimit OrderType = "limit" // Place a market order on the exchange (only crypto-to-ZAR pairs). OrderTypeMarket OrderType = "market" // Similar to market order, but allows for crypto-to-crypto pairs. OrderTypeSimple OrderType = "simple" )
type OrderTypesRequest ¶
type OrderTypesRequest struct {
Pair string
}
OrderTypesRequest contains the request parameters for obtaining a list of supported order types for a currency pair.
GET /public/{pair}/ordertypes
type PrivateClient ¶
type PrivateClient interface { // Balances returns the list of all wallets with their respective balances. Balances(ctx context.Context) ([]Balance, error) // DepositAddress returns the default deposit address with a specified // currency. DepositAddress(ctx context.Context, currency string) (*DepositAddress, error) // TradeHistory gets the last 100 trades for a given currency pair for your // account. TradeHistory(ctx context.Context, pair string) ([]Trade, error) // TransactionHistory returns the list of all activities for your account. TransactionHistory(ctx context.Context, req *TransactionHistoryRequest) ( []Transaction, error) // WithdrawalInfo gets all the information about withdrawing a given // currency from your VALR account. That will include withdrawal costs, // minimum withdrawal amount, etc. WithdrawalInfo(ctx context.Context, currency string) (*WithdrawalInfo, error) }
PrivateClient contains methods that require authentication in order to access and have more relaxed rate limiting rules.
func ToPrivateClient ¶
func ToPrivateClient(c PublicClient, key, secret string) PrivateClient
ToPrivateClient converts a PublicClient to a PrivateClient.
type PublicClient ¶
type PublicClient interface { // Currencies returns a list of currencies supported by VALR. Currencies(ctx context.Context) ([]Currency, error) // CurrencyPairs returns a list of all the currency pairs supported by VALR. CurrencyPairs(ctx context.Context) ([]CurrencyPair, error) // MarketSummary reutns a market summary for all supported currency pairs. MarketSummary(ctx context.Context) ([]MarketSummary, error) // MarketSummaryForCurrency returns the market summary for a given currency // pair. MarketSummaryForCurrency(ctx context.Context, pair string) (*MarketSummary, error) // OrderBook returns a list of the top 20 bids and asks 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. OrderBook(ctx context.Context, pair string) (*OrderBook, error) // OrderTypes returns a map of all the order types supported for all // currency pairs. A 2D map is returned with the first key being the // currency pair and the second key being the order type. The value of the // map is a boolean denoting whether the order type is supported. You can // only place an order that is supported by that currency pair. // // Example: // // if orderTypes["BTCZAR"][OrderTypeSimple] { // /* The simple order type is supported for BTCZAR. */ // } else { // /* The simple order type is not supported for BTCZAR. */ // } OrderTypes(ctx context.Context) (map[string]map[OrderType]bool, error) // OrderTypesForCurrency returns a map of the order types supported for a // given currency pair. A map is returned with key being the currency pair // and the value being a boolean denoting whether the order type is // supported. You can only place an order that is supported by that currency // pair. // // Example: // // if orderTypes[OrderTypeSimple] { // /* The simple order type is supported. */ // } else { // /* The simple order type is not supported. */ // } OrderTypesForCurrency(ctx context.Context, pair string) (map[OrderType]bool, error) // ServerTime returns the time on the server. ServerTime(ctx context.Context) (*ServerTime, error) // Status returns the current status of VALR. Status(ctx context.Context) (Status, error) }
PublicClient contains methods that do not require authentication in order to access and have stricter rate limiting rules.
var DefaultClient PublicClient = &client{ apiKey: "", apiSecret: "", encoder: schema.NewEncoder(), httpClient: snorlax.DefaultClient. SetBaseURL(defaultBaseURL). SetHeader(http.CanonicalHeaderKey("Content-Type"), "application/json"), }
DefaultClient is a VALR client initialized with default values. This should be sufficient for callers only using the
func ToPublicClient ¶
func ToPublicClient(c PrivateClient) PublicClient
ToPublicClient converts a PrivateClient to a PublicClient.
type ServerTime ¶
Server time contains the time on VALRs servers.
type SimpleOrderRequest ¶
type SimpleOrderRequest struct { Amount string `json:"payAmount"` Pair string QuoteCurrency string `json:"payInCurrency"` Side string `json:"side"` }
SimpleOrderRequest contains the request parameters for placing a simple buy or sell order.
POST /simple/{pair}/order
type SimpleOrderStatusRequest ¶
SimpleOrderStatusRequest contains the request parameters for getting the current status of a simple buy or sell.
GET /simple/{pair}/order/{id}
type SimpleQuoteRequest ¶
type SimpleQuoteRequest struct { Amount string `json:"payAmount"` Pair string QuoteCurrency string `json:"payInCurrency"` Side string `json:"side"` }
SimpleQuoteRequest contains the request parameters for generating a simple buy or sell quote.
POST /simple/{pair}/quote
type Status ¶
type Status string
Status describes the current status of VALR.
const ( // StatusUnknown implies that the call to VALR failed and we are unable to // determine VALRs current status. StatusUnknown Status = "unknown" // StatusOnline implies that all functionality is available. StatusOnline Status = "online" // StatusReadOnly implies that only GET and OPTIONS requests are accepted. // All other requests in read-only mode will respond with a 503 status code. StatusReadOnly Status = "read-only" )
type Trade ¶
type Trade struct { CurrencyPair string `json:"currencyPair"` ID int64 `json:"tradeId"` Price string `json:"price"` Quantity string `json:"quantity"` Side string `json:"side"` TradedAt time.Time `json:"tradedAt"` }
Trade contains information regarding a single trade which has been executed.
type TradeHistoryRequest ¶
AccountTradeHistoryRequest contains the request parameters for obtaining the trade history for a given currency pair for your account, or for the market in general.
GET /account/{pair}/tradehistory GET /marketdata/{pair}/tradehistory
type Transaction ¶
type Transaction struct { AdditionalInfo *TransactionInfo `json:"additionalInfo,omitempty"` CreditCurrency string `json:"creditCurrency,omitempty"` CreditValue string `json:"creditValue,omitempty"` DebitCurrency string `json:"debitCurrency,omitempty"` DebitValue string `json:"debitValue,omitempty"` FeeCurrency string `json:"feeCurrency,omitempty"` FeeValue string `json:"feeValue,omitempty"` EventAt time.Time `json:"eventAt,omitempty"` TypeInfo *TransactionTypeInfo `json:"transactionType,omitempty"` }
Transaction contains information regarding certain activities of your wallets.
type TransactionHistoryRequest ¶
type TransactionHistoryRequest struct { BeforeID string `schema:"beforeId,omitempty"` Currency string `schema:"currency,omitempty"` EndTime time.Time `schema:"endTime,omitempty"` Limit int `schema:"skip,omitempty"` Offset int `schema:"limit,omitempty"` StartTime time.Time `schema:"startTime,omitempty"` Types []TransactionType `schema:"transactionTypes,omitempty"` }
TransactionHistoryRequest contains the request parameters for obtaining the transaction history for your account.
GET /account/transactionhistory
type TransactionInfo ¶
type TransactionInfo struct { CostPerCoin float64 `json:"costPerCoin,omitempty"` CostPerCoinSymbol string `json:"costPerCoinSymbol,omitempty"` CurrencyPairSymbol string `json:"currencyPairSymbol,omitempty"` OrderID string `json:"orderID,omitempty"` }
TransactionInfo contains additional information regarding Transactions.
type TransactionType ¶
type TransactionType string
TransactionType defines the kind of a transaction.
const ( TransactionTypeLimitBuy TransactionType = "LIMIT_BUY" TransactionTypeLimitSell TransactionType = "LIMIT_SELL" TransactionTypeMarketBuy TransactionType = "MARKET_BUY" TransactionTypeMarketSell TransactionType = "MARKET_SELL" TransactionTypeSimpleBuy TransactionType = "SIMPLE_BUY" TransactionTypeSimpleSell TransactionType = "SIMPLE_SELL" TransactionTypeMakerReward TransactionType = "MAKER_REWARD" TransactionTypeBlockchainReceive TransactionType = "BLOCKCHAIN_RECEIVE" TransactionTypeBlockchainSend TransactionType = "BLOCKCHAIN_SEND" TransactionTypeFiatDeposit TransactionType = "FIAT_DEPOSIT" TransactionTypeFiatWithdrawal TransactionType = "FIAT_WITHDRAWAL" TransactionTypeReferralRebate TransactionType = "REFERRAL_REBATE" TransactionTypeReferralReward TransactionType = "REFERRAL_REWARD" TransactionTypePromotionalRebate TransactionType = "PROMOTIONAL_REBATE" TransactionTypeInternalTransfer TransactionType = "INTERNAL_TRANSFER" TransactionTypeFiatWithdrawalReversal TransactionType = "FIAT_WITHDRAWAL_REVERSAL" )
TransactionType constants which may be used to filter lists of transactions.
type TransactionTypeInfo ¶
type TransactionTypeInfo struct { Type TransactionType `json:"type,omitempty"` Description string `json:"description,omitempty"` }
TransactionTypeInfo contains additional information regarding the type of a transaction.
type WithdrawalInfo ¶
type WithdrawalInfo struct { Currency string `json:"currency"` IsActive bool `json:"isActive"` MinWithdrawalAmount string `json:"minimumWithdrawAmount"` SupportsPaymentRef bool `json:"supportsPaymentReference"` WithdrawalCost string `json:"withdrawCost"` }
WithdrawalInfo contains information about withdrawing from your VALR account.