bitfinex

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bitfinex

type Bitfinex struct {
	// contains filtered or unexported fields
}

func New

func New(client *http.Client, accessKey, secretKey string) *Bitfinex

func (*Bitfinex) ActiveCredits

func (bfx *Bitfinex) ActiveCredits() (error, []LendOrder)

func (*Bitfinex) ActiveLendOrders

func (bfx *Bitfinex) ActiveLendOrders() (error, []LendOrder)

func (*Bitfinex) CancelLendOrder

func (bfx *Bitfinex) CancelLendOrder(id int) (error, *LendOrder)

func (*Bitfinex) CancelOrder

func (bfx *Bitfinex) CancelOrder(orderId string, currencyPair CurrencyPair) (bool, error)

func (*Bitfinex) GetAccount

func (bfx *Bitfinex) GetAccount() (*Account, error)

defalut only return exchange wallet balance

func (*Bitfinex) GetDepositWalletBalance

func (bfx *Bitfinex) GetDepositWalletBalance() (*Account, error)

func (*Bitfinex) GetDepth

func (bfx *Bitfinex) GetDepth(size int, currencyPair CurrencyPair) (*Depth, error)

func (*Bitfinex) GetExchangeName

func (bfx *Bitfinex) GetExchangeName() string

func (*Bitfinex) GetKlineRecords

func (bfx *Bitfinex) GetKlineRecords(currencyPair CurrencyPair, period KlinePeriod, size int, optional ...OptionalParameter) ([]Kline, error)

func (*Bitfinex) GetLendBook

func (bfx *Bitfinex) GetLendBook(currency Currency) (error, *LendBook)

func (*Bitfinex) GetLendOrderStatus

func (bfx *Bitfinex) GetLendOrderStatus(id int) (error, *LendOrder)

func (*Bitfinex) GetLendTickers

func (bfx *Bitfinex) GetLendTickers() ([]LendTicker, error)

func (*Bitfinex) GetMarginInfos

func (bfx *Bitfinex) GetMarginInfos() ([]MarginInfo, error)

func (*Bitfinex) GetMarginTradingWalletBalance

func (bfx *Bitfinex) GetMarginTradingWalletBalance() (*Account, error)

func (*Bitfinex) GetOneOrder

func (bfx *Bitfinex) GetOneOrder(orderId string, currencyPair CurrencyPair) (*Order, error)

func (*Bitfinex) GetOrderHistorys

func (bfx *Bitfinex) GetOrderHistorys(currencyPair CurrencyPair, optional ...OptionalParameter) ([]Order, error)

func (*Bitfinex) GetTicker

func (bfx *Bitfinex) GetTicker(currencyPair CurrencyPair) (*Ticker, error)

func (*Bitfinex) GetTrades

func (bfx *Bitfinex) GetTrades(currencyPair CurrencyPair, since int64) ([]Trade, error)

func (*Bitfinex) GetUnfinishOrders

func (bfx *Bitfinex) GetUnfinishOrders(currencyPair CurrencyPair) ([]Order, error)

func (*Bitfinex) GetWalletBalances

func (bfx *Bitfinex) GetWalletBalances() (map[string]*Account, error)

func (*Bitfinex) LimitBuy

func (bfx *Bitfinex) LimitBuy(amount, price string, currencyPair CurrencyPair, opt ...LimitOrderOptionalParameter) (*Order, error)

func (*Bitfinex) LimitSell

func (bfx *Bitfinex) LimitSell(amount, price string, currencyPair CurrencyPair, opt ...LimitOrderOptionalParameter) (*Order, error)

func (*Bitfinex) MarginLimitBuy

func (bfx *Bitfinex) MarginLimitBuy(amount, price string, currencyPair CurrencyPair) (*Order, error)

func (*Bitfinex) MarginLimitSell

func (bfx *Bitfinex) MarginLimitSell(amount, price string, currencyPair CurrencyPair) (*Order, error)

func (*Bitfinex) MarginMarketBuy

func (bfx *Bitfinex) MarginMarketBuy(amount, price string, currencyPair CurrencyPair) (*Order, error)

func (*Bitfinex) MarginMarketSell

func (bfx *Bitfinex) MarginMarketSell(amount, price string, currencyPair CurrencyPair) (*Order, error)

func (*Bitfinex) MarketBuy

func (bfx *Bitfinex) MarketBuy(amount, price string, currencyPair CurrencyPair) (*Order, error)

func (*Bitfinex) MarketSell

func (bfx *Bitfinex) MarketSell(amount, price string, currencyPair CurrencyPair) (*Order, error)

func (*Bitfinex) MytradesFunding

func (bfx *Bitfinex) MytradesFunding(currency Currency, limit int) (error, []TradeFunding)

func (*Bitfinex) NewLendOrder

func (bfx *Bitfinex) NewLendOrder(currency Currency, amount, rate string, period int) (error, *LendOrder)

func (*Bitfinex) NewLoanOrder

func (bfx *Bitfinex) NewLoanOrder(currency Currency, amount, rate string, period int) (error, *LendOrder)

func (*Bitfinex) OffersHistory

func (bfx *Bitfinex) OffersHistory(limit int) (error, []LendOrder)

func (*Bitfinex) StopBuy

func (bfx *Bitfinex) StopBuy(amount, price string, currencyPair CurrencyPair) (*Order, error)

func (*Bitfinex) StopSell

func (bfx *Bitfinex) StopSell(amount, price string, currencyPair CurrencyPair) (*Order, error)

func (*Bitfinex) Transfer

func (bfx *Bitfinex) Transfer(amount float64, currency Currency, fromWallet, toWallet string) error

type BitfinexWs

type BitfinexWs struct {
	*WsBuilder
	sync.Once
	// contains filtered or unexported fields
}

func NewWs

func NewWs() *BitfinexWs

func (*BitfinexWs) SetCallbacks

func (bws *BitfinexWs) SetCallbacks(tickerCallback func(*Ticker), tradeCallback func(*Trade), candleCallback func(*Kline))

func (*BitfinexWs) SubscribeCandle

func (bws *BitfinexWs) SubscribeCandle(pair CurrencyPair, klinePeriod KlinePeriod) error

func (*BitfinexWs) SubscribeTicker

func (bws *BitfinexWs) SubscribeTicker(pair CurrencyPair) error

func (*BitfinexWs) SubscribeTrade

func (bws *BitfinexWs) SubscribeTrade(pair CurrencyPair) error

type EventMap

type EventMap map[int64]SubscribeEvent

type LendBook

type LendBook struct {
	Bids []LendBookItem `json:"bids"`
	Asks []LendBookItem `json:"asks"`
}

type LendBookItem

type LendBookItem struct {
	Rate      float64 `json:",string"`
	Amount    float64 `json:",string"`
	Period    int     `json:"period"`
	Timestamp string  `json:"timestamp"`
	Frr       string  `json:"frr"`
}

type LendOrder

type LendOrder struct {
	Id              int     `json:"id"`
	Currency        string  `json:"currency"`
	Rate            float64 `json:"rate,string"`
	Period          int     `json:"period"`
	Direction       string  `json:"direction"`
	IsLive          bool    `json:"is_live"`
	IsCancelled     bool    `json:"is_cancelled"`
	Amount          float64 `json:"amount,string"`
	ExecutedAmount  float64 `json:"executed_amount,string"`
	RemainingAmount float64 `json:"remaining_amount,string"`
	OriginalAmount  float64 `json:"original_amount,string"`
	Timestamp       string  `json:"timestamp"`
}

type LendTicker

type LendTicker struct {
	Ticker
	Coin            Currency
	DailyChangePerc float64
}

type MarginInfo

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

type MarginLimits

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

type SubscribeEvent

type SubscribeEvent struct {
	Event     string `json:"event"`
	SubID     string `json:"subId"`
	Channel   string `json:"channel"`
	ChanID    int64  `json:"chanId"`
	Symbol    string `json:"symbol"`
	Precision string `json:"prec,omitempty"`
	Frequency string `json:"freq,omitempty"`
	Key       string `json:"key,omitempty"`
	Len       string `json:"len,omitempty"`
	Pair      string `json:"pair"`
}

type TradeFunding

type TradeFunding struct {
	Rate      string `json:"rate"`
	Period    string `json:"period"`
	Amount    string `json:"amount"`
	Timestamp string `json:"timestamp"`
	Type      string `json:"type"`
	Tid       int64  `json:"tid"`
	OfferId   int64  `json:"offer_id"`
}

Jump to

Keyboard shortcuts

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