bitfinex

package
v0.0.0-...-e477184 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2017 License: MIT Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const (
	InvalidAPIKeyErrCode = 10100
	MaintenanceErrCode   = 20060 // API endpoint under maintenance... try again later
)

Error codes that may be returned by SendAuthenticatedHTTPRequest2

View Source
const (
	// WalletTypeExchange contains funds that can be used for regular orders
	WalletTypeExchange = "exchange"
	// WalletTypeMargin contains funds that can be used for margin orders
	WalletTypeMargin = "trading"
	// WalletTypeFunding contains funds that can be used to provide funding for other traders
	WalletTypeFunding = "deposit"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountFees

type AccountFees struct {
	Withdraw struct {
		BTC float64 `json:"BTC,string"`
		LTC float64 `json:"LTC,string"`
		ETH float64 `json:"ETH,string"`
		ETC float64 `json:"ETC,string"`
		ZEC float64 `json:"ZEC,string"`
		XMR float64 `json:"XMR,string"`
		DSH float64 `json:"DSH,string"`
		XRP float64 `json:"XRP,string"`
		IOT float64 `json:"IOT"`
		EOS float64 `json:"EOS,string"`
		SAN float64 `json:"SAN,string"`
		OMG float64 `json:"OMG,string"`
		BCH float64 `json:"BCH,string"`
	} `json:"withdraw"`
}

AccountFees stores withdrawal account fee data from Bitfinex

type AccountInfo

type AccountInfo struct {
	MakerFees string `json:"maker_fees"`
	TakerFees string `json:"taker_fees"`
	Fees      []struct {
		Pairs     string `json:"pairs"`
		MakerFees string `json:"maker_fees"`
		TakerFees string `json:"taker_fees"`
	} `json:"fees"`
}

AccountInfo general account information with fees

type AccountSummary

type AccountSummary struct {
	TradeVolumePer30D []Currency `json:"trade_vol_30d"`
	FundingProfit30D  []Currency `json:"funding_profit_30d"`
	MakerFee          float64    `json:"maker_fee"`
	TakerFee          float64    `json:"taker_fee"`
}

AccountSummary holds account summary data

type Balance

type Balance struct {
	Type      WalletType      `json:"type"`
	Currency  string          `json:"currency"`
	Amount    decimal.Decimal `json:"amount,string"`    // Current balance
	Available decimal.Decimal `json:"available,string"` // Amount available for trading
}

Balance holds current balance data

type BalanceHistory

type BalanceHistory struct {
	Currency    string  `json:"currency"`
	Amount      float64 `json:"amount,string"`
	Balance     float64 `json:"balance,string"`
	Description string  `json:"description"`
	Timestamp   string  `json:"timestamp"`
}

BalanceHistory holds balance history information

type Bitfinex

type Bitfinex struct {
	exchange.Base
	WebsocketConn         *websocket.Conn
	WebsocketSubdChannels map[int]WebsocketChanInfo
	// contains filtered or unexported fields
}

Bitfinex is the overarching type across the bitfinex package Notes: Bitfinex has added a rate limit to the number of REST requests. Rate limit policy can vary in a range of 10 to 90 requests per minute depending on some factors (e.g. servers load, endpoint, etc.).

func (*Bitfinex) CalcAvailableBalance

func (b *Bitfinex) CalcAvailableBalance(
	symbol string, side exchange.OrderSide, rate float64, orderType exchange.OrderType) (float64, error)

func (*Bitfinex) CancelAllOrders

func (b *Bitfinex) CancelAllOrders() (string, error)

CancelAllOrders cancels all active and open orders

func (*Bitfinex) CancelMultipleOrders

func (b *Bitfinex) CancelMultipleOrders(OrderIDs []int64) (string, error)

CancelMultipleOrders cancels multiple orders

func (*Bitfinex) CancelOffer

func (b *Bitfinex) CancelOffer(OfferID int64) (Offer, error)

CancelOffer cancels offer by offerID

func (*Bitfinex) CancelOrder

func (b *Bitfinex) CancelOrder(orderStr string, currencyPair pair.CurrencyPair) error

func (*Bitfinex) ClaimPosition

func (b *Bitfinex) ClaimPosition(PositionID int) (Position, error)

ClaimPosition allows positions to be claimed

func (*Bitfinex) CloseMarginFunding

func (b *Bitfinex) CloseMarginFunding(SwapID int64) (Offer, error)

CloseMarginFunding closes an unused or used taken fund

func (*Bitfinex) CurrencyPairToSymbol

func (b *Bitfinex) CurrencyPairToSymbol(p pair.CurrencyPair) string

CurrencyPairToSymbol converts a currency pair to a symbol (exchange specific market identifier).

func (*Bitfinex) GetAccountBalance

func (b *Bitfinex) GetAccountBalance() ([]Balance, error)

GetAccountBalance returns full wallet balance information

func (*Bitfinex) GetAccountFees

func (b *Bitfinex) GetAccountFees() (AccountFees, error)

GetAccountFees - NOT YET IMPLEMENTED

func (*Bitfinex) GetAccountInfo

func (b *Bitfinex) GetAccountInfo() ([]AccountInfo, error)

GetAccountInfo returns information about your account incl. trading fees

func (*Bitfinex) GetAccountSummary

func (b *Bitfinex) GetAccountSummary() (AccountSummary, error)

GetAccountSummary returns a 30-day summary of your trading volume and return on margin funding

func (*Bitfinex) GetActiveCredits

func (b *Bitfinex) GetActiveCredits() ([]Offer, error)

GetActiveCredits returns all available credits

func (*Bitfinex) GetActiveMarginFunding

func (b *Bitfinex) GetActiveMarginFunding() ([]MarginFunds, error)

GetActiveMarginFunding returns an array of active margin funds

func (*Bitfinex) GetActiveOffers

func (b *Bitfinex) GetActiveOffers() ([]Offer, error)

GetActiveOffers returns all current active offers

func (*Bitfinex) GetActiveOrders

func (b *Bitfinex) GetActiveOrders() ([]Order, error)

GetActiveOrders returns all active orders and statuses

func (*Bitfinex) GetActivePositions

func (b *Bitfinex) GetActivePositions() ([]Position, error)

GetActivePositions returns an array of active positions

func (*Bitfinex) GetAvailableBalance

func (b *Bitfinex) GetAvailableBalance(currencyPair pair.CurrencyPair, side exchange.OrderSide,
	price float64, orderType exchange.OrderType) (float64, error)

GetAvailableBalance will attempt to compute the available balance for an order with the given parameters. This is primarily intended for checking the available balance for margin orders, where simply checking the exchange wallet balance is not sufficient.

func (*Bitfinex) GetBalanceHistory

func (b *Bitfinex) GetBalanceHistory(symbol string, timeSince, timeUntil time.Time, limit int, wallet string) ([]BalanceHistory, error)

GetBalanceHistory returns balance history for the account

func (*Bitfinex) GetCurrencyPairs

func (b *Bitfinex) GetCurrencyPairs() map[pair.CurrencyItem]*exchange.CurrencyPairInfo

Returns currency pairs that can be used by the exchange account associated with this bot. Use FormatExchangeCurrency to get the right key.

func (*Bitfinex) GetExchangeAccountInfo

func (b *Bitfinex) GetExchangeAccountInfo() (exchange.AccountInfo, error)

GetExchangeAccountInfo retrieves balances for all enabled currencies on the Bitfinex exchange

func (*Bitfinex) GetFundingBook

func (b *Bitfinex) GetFundingBook(symbol string) (FundingBook, error)

GetFundingBook the entire margin funding book for both bids and asks sides per currency string symbol - example "USD"

func (*Bitfinex) GetKeyPermissions

func (b *Bitfinex) GetKeyPermissions() (KeyPermissions, error)

GetKeyPermissions checks the permissions of the key being used to generate this request.

func (*Bitfinex) GetLendbook

func (b *Bitfinex) GetLendbook(symbol string, values url.Values) (Lendbook, error)

GetLendbook returns a list of the most recent funding data for the given currency: total amount provided and Flash Return Rate (in % by 365 days) over time Symbol - example "USD"

func (*Bitfinex) GetLends

func (b *Bitfinex) GetLends(symbol string, values url.Values) ([]Lends, error)

GetLends returns a list of the most recent funding data for the given currency: total amount provided and Flash Return Rate (in % by 365 days) over time Symbol - example "USD"

func (*Bitfinex) GetLimits

func (b *Bitfinex) GetLimits() exchange.ILimits

GetLimits returns price/amount limits for the exchange.

func (*Bitfinex) GetMarginInfo

func (b *Bitfinex) GetMarginInfo() ([]MarginInfo, error)

GetMarginInfo shows your trading wallet information for margin trading

func (*Bitfinex) GetMarginTotalTakenFunds

func (b *Bitfinex) GetMarginTotalTakenFunds() ([]MarginTotalTakenFunds, error)

GetMarginTotalTakenFunds returns an array of active funding used in a position

func (*Bitfinex) GetMovementHistory

func (b *Bitfinex) GetMovementHistory(symbol, method string, timeSince, timeUntil time.Time, limit int) ([]MovementHistory, error)

GetMovementHistory returns an array of past deposits and withdrawals

func (*Bitfinex) GetOfferStatus

func (b *Bitfinex) GetOfferStatus(OfferID int64) (Offer, error)

GetOfferStatus checks offer status whether it has been cancelled, execute or is still active

func (*Bitfinex) GetOrder

func (b *Bitfinex) GetOrder(orderID string, currencyPair pair.CurrencyPair) (*exchange.Order, error)

GetOrder returns information about the exchange order matching the given ID

func (*Bitfinex) GetOrderStatus

func (b *Bitfinex) GetOrderStatus(OrderID int64) (Order, error)

GetOrderStatus returns order status information

func (*Bitfinex) GetOrderbook

func (b *Bitfinex) GetOrderbook(currencyPair string, values url.Values) (Orderbook, error)

GetOrderbook retieves the orderbook bid and ask price points for a currency pair - By default the response will return 25 bid and 25 ask price points. CurrencyPair - Example "BTCUSD" Values can contain limit amounts for both the asks and bids - Example "limit_bids" = 1000

func (*Bitfinex) GetOrderbookEx

func (b *Bitfinex) GetOrderbookEx(p pair.CurrencyPair, assetType string) (orderbook.Base, error)

GetOrderbookEx returns the orderbook for a currency pair

func (*Bitfinex) GetOrders

func (b *Bitfinex) GetOrders(pairs []pair.CurrencyPair) ([]*exchange.Order, error)

func (*Bitfinex) GetStats

func (b *Bitfinex) GetStats(symbol string) ([]Stat, error)

GetStats returns various statistics about the requested pair

func (*Bitfinex) GetSymbols

func (b *Bitfinex) GetSymbols() ([]string, error)

GetSymbols returns the available currency pairs on the exchange

func (*Bitfinex) GetSymbolsDetails

func (b *Bitfinex) GetSymbolsDetails() ([]SymbolDetails, error)

GetSymbolsDetails a list of valid symbol IDs and the pair details

func (*Bitfinex) GetTicker

func (b *Bitfinex) GetTicker(symbol string, values url.Values) (Ticker, error)

GetTicker returns ticker information

func (*Bitfinex) GetTickerPrice

func (b *Bitfinex) GetTickerPrice(p pair.CurrencyPair, assetType string) (ticker.Price, error)

GetTickerPrice returns the ticker for a currency pair

func (*Bitfinex) GetTradeHistory

func (b *Bitfinex) GetTradeHistory(currencyPair string, timestamp, until time.Time, limit, reverse int) ([]TradeHistory, error)

GetTradeHistory returns past executed trades

func (*Bitfinex) GetTrades

func (b *Bitfinex) GetTrades(currencyPair string, values url.Values) ([]TradeStructure, error)

GetTrades returns a list of the most recent trades for the given curencyPair By default the response will return 100 trades CurrencyPair - Example "BTCUSD" Values can contain limit amounts for the number of trades returned - Example "limit_trades" = 1000

func (*Bitfinex) GetUnusedMarginFunds

func (b *Bitfinex) GetUnusedMarginFunds() ([]MarginFunds, error)

GetUnusedMarginFunds returns an array of funding borrowed but not currently used

func (*Bitfinex) NewDeposit

func (b *Bitfinex) NewDeposit(method, walletName string, renew int) (DepositResponse, error)

NewDeposit returns a new deposit address Method - Example methods accepted: “bitcoin”, “litecoin”, “ethereum”, “tethers", "ethereumc", "zcash", "monero", "iota", "bcash" WalletName - accepted: “trading”, “exchange”, “deposit” renew - Default is 0. If set to 1, will return a new unused deposit address

func (*Bitfinex) NewOffer

func (b *Bitfinex) NewOffer(symbol string, amount, rate float64, period int64, direction string) (Offer, error)

NewOffer submits a new offer

func (*Bitfinex) NewOrder

func (b *Bitfinex) NewOrder(currencyPair pair.CurrencyPair, amount, price float64,
	side exchange.OrderSide, orderType exchange.OrderType) (string, error)

NewOrder submits a new order and returns the ID of the new exchange order

func (*Bitfinex) NewOrderMulti

func (b *Bitfinex) NewOrderMulti(orders []PlaceOrder) (OrderMultiResponse, error)

NewOrderMulti allows several new orders at once

func (*Bitfinex) ReplaceOrder

func (b *Bitfinex) ReplaceOrder(OrderID int64, Symbol string, Amount float64, Price float64, Buy bool, Type string, Hidden bool) (Order, error)

ReplaceOrder replaces an older order with a new order

func (*Bitfinex) Run

func (b *Bitfinex) Run()

Run implements the Bitfinex wrapper

func (*Bitfinex) SendAuthenticatedHTTPRequest

func (b *Bitfinex) SendAuthenticatedHTTPRequest(method, path string, params map[string]interface{}, result interface{}) error

SendAuthenticatedHTTPRequest sends an autheticated http request and json unmarshals result to a supplied variable

func (*Bitfinex) SendAuthenticatedHTTPRequest2

func (b *Bitfinex) SendAuthenticatedHTTPRequest2(method, path string, params map[string]interface{},
	result interface{}) (int, error)

SendAuthenticatedHTTPRequest2 sends a POST request to an authenticated endpoint, the response is decoded into the result object. Returns the Bitfinex error code and error message (if any).

func (*Bitfinex) SendRateLimitedHTTPRequest

func (b *Bitfinex) SendRateLimitedHTTPRequest(requestsPerMin uint, method string, apiVersion uint8,
	path string, params map[string]interface{}, result interface{}, defaultValue interface{}) error

SendRateLimitedHTTPRequest sends an HTTP request if the given number of requests per minute hasn't been exceeded for the specified method & path and unmarshals the response into the result parameter. If the number of requests per minute has been exceeded this method will set the result to the default value (which can be a pointer, but must not be nil), and return exchange.WarningHTTPRequestRateLimited.

func (*Bitfinex) SetDefaults

func (b *Bitfinex) SetDefaults()

SetDefaults sets the basic defaults for bitfinex

func (*Bitfinex) Setup

func (b *Bitfinex) Setup(exch config.ExchangeConfig)

Setup takes in the supplied exchange configuration details and sets params

func (*Bitfinex) Start

func (b *Bitfinex) Start()

Start starts the Bitfinex go routine

func (*Bitfinex) SymbolToCurrencyPair

func (b *Bitfinex) SymbolToCurrencyPair(symbol string) (pair.CurrencyPair, error)

SymbolToCurrencyPair converts a symbol (exchange specific market identifier) to a currency pair.

func (*Bitfinex) UpdateOrderbook

func (b *Bitfinex) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*Bitfinex) UpdateTicker

func (b *Bitfinex) UpdateTicker(p pair.CurrencyPair, assetType string) (ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*Bitfinex) WalletTransfer

func (b *Bitfinex) WalletTransfer(amount float64, currency, walletFrom, walletTo string) ([]WalletTransfer, error)

WalletTransfer move available balances between your wallets Amount - Amount to move Currency - example "BTC" WalletFrom - example "exchange" WalletTo - example "deposit"

func (*Bitfinex) WebsocketAddSubscriptionChannel

func (b *Bitfinex) WebsocketAddSubscriptionChannel(chanID int, channel, pair string)

WebsocketAddSubscriptionChannel adds a new subscription channel to the WebsocketSubdChannels map in bitfinex.go (Bitfinex struct)

func (*Bitfinex) WebsocketClient

func (b *Bitfinex) WebsocketClient()

WebsocketClient makes a connection with the websocket server

func (*Bitfinex) WebsocketPingHandler

func (b *Bitfinex) WebsocketPingHandler() error

WebsocketPingHandler sends a ping request to the websocket server

func (*Bitfinex) WebsocketSend

func (b *Bitfinex) WebsocketSend(data interface{}) error

WebsocketSend sends data to the websocket server

func (*Bitfinex) WebsocketSendAuth

func (b *Bitfinex) WebsocketSendAuth() error

WebsocketSendAuth sends a autheticated event payload

func (*Bitfinex) WebsocketSendUnauth

func (b *Bitfinex) WebsocketSendUnauth() error

WebsocketSendUnauth sends an unauthenticated payload

func (*Bitfinex) WebsocketSubscribe

func (b *Bitfinex) WebsocketSubscribe(channel string, params map[string]string) error

WebsocketSubscribe subscribes to the websocket channel

func (*Bitfinex) Withdrawal

func (b *Bitfinex) Withdrawal(withdrawType, wallet, address string, amount float64) ([]Withdrawal, error)

Withdrawal requests a withdrawal from one of your wallets. Major Upgrade needed on this function to include all query params

type Book

type Book struct {
	Price           float64 `json:"price,string"`
	Rate            float64 `json:"rate,string"`
	Amount          float64 `json:"amount,string"`
	Period          int     `json:"period"`
	Timestamp       string  `json:"timestamp"`
	FlashReturnRate string  `json:"frr"`
}

Book is a generalised sub-type to hold book information

type Currency

type Currency struct {
	Currency string  `json:"curr"`
	Volume   float64 `json:"vol,string"`
	Amount   float64 `json:"amount,string"`
}

Currency is a sub-type for AccountSummary data

type DepositResponse

type DepositResponse struct {
	Result   string `json:"string"`
	Method   string `json:"method"`
	Currency string `json:"currency"`
	Address  string `json:"address"`
}

DepositResponse holds deposit address information

type ErrorCapture

type ErrorCapture struct {
	Message string `json:"message"`
}

ErrorCapture is a simple type for returned errors from Bitfinex

type Fee

type Fee struct {
	Currency  string
	TakerFees float64
	MakerFees float64
}

Fee holds fee data for a specified currency

type FundingBook

type FundingBook struct {
	Bids []Book `json:"bids"`
	Asks []Book `json:"asks"`
}

FundingBook holds current the full margin funding book

type GenericResponse

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

GenericResponse holds the result for a generic response

type KeyPermissions

type KeyPermissions struct {
	Account   Permission `json:"account"`
	History   Permission `json:"history"`
	Orders    Permission `json:"orders"`
	Positions Permission `json:"positions"`
	Funding   Permission `json:"funding"`
	Wallets   Permission `json:"wallets"`
	Withdraw  Permission `json:"withdraw"`
}

KeyPermissions holds the key permissions for the API key set

type Lendbook

type Lendbook struct {
	Bids []Book `json:"bids"`
	Asks []Book `json:"asks"`
}

Lendbook holds most recent funding data for a relevant currency

type Lends

type Lends struct {
	Rate       float64 `json:"rate,string"`
	AmountLent float64 `json:"amount_lent,string"`
	AmountUsed float64 `json:"amount_used,string"`
	Timestamp  int64   `json:"timestamp"`
}

Lends holds the lent information by currency

type MarginData

type MarginData struct {
	MarginBalance     float64        `json:"margin_balance,string"`
	TradableBalance   float64        `json:"tradable_balance,string"`
	UnrealizedPL      int64          `json:"unrealized_pl"`
	UnrealizedSwap    int64          `json:"unrealized_swap"`
	NetValue          float64        `json:"net_value,string"`
	RequiredMargin    int64          `json:"required_margin"`
	Leverage          float64        `json:"leverage,string"`
	MarginRequirement float64        `json:"margin_requirement,string"`
	MarginLimits      []MarginLimits `json:"margin_limits"`
}

MarginData holds wallet information for margin trading

type MarginFunds

type MarginFunds struct {
	ID         int64   `json:"id"`
	PositionID int64   `json:"position_id"`
	Currency   string  `json:"currency"`
	Rate       float64 `json:"rate,string"`
	Period     int     `json:"period"`
	Amount     float64 `json:"amount,string"`
	Timestamp  string  `json:"timestamp"`
	AutoClose  bool    `json:"auto_close"`
}

MarginFunds holds active funding information used in a margin position

type MarginInfo

type MarginInfo struct {
	Info    MarginData
	Message string `json:"message"`
}

MarginInfo holds metadata for margin information from bitfinex

type MarginLimits

type MarginLimits struct {
	OnPair            string  `json:"on_pair"`
	InitialMargin     float64 `json:"initial_margin,string"`
	MarginRequirement float64 `json:"margin_requirement,string"`
	TradableBalance   float64 `json:"tradable_balance,string"`
}

MarginLimits holds limit data per pair

type MarginTotalTakenFunds

type MarginTotalTakenFunds struct {
	PositionPair string  `json:"position_pair"`
	TotalSwaps   float64 `json:"total_swaps,string"`
}

MarginTotalTakenFunds holds position funding including sum of active backing as total swaps

type MovementHistory

type MovementHistory struct {
	ID               int64   `json:"id"`
	TxID             int64   `json:"txid"`
	Currency         string  `json:"currency"`
	Method           string  `json:"method"`
	Type             string  `json:"withdrawal"`
	Amount           float64 `json:"amount,string"`
	Description      string  `json:"description"`
	Address          string  `json:"address"`
	Status           string  `json:"status"`
	Timestamp        string  `json:"timestamp"`
	TimestampCreated string  `json:"timestamp_created"`
	Fee              float64 `json:"fee"`
}

MovementHistory holds deposit and withdrawal history data

type Offer

type Offer struct {
	ID              int64   `json:"id"`
	Currency        string  `json:"currency"`
	Rate            float64 `json:"rate,string"`
	Period          int64   `json:"period"`
	Direction       string  `json:"direction"`
	Timestamp       string  `json:"timestamp"`
	Type            string  `json:"type"`
	IsLive          bool    `json:"is_live"`
	IsCancelled     bool    `json:"is_cancelled"`
	OriginalAmount  float64 `json:"original_amount,string"`
	RemainingAmount float64 `json:"remaining_amount,string"`
	ExecutedAmount  float64 `json:"executed_amount,string"`
}

Offer holds offer information

type Order

type Order struct {
	ID                    int64     `json:"id"`
	Symbol                string    `json:"symbol"`
	Exchange              string    `json:"exchange"`
	Price                 float64   `json:"price,string"`
	AverageExecutionPrice float64   `json:"avg_execution_price,string"`
	Side                  string    `json:"side"`
	Type                  OrderType `json:"type"`
	Timestamp             string    `json:"timestamp"`
	IsLive                bool      `json:"is_live"`
	IsCancelled           bool      `json:"is_cancelled"`
	IsHidden              bool      `json:"is_hidden"`
	WasForced             bool      `json:"was_forced"`
	OriginalAmount        float64   `json:"original_amount,string"`
	RemainingAmount       float64   `json:"remaining_amount,string"`
	ExecutedAmount        float64   `json:"executed_amount,string"`
	OrderID               int64     `json:"order_id"`
}

Order holds order information when an order is in the market

type OrderMultiResponse

type OrderMultiResponse struct {
	Orders []Order `json:"order_ids"`
	Status string  `json:"status"`
}

OrderMultiResponse holds order information on the executed orders

type OrderType

type OrderType string
const (
	OrderTypeMarginLimit   OrderType = "limit"
	OrderTypeExchangeLimit OrderType = "exchange limit"
)

type Orderbook

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

Orderbook holds orderbook information from bid and ask sides

type Permission

type Permission struct {
	Read  bool `json:"read"`
	Write bool `json:"write"`
}

Permission sub-type for KeyPermissions

type PlaceOrder

type PlaceOrder struct {
	Symbol   string  `json:"symbol"`
	Amount   float64 `json:"amount,string"`
	Price    float64 `json:"price,string"`
	Exchange string  `json:"exchange"`
	Side     string  `json:"side"`
	Type     string  `json:"type"`
}

PlaceOrder is used for order placement

type Position

type Position struct {
	ID        int64   `json:"id"`
	Symbol    string  `json:"string"`
	Status    string  `json:"active"`
	Base      float64 `json:"base,string"`
	Amount    float64 `json:"amount,string"`
	Timestamp string  `json:"timestamp"`
	Swap      float64 `json:"swap,string"`
	PL        float64 `json:"pl,string"`
}

Position holds position information

type Stat

type Stat struct {
	Period int64   `json:"period"`
	Volume float64 `json:"volume,string"`
}

Stat holds individual statistics from exchange

type SymbolDetails

type SymbolDetails struct {
	Pair             string  `json:"pair"`
	PricePrecision   int     `json:"price_precision"`
	InitialMargin    float64 `json:"initial_margin,string"`
	MinimumMargin    float64 `json:"minimum_margin,string"`
	MaximumOrderSize float64 `json:"maximum_order_size,string"`
	MinimumOrderSize float64 `json:"minimum_order_size,string"`
	Expiration       string  `json:"expiration"`
}

SymbolDetails holds currency pair information

type Ticker

type Ticker struct {
	Mid       float64 `json:"mid,string"`
	Bid       float64 `json:"bid,string"`
	Ask       float64 `json:"ask,string"`
	Last      float64 `json:"last_price,string"`
	Low       float64 `json:"low,string"`
	High      float64 `json:"high,string"`
	Volume    float64 `json:"volume,string"`
	Timestamp string  `json:"timestamp"`
}

Ticker holds basic ticker information from the exchange

type TradeHistory

type TradeHistory struct {
	Price       float64 `json:"price,string"`
	Amount      float64 `json:"amount,string"`
	Timestamp   string  `json:"timestamp"`
	Exchange    string  `json:"exchange"`
	Type        string  `json:"type"`
	FeeCurrency string  `json:"fee_currency"`
	FeeAmount   float64 `json:"fee_amount,string"`
	TID         int64   `json:"tid"`
	OrderID     int64   `json:"order_id"`
}

TradeHistory holds trade history data

type TradeStructure

type TradeStructure struct {
	Timestamp int64   `json:"timestamp"`
	Tid       int64   `json:"tid"`
	Price     float64 `json:"price,string"`
	Amount    float64 `json:"amount,string"`
	Exchange  string  `json:"exchange"`
	Type      string  `json:"sell"`
}

TradeStructure holds executed trade information

type WalletTransfer

type WalletTransfer struct {
	Status  string `json:"status"`
	Message string `json:"message"`
}

WalletTransfer holds status of wallet to wallet content transfer on exchange

type WalletType

type WalletType string

type WebsocketBook

type WebsocketBook struct {
	Price  float64
	Count  int
	Amount float64
}

WebsocketBook holds booking information

type WebsocketChanInfo

type WebsocketChanInfo struct {
	Channel string
	Pair    string
}

WebsocketChanInfo holds websocket channel information

type WebsocketOrder

type WebsocketOrder struct {
	OrderID    int64
	Pair       string
	Amount     float64
	OrigAmount float64
	OrderType  string
	Status     string
	Price      float64
	PriceAvg   float64
	Timestamp  string
	Notify     int
}

WebsocketOrder holds order data

type WebsocketPosition

type WebsocketPosition struct {
	Pair              string
	Status            string
	Amount            float64
	Price             float64
	MarginFunding     float64
	MarginFundingType int
}

WebsocketPosition holds position information

type WebsocketTicker

type WebsocketTicker struct {
	Bid             float64
	BidSize         float64
	Ask             float64
	AskSize         float64
	DailyChange     float64
	DialyChangePerc float64
	LastPrice       float64
	Volume          float64
}

WebsocketTicker holds ticker information

type WebsocketTrade

type WebsocketTrade struct {
	ID        int64
	Timestamp int64
	Price     float64
	Amount    float64
}

WebsocketTrade holds trade information

type WebsocketTradeExecuted

type WebsocketTradeExecuted struct {
	TradeID        int64
	Pair           string
	Timestamp      int64
	OrderID        int64
	AmountExecuted float64
	PriceExecuted  float64
}

WebsocketTradeExecuted holds executed trade data

type WebsocketWallet

type WebsocketWallet struct {
	Name              string
	Currency          string
	Balance           float64
	UnsettledInterest float64
}

WebsocketWallet holds wallet information

type Withdrawal

type Withdrawal struct {
	Status       string `json:"status"`
	Message      string `json:"message"`
	WithdrawalID int64  `json:"withdrawal_id,string"`
}

Withdrawal holds withdrawal status information

Jump to

Keyboard shortcuts

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