Documentation
¶
Overview ¶
Package krakenapi provides access to the Kraken cryptocurrency exchange.
Index ¶
- Variables
- func RestPair(input string) string
- func WebSocketPair(input string) string
- type AddOrderOrderType
- type AddOrderRequest
- type AddOrderResponse
- type AssetPairInfo
- type AssetPairResponse
- type AssetPairService
- type Book
- type CancelOrderResponse
- type EventMessage
- type Interval
- type OHLC
- type Order
- type OrderSide
- type RequestError
- type RestClient
- func (c *RestClient) AddOrder(order AddOrderRequest) (*AddOrderResponse, error)
- func (c *RestClient) CancelOrder(txId string) (*CancelOrderResponse, error)
- func (c *RestClient) Get(path string) (*http.Response, error)
- func (c *RestClient) Post(path string, params map[string]interface{}) (*http.Response, error)
- func (c *RestClient) Time() (*TimeResponse, error)
- type Side
- type Spread
- type SubscribeMessage
- type Ticker
- type TimeResponse
- type WebSocket
- func (s *WebSocket) Close()
- func (s *WebSocket) Decode(input []byte) (interface{}, error)
- func (s *WebSocket) Next() ([]byte, error)
- func (s *WebSocket) Ping(reqId int) error
- func (s *WebSocket) SubscribeBook(tickers []string, depth int) error
- func (s *WebSocket) SubscribeOHLC(interval Interval, tickers ...string) error
- func (s *WebSocket) SubscribeSpread(tickers ...string) error
- func (s *WebSocket) SubscribeTicker(tickers ...string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var API_ROOT string = "https://api.kraken.com"
View Source
var WS_URL = "wss://ws.kraken.com"
Functions ¶
func WebSocketPair ¶
Given a common pair naming, return the Kraken format for websockets.
Types ¶
type AddOrderOrderType ¶
type AddOrderOrderType string
const OrderTypeLimit AddOrderOrderType = "limit"
const OrderTypeMarket AddOrderOrderType = "market"
type AddOrderRequest ¶
type AddOrderResponse ¶
type AddOrderResponse struct { Error []interface{} `json:"error"` Result struct { Descr struct { Order string `json:"order"` } Txid []string `json:"txid"` } `json:"result"` }
func (*AddOrderResponse) HasError ¶
func (r *AddOrderResponse) HasError() bool
type AssetPairInfo ¶
type AssetPairResponse ¶
type AssetPairResponse struct { Error []interface{} `json:"error"` Result map[string]*AssetPairInfo `json:"result"` }
type AssetPairService ¶
type AssetPairService struct {
// contains filtered or unexported fields
}
func NewAssetPairService ¶
func NewAssetPairService() *AssetPairService
func (*AssetPairService) GetRestPair ¶
func (s *AssetPairService) GetRestPair(pair string) string
func (*AssetPairService) GetWsPair ¶
func (s *AssetPairService) GetWsPair(pair string) string
func (*AssetPairService) LoadResponse ¶
func (s *AssetPairService) LoadResponse(response AssetPairResponse)
func (*AssetPairService) Refresh ¶
func (s *AssetPairService) Refresh() error
func (*AssetPairService) SetCacheFilename ¶
func (s *AssetPairService) SetCacheFilename(filename string)
type Book ¶
func DecodeBook ¶
type CancelOrderResponse ¶
type CancelOrderResponse struct { Error []interface{} `json:"error"` Result struct { Count int64 `json:"count"` } `json:"result"` }
func (*CancelOrderResponse) HasError ¶
func (r *CancelOrderResponse) HasError() bool
type EventMessage ¶
type OHLC ¶
type OHLC struct { Pair string Time float64 EndTime float64 Open float64 High float64 Low float64 Close float64 VWAP float64 Volume float64 Count int64 }
OHLC is the decoded OHLC event for a pair.
func DecodeOHLC ¶
DecodeOHLC decodes an array into an OHLC.
type OrderSide ¶
type OrderSide string
const OrderSideBuy OrderSide = "buy"
const OrderSideSell OrderSide = "sell"
type RequestError ¶
func (RequestError) Error ¶
func (e RequestError) Error() string
type RestClient ¶
type RestClient struct {
// contains filtered or unexported fields
}
func NewRestClient ¶
func NewRestClient(apiKey string, apiSecret string) (*RestClient, error)
func (*RestClient) AddOrder ¶
func (c *RestClient) AddOrder(order AddOrderRequest) (*AddOrderResponse, error)
func (*RestClient) CancelOrder ¶
func (c *RestClient) CancelOrder(txId string) (*CancelOrderResponse, error)
func (*RestClient) Time ¶
func (c *RestClient) Time() (*TimeResponse, error)
type Spread ¶
Spread represents a decoded spread event for a pair.
func DecodeSpread ¶
DecodeSpread decodes the input instead a Spread struct.
type SubscribeMessage ¶
type Ticker ¶
type Ticker struct { Pair string // Ask. Ask struct { Price float64 WholeLotVolume int64 LotVolume float64 } // Bid. Bid struct { Price float64 WholeLotVolume int64 LotVolume float64 } // Close. Close struct { Price float64 LotVolume float64 } // Volume. Volume struct { Today float64 Last24Hours float64 } // VWAP. Vwap struct { Today float64 Last24Hours float64 } // Number of trades. Trades struct { Today int64 Last24Hours int64 } // Low price. Low struct { Today float64 Last24Hours float64 } // High price. High struct { Today float64 Last24Hours float64 } // Open price. Open struct { Today float64 Last24Hours float64 } }
Ticker is the decoded representation of a ticker.
func DecodeTicker ¶
DecodeTicker decodes an array into a Ticker.
type TimeResponse ¶
type WebSocket ¶
func OpenWebSocket ¶
func (*WebSocket) Ping ¶
Ping sends an application ping to the server. The reqId will only be included if non-zero.
func (*WebSocket) SubscribeBook ¶
func (*WebSocket) SubscribeOHLC ¶
func (*WebSocket) SubscribeSpread ¶
func (*WebSocket) SubscribeTicker ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.