kraken

package
v0.0.0-...-3240a16 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KRAKEN_API_URL        = "https://api.kraken.com"
	KRAKEN_API_VERSION    = "0"
	KRAKEN_SERVER_TIME    = "Time"
	KRAKEN_ASSETS         = "Assets"
	KRAKEN_ASSET_PAIRS    = "AssetPairs"
	KRAKEN_TICKER         = "Ticker"
	KRAKEN_OHLC           = "OHLC"
	KRAKEN_DEPTH          = "Depth"
	KRAKEN_TRADES         = "Trades"
	KRAKEN_SPREAD         = "Spread"
	KRAKEN_BALANCE        = "Balance"
	KRAKEN_TRADE_BALANCE  = "TradeBalance"
	KRAKEN_OPEN_ORDERS    = "OpenOrders"
	KRAKEN_CLOSED_ORDERS  = "ClosedOrders"
	KRAKEN_QUERY_ORDERS   = "QueryOrders"
	KRAKEN_TRADES_HISTORY = "TradesHistory"
	KRAKEN_QUERY_TRADES   = "QueryTrades"
	KRAKEN_OPEN_POSITIONS = "OpenPositions"
	KRAKEN_LEDGERS        = "Ledgers"
	KRAKEN_QUERY_LEDGERS  = "QueryLedgers"
	KRAKEN_TRADE_VOLUME   = "TradeVolume"
	KRAKEN_ORDER_CANCEL   = "CancelOrder"
	KRAKEN_ORDER_PLACE    = "AddOrder"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Kraken

type Kraken struct {
	exchange.Base
	CryptoFee, FiatFee float64
	Ticker             map[string]KrakenTicker
}

func (*Kraken) AddOrder

func (k *Kraken) AddOrder(symbol, side, orderType string, price, price2, volume, leverage, position float64)

func (*Kraken) CancelOrder

func (k *Kraken) CancelOrder(orderID int64)

func (*Kraken) GetAssetPairs

func (k *Kraken) GetAssetPairs() (map[string]KrakenAssetPairs, error)

func (*Kraken) GetAssets

func (k *Kraken) GetAssets() error

func (*Kraken) GetBalance

func (k *Kraken) GetBalance()

func (*Kraken) GetClosedOrders

func (k *Kraken) GetClosedOrders(showTrades bool, userref, start, end, offset int64, closetime string)

func (*Kraken) GetDepth

func (k *Kraken) GetDepth(symbol string) (Orderbook, error)

GetDepth returns the orderbook for a particular currency

func (*Kraken) GetExchangeAccountInfo

func (k *Kraken) GetExchangeAccountInfo() (exchange.AccountInfo, error)

GetExchangeAccountInfo retrieves balances for all enabled currencies for the Kraken exchange - to-do

func (*Kraken) GetFee

func (k *Kraken) GetFee(cryptoTrade bool) float64

func (*Kraken) GetLedgers

func (k *Kraken) GetLedgers(symbol, asset, ledgerType string, start, end, offset int64)

func (*Kraken) GetOHLC

func (k *Kraken) GetOHLC(symbol string) error

func (*Kraken) GetOpenOrders

func (k *Kraken) GetOpenOrders(showTrades bool, userref int64)

func (*Kraken) GetOrderbookEx

func (k *Kraken) GetOrderbookEx(p pair.CurrencyPair, assetType string) (orderbook.Base, error)

GetOrderbookEx returns orderbook base on the currency pair

func (*Kraken) GetServerTime

func (k *Kraken) GetServerTime() error

func (*Kraken) GetSpread

func (k *Kraken) GetSpread(symbol string)

func (*Kraken) GetTicker

func (k *Kraken) GetTicker(symbol string) error

func (*Kraken) GetTickerPrice

func (k *Kraken) GetTickerPrice(p pair.CurrencyPair, assetType string) (ticker.Price, error)

GetTickerPrice returns the ticker for a currency pair

func (*Kraken) GetTradeBalance

func (k *Kraken) GetTradeBalance(symbol, asset string)

func (*Kraken) GetTradeVolume

func (k *Kraken) GetTradeVolume(symbol string)

func (*Kraken) GetTrades

func (k *Kraken) GetTrades(symbol string) error

func (*Kraken) GetTradesHistory

func (k *Kraken) GetTradesHistory(tradeType string, showRelatedTrades bool, start, end, offset int64)

func (*Kraken) OpenPositions

func (k *Kraken) OpenPositions(txid int64, showPL bool)

func (*Kraken) QueryLedgers

func (k *Kraken) QueryLedgers(id string)

func (*Kraken) QueryOrdersInfo

func (k *Kraken) QueryOrdersInfo(showTrades bool, userref, txid int64)

func (*Kraken) QueryTrades

func (k *Kraken) QueryTrades(txid int64, showRelatedTrades bool)

func (*Kraken) Run

func (k *Kraken) Run()

Run implements the Kraken wrapper

func (*Kraken) SendAuthenticatedHTTPRequest

func (k *Kraken) SendAuthenticatedHTTPRequest(method string, values url.Values) (interface{}, error)

func (*Kraken) SetDefaults

func (k *Kraken) SetDefaults()

func (*Kraken) Setup

func (k *Kraken) Setup(exch config.ExchangeConfig)

func (*Kraken) Start

func (k *Kraken) Start()

Start starts the Kraken go routine

func (*Kraken) UpdateOrderbook

func (k *Kraken) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*Kraken) UpdateTicker

func (k *Kraken) UpdateTicker(p pair.CurrencyPair, assetType string) (ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

type KrakenAssetPairs

type KrakenAssetPairs 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"`
}

type KrakenTicker

type KrakenTicker struct {
	Ask    float64
	Bid    float64
	Last   float64
	Volume float64
	VWAP   float64
	Trades int64
	Low    float64
	High   float64
	Open   float64
}

type KrakenTickerResponse

type KrakenTickerResponse 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"`
}

type Orderbook

type Orderbook struct {
	Bids []OrderbookBase
	Asks []OrderbookBase
}

Orderbook stores the bids and asks orderbook data

type OrderbookBase

type OrderbookBase struct {
	Price  float64
	Amount float64
}

OrderbookBase stores the orderbook price and amount data

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL