kraken

package
v0.0.0-...-8bcfbc3 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2018 License: MIT Imports: 15 Imported by: 0

README

GoCryptoTrader package Kraken

Build Status Software License GoDoc Coverage Status Go Report Card

This kraken package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progresss on this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

Kraken Exchange

Current Features
  • Initial generation
Please click GoDocs chevron above to view current GoDoc information for this package

Contribution

Please feel free to submit any pull requests or suggest any desired features to be added.

When submitting a PR, please abide by our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Code must adhere to our coding style.
  • Pull requests need to be based on and opened against the master branch.

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 GeneralResponse

type GeneralResponse struct {
	Result map[string]interface{} `json:"result"`
	Error  []interface{}          `json:"error"`
}

GeneralResponse is a generalized response type

type Kraken

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

Kraken is the overarching type across the alphapoint package

func (*Kraken) AddOrder

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

AddOrder adds a new order for Kraken exchange

func (*Kraken) CancelOrder

func (k *Kraken) CancelOrder(orderID int64) (interface{}, 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) GetAssets

func (k *Kraken) GetAssets() (interface{}, error)

GetAssets returns a full asset list

func (*Kraken) GetBalance

func (k *Kraken) GetBalance() (interface{}, error)

GetBalance returns your balance associated with your keys

func (*Kraken) GetClosedOrders

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

GetClosedOrders returns a list of closed orders

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) GetExchangeHistory

func (k *Kraken) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error)

GetExchangeHistory returns historic trade data since exchange opening.

func (*Kraken) GetFee

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

GetFee returns current fee for either crypto or fiat

func (*Kraken) GetLedgers

func (k *Kraken) GetLedgers(symbol, asset, ledgerType string, start, end, offset int64) (interface{}, 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(showTrades bool, userref int64) (interface{}, error)

GetOpenOrders returns all current open orders

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(unixTime bool) (interface{}, error)

GetServerTime returns current server time

func (*Kraken) GetSpread

func (k *Kraken) GetSpread(symbol string) ([]Spread, error)

GetSpread returns the full spread on Kraken

func (*Kraken) GetTicker

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

GetTicker returns ticker information from kraken

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) (interface{}, error)

GetTradeBalance returns full information about your trades on Kraken

func (*Kraken) GetTradeVolume

func (k *Kraken) GetTradeVolume(symbol string) (interface{}, 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(tradeType string, showRelatedTrades bool, start, end, offset int64) (interface{}, error)

GetTradesHistory returns trade history information

func (*Kraken) OpenPositions

func (k *Kraken) OpenPositions(txid int64, showPL bool) (interface{}, error)

OpenPositions returns current open positions

func (*Kraken) QueryLedgers

func (k *Kraken) QueryLedgers(id string) (interface{}, error)

QueryLedgers queries an individual ledger by ID

func (*Kraken) QueryOrdersInfo

func (k *Kraken) QueryOrdersInfo(showTrades bool, userref, txid int64) (interface{}, error)

QueryOrdersInfo returns order information

func (*Kraken) QueryTrades

func (k *Kraken) QueryTrades(txid int64, showRelatedTrades bool) (interface{}, error)

QueryTrades returns information on a specific trade

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)

SendAuthenticatedHTTPRequest sends an authenticated HTTP request

func (*Kraken) SendHTTPRequest

func (k *Kraken) SendHTTPRequest(path string, result interface{}) error

SendHTTPRequest sends an unauthenticated HTTP requests

func (*Kraken) SetDefaults

func (k *Kraken) SetDefaults()

SetDefaults sets current default settings

func (*Kraken) SetTicker

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

SetTicker sets ticker information from kraken

func (*Kraken) Setup

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

Setup sets current exchange configuration

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 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 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

type RecentTrades

type RecentTrades struct {
	Price         float64
	Volume        float64
	Time          float64
	BuyOrSell     string
	MarketOrLimit string
	Miscellaneous interface{}
}

RecentTrades holds recent trade data

type Spread

type Spread struct {
	Time float64
	Bid  float64
	Ask  float64
}

Spread holds the spread between trades

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

Jump to

Keyboard shortcuts

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