Documentation
¶
Index ¶
- func GetError(errors []string) error
- type AddOrderOptions
- type AddOrderResponse
- type Asset
- type AssetPairs
- type CancelOrderResponse
- type ClosedOrders
- type GetClosedOrdersOptions
- type GetLedgersOptions
- type GetTradesHistoryOptions
- type Kraken
- func (k *Kraken) AddOrder(symbol, side, orderType string, volume, price, price2, leverage float64, ...) (AddOrderResponse, error)
- func (k *Kraken) CancelAllExchangeOrders() error
- func (k *Kraken) CancelExchangeOrder(orderID int64) error
- func (k *Kraken) CancelOrder(txid string) (CancelOrderResponse, error)
- func (k *Kraken) GetAssetPairs() (map[string]AssetPairs, error)
- func (k *Kraken) GetAssets() (map[string]Asset, error)
- func (k *Kraken) GetBalance() (map[string]float64, error)
- func (k *Kraken) GetClosedOrders(args ...GetClosedOrdersOptions) (ClosedOrders, error)
- func (k *Kraken) GetDepth(symbol string) (Orderbook, error)
- func (k *Kraken) GetExchangeAccountInfo() (exchange.AccountInfo, error)
- func (k *Kraken) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error)
- func (k *Kraken) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error)
- func (k *Kraken) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error)
- func (k *Kraken) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error)
- func (k *Kraken) GetFee(cryptoTrade bool) float64
- func (k *Kraken) GetLedgers(args ...GetLedgersOptions) (Ledgers, error)
- func (k *Kraken) GetOHLC(symbol string) ([]OpenHighLowClose, error)
- func (k *Kraken) GetOpenOrders(args ...OrderInfoOptions) (OpenOrders, error)
- func (k *Kraken) GetOrderbookEx(p pair.CurrencyPair, assetType string) (orderbook.Base, error)
- func (k *Kraken) GetServerTime() (TimeResponse, error)
- func (k *Kraken) GetSpread(symbol string) ([]Spread, error)
- func (k *Kraken) GetTicker(symbol string) (Ticker, error)
- func (k *Kraken) GetTickerPrice(p pair.CurrencyPair, assetType string) (ticker.Price, error)
- func (k *Kraken) GetTradeBalance(args ...TradeBalanceOptions) (TradeBalanceInfo, error)
- func (k *Kraken) GetTradeVolume(feeinfo bool, symbol ...string) (TradeVolumeResponse, error)
- func (k *Kraken) GetTrades(symbol string) ([]RecentTrades, error)
- func (k *Kraken) GetTradesHistory(args ...GetTradesHistoryOptions) (TradesHistory, error)
- func (k *Kraken) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error)
- func (k *Kraken) OpenPositions(docalcs bool, txids ...string) (map[string]Position, error)
- func (k *Kraken) QueryLedgers(id string, ids ...string) (map[string]LedgerInfo, error)
- func (k *Kraken) QueryOrdersInfo(args OrderInfoOptions, txid string, txids ...string) (map[string]OrderInfo, error)
- func (k *Kraken) QueryTrades(trades bool, txid string, txids ...string) (map[string]TradeInfo, error)
- func (k *Kraken) Run()
- func (k *Kraken) SendAuthenticatedHTTPRequest(method string, params url.Values, result interface{}) (err error)
- func (k *Kraken) SendHTTPRequest(path string, result interface{}) error
- func (k *Kraken) SetDefaults()
- func (k *Kraken) SetTicker(symbol string) error
- func (k *Kraken) Setup(exch config.ExchangeConfig)
- func (k *Kraken) Start(wg *sync.WaitGroup)
- func (k *Kraken) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, ...) (int64, error)
- func (k *Kraken) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbook.Base, error)
- func (k *Kraken) UpdateTicker(p pair.CurrencyPair, assetType string) (ticker.Price, error)
- func (k *Kraken) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error)
- func (k *Kraken) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error)
- func (k *Kraken) WithdrawFiatExchangeFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error)
- type LedgerInfo
- type Ledgers
- type OpenHighLowClose
- type OpenOrders
- type OrderDescription
- type OrderInfo
- type OrderInfoOptions
- type Orderbook
- type OrderbookBase
- type Position
- type RecentTrades
- type Spread
- type Ticker
- type TickerResponse
- type TimeResponse
- type TradeBalanceInfo
- type TradeBalanceOptions
- type TradeInfo
- type TradeVolumeFee
- type TradeVolumeResponse
- type TradesHistory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddOrderOptions ¶
type AddOrderOptions struct { UserRef int32 Oflags string StartTm string ExpireTm string CloseOrderType string ClosePrice float64 ClosePrice2 float64 Validate bool }
AddOrderOptions represents the AddOrder options
type AddOrderResponse ¶
type AddOrderResponse struct { Description OrderDescription `json:"descr"` TransactionIds []string `json:"txid"` }
AddOrderResponse type
type Asset ¶
type Asset struct { Altname string `json:"altname"` AclassBase string `json:"aclass_base"` Decimals int `json:"decimals"` DisplayDecimals int `json:"display_decimals"` }
Asset holds asset information
type AssetPairs ¶
type AssetPairs struct { Altname string `json:"altname"` AclassBase string `json:"aclass_base"` Base string `json:"base"` AclassQuote string `json:"aclass_quote"` Quote string `json:"quote"` Lot string `json:"lot"` PairDecimals int `json:"pair_decimals"` LotDecimals int `json:"lot_decimals"` LotMultiplier int `json:"lot_multiplier"` LeverageBuy []int `json:"leverage_buy"` LeverageSell []int `json:"leverage_sell"` Fees [][]float64 `json:"fees"` FeesMaker [][]float64 `json:"fees_maker"` FeeVolumeCurrency string `json:"fee_volume_currency"` MarginCall int `json:"margin_call"` MarginStop int `json:"margin_stop"` }
AssetPairs holds asset pair information
type CancelOrderResponse ¶
type CancelOrderResponse struct { Count int64 `json:"count"` Pending interface{} `json:"pending"` }
CancelOrderResponse type
type ClosedOrders ¶
ClosedOrders type
type GetClosedOrdersOptions ¶
type GetClosedOrdersOptions struct { Trades bool UserRef int32 Start string End string Ofs int64 CloseTime string }
GetClosedOrdersOptions type
type GetLedgersOptions ¶
type GetLedgersOptions struct { Aclass string Asset string Type string Start string End string Ofs int64 }
GetLedgersOptions type
type GetTradesHistoryOptions ¶
GetTradesHistoryOptions type
type Kraken ¶
Kraken is the overarching type across the alphapoint package
func (*Kraken) AddOrder ¶
func (k *Kraken) AddOrder(symbol, side, orderType string, volume, price, price2, leverage float64, args AddOrderOptions) (AddOrderResponse, error)
AddOrder adds a new order for Kraken exchange
func (*Kraken) CancelAllExchangeOrders ¶
CancelAllExchangeOrders cancels all orders associated with a currency pair
func (*Kraken) CancelExchangeOrder ¶
CancelExchangeOrder cancels an order by its corresponding ID number
func (*Kraken) CancelOrder ¶
func (k *Kraken) CancelOrder(txid string) (CancelOrderResponse, error)
CancelOrder cancels order by orderID
func (*Kraken) GetAssetPairs ¶
func (k *Kraken) GetAssetPairs() (map[string]AssetPairs, error)
GetAssetPairs returns a full asset pair list
func (*Kraken) GetBalance ¶
GetBalance returns your balance associated with your keys
func (*Kraken) GetClosedOrders ¶
func (k *Kraken) GetClosedOrders(args ...GetClosedOrdersOptions) (ClosedOrders, error)
GetClosedOrders returns a list of closed orders
func (*Kraken) GetExchangeAccountInfo ¶
GetExchangeAccountInfo retrieves balances for all enabled currencies for the Kraken exchange - to-do
func (*Kraken) GetExchangeDepositAddress ¶
func (k *Kraken) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error)
GetExchangeDepositAddress returns a deposit address for a specified currency
func (*Kraken) GetExchangeFundTransferHistory ¶
GetExchangeFundTransferHistory returns funding history, deposits and withdrawals
func (*Kraken) GetExchangeHistory ¶
func (k *Kraken) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error)
GetExchangeHistory returns historic trade data since exchange opening.
func (*Kraken) GetExchangeOrderInfo ¶
GetExchangeOrderInfo returns information on a current open order
func (*Kraken) GetLedgers ¶
func (k *Kraken) GetLedgers(args ...GetLedgersOptions) (Ledgers, error)
GetLedgers returns current ledgers
func (*Kraken) GetOHLC ¶
func (k *Kraken) GetOHLC(symbol string) ([]OpenHighLowClose, error)
GetOHLC returns an array of open high low close values of a currency pair
func (*Kraken) GetOpenOrders ¶
func (k *Kraken) GetOpenOrders(args ...OrderInfoOptions) (OpenOrders, error)
GetOpenOrders returns all current open orders
func (*Kraken) GetOrderbookEx ¶
GetOrderbookEx returns orderbook base on the currency pair
func (*Kraken) GetServerTime ¶
func (k *Kraken) GetServerTime() (TimeResponse, error)
GetServerTime returns current server time
func (*Kraken) GetTickerPrice ¶
GetTickerPrice returns the ticker for a currency pair
func (*Kraken) GetTradeBalance ¶
func (k *Kraken) GetTradeBalance(args ...TradeBalanceOptions) (TradeBalanceInfo, error)
GetTradeBalance returns full information about your trades on Kraken
func (*Kraken) GetTradeVolume ¶
func (k *Kraken) GetTradeVolume(feeinfo bool, symbol ...string) (TradeVolumeResponse, error)
GetTradeVolume returns your trade volume by currency
func (*Kraken) GetTrades ¶
func (k *Kraken) GetTrades(symbol string) ([]RecentTrades, error)
GetTrades returns current trades on Kraken
func (*Kraken) GetTradesHistory ¶
func (k *Kraken) GetTradesHistory(args ...GetTradesHistoryOptions) (TradesHistory, error)
GetTradesHistory returns trade history information
func (*Kraken) ModifyExchangeOrder ¶
ModifyExchangeOrder will allow of changing orderbook placement and limit to market conversion
func (*Kraken) OpenPositions ¶
OpenPositions returns current open positions
func (*Kraken) QueryLedgers ¶
QueryLedgers queries an individual ledger by ID
func (*Kraken) QueryOrdersInfo ¶
func (k *Kraken) QueryOrdersInfo(args OrderInfoOptions, txid string, txids ...string) (map[string]OrderInfo, error)
QueryOrdersInfo returns order information
func (*Kraken) QueryTrades ¶
func (k *Kraken) QueryTrades(trades bool, txid string, txids ...string) (map[string]TradeInfo, error)
QueryTrades returns information on a specific trade
func (*Kraken) SendAuthenticatedHTTPRequest ¶
func (k *Kraken) SendAuthenticatedHTTPRequest(method string, params url.Values, result interface{}) (err error)
SendAuthenticatedHTTPRequest sends an authenticated HTTP request
func (*Kraken) SendHTTPRequest ¶
SendHTTPRequest sends an unauthenticated HTTP requests
func (*Kraken) SetDefaults ¶
func (k *Kraken) SetDefaults()
SetDefaults sets current default settings
func (*Kraken) Setup ¶
func (k *Kraken) Setup(exch config.ExchangeConfig)
Setup sets current exchange configuration
func (*Kraken) SubmitExchangeOrder ¶
func (k *Kraken) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error)
SubmitExchangeOrder submits a new order
func (*Kraken) UpdateOrderbook ¶
UpdateOrderbook updates and returns the orderbook for a currency pair
func (*Kraken) UpdateTicker ¶
UpdateTicker updates and returns the ticker for a currency pair
func (*Kraken) WithdrawCryptoExchangeFunds ¶
func (k *Kraken) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error)
WithdrawCryptoExchangeFunds returns a withdrawal ID when a withdrawal is submitted
func (*Kraken) WithdrawFiatExchangeFunds ¶
func (k *Kraken) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error)
WithdrawFiatExchangeFunds returns a withdrawal ID when a withdrawal is submitted
func (*Kraken) WithdrawFiatExchangeFundsToInternationalBank ¶
func (k *Kraken) WithdrawFiatExchangeFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error)
WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted
type LedgerInfo ¶
type LedgerInfo struct { Refid string `json:"refid"` Time float64 `json:"time"` Type string `json:"type"` Aclass string `json:"aclass"` Asset string `json:"asset"` Amount float64 `json:"amount,string"` Fee float64 `json:"fee,string"` Balance float64 `json:"balance,string"` }
LedgerInfo type
type Ledgers ¶
type Ledgers struct { Ledger map[string]LedgerInfo `json:"ledger"` Count int64 `json:"count"` }
Ledgers type
type OpenHighLowClose ¶
type OpenHighLowClose struct { Time float64 Open float64 High float64 Low float64 Close float64 Vwap float64 Volume float64 Count float64 }
OpenHighLowClose contains ticker event information
type OpenOrders ¶
OpenOrders type
type OrderDescription ¶
OrderDescription represents an orders description
type OrderInfo ¶
type OrderInfo struct { RefID string `json:"refid"` UserRef int32 `json:"userref"` Status string `json:"status"` OpenTm float64 `json:"opentm"` StartTm float64 `json:"starttm"` ExpireTm float64 `json:"expiretm"` Descr struct { Pair string `json:"pair"` Type string `json:"type"` OrderType string `json:"ordertype"` Price float64 `json:"price,string"` Price2 float64 `json:"price2,string"` Leverage string `json:"leverage"` Order string `json:"order"` Close string `json:"close"` } `json:"descr"` Vol float64 `json:"vol,string"` VolExec float64 `json:"vol_exec,string"` Cost float64 `json:"cost,string"` Fee float64 `json:"fee,string"` Price float64 `json:"price,string"` StopPrice float64 `json:"stopprice,string"` LimitPrice float64 `json:"limitprice,string"` Misc string `json:"misc"` Oflags string `json:"oflags"` Trades []string `json:"trades"` }
OrderInfo type
type OrderInfoOptions ¶
OrderInfoOptions type
type Orderbook ¶
type Orderbook struct { Bids []OrderbookBase Asks []OrderbookBase }
Orderbook stores the bids and asks orderbook data
type OrderbookBase ¶
OrderbookBase stores the orderbook price and amount data
type Position ¶
type Position struct { Ordertxid string `json:"ordertxid"` Pair string `json:"pair"` Time float64 `json:"time"` Type string `json:"type"` OrderType string `json:"ordertype"` Cost float64 `json:"cost,string"` Fee float64 `json:"fee,string"` Vol float64 `json:"vol,string"` VolClosed float64 `json:"vol_closed,string"` Margin float64 `json:"margin,string"` Rollovertm int64 `json:"rollovertm,string"` Misc string `json:"misc"` Oflags string `json:"oflags"` PosStatus string `json:"posstatus"` Net string `json:"net"` Terms string `json:"terms"` }
Position holds the opened position
type RecentTrades ¶
type RecentTrades struct { Price float64 Volume float64 Time float64 BuyOrSell string MarketOrLimit string Miscellaneous interface{} }
RecentTrades holds recent trade data
type Ticker ¶
type Ticker struct { Ask float64 Bid float64 Last float64 Volume float64 VWAP float64 Trades int64 Low float64 High float64 Open float64 }
Ticker is a standard ticker type
type TickerResponse ¶
type TickerResponse struct { Ask []string `json:"a"` Bid []string `json:"b"` Last []string `json:"c"` Volume []string `json:"v"` VWAP []string `json:"p"` Trades []int64 `json:"t"` Low []string `json:"l"` High []string `json:"h"` Open string `json:"o"` }
TickerResponse holds ticker information before its put into the Ticker struct
type TimeResponse ¶
TimeResponse type
type TradeBalanceInfo ¶
type TradeBalanceInfo struct { EquivalentBalance float64 `json:"eb,string"` // combined balance of all currencies TradeBalance float64 `json:"tb,string"` // combined balance of all equity currencies MarginAmount float64 `json:"m,string"` // margin amount of open positions Net float64 `json:"n,string"` // unrealized net profit/loss of open positions Equity float64 `json:"e,string"` // trade balance + unrealized net profit/loss FreeMargin float64 `json:"mf,string"` // equity - initial margin (maximum margin available to open new positions) MarginLevel float64 `json:"ml,string"` // (equity / initial margin) * 100 }
TradeBalanceInfo type
type TradeBalanceOptions ¶
TradeBalanceOptions type
type TradeInfo ¶
type TradeInfo struct { OrderTxID string `json:"ordertxid"` Pair string `json:"pair"` Time float64 `json:"time"` Type string `json:"type"` OrderType string `json:"ordertype"` Price float64 `json:"price,string"` Cost float64 `json:"cost,string"` Fee float64 `json:"fee,string"` Vol float64 `json:"vol,string"` Margin float64 `json:"margin,string"` Misc string `json:"misc"` PosTxID string `json:"postxid"` Cprice float64 `json:"cprice,string"` Cfee float64 `json:"cfee,string"` Cvol float64 `json:"cvol,string"` Cmargin float64 `json:"cmargin,string"` Trades []string `json:"trades"` PosStatus string `json:"posstatus"` }
TradeInfo type
type TradeVolumeFee ¶
type TradeVolumeFee struct { Fee float64 `json:"fee,string"` MinFee float64 `json:"minfee,string"` MaxFee float64 `json:"maxfee,string"` NextFee float64 `json:"nextfee,string"` NextVolume float64 `json:"nextvolume,string"` TierVolume float64 `json:"tiervolume,string"` }
TradeVolumeFee type
type TradeVolumeResponse ¶
type TradeVolumeResponse struct { Currency string `json:"currency"` Volume float64 `json:"volume,string"` Fees map[string]TradeVolumeFee `json:"fees"` FeesMaker map[string]TradeVolumeFee `json:"fees_maker"` }
TradeVolumeResponse type
type TradesHistory ¶
type TradesHistory struct { Trades map[string]TradeInfo `json:"trades"` Count int64 `json:"count"` }
TradesHistory type