bitfinex

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 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 BitfinexWs added in v1.2.6

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

func NewWs added in v1.2.6

func NewWs() *BitfinexWs

func (*BitfinexWs) SetCallbacks added in v1.2.6

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

func (*BitfinexWs) SubscribeCandle added in v1.2.6

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

func (*BitfinexWs) SubscribeTicker added in v1.2.6

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

func (*BitfinexWs) SubscribeTrade added in v1.2.6

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

type EventMap added in v1.2.6

type EventMap map[int64]SubscribeEvent

type Exchange added in v1.3.9

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

func New

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

func (*Exchange) ActiveCredits added in v1.3.9

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

func (*Exchange) ActiveLendOrders added in v1.3.9

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

func (*Exchange) CancelLendOrder added in v1.3.9

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

func (*Exchange) CancelOrder added in v1.3.9

func (exchange *Exchange) CancelOrder(orderId string, currencyPair CurrencyPair) (bool, error)

func (*Exchange) GetAccount added in v1.3.9

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

defalut only return exchange wallet balance

func (*Exchange) GetAssets added in v1.3.9

func (exchange *Exchange) GetAssets(currency CurrencyPair) (*Assets, error)

func (*Exchange) GetDepositWalletBalance added in v1.3.9

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

func (*Exchange) GetDepth added in v1.3.9

func (exchange *Exchange) GetDepth(size int, currencyPair CurrencyPair) (*Depth, error)

func (*Exchange) GetExchangeName added in v1.3.9

func (exchange *Exchange) GetExchangeName() string

func (*Exchange) GetKlineRecords added in v1.3.9

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

func (*Exchange) GetLendBook added in v1.3.9

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

func (*Exchange) GetLendOrderStatus added in v1.3.9

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

func (*Exchange) GetLendTickers added in v1.3.9

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

func (*Exchange) GetMarginInfos added in v1.3.9

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

func (*Exchange) GetMarginTradingWalletBalance added in v1.3.9

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

func (*Exchange) GetOneOrder added in v1.3.9

func (exchange *Exchange) GetOneOrder(orderId string, currencyPair CurrencyPair) (*Order, error)

func (*Exchange) GetOrderHistorys added in v1.3.9

func (exchange *Exchange) GetOrderHistorys(currencyPair CurrencyPair, optional ...OptionalParameter) ([]Order, error)

func (*Exchange) GetTicker added in v1.3.9

func (exchange *Exchange) GetTicker(currencyPair CurrencyPair) (*Ticker, error)

func (*Exchange) GetTradeHistory added in v1.3.9

func (exchange *Exchange) GetTradeHistory(currency CurrencyPair, optional ...OptionalParameter) ([]Trade, error)

func (*Exchange) GetTrades added in v1.3.9

func (exchange *Exchange) GetTrades(currencyPair CurrencyPair, since int64) ([]Trade, error)

func (*Exchange) GetUnfinishOrders added in v1.3.9

func (exchange *Exchange) GetUnfinishOrders(currencyPair CurrencyPair) ([]Order, error)

func (*Exchange) GetWalletBalances added in v1.3.9

func (exchange *Exchange) GetWalletBalances() (map[string]*Account, error)

func (*Exchange) LimitBuy added in v1.3.9

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

func (*Exchange) LimitSell added in v1.3.9

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

func (*Exchange) MarginLimitBuy added in v1.3.9

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

func (*Exchange) MarginLimitSell added in v1.3.9

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

func (*Exchange) MarginMarketBuy added in v1.3.9

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

func (*Exchange) MarginMarketSell added in v1.3.9

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

func (*Exchange) MarketBuy added in v1.3.9

func (exchange *Exchange) MarketBuy(amount, price string, currencyPair CurrencyPair) (*Order, error)

func (*Exchange) MarketSell added in v1.3.9

func (exchange *Exchange) MarketSell(amount, price string, currencyPair CurrencyPair) (*Order, error)

func (*Exchange) MytradesFunding added in v1.3.9

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

func (*Exchange) NewLendOrder added in v1.3.9

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

func (*Exchange) NewLoanOrder added in v1.3.9

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

func (*Exchange) OffersHistory added in v1.3.9

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

func (*Exchange) StopBuy added in v1.3.9

func (exchange *Exchange) StopBuy(amount, price string, currencyPair CurrencyPair) (*Order, error)

func (*Exchange) StopSell added in v1.3.9

func (exchange *Exchange) StopSell(amount, price string, currencyPair CurrencyPair) (*Order, error)

func (*Exchange) Transfer added in v1.3.9

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

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 added in v1.2.6

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