kraken

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MIT Imports: 34 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 progress 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
  • REST Support
How to enable
	// Exchanges will be abstracted out in further updates and examples will be
	// supplied then
How to do REST public/private calls
  • If enabled via "configuration".json file the exchange will be added to the IBotExchange array in the go var bot Bot and you will only be able to use the wrapper interface functions for accessing exchange data. View routines.go for an example of integration usage with GoCryptoTrader. Rudimentary example below:

main.go

var k exchange.IBotExchange

for i := range bot.Exchanges {
	if bot.Exchanges[i].GetName() == "Kraken" {
		k = bot.Exchanges[i]
	}
}

// Public calls - wrapper functions

// Fetches current ticker information
tick, err := k.FetchTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := k.FetchOrderbook()
if err != nil {
	// Handle error
}

// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
// set and AuthenticatedAPISupport is set to true

// Fetches current account information
accountInfo, err := k.GetAccountInfo()
if err != nil {
	// Handle error
}
  • If enabled via individually importing package, rudimentary example below:
// Public calls

// Fetches current ticker information
ticker, err := k.GetTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := k.GetOrderBook()
if err != nil {
	// Handle error
}

// Private calls - make sure your APIKEY and APISECRET are set and
// AuthenticatedAPISupport is set to true

// GetUserInfo returns account info
accountInfo, err := k.GetUserInfo(...)
if err != nil {
	// Handle error
}

// Submits an order and the exchange and returns its tradeID
tradeID, err := k.Trade(...)
if err != nil {
	// Handle error
}
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:

bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DepositFees = map[currency.Code]float64{
	currency.XTZ: 0.05,
}

DepositFees the large list of predefined deposit fees Prone to change

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

func GetError

func GetError(apiErrors []string) error

GetError parse Exchange errors in response and return the first one Error format from API doc:

error = array of error messages in the format of:
    <char-severity code><string-error category>:<string-error type>[:<string-extra info>]
    severity code can be E for error or W for warning

Types

type AccountsData

type AccountsData struct {
	AccType   string             `json:"type"`
	Currency  string             `json:"currency"`
	Balances  map[string]float64 `json:"balances"`
	Auxiliary struct {
		AvailableFunds float64 `json:"af"`
		ProfitAndLoss  float64 `json:"pnl"`
		PortfolioValue float64 `json:"pv"`
	} `json:"auxiliary"`
	MarginRequirements struct {
		InitialMargin        float64 `json:"im"`
		MaintenanceMargin    float64 `json:"mm"`
		LiquidationThreshold float64 `json:"lt"`
		TerminationThreshold float64 `json:"tt"`
	} `json:"marginRequirements"`
	TriggerEstimates struct {
		InitialMargin        float64 `json:"im"`
		MaintenanceMargin    float64 `json:"mm"`
		LiquidationThreshold float64 `json:"lt"`
		TerminationThreshold float64 `json:"tt"`
	} `json:"triggerEstimates"`
}

AccountsData stores data of an account

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"`
	Wsname            string      `json:"wsname"`
	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"`
	Ordermin          string      `json:"ordermin"`
}

AssetPairs holds asset pair information

type AuthErrorData

type AuthErrorData struct {
	Result     string `json:"result"`
	ServerTime string `json:"serverTime"`
	Error      string `json:"error"`
}

AuthErrorData stores authenticated error messages

type BatchOrderData

type BatchOrderData struct {
	Result      string `json:"result"`
	ServerTime  string `json:"serverTime"`
	BatchStatus []struct {
		Status           string `json:"status"`
		OrderTag         string `json:"order_tag"`
		OrderID          string `json:"order_id"`
		DateTimeReceived string `json:"dateTimeReceived"`
		OrderEvents      []struct {
			OrderPlaced    FuturesOrderData `json:"orderPlaced"`
			ReduceOnly     bool             `json:"reduceOnly"`
			Timestamp      string           `json:"timestamp"`
			OldEditedOrder FuturesOrderData `json:"old"`
			NewEditedOrder FuturesOrderData `json:"new"`
			UID            string           `json:"uid"`
			RequestType    string           `json:"requestType"`
		} `json:"orderEvents"`
	} `json:"batchStatus"`
}

BatchOrderData stores batch order data

type CancelAllOrdersData

type CancelAllOrdersData struct {
	CancelStatus struct {
		ReceivedTime    string `json:"receivedTime"`
		CancelOnly      string `json:"cancelOnly"`
		Status          string `json:"status"`
		CancelledOrders []struct {
			OrderID string `json:"order_id"`
		} `json:"cancelledOrders"`
		OrderEvents []struct {
			UID string `json:"uid"`
		} `json:"uid"`
		Order    FuturesOrderData `json:"order"`
		DataType string           `json:"type"`
	} `json:"cancelStatus"`
	ServerTime string `json:"serverTime"`
}

CancelAllOrdersData stores order data for all cancelled orders

type CancelOrderResponse

type CancelOrderResponse struct {
	Count   int64       `json:"count"`
	Pending interface{} `json:"pending"`
}

CancelOrderResponse type

type CancelOrdersAfterData

type CancelOrdersAfterData struct {
	Result string `json:"result"`
	Status struct {
		CurrentTime string `json:"currentTime"`
		TriggerTime string `json:"triggerTime"`
	} `json:"status"`
	ServerTime string `json:"serverTime"`
}

CancelOrdersAfterData stores data of all orders after a certain time that are cancelled

type ClosedOrders

type ClosedOrders struct {
	Closed map[string]OrderInfo `json:"closed"`
	Count  int64                `json:"count"`
}

ClosedOrders type

type DepositAddress

type DepositAddress struct {
	Address    string      `json:"address"`
	ExpireTime interface{} `json:"expiretm"` // this is an int when new is specified
	Tag        string      `json:"tag"`
	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 ExecutionData

type ExecutionData struct {
	UID        string          `json:"uid"`
	TakerOrder RecentOrderData `json:"takerOrder"`
}

ExecutionData stores execution data

type FOpenOrdersData

type FOpenOrdersData struct {
	OrderID        string  `json:"order_id"`
	ClientOrderID  string  `json:"cliOrdId"`
	Symbol         string  `json:"symbol"`
	Side           string  `json:"side"`
	OrderType      string  `json:"orderType"`
	LimitPrice     float64 `json:"limitPrice"`
	StopPrice      float64 `json:"stopPrice"`
	UnfilledSize   float64 `json:"unfilledSize"`
	ReceivedTime   string  `json:"receivedTime"`
	Status         string  `json:"status"`
	FilledSize     float64 `json:"filledSize"`
	ReduceOnly     bool    `json:"reduceOnly"`
	TriggerSignal  string  `json:"triggerSignal"`
	LastUpdateTime string  `json:"lastUpdateTime"`
}

FOpenOrdersData stores open orders data for futures

type FuturesAccountsData

type FuturesAccountsData struct {
	ServerTime string                  `json:"serverTime"`
	Accounts   map[string]AccountsData `json:"accounts"`
}

FuturesAccountsData stores account data

type FuturesCancelOrderData

type FuturesCancelOrderData struct {
	CancelStatus struct {
		Status       string `json:"status"`
		OrderID      string `json:"order_id"`
		ReceivedTime string `json:"receivedTime"`
		OrderEvents  []struct {
			UID      string           `json:"uid"`
			Order    FuturesOrderData `json:"order"`
			DataType string           `json:"type"`
		} `json:"orderEvents"`
	} `json:"cancelStatus"`
	ServerTime string `json:"serverTime"`
}

FuturesCancelOrderData stores cancel order data for futures

type FuturesEditedOrderData

type FuturesEditedOrderData struct {
	ServerTime string `json:"serverTime"`
	EditStatus struct {
		Status       string `json:"status"`
		OrderID      string `json:"orderId"`
		ReceivedTime string `json:"receivedTime"`
		OrderEvents  []struct {
			Old FuturesOrderData `json:"old"`
			New FuturesOrderData `json:"new"`
		} `json:"orderEvents"`
		ReduceQuantity string `json:"reduceQuantity"`
		DataType       string `json:"type"`
	} `json:"editStatus"`
}

FuturesEditedOrderData stores an edited order's data

type FuturesFillsData

type FuturesFillsData struct {
	Fills []struct {
		FillID   string  `json:"fill_id"`
		Symbol   string  `json:"symbol"`
		Side     string  `json:"buy"`
		OrderID  string  `json:"order_id"`
		Size     float64 `json:"size"`
		Price    float64 `json:"price"`
		FillTime string  `json:"fillTime"`
		FillType string  `json:"fillType"`
	} `json:"fills"`
	ServerTime string `json:"serverTime"`
}

FuturesFillsData stores fills data

type FuturesInstrumentData

type FuturesInstrumentData struct {
	Instruments []struct {
		Symbol          string  `json:"symbol"`
		FutureType      string  `json:"type"`
		Underlying      string  `json:"underlying"`
		LastTradingTime string  `json:"lastTradingTime"`
		TickSize        float64 `json:"tickSize"`
		ContractSize    float64 `json:"contractSize"`
		Tradable        bool    `json:"tradeable"`
		MarginLevels    []struct {
			Contracts         float64 `json:"contracts"`
			InitialMargin     float64 `json:"initialMargin"`
			MaintenanceMargin float64 `json:"maintenanceMargin"`
		} `json:"marginLevels"`
	} `json:"instruments"`
}

FuturesInstrumentData stores info for futures market

type FuturesNotificationData

type FuturesNotificationData struct {
	Notifications []struct {
		NotificationType string `json:"type"`
		Priority         string `json:"priority"`
		Note             string `json:"note"`
		EffectiveTime    string `json:"effectiveTime"`
	} `json:"notifcations"`
	ServerTime string `json:"serverTime"`
}

FuturesNotificationData stores notification data

type FuturesOpenOrdersData

type FuturesOpenOrdersData struct {
	Result     string            `json:"result"`
	OpenOrders []FOpenOrdersData `json:"openOrders"`
	ServerTime string            `json:"serverTime"`
}

FuturesOpenOrdersData stores open orders data for futures

type FuturesOpenPositions

type FuturesOpenPositions struct {
	OpenPositions []struct {
		Side              string  `json:"side"`
		Symbol            string  `json:"symbol"`
		Price             float64 `json:"price"`
		FillTime          string  `json:"fillTime"`
		Size              float64 `json:"size"`
		UnrealizedFunding float64 `json:"unrealizedFunding"`
	} `json:"openPositions"`
	ServerTime string `json:"serverTime"`
}

FuturesOpenPositions stores open positions data for futures

type FuturesOrderData

type FuturesOrderData struct {
	OrderID             string  `json:"orderId"`
	ClientOrderID       string  `json:"cliOrderId"`
	OrderType           string  `json:"type"`
	Symbol              string  `json:"symbol"`
	Side                string  `json:"side"`
	Quantity            float64 `json:"quantity"`
	Filled              float64 `json:"filled"`
	LimitPrice          float64 `json:"limitPrice"`
	ReduceOnly          bool    `json:"reduceOnly"`
	Timestamp           string  `json:"timestamp"`
	LastUpdateTimestamp string  `json:"lastUpdateTimestamp"`
}

FuturesOrderData stores order data

type FuturesOrderbookData

type FuturesOrderbookData struct {
	ServerTime string `json:"serverTime"`
	Orderbook  struct {
		Bids [][2]float64 `json:"bids"`
		Asks [][2]float64 `json:"asks"`
	} `json:"orderBook"`
}

FuturesOrderbookData stores orderbook data for futures

type FuturesRecentOrdersData

type FuturesRecentOrdersData struct {
	OrderEvents []struct {
		Timestamp int64 `json:"timestamp"`
		Event     struct {
			Timestamp   string `json:"timestamp"`
			UID         string `json:"uid"`
			OrderPlaced struct {
				RecentOrder RecentOrderData `json:"order"`
				Reason      string          `json:"reason"`
			} `json:"orderPlaced"`
			OrderCancelled struct {
				RecentOrder RecentOrderData `json:"order"`
				Reason      string          `json:"reason"`
			} `json:"orderCancelled"`
			OrderRejected struct {
				RecentOrder RecentOrderData `json:"order"`
				Reason      string          `json:"reason"`
			} `json:"orderRejected"`
			ExecutionEvent struct {
				Execution   ExecutionData `json:"execution"`
				Timestamp   string        `json:"timestamp"`
				Quantity    float64       `json:"quantity"`
				Price       float64       `json:"price"`
				MarkPrice   float64       `json:"markPrice"`
				LimitFilled bool          `json:"limitFilled"`
			} `json:"executionEvent"`
		} `json:"event"`
	} `json:"orderEvents"`
}

FuturesRecentOrdersData stores recent orders data

type FuturesSendOrderData

type FuturesSendOrderData struct {
	SendStatus struct {
		OrderID      string `json:"order_id"`
		Status       string `json:"status"`
		ReceivedTime string `json:"receivedTime"`
		OrderEvents  []struct {
			UID      string           `json:"uid"`
			Order    FuturesOrderData `json:"order"`
			Reason   string           `json:"reason"`
			DataType string           `json:"type"`
		} `json:"orderEvents"`
	} `json:"sendStatus"`
	ServerTime string `json:"serverTime"`
}

FuturesSendOrderData stores send order data

type FuturesTickerData

type FuturesTickerData struct {
	Tickers []struct {
		Tag                   string  `json:"tag"`
		Pair                  string  `json:"pair"`
		Symbol                string  `json:"symbol"`
		MarkPrice             float64 `json:"markPrice"`
		Bid                   float64 `json:"bid"`
		BidSize               float64 `json:"bidSize"`
		Ask                   float64 `json:"ask"`
		AskSize               float64 `json:"askSize"`
		Vol24h                float64 `json:"vol24h"`
		OpenInterest          float64 `json:"openInterest"`
		Open24H               float64 `json:"open24h"`
		Last                  float64 `json:"last"`
		LastTime              string  `json:"lastTime"`
		LastSize              float64 `json:"lastSize"`
		Suspended             bool    `json:"suspended"`
		FundingRate           float64 `json:"fundingRate"`
		FundingRatePrediction float64 `json:"fundingRatePrediction"`
	} `json:"tickers"`
	ServerTime string `json:"serverTime"`
}

FuturesTickerData stores info for futures ticker

type FuturesTradeHistoryData

type FuturesTradeHistoryData struct {
	History []struct {
		Time      string  `json:"time"`
		TradeID   int64   `json:"trade_id"`
		Price     float64 `json:"price"`
		Size      float64 `json:"size"`
		Side      string  `json:"side"`
		TradeType string  `json:"type"`
	} `json:"history"`
}

FuturesTradeHistoryData stores trade history data for futures

type FuturesTransferData

type FuturesTransferData struct {
	Result     string `json:"result"`
	ServerTime string `json:"serverTime"`
}

FuturesTransferData stores transfer data

type GenericResponse

type GenericResponse struct {
	Timestamp string `json:"timestamp"`
	Result    string `json:"result"`
}

GenericResponse stores general response data for functions that only return success

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

type GetTradesHistoryOptions struct {
	Type   string
	Trades bool
	Start  string
	End    string
	Ofs    int64
}

GetTradesHistoryOptions type

type Kraken

type Kraken struct {
	exchange.Base
	// contains filtered or unexported fields
}

Kraken is the overarching type across the alphapoint package

func (*Kraken) AddOrder

func (k *Kraken) AddOrder(ctx context.Context, symbol currency.Pair, side, orderType string, volume, price, price2, leverage float64, args *AddOrderOptions) (AddOrderResponse, error)

AddOrder adds a new order for Kraken exchange

func (*Kraken) AuthenticateWebsocket

func (k *Kraken) AuthenticateWebsocket(ctx context.Context) error

AuthenticateWebsocket sends an authentication message to the websocket

func (*Kraken) CancelAllOrders

func (k *Kraken) CancelAllOrders(ctx context.Context, req *order.Cancel) (order.CancelAllResponse, error)

CancelAllOrders cancels all orders associated with a currency pair

func (*Kraken) CancelBatchOrders

func (k *Kraken) CancelBatchOrders(ctx context.Context, orders []order.Cancel) (order.CancelBatchResponse, error)

CancelBatchOrders cancels an orders by their corresponding ID numbers

func (*Kraken) CancelExistingOrder

func (k *Kraken) CancelExistingOrder(ctx context.Context, txid string) (CancelOrderResponse, error)

CancelExistingOrder cancels order by orderID

func (*Kraken) CancelOrder

func (k *Kraken) CancelOrder(ctx context.Context, o *order.Cancel) error

CancelOrder cancels an order by its corresponding ID number

func (*Kraken) FetchAccountInfo

func (k *Kraken) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)

FetchAccountInfo retrieves balances for all enabled currencies

func (*Kraken) FetchOrderbook

func (k *Kraken) FetchOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)

FetchOrderbook returns orderbook base on the currency pair

func (*Kraken) FetchTicker

func (k *Kraken) FetchTicker(ctx context.Context, p currency.Pair, assetType asset.Item) (*ticker.Price, error)

FetchTicker returns the ticker for a currency pair

func (*Kraken) FetchTradablePairs

func (k *Kraken) FetchTradablePairs(ctx context.Context, assetType asset.Item) ([]string, error)

FetchTradablePairs returns a list of the exchanges tradable pairs

func (*Kraken) FormatExchangeKlineInterval

func (k *Kraken) FormatExchangeKlineInterval(in kline.Interval) string

FormatExchangeKlineInterval returns Interval to exchange formatted string

func (*Kraken) FuturesBatchOrder

func (k *Kraken) FuturesBatchOrder(ctx context.Context, data []PlaceBatchOrderData) (BatchOrderData, error)

FuturesBatchOrder places a batch order for futures

func (*Kraken) FuturesCancelAllOrders

func (k *Kraken) FuturesCancelAllOrders(ctx context.Context, symbol currency.Pair) (CancelAllOrdersData, error)

FuturesCancelAllOrders cancels all futures orders for a given symbol or all symbols

func (*Kraken) FuturesCancelAllOrdersAfter

func (k *Kraken) FuturesCancelAllOrdersAfter(ctx context.Context, timeout int64) (CancelOrdersAfterData, error)

FuturesCancelAllOrdersAfter cancels all futures orders for all symbols after a period of time (timeout measured in seconds)

func (*Kraken) FuturesCancelOrder

func (k *Kraken) FuturesCancelOrder(ctx context.Context, orderID, clientOrderID string) (FuturesCancelOrderData, error)

FuturesCancelOrder cancels an order

func (*Kraken) FuturesEditOrder

func (k *Kraken) FuturesEditOrder(ctx context.Context, orderID, clientOrderID string, size, limitPrice, stopPrice float64) (FuturesAccountsData, error)

FuturesEditOrder edits a futures order

func (*Kraken) FuturesGetFills

func (k *Kraken) FuturesGetFills(ctx context.Context, lastFillTime time.Time) (FuturesFillsData, error)

FuturesGetFills gets order fills for futures

func (*Kraken) FuturesGetOpenPositions

func (k *Kraken) FuturesGetOpenPositions(ctx context.Context) (FuturesOpenPositions, error)

FuturesGetOpenPositions gets futures platform's notifications

func (*Kraken) FuturesGetTransfers

func (k *Kraken) FuturesGetTransfers(ctx context.Context, lastTransferTime time.Time) (GenericResponse, error)

FuturesGetTransfers withdraws currencies from futures wallet to spot wallet

func (*Kraken) FuturesNotifications

func (k *Kraken) FuturesNotifications(ctx context.Context) (FuturesNotificationData, error)

FuturesNotifications gets futures notifications

func (*Kraken) FuturesOpenOrders

func (k *Kraken) FuturesOpenOrders(ctx context.Context) (FuturesOpenOrdersData, error)

FuturesOpenOrders gets all futures open orders

func (*Kraken) FuturesRecentOrders

func (k *Kraken) FuturesRecentOrders(ctx context.Context, symbol currency.Pair) (FuturesRecentOrdersData, error)

FuturesRecentOrders gets recent futures orders for a symbol or all symbols

func (*Kraken) FuturesSendOrder

func (k *Kraken) FuturesSendOrder(ctx context.Context, orderType order.Type, symbol currency.Pair, side, triggerSignal, clientOrderID, reduceOnly string,
	ioc bool,
	size, limitPrice, stopPrice float64) (FuturesSendOrderData, error)

FuturesSendOrder sends a futures order

func (*Kraken) FuturesTransfer

func (k *Kraken) FuturesTransfer(ctx context.Context, fromAccount, toAccount, unit string, amount float64) (FuturesTransferData, error)

FuturesTransfer transfers funds between accounts

func (*Kraken) FuturesWithdrawToSpotWallet

func (k *Kraken) FuturesWithdrawToSpotWallet(ctx context.Context, currency string, amount float64) (GenericResponse, error)

FuturesWithdrawToSpotWallet withdraws currencies from futures wallet to spot wallet

func (*Kraken) GenerateDefaultSubscriptions

func (k *Kraken) GenerateDefaultSubscriptions() ([]stream.ChannelSubscription, error)

GenerateDefaultSubscriptions Adds default subscriptions to websocket to be handled by ManageSubscriptions()

func (*Kraken) GetActiveOrders

func (k *Kraken) GetActiveOrders(ctx context.Context, req *order.GetOrdersRequest) ([]order.Detail, error)

GetActiveOrders retrieves any orders that are active/open

func (*Kraken) GetAssetPairs

func (k *Kraken) GetAssetPairs(ctx context.Context, assetPairs []string, info string) (map[string]AssetPairs, error)

GetAssetPairs returns a full asset pair list Parameter 'info' only supports 4 strings: "fees", "leverage", "margin", "info" <- (default)

func (*Kraken) GetAssets

func (k *Kraken) GetAssets(ctx context.Context) (map[string]*Asset, error)

GetAssets returns a full asset list

func (*Kraken) GetAvailableTransferChains

func (k *Kraken) GetAvailableTransferChains(ctx context.Context, cryptocurrency currency.Code) ([]string, error)

GetAvailableTransferChains returns the available transfer blockchains for the specific cryptocurrency

func (*Kraken) GetBalance

func (k *Kraken) GetBalance(ctx context.Context) (map[string]float64, error)

GetBalance returns your balance associated with your keys

func (*Kraken) GetClosedOrders

func (k *Kraken) GetClosedOrders(ctx context.Context, args GetClosedOrdersOptions) (ClosedOrders, error)

GetClosedOrders returns a list of closed orders

func (*Kraken) GetCryptoDepositAddress

func (k *Kraken) GetCryptoDepositAddress(ctx context.Context, method, code string, createNew bool) ([]DepositAddress, error)

GetCryptoDepositAddress returns a deposit address for a cryptocurrency

func (*Kraken) GetDefaultConfig

func (k *Kraken) GetDefaultConfig() (*config.Exchange, error)

GetDefaultConfig returns a default exchange config

func (*Kraken) GetDepositAddress

func (k *Kraken) GetDepositAddress(ctx context.Context, cryptocurrency currency.Code, _, chain string) (*deposit.Address, error)

GetDepositAddress returns a deposit address for a specified currency

func (*Kraken) GetDepositMethods

func (k *Kraken) GetDepositMethods(ctx context.Context, currency string) ([]DepositMethods, error)

GetDepositMethods gets withdrawal fees

func (*Kraken) GetDepth

func (k *Kraken) GetDepth(ctx context.Context, symbol currency.Pair) (Orderbook, error)

GetDepth returns the orderbook for a particular currency

func (*Kraken) GetFee

func (k *Kraken) GetFee(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)

GetFee returns an estimate of fee based on type of transaction

func (*Kraken) GetFeeByType

func (k *Kraken) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)

GetFeeByType returns an estimate of fee based on type of transaction

func (*Kraken) GetFundingHistory

func (k *Kraken) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error)

GetFundingHistory returns funding history, deposits and withdrawals

func (*Kraken) GetFuturesAccountData

func (k *Kraken) GetFuturesAccountData(ctx context.Context) (FuturesAccountsData, error)

GetFuturesAccountData gets account data for futures

func (*Kraken) GetFuturesMarkets

func (k *Kraken) GetFuturesMarkets(ctx context.Context) (FuturesInstrumentData, error)

GetFuturesMarkets gets a list of futures markets and their data

func (*Kraken) GetFuturesOrderbook

func (k *Kraken) GetFuturesOrderbook(ctx context.Context, symbol currency.Pair) (FuturesOrderbookData, error)

GetFuturesOrderbook gets orderbook data for futures

func (*Kraken) GetFuturesTickers

func (k *Kraken) GetFuturesTickers(ctx context.Context) (FuturesTickerData, error)

GetFuturesTickers gets a list of futures tickers and their data

func (*Kraken) GetFuturesTradeHistory

func (k *Kraken) GetFuturesTradeHistory(ctx context.Context, symbol currency.Pair, lastTime time.Time) (FuturesTradeHistoryData, error)

GetFuturesTradeHistory gets public trade history data for futures

func (*Kraken) GetHistoricCandles

func (k *Kraken) GetHistoricCandles(ctx context.Context, 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(ctx context.Context, 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) GetHistoricTrades

func (k *Kraken) GetHistoricTrades(_ context.Context, _ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error)

GetHistoricTrades returns historic trade data within the timeframe provided

func (*Kraken) GetKlines

func (b *Kraken) GetKlines(arg interface{}) ([]*kline.Kline, error)

GetKlines checks and returns a requested kline if it exists

func (*Kraken) GetLedgers

func (k *Kraken) GetLedgers(ctx context.Context, args ...GetLedgersOptions) (Ledgers, error)

GetLedgers returns current ledgers

func (*Kraken) GetOHLC

func (k *Kraken) GetOHLC(ctx context.Context, symbol currency.Pair, 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(ctx context.Context, args OrderInfoOptions) (OpenOrders, error)

GetOpenOrders returns all current open orders

func (*Kraken) GetOrderHistory

func (k *Kraken) GetOrderHistory(ctx context.Context, getOrdersRequest *order.GetOrdersRequest) ([]order.Detail, error)

GetOrderHistory retrieves account order information Can Limit response to specific order status

func (*Kraken) GetOrderInfo

func (k *Kraken) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error)

GetOrderInfo returns information on a current open order

func (*Kraken) GetRecentTrades

func (k *Kraken) GetRecentTrades(ctx context.Context, p currency.Pair, assetType asset.Item) ([]trade.Data, error)

GetRecentTrades returns the most recent trades for a currency and asset

func (*Kraken) GetServerTime

func (k *Kraken) GetServerTime(ctx context.Context) (TimeResponse, error)

GetServerTime returns current server time

func (*Kraken) GetSpread

func (k *Kraken) GetSpread(ctx context.Context, symbol currency.Pair) ([]Spread, error)

GetSpread returns the full spread on Kraken

func (*Kraken) GetTicker

func (k *Kraken) GetTicker(ctx context.Context, symbol currency.Pair) (Ticker, error)

GetTicker returns ticker information from kraken

func (*Kraken) GetTickers

func (k *Kraken) GetTickers(ctx context.Context, pairList string) (map[string]Ticker, error)

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(ctx context.Context, args ...TradeBalanceOptions) (TradeBalanceInfo, error)

GetTradeBalance returns full information about your trades on Kraken

func (*Kraken) GetTradeVolume

func (k *Kraken) GetTradeVolume(ctx context.Context, feeinfo bool, symbol ...currency.Pair) (TradeVolumeResponse, error)

GetTradeVolume returns your trade volume by currency

func (*Kraken) GetTrades

func (k *Kraken) GetTrades(ctx context.Context, symbol currency.Pair) ([]RecentTrades, error)

GetTrades returns current trades on Kraken

func (*Kraken) GetTradesHistory

func (k *Kraken) GetTradesHistory(ctx context.Context, args ...GetTradesHistoryOptions) (TradesHistory, error)

GetTradesHistory returns trade history information

func (*Kraken) GetWebsocketToken

func (k *Kraken) GetWebsocketToken(ctx context.Context) (string, error)

GetWebsocketToken returns a websocket token

func (*Kraken) GetWithdrawInfo

func (k *Kraken) GetWithdrawInfo(ctx context.Context, currency string, amount float64) (WithdrawInformation, error)

GetWithdrawInfo gets withdrawal fees

func (*Kraken) GetWithdrawalsHistory

func (k *Kraken) GetWithdrawalsHistory(ctx context.Context, c currency.Code) (resp []exchange.WithdrawalHistory, err error)

GetWithdrawalsHistory returns previous withdrawals data

func (*Kraken) ModifyOrder

func (k *Kraken) ModifyOrder(ctx context.Context, action *order.Modify) (order.Modify, error)

ModifyOrder will allow of changing orderbook placement and limit to market conversion

func (*Kraken) OpenPositions

func (k *Kraken) OpenPositions(ctx context.Context, docalcs bool, txids ...string) (map[string]Position, error)

OpenPositions returns current open positions

func (*Kraken) QueryLedgers

func (k *Kraken) QueryLedgers(ctx context.Context, id string, ids ...string) (map[string]LedgerInfo, error)

QueryLedgers queries an individual ledger by ID

func (*Kraken) QueryOrdersInfo

func (k *Kraken) QueryOrdersInfo(ctx context.Context, args OrderInfoOptions, txid string, txids ...string) (map[string]OrderInfo, error)

QueryOrdersInfo returns order information

func (*Kraken) QueryTrades

func (k *Kraken) QueryTrades(ctx context.Context, trades bool, txid string, txids ...string) (map[string]TradeInfo, error)

QueryTrades returns information on a specific trade

func (*Kraken) Run

func (k *Kraken) Run()

Run implements the Kraken wrapper

func (*Kraken) SeedAssets

func (k *Kraken) SeedAssets(ctx context.Context) error

SeedAssets seeds Kraken's asset list and stores it in the asset translator

func (*Kraken) SendAuthenticatedHTTPRequest

func (k *Kraken) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.URL, method string, params url.Values, result interface{}) error

SendAuthenticatedHTTPRequest sends an authenticated HTTP request

func (*Kraken) SendFuturesAuthRequest

func (k *Kraken) SendFuturesAuthRequest(ctx context.Context, method, path string, data url.Values, result interface{}) error

SendFuturesAuthRequest will send an auth req

func (*Kraken) SendHTTPRequest

func (k *Kraken) SendHTTPRequest(ctx context.Context, ep exchange.URL, 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) Setup

func (k *Kraken) Setup(exch *config.Exchange) error

Setup sets current exchange configuration

func (*Kraken) Start

func (k *Kraken) Start(wg *sync.WaitGroup) error

Start starts the Kraken go routine

func (*Kraken) SubmitOrder

func (k *Kraken) SubmitOrder(ctx context.Context, s *order.Submit) (order.SubmitResponse, error)

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

func (k *Kraken) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)

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

func (*Kraken) UpdateOrderbook

func (k *Kraken) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*Kraken) UpdateTicker

func (k *Kraken) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*Kraken) UpdateTickers

func (k *Kraken) UpdateTickers(ctx context.Context, a asset.Item) error

UpdateTickers updates the ticker for all currency pairs of a given asset type

func (*Kraken) UpdateTradablePairs

func (k *Kraken) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error

UpdateTradablePairs updates the exchanges available pairs and stores them in the exchanges config

func (*Kraken) ValidateCredentials

func (k *Kraken) ValidateCredentials(ctx context.Context, assetType asset.Item) error

ValidateCredentials validates current credentials used for wrapper functionality

func (*Kraken) Withdraw

func (k *Kraken) Withdraw(ctx context.Context, asset, key string, amount float64) (string, error)

Withdraw withdraws funds

func (*Kraken) WithdrawCancel

func (k *Kraken) WithdrawCancel(ctx context.Context, c currency.Code, refID string) (bool, error)

WithdrawCancel sends a withdrawal cancelation request

func (*Kraken) WithdrawCryptocurrencyFunds

func (k *Kraken) WithdrawCryptocurrencyFunds(ctx context.Context, 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(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted

func (*Kraken) WithdrawFiatFundsToInternationalBank

func (k *Kraken) WithdrawFiatFundsToInternationalBank(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted

func (*Kraken) WithdrawStatus

func (k *Kraken) WithdrawStatus(ctx context.Context, c currency.Code, method string) ([]WithdrawStatusResponse, error)

WithdrawStatus gets the status of recent withdrawals

func (*Kraken) WsConnect

func (k *Kraken) WsConnect() error

WsConnect initiates a websocket connection

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

type OpenOrders struct {
	Open  map[string]OrderInfo `json:"open"`
	Count int64                `json:"count"`
}

OpenOrders type

type OrderDescription

type OrderDescription struct {
	Close string `json:"close"`
	Order string `json:"order"`
}

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

type OrderInfoOptions struct {
	Trades  bool
	UserRef int32
}

OrderInfoOptions type

type OrderVars

type OrderVars struct {
	Side      order.Side
	Status    order.Status
	OrderType order.Type
	Fee       float64
}

OrderVars stores side, status and type for any order/trade

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 PlaceBatchOrderData

type PlaceBatchOrderData struct {
	PlaceOrderType string  `json:"order,omitempty"`
	OrderType      string  `json:"orderType,omitempty"`
	OrderTag       string  `json:"order_tag,omitempty"`
	Symbol         string  `json:"symbol,omitempty"`
	Side           string  `json:"side,omitempty"`
	Size           float64 `json:"size,omitempty"`
	LimitPrice     float64 `json:"limitPrice,omitempty"`
	StopPrice      float64 `json:"stopPrice,omitempty"`
	ClientOrderID  int64   `json:"cliOrdId,omitempty"`
	ReduceOnly     string  `json:"reduceOnly,omitempty"`
	OrderID        string  `json:"order_id,omitempty"`
}

PlaceBatchOrderData stores data required to place a batch order

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 RecentOrderData

type RecentOrderData struct {
	UID        string  `json:"uid"`
	AccountID  string  `json:"accountId"`
	Tradeable  string  `json:"tradeable"`
	Direction  string  `json:"direction"`
	Quantity   float64 `json:"quantity,string"`
	Filled     float64 `json:"filled,string"`
	Timestamp  string  `json:"timestamp"`
	LimitPrice float64 `json:"limitPrice,string"`
	OrderType  string  `json:"orderType"`
	ClientID   string  `json:"clientId"`
	StopPrice  float64 `json:"stopPrice,string"`
}

RecentOrderData stores order data of a recent order

type RecentTrades

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

RecentTrades holds recent trade data

type SpotAuthError

type SpotAuthError struct {
	Error interface{} `json:"error"` // can be a []string or string
}

SpotAuthError stores authenticated error messages

type Spread

type Spread struct {
	Time time.Time
	Bid  float64
	Ask  float64
}

Spread holds the spread between trades

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 Tickers

type Tickers map[string]Ticker

Tickers stores a map of tickers

type TimeResponse

type TimeResponse struct {
	Unixtime int64  `json:"unixtime"`
	Rfc1123  string `json:"rfc1123"`
}

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

type TradeBalanceOptions struct {
	Aclass string
	Asset  string
}

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 WSFuturesTickerData

type WSFuturesTickerData struct {
	Time                          int64   `json:"time"`
	Feed                          string  `json:"feed"`
	ProductID                     string  `json:"product_id"`
	Bid                           float64 `json:"bid"`
	Ask                           float64 `json:"ask"`
	BidSize                       float64 `json:"bid_size"`
	AskSize                       float64 `json:"ask_size"`
	Volume                        float64 `json:"volume"`
	DTM                           float64 `json:"dtm"`
	Leverage                      string  `json:"leverage"`
	Index                         float64 `json:"index"`
	Premium                       float64 `json:"premium"`
	Last                          float64 `json:"last"`
	Change                        float64 `json:"change"`
	Suspended                     bool    `json:"suspended"`
	Tag                           string  `json:"tag"`
	Pair                          string  `json:"pair"`
	OpenInterest                  float64 `json:"openinterest"`
	MarkPrice                     float64 `json:"markPrice"`
	MaturityTime                  int64   `json:"maturityTime"`
	FundingRate                   float64 `json:"funding_rate"`
	FundingRatePrediction         float64 `json:"funding_rate_prediction"`
	RelativeFundingRate           float64 `json:"relative_funding_rate"`
	RelativeFundingRatePrediction float64 `json:"relative_funding_rate_prediction"`
	NextFundingRateTime           int64   `json:"next_funding_rate_time"`
}

WSFuturesTickerData stores ws ticker data for futures websocket

type WebsocketBaseEventRequest

type WebsocketBaseEventRequest struct {
	Event string `json:"event"` // eg "unsubscribe"
}

WebsocketBaseEventRequest Just has an "event" property

type WebsocketChannelData

type WebsocketChannelData struct {
	Subscription string
	Pair         currency.Pair
	ChannelID    *int64
}

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 WsAccountBalancesAndMargin

type WsAccountBalancesAndMargin struct {
	Seq            int64  `json:"seq"`
	Feed           string `json:"feed"`
	Account        string `json:"account"`
	MarginAccounts []struct {
		Name              string  `json:"name"`
		PortfolioValue    float64 `json:"pv"`
		Balance           float64 `json:"balance"`
		Funding           float64 `json:"funding"`
		MaintenanceMargin float64 `json:"mm"`
		ProfitAndLoss     float64 `json:"pnl"`
		InitialMargin     float64 `json:"im"`
		AM                float64 `json:"am"`
	} `json:"margin_accounts"`
}

WsAccountBalancesAndMargin stores account balances and margin data for futures websocket

type WsAddOrderRequest

type WsAddOrderRequest struct {
	Event           string  `json:"event"`
	Token           string  `json:"token"`
	RequestID       int64   `json:"reqid,omitempty"` // Optional, client originated ID reflected in response message.
	OrderType       string  `json:"ordertype"`
	OrderSide       string  `json:"type"`
	Pair            string  `json:"pair"`
	Price           float64 `json:"price,string,omitempty"`  // optional
	Price2          float64 `json:"price2,string,omitempty"` // optional
	Volume          float64 `json:"volume,string,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 {
	Event         string `json:"event"`
	RequestID     int64  `json:"reqid"`
	Status        string `json:"status"`
	TransactionID string `json:"txid"`
	Description   string `json:"descr"`
	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,omitempty"`
	RequestID      int64    `json:"reqid,omitempty"` // Optional, client originated ID reflected in response message.
}

WsCancelOrderRequest request for ws cancel order

type WsCancelOrderResponse

type WsCancelOrderResponse struct {
	Event        string `json:"event"`
	Status       string `json:"status"`
	ErrorMessage string `json:"errorMessage"`
	RequestID    int64  `json:"reqid"`
	Count        int64  `json:"count"`
}

WsCancelOrderResponse response data for ws cancel order and ws cancel all orders

type WsFuturesAccountLog

type WsFuturesAccountLog struct {
	Feed string `json:"feed"`
	Logs []struct {
		ID              int64   `json:"id"`
		Date            string  `json:"date"`
		Asset           string  `json:"asset"`
		Info            string  `json:"info"`
		BookingUID      string  `json:"booking_uid"`
		MarginAccount   string  `json:"margin_account"`
		OldBalance      float64 `json:"old_balance"`
		NewBalance      float64 `json:"new_balance"`
		OldAverageEntry float64 `json:"old_average_entry"`
		NewAverageEntry float64 `json:"new_average_entry"`
		TradePrice      float64 `json:"trade_price"`
		MarkPrice       float64 `json:"mark_price"`
		RealizedPNL     float64 `json:"realized_pnl"`
		Fee             float64 `json:"fee"`
		Execution       string  `json:"execution"`
		Collateral      string  `json:"collateral"`
		FundingRate     float64 `json:"funding_rate"`
		RealizedFunding float64 `json:"realized_funding"`
	} `json:"logs"`
}

WsFuturesAccountLog stores account log data for futures websocket

type WsFuturesFillsData

type WsFuturesFillsData struct {
	Feed    string `json:"feed"`
	Account string `json:"account"`
	Fills   []struct {
		Instrument    string  `json:"instrument"`
		Time          int64   `json:"time"`
		Price         float64 `json:"price"`
		Seq           int64   `json:"seq"`
		Buy           bool    `json:"buy"`
		Quantity      float64 `json:"qty"`
		OrderID       string  `json:"order_id"`
		ClientOrderID string  `json:"cli_order_id"`
		FillID        string  `json:"fill_id"`
		FillType      string  `json:"fill_type"`
	} `json:"fills"`
}

WsFuturesFillsData stores fills data for futures websocket

type WsFuturesNotifications

type WsFuturesNotifications struct {
	Feed          string `json:"feed"`
	Notifications []struct {
		ID               int64  `json:"id"`
		NotificationType string `json:"notificationType"`
		Priority         string `json:"priority"`
		Note             string `json:"note"`
		EffectiveTime    int64  `json:"effective_time"`
	}
}

WsFuturesNotifications stores notifications data for futures websocket

type WsFuturesOB

type WsFuturesOB struct {
	Feed      string     `json:"feed"`
	ProductID string     `json:"product_id"`
	Seq       int64      `json:"seq"`
	Bids      []wsOBItem `json:"bids"`
	Asks      []wsOBItem `json:"asks"`
}

WsFuturesOB stores orderbook data for futures websocket

type WsFuturesOpenOrders

type WsFuturesOpenOrders struct {
	Feed    string `json:"feed"`
	Account string `json:"account"`
	Orders  []struct {
		Instrument     string  `json:"instrument"`
		Time           int64   `json:"time"`
		LastUpdateTime int64   `json:"last_update_time"`
		Qty            float64 `json:"qty"`
		Filled         float64 `json:"filled"`
		LimitPrice     float64 `json:"limit_price"`
		StopPrice      float64 `json:"stop_price"`
		OrderType      string  `json:"order_type"`
		OrderID        string  `json:"order_id"`
		Direction      string  `json:"direction"`
		ReduceOnly     bool    `json:"reduce_only"`
	} `json:"orders"`
}

WsFuturesOpenOrders stores open orders data for futures websocket

type WsFuturesTickerLite

type WsFuturesTickerLite struct {
	Feed      string  `json:"feed"`
	ProductID string  `json:"product_id"`
	Bid       float64 `json:"bid"`
	Ask       float64 `json:"ask"`
	Change    float64 `json:"change"`
	Premium   float64 `json:"premium"`
	Volume    float64 `json:"volume"`
	Tag       string  `json:"tag"`
	Pair      string  `json:"pair"`
	DTM       float64 `json:"dtm"`
}

WsFuturesTickerLite stores ticker lite data for futures websocket

type WsFuturesTradeData

type WsFuturesTradeData struct {
	Feed      string `json:"feed"`
	ProductID string `json:"product_id"`
	Trades    []struct {
		Feed        string  `json:"feed"`
		ProductID   string  `json:"product_id"`
		Side        string  `json:"side"`
		ProductType string  `json:"type"`
		Seq         int64   `json:"seq"`
		Time        int64   `json:"time"`
		Quantity    float64 `json:"qty"`
		Price       float64 `json:"price"`
	} `json:"trades"`
}

WsFuturesTradeData stores public trade data for futures websocket

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  float64 `json:"leverage,string"`
		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 WsOpenPositions

type WsOpenPositions struct {
	Feed      string `json:"feed"`
	Account   string `json:"account"`
	Positions []struct {
		Instrument    string  `json:"instrument"`
		Balance       float64 `json:"balance"`
		EntryPrice    float64 `json:"entry_price"`
		MarkPrice     float64 `json:"mark_price"`
		IndexPrice    float64 `json:"index_price"`
		ProfitAndLoss float64 `json:"pnl"`
	} `json:"positions"`
}

WsOpenPositions stores open positions data for futures websocket

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

type WsVerboseOpenOrders

type WsVerboseOpenOrders struct {
	Feed    string `json:"feed"`
	Account string `json:"account"`
	Orders  []struct {
		Instrument     string  `json:"instrument"`
		Time           int64   `json:"time"`
		LastUpdateTime int64   `json:"last_update_time"`
		Qty            float64 `json:"qty"`
		Filled         float64 `json:"filled"`
		LimitPrice     float64 `json:"limit_price"`
		StopPrice      float64 `json:"stop_price"`
		OrderType      string  `json:"type"`
		OrderID        string  `json:"order_id"`
		Direction      int64   `json:"direction"`
		ReduceOnly     bool    `json:"reduce_only"`
	} `json:"orders"`
}

WsVerboseOpenOrders stores verbose open orders data for futures websocket

Jump to

Keyboard shortcuts

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