Documentation
¶
Index ¶
- Variables
- func GetError(apiErrors []string) error
- type AddOrderOptions
- type AddOrderResponse
- type Asset
- type AssetPairs
- type CancelOrderResponse
- type ClosedOrders
- type DepositAddress
- type DepositMethods
- 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) AuthenticateWebsocket() error
- func (k *Kraken) CancelAllOrders(_ *order.Cancel) (order.CancelAllResponse, error)
- func (k *Kraken) CancelExistingOrder(txid string) (CancelOrderResponse, error)
- func (k *Kraken) CancelOrder(order *order.Cancel) error
- func (k *Kraken) FetchAccountInfo() (account.Holdings, error)
- func (k *Kraken) FetchOrderbook(p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
- func (k *Kraken) FetchTicker(p currency.Pair, assetType asset.Item) (*ticker.Price, error)
- func (k *Kraken) FetchTradablePairs(asset asset.Item) ([]string, error)
- func (k *Kraken) FormatExchangeKlineInterval(in kline.Interval) string
- func (k *Kraken) GenerateAuthenticatedSubscriptions() ([]stream.ChannelSubscription, error)
- func (k *Kraken) GenerateDefaultSubscriptions() ([]stream.ChannelSubscription, error)
- func (k *Kraken) GetActiveOrders(req *order.GetOrdersRequest) ([]order.Detail, 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) GetClosedOrder(orderId string) (ClosedOrders, error)
- func (k *Kraken) GetClosedOrders(args GetClosedOrdersOptions) (ClosedOrders, error)
- func (k *Kraken) GetCryptoDepositAddress(method, code string) (string, error)
- func (k *Kraken) GetDefaultConfig() (*config.ExchangeConfig, error)
- func (k *Kraken) GetDepositAddress(cryptocurrency currency.Code, _ string) (string, error)
- func (k *Kraken) GetDepositMethods(currency string) ([]DepositMethods, error)
- func (k *Kraken) GetDepth(symbol string) (Orderbook, error)
- func (k *Kraken) GetExchangeHistory(p currency.Pair, assetType asset.Item, timestampStart, timestampEnd time.Time) ([]exchange.TradeHistory, error)
- func (k *Kraken) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)
- func (k *Kraken) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)
- func (k *Kraken) GetFundingHistory() ([]exchange.FundHistory, error)
- func (k *Kraken) GetHistoricCandles(pair currency.Pair, a asset.Item, start, end time.Time, ...) (kline.Item, error)
- func (k *Kraken) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, start, end time.Time, ...) (kline.Item, error)
- func (k *Kraken) GetLedgers(args ...GetLedgersOptions) (Ledgers, error)
- func (k *Kraken) GetOHLC(symbol, interval string) ([]OpenHighLowClose, error)
- func (k *Kraken) GetOpenOrders(args OrderInfoOptions) (OpenOrders, error)
- func (k *Kraken) GetOrderHistory(getOrdersRequest *order.GetOrdersRequest) ([]order.Detail, error)
- func (k *Kraken) GetOrderHistoryById(getOrdersRequest string) ([]order.Detail, error)
- func (k *Kraken) GetOrderInfo(orderID string) (order.Detail, 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) GetTickers(pairList string) (map[string]Ticker, 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) GetWebsocketToken() (string, error)
- func (k *Kraken) GetWithdrawInfo(currency string, amount float64) (WithdrawInformation, error)
- func (k *Kraken) ModifyOrder(action *order.Modify) (string, 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) SeedAssets() error
- 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) Setup(exch *config.ExchangeConfig) error
- func (k *Kraken) Start(wg *sync.WaitGroup)
- func (k *Kraken) SubmitOrder(s *order.Submit) (order.SubmitResponse, error)
- func (k *Kraken) Subscribe(channelsToSubscribe []stream.ChannelSubscription) error
- func (k *Kraken) Unsubscribe(channelsToUnsubscribe []stream.ChannelSubscription) error
- func (k *Kraken) UpdateAccountInfo() (account.Holdings, error)
- func (k *Kraken) UpdateOrderbook(p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
- func (k *Kraken) UpdateTicker(p currency.Pair, assetType asset.Item) (*ticker.Price, error)
- func (k *Kraken) UpdateTradablePairs(forceUpdate bool) error
- func (k *Kraken) ValidateCredentials() error
- func (k *Kraken) Withdraw(asset, key string, amount float64) (string, error)
- func (k *Kraken) WithdrawCancel(c currency.Code, refID string) (bool, error)
- func (k *Kraken) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (k *Kraken) WithdrawFiatFunds(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (k *Kraken) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (k *Kraken) WithdrawStatus(c currency.Code, method string) ([]WithdrawStatusResponse, error)
- func (k *Kraken) WsConnect() 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 Tickers
- type TimeResponse
- type TradeBalanceInfo
- type TradeBalanceOptions
- type TradeInfo
- type TradeVolumeFee
- type TradeVolumeResponse
- type TradesHistory
- type WebsocketBaseEventRequest
- type WebsocketChannelData
- type WebsocketDataResponse
- type WebsocketErrorResponse
- type WebsocketEventResponse
- type WebsocketSubscriptionData
- type WebsocketSubscriptionEventRequest
- type WebsocketSubscriptionEventResponse
- type WebsocketSubscriptionResponseData
- type WebsocketUnsubscribeByChannelIDEventRequest
- type WithdrawInformation
- type WithdrawStatusResponse
- type WsAddOrderRequest
- type WsAddOrderResponse
- type WsCancelOrderRequest
- type WsCancelOrderResponse
- type WsOpenOrder
- type WsOpenOrderDescription
- type WsOpenOrders
- type WsOwnTrade
- type WsTokenResponse
Constants ¶
This section is empty.
Variables ¶
DepositFees the large list of predefined deposit fees Prone to change
var WithdrawalFees = map[currency.Code]float64{ currency.ZUSD: 5, currency.ZEUR: 5, currency.USD: 5, currency.EUR: 5, currency.REP: 0.01, currency.XXBT: 0.0005, currency.BTC: 0.0005, currency.XBT: 0.0005, currency.BCH: 0.0001, currency.ADA: 0.3, currency.DASH: 0.005, currency.XDG: 2, currency.EOS: 0.05, currency.ETH: 0.005, currency.ETC: 0.005, currency.GNO: 0.005, currency.ICN: 0.2, currency.LTC: 0.001, currency.MLN: 0.003, currency.XMR: 0.05, currency.QTUM: 0.01, currency.XRP: 0.02, currency.XLM: 0.00002, currency.USDT: 5, currency.XTZ: 0.05, currency.ZEC: 0.0001, }
WithdrawalFees the large list of predefined withdrawal fees Prone to change
Functions ¶
Types ¶
type AddOrderOptions ¶
type AddOrderOptions struct {
UserRef int32
OrderFlags 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 DepositAddress ¶
type DepositAddress struct {
Address string `json:"address"`
ExpireTime int64 `json:"expiretm,string"`
New bool `json:"new"`
}
DepositAddress defines a deposit address
type DepositMethods ¶
type DepositMethods struct {
Method string `json:"method"`
Limit interface{} `json:"limit"` // If no limit amount, this comes back as boolean
Fee float64 `json:"fee,string"`
AddressSetupFee float64 `json:"address-setup-fee,string"`
}
DepositMethods Used to check deposit fees
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) AuthenticateWebsocket ¶
AuthenticateWebsocket sends an authentication message to the websocket
func (*Kraken) CancelAllOrders ¶
CancelAllOrders cancels all orders associated with a currency pair
func (*Kraken) CancelExistingOrder ¶
func (k *Kraken) CancelExistingOrder(txid string) (CancelOrderResponse, error)
CancelExistingOrder cancels order by orderID
func (*Kraken) CancelOrder ¶
CancelOrder cancels an order by its corresponding ID number
func (*Kraken) FetchAccountInfo ¶
FetchAccountInfo retrieves balances for all enabled currencies
func (*Kraken) FetchOrderbook ¶
FetchOrderbook returns orderbook base on the currency pair
func (*Kraken) FetchTicker ¶
FetchTicker returns the ticker for a currency pair
func (*Kraken) FetchTradablePairs ¶
FetchTradablePairs returns a list of the exchanges tradable pairs
func (*Kraken) FormatExchangeKlineInterval ¶
FormatExchangeKlineInterval returns Interval to exchange formatted string
func (*Kraken) GenerateAuthenticatedSubscriptions ¶
func (k *Kraken) GenerateAuthenticatedSubscriptions() ([]stream.ChannelSubscription, error)
GenerateAuthenticatedSubscriptions Adds default subscriptions to websocket to be handled by ManageSubscriptions()
func (*Kraken) GenerateDefaultSubscriptions ¶
func (k *Kraken) GenerateDefaultSubscriptions() ([]stream.ChannelSubscription, error)
GenerateDefaultSubscriptions Adds default subscriptions to websocket to be handled by ManageSubscriptions()
func (*Kraken) GetActiveOrders ¶
GetActiveOrders retrieves any orders that are active/open
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) GetClosedOrder ¶
func (k *Kraken) GetClosedOrder(orderId string) (ClosedOrders, error)
GetClosedOrders returns a specified closed order
func (*Kraken) GetClosedOrders ¶
func (k *Kraken) GetClosedOrders(args GetClosedOrdersOptions) (ClosedOrders, error)
GetClosedOrders returns a list of closed orders
func (*Kraken) GetCryptoDepositAddress ¶
GetCryptoDepositAddress returns a deposit address for a cryptocurrency
func (*Kraken) GetDefaultConfig ¶
func (k *Kraken) GetDefaultConfig() (*config.ExchangeConfig, error)
GetDefaultConfig returns a default exchange config
func (*Kraken) GetDepositAddress ¶
GetDepositAddress returns a deposit address for a specified currency
func (*Kraken) GetDepositMethods ¶
func (k *Kraken) GetDepositMethods(currency string) ([]DepositMethods, error)
GetDepositMethods gets withdrawal fees
func (*Kraken) GetExchangeHistory ¶
func (k *Kraken) GetExchangeHistory(p currency.Pair, assetType asset.Item, timestampStart, timestampEnd time.Time) ([]exchange.TradeHistory, error)
GetExchangeHistory returns historic trade data within the timeframe provided.
func (*Kraken) GetFee ¶
func (k *Kraken) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)
GetFee returns an estimate of fee based on type of transaction
func (*Kraken) GetFeeByType ¶
func (k *Kraken) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)
GetFeeByType returns an estimate of fee based on type of transaction
func (*Kraken) GetFundingHistory ¶
func (k *Kraken) GetFundingHistory() ([]exchange.FundHistory, error)
GetFundingHistory returns funding history, deposits and withdrawals
func (*Kraken) GetHistoricCandles ¶
func (k *Kraken) GetHistoricCandles(pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error)
GetHistoricCandles returns candles between a time period for a set time interval
func (*Kraken) GetHistoricCandlesExtended ¶
func (k *Kraken) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error)
GetHistoricCandlesExtended returns candles between a time period for a set time interval
func (*Kraken) GetLedgers ¶
func (k *Kraken) GetLedgers(args ...GetLedgersOptions) (Ledgers, error)
GetLedgers returns current ledgers
func (*Kraken) GetOHLC ¶
func (k *Kraken) GetOHLC(symbol, interval 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) GetOrderHistory ¶
GetOrderHistory retrieves account order information Can Limit response to specific order status
func (*Kraken) GetOrderHistoryById ¶
GetOrderHistoryById retrieves specified closed order information Can Limit response to specific order status
func (*Kraken) GetOrderInfo ¶
GetOrderInfo returns information on a current open order
func (*Kraken) GetServerTime ¶
func (k *Kraken) GetServerTime() (TimeResponse, error)
GetServerTime returns current server time
func (*Kraken) GetTickers ¶
GetTickers supports fetching multiple tickers from Kraken pairList must be in the format pairs separated by commas ("LTCUSD,ETCUSD")
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) GetWebsocketToken ¶
GetWebsocketToken returns a websocket token
func (*Kraken) GetWithdrawInfo ¶
func (k *Kraken) GetWithdrawInfo(currency string, amount float64) (WithdrawInformation, error)
GetWithdrawInfo gets withdrawal fees
func (*Kraken) ModifyOrder ¶
ModifyOrder 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) SeedAssets ¶
SeedAssets seeds Kraken's asset list and stores it in the asset translator
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) error
Setup sets current exchange configuration
func (*Kraken) SubmitOrder ¶
SubmitOrder submits a new order
func (*Kraken) Subscribe ¶
func (k *Kraken) Subscribe(channelsToSubscribe []stream.ChannelSubscription) error
Subscribe sends a websocket message to receive data from the channel
func (*Kraken) Unsubscribe ¶
func (k *Kraken) Unsubscribe(channelsToUnsubscribe []stream.ChannelSubscription) error
Unsubscribe sends a websocket message to stop receiving data from the channel
func (*Kraken) UpdateAccountInfo ¶
UpdateAccountInfo retrieves balances for all enabled currencies for the Kraken exchange - to-do
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) UpdateTradablePairs ¶
UpdateTradablePairs updates the exchanges available pairs and stores them in the exchanges config
func (*Kraken) ValidateCredentials ¶
ValidateCredentials validates current credentials used for wrapper functionality
func (*Kraken) WithdrawCancel ¶
WithdrawCancel sends a withdrawal cancelation request
func (*Kraken) WithdrawCryptocurrencyFunds ¶
func (k *Kraken) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal Populate exchange.WithdrawRequest.TradePassword with withdrawal key name, as set up on your account
func (*Kraken) WithdrawFiatFunds ¶
func (k *Kraken) WithdrawFiatFunds(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted
func (*Kraken) WithdrawFiatFundsToInternationalBank ¶
func (k *Kraken) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted
func (*Kraken) WithdrawStatus ¶
WithdrawStatus gets the status of recent withdrawals
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
VolumeWeightedAveragePrice 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"`
OpenTime float64 `json:"opentm"`
CloseTime float64 `json:"closetm"`
StartTime float64 `json:"starttm"`
ExpireTime float64 `json:"expiretm"`
Description 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"`
Volume float64 `json:"vol,string"`
VolumeExecuted 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"`
OrderFlags 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"`
Volume float64 `json:"vol,string"`
VolumeClosed float64 `json:"vol_closed,string"`
Margin float64 `json:"margin,string"`
RolloverTime int64 `json:"rollovertm,string"`
Misc string `json:"misc"`
OrderFlags string `json:"oflags"`
PositionStatus 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
VolumeWeightedAveragePrice 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"`
VolumeWeightedAveragePrice []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"`
Volume float64 `json:"vol,string"`
Margin float64 `json:"margin,string"`
Misc string `json:"misc"`
PosTxID string `json:"postxid"`
ClosedPositionAveragePrice float64 `json:"cprice,string"`
ClosedPositionFee float64 `json:"cfee,string"`
ClosedPositionVolume float64 `json:"cvol,string"`
ClosedPositionMargin 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
type WebsocketBaseEventRequest ¶
type WebsocketBaseEventRequest struct {
Event string `json:"event"` // eg "unsubscribe"
}
WebsocketBaseEventRequest Just has an "event" property
type WebsocketChannelData ¶
WebsocketChannelData Holds relevant data for channels to identify what we're doing
type WebsocketDataResponse ¶
type WebsocketDataResponse []interface{}
WebsocketDataResponse defines a websocket data type
type WebsocketErrorResponse ¶
type WebsocketErrorResponse struct {
ErrorMessage string `json:"errorMessage"`
}
WebsocketErrorResponse defines a websocket error response
type WebsocketEventResponse ¶
type WebsocketEventResponse struct {
WebsocketBaseEventRequest
Status string `json:"status"`
Pair currency.Pair `json:"pair,omitempty"`
RequestID int64 `json:"reqid,omitempty"` // Optional, client originated ID reflected in response message.
Subscription WebsocketSubscriptionResponseData `json:"subscription,omitempty"`
ChannelName string `json:"channelName,omitempty"`
WebsocketSubscriptionEventResponse
WebsocketErrorResponse
}
WebsocketEventResponse holds all data response types
type WebsocketSubscriptionData ¶
type WebsocketSubscriptionData struct {
Name string `json:"name,omitempty"` // ticker|ohlc|trade|book|spread|*, * for all (ohlc interval value is 1 if all channels subscribed)
Interval int64 `json:"interval,omitempty"` // Optional - Time interval associated with ohlc subscription in minutes. Default 1. Valid Interval values: 1|5|15|30|60|240|1440|10080|21600
Depth int64 `json:"depth,omitempty"` // Optional - depth associated with book subscription in number of levels each side, default 10. Valid Options are: 10, 25, 100, 500, 1000
Token string `json:"token,omitempty"` // Optional used for authenticated requests
}
WebsocketSubscriptionData contains details on WS channel
type WebsocketSubscriptionEventRequest ¶
type WebsocketSubscriptionEventRequest struct {
Event string `json:"event"` // subscribe
RequestID int64 `json:"reqid,omitempty"` // Optional, client originated ID reflected in response message.
Pairs []string `json:"pair,omitempty"` // Array of currency pairs (pair1,pair2,pair3).
Subscription WebsocketSubscriptionData `json:"subscription,omitempty"`
Channels []stream.ChannelSubscription `json:"-"` // Keeps track of associated subscriptions in batched outgoings
}
WebsocketSubscriptionEventRequest handles WS subscription events
type WebsocketSubscriptionEventResponse ¶
type WebsocketSubscriptionEventResponse struct {
ChannelID int64 `json:"channelID"`
}
WebsocketSubscriptionEventResponse defines a websocket socket event response
type WebsocketSubscriptionResponseData ¶
type WebsocketSubscriptionResponseData struct {
Name string `json:"name"`
}
WebsocketSubscriptionResponseData defines a websocket subscription response
type WebsocketUnsubscribeByChannelIDEventRequest ¶
type WebsocketUnsubscribeByChannelIDEventRequest struct {
WebsocketBaseEventRequest
RequestID int64 `json:"reqid,omitempty"` // Optional, client originated ID reflected in response message.
Pairs []string `json:"pair,omitempty"` // Array of currency pairs (pair1,pair2,pair3).
ChannelID int64 `json:"channelID,omitempty"`
}
WebsocketUnsubscribeByChannelIDEventRequest handles WS unsubscribe events
type WithdrawInformation ¶
type WithdrawInformation struct {
Method string `json:"method"`
Limit float64 `json:"limit,string"`
Fee float64 `json:"fee,string"`
}
WithdrawInformation Used to check withdrawal fees
type WithdrawStatusResponse ¶
type WithdrawStatusResponse struct {
Method string `json:"method"`
Aclass string `json:"aclass"`
Asset string `json:"asset"`
Refid string `json:"refid"`
TxID string `json:"txid"`
Info string `json:"info"`
Amount float64 `json:"amount,string"`
Fee float64 `json:"fee,string"`
Time float64 `json:"time"`
Status string `json:"status"`
}
WithdrawStatusResponse defines a withdrawal status response
type WsAddOrderRequest ¶
type WsAddOrderRequest struct {
Event string `json:"event"`
Token string `json:"token"`
OrderType string `json:"ordertype"`
OrderSide string `json:"type"`
Pair string `json:"pair"`
Price float64 `json:"price,omitempty"` // optional
Price2 float64 `json:"price2,omitempty"` // optional
Volume float64 `json:"volume,omitempty"`
Leverage float64 `json:"leverage,omitempty"` // optional
OFlags string `json:"oflags,omitempty"` // optional
StartTime string `json:"starttm,omitempty"` // optional
ExpireTime string `json:"expiretm,omitempty"` // optional
UserReferenceID string `json:"userref,omitempty"` // optional
Validate string `json:"validate,omitempty"` // optional
CloseOrderType string `json:"close[ordertype],omitempty"` // optional
ClosePrice float64 `json:"close[price],omitempty"` // optional
ClosePrice2 float64 `json:"close[price2],omitempty"` // optional
}
WsAddOrderRequest request type for ws adding order
type WsAddOrderResponse ¶
type WsAddOrderResponse struct {
Description string `json:"descr"`
Event string `json:"event"`
Status string `json:"status"`
TransactionID string `json:"txid"`
ErrorMessage string `json:"errorMessage"`
}
WsAddOrderResponse response data for ws order
type WsCancelOrderRequest ¶
type WsCancelOrderRequest struct {
Event string `json:"event"`
Token string `json:"token"`
TransactionIDs []string `json:"txid"`
}
WsCancelOrderRequest request for ws cancel order
type WsCancelOrderResponse ¶
type WsCancelOrderResponse struct {
Event string `json:"event"`
Status string `json:"status"`
ErrorMessage string `json:"errorMessage"`
}
WsCancelOrderResponse response data for ws cancel order
type WsOpenOrder ¶
type WsOpenOrder struct {
UserReferenceID int64 `json:"userref"`
ExpireTime float64 `json:"expiretm,string"`
OpenTime float64 `json:"opentm,string"`
StartTime float64 `json:"starttm,string"`
Fee float64 `json:"fee,string"`
LimitPrice float64 `json:"limitprice,string"`
StopPrice float64 `json:"stopprice,string"`
Volume float64 `json:"vol,string"`
ExecutedVolume float64 `json:"vol_exec,string"`
Cost float64 `json:"cost,string"`
Price float64 `json:"price,string"`
Misc string `json:"misc"`
OFlags string `json:"oflags"`
RefID string `json:"refid"`
Status string `json:"status"`
Description struct {
Close string `json:"close"`
Price float64 `json:"price,string"`
Price2 float64 `json:"price2,string"`
Leverage string `json:"leverage"`
Order string `json:"order"`
OrderType string `json:"ordertype"`
Pair string `json:"pair"`
Type string `json:"type"`
} `json:"descr"`
}
WsOpenOrder contains all open order data from ws feed
type WsOpenOrderDescription ¶
type WsOpenOrderDescription struct {
Close string `json:"close"`
Leverage string `json:"leverage"`
Order string `json:"order"`
OrderType string `json:"ordertype"`
Pair string `json:"pair"`
Price float64 `json:"price,string"`
Price2 float64 `json:"price2,string"`
Type string `json:"type"`
}
WsOpenOrderDescription additional data for WsOpenOrders
type WsOpenOrders ¶
type WsOpenOrders struct {
Cost float64 `json:"cost,string"`
Description WsOpenOrderDescription `json:"descr"`
ExpireTime time.Time `json:"expiretm"`
Fee float64 `json:"fee,string"`
LimitPrice float64 `json:"limitprice,string"`
Misc string `json:"misc"`
OFlags string `json:"oflags"`
OpenTime time.Time `json:"opentm"`
Price float64 `json:"price,string"`
RefID string `json:"refid"`
StartTime time.Time `json:"starttm"`
Status string `json:"status"`
StopPrice float64 `json:"stopprice,string"`
UserReference float64 `json:"userref"`
Volume float64 `json:"vol,string"`
ExecutedVolume float64 `json:"vol_exec,string"`
}
WsOpenOrders ws auth open order data
type WsOwnTrade ¶
type WsOwnTrade struct {
Cost float64 `json:"cost,string"`
Fee float64 `json:"fee,string"`
Margin float64 `json:"margin,string"`
OrderTransactionID string `json:"ordertxid"`
OrderType string `json:"ordertype"`
Pair string `json:"pair"`
PostTransactionID string `json:"postxid"`
Price float64 `json:"price,string"`
Time float64 `json:"time,string"`
Type string `json:"type"`
Vol float64 `json:"vol,string"`
}
WsOwnTrade ws auth owntrade data
type WsTokenResponse ¶
type WsTokenResponse struct {
Error []string `json:"error"`
Result struct {
Expires int64 `json:"expires"`
Token string `json:"token"`
} `json:"result"`
}
WsTokenResponse holds the WS auth token