Documentation ¶
Overview ¶
Package bitfinex is the official client to access to bitfinex.com API
Index ¶
- Constants
- type AccountInfo
- type AccountPairFee
- type AccountService
- type ActiveOffer
- type Balance
- type BalancesService
- type BankAccount
- type Client
- type Credit
- type CreditsService
- type DepositResponse
- type DepositService
- type ErrorResponse
- type HistoryService
- func (s *HistoryService) Balance(currency, wallet string, since, until time.Time, limit int) ([]Balance, error)
- func (s *HistoryService) Movements(currency, method string, since, until time.Time, limit int) ([]Movement, error)
- func (s *HistoryService) Trades(pair string, since, until time.Time, limit int, reverse bool) ([]PastTrade, error)
- type KeyPerm
- type Lend
- type Lendbook
- type LendbookService
- type Lends
- type MarginFundingService
- func (s *MarginFundingService) Cancel(offerId int64) (MarginOffer, error)
- func (s *MarginFundingService) Credits() ([]ActiveOffer, error)
- func (s *MarginFundingService) NewLend(currency string, amount, rate float64, period int) (MarginOffer, error)
- func (s *MarginFundingService) NewLoan(currency string, amount, rate float64, period int) (MarginOffer, error)
- func (s *MarginFundingService) Offers() ([]ActiveOffer, error)
- func (s *MarginFundingService) Status(offerId int64) (MarginOffer, error)
- type MarginInfo
- type MarginInfoService
- type MarginLimit
- type MarginOffer
- type Movement
- type MultipleOrderResponse
- type Offer
- type OffersService
- type Order
- type OrderBook
- type OrderBookEntry
- type OrderBookService
- type OrderService
- func (s *OrderService) All() ([]Order, error)
- func (s *OrderService) Cancel(orderID int64) error
- func (s *OrderService) CancelAll() error
- func (s *OrderService) CancelMulti(orderIDS []int64) (string, error)
- func (s *OrderService) Create(symbol string, amount float64, price float64, orderType string) (*Order, error)
- func (s *OrderService) CreateMulti(orders []SubmitOrder) (MultipleOrderResponse, error)
- func (s *OrderService) Replace(orderID int64, useRemaining bool, newOrder SubmitOrder) (Order, error)
- func (s *OrderService) Status(orderID int64) (Order, error)
- type Pair
- type PairsService
- type PastTrade
- type Permissions
- type Position
- type PositionsService
- type Response
- type Stats
- type StatsService
- type SubmitOrder
- type Summary
- type SummaryProfit
- type SummaryVolume
- type TermData
- type Tick
- type TickerService
- type Trade
- type TradesService
- type TransferStatus
- type WalletBalance
- type WalletService
- func (c *WalletService) Transfer(amount float64, currency, from, to string) ([]TransferStatus, error)
- func (c *WalletService) WithdrawCrypto(amount float64, currency, wallet, destinationAddress string) ([]WithdrawStatus, error)
- func (c *WalletService) WithdrawWire(amount float64, expressWire bool, wallet string, ...) ([]WithdrawStatus, error)
- type WebSocketService
- func (w *WebSocketService) AddSubscribe(channel string, pair string, c chan []float64)
- func (w *WebSocketService) ClearSubscriptions()
- func (w *WebSocketService) Close()
- func (w *WebSocketService) Connect() error
- func (w *WebSocketService) ConnectPrivate(ch chan TermData)
- func (w *WebSocketService) Subscribe() error
- type WithdrawStatus
Constants ¶
const ( // BaseURL is the v1 REST endpoint. BaseURL = "https://api.bitfinex.com/v1/" // WebSocketURL the v1 Websocket endpoint. WebSocketURL = "wss://api-pub.bitfinex.com/ws/" )
const ( LEND = "lend" LOAN = "loan" )
const ( OrderTypeMarket = "market" OrderTypeLimit = "limit" OrderTypeStop = "stop" OrderTypeTrailingStop = "trailing-stop" OrderTypeFillOrKill = "fill-or-kill" OrderTypeExchangeMarket = "exchange market" OrderTypeExchangeLimit = "exchange limit" OrderTypeExchangeStop = "exchange stop" OrderTypeExchangeTrailingStop = "exchange trailing-stop" OrderTypeExchangeFillOrKill = "exchange fill-or-kill" )
Order types that the API can return.
const ( WALLET_TRADING = "trading" WALLET_EXCHANGE = "exchange" WALLET_DEPOSIT = "deposit" )
const ( // Pairs BTCUSD = "BTCUSD" LTCUSD = "LTCUSD" LTCBTC = "LTCBTC" ETHUSD = "ETHUSD" ETHBTC = "ETHBTC" ETCUSD = "ETCUSD" ETCBTC = "ETCBTC" BFXUSD = "BFXUSD" BFXBTC = "BFXBTC" ZECUSD = "ZECUSD" ZECBTC = "ZECBTC" XMRUSD = "XMRUSD" XMRBTC = "XMRBTC" RRTUSD = "RRTUSD" RRTBTC = "RRTBTC" XRPUSD = "XRPUSD" XRPBTC = "XRPBTC" EOSETH = "EOSETH" EOSUSD = "EOSUSD" EOSBTC = "EOSBTC" IOTUSD = "IOTUSD" IOTBTC = "IOTBTC" IOTETH = "IOTETH" BCCBTC = "BCCBTC" BCUBTC = "BCUBTC" BCCUSD = "BCCUSD" BCUUSD = "BCUUSD" // Channels ChanBook = "book" ChanTrade = "trades" ChanTicker = "ticker" )
Pairs available
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountInfo ¶
type AccountInfo struct { MakerFees float64 `json:"maker_fees,string"` TakerFees float64 `json:"taker_fees,string"` Fees []AccountPairFee }
type AccountPairFee ¶
type AccountService ¶
type AccountService struct {
// contains filtered or unexported fields
}
func (*AccountService) Info ¶
func (a *AccountService) Info() (AccountInfo, error)
GET account_infos
func (*AccountService) KeyPermission ¶
func (a *AccountService) KeyPermission() (Permissions, error)
func (*AccountService) Summary ¶
func (a *AccountService) Summary() (Summary, error)
type ActiveOffer ¶
type ActiveOffer struct { ID int64 Currency string Rate string Period int Direction string Timestamp string IsLive bool `json:"is_live"` IsCancelled bool `json:"is_cancelled"` OriginalAmount string `json:"original_amount"` RemainingAmount string `json:"remaining_amount"` ExecutedAmount string `json:"executed_amount"` }
type BalancesService ¶
type BalancesService struct {
// contains filtered or unexported fields
}
type BankAccount ¶
type Client ¶
type Client struct { // Base URL for API requests. BaseURL *url.URL WebSocketURL string WebSocketTLSSkipVerify bool // Auth data APIKey string APISecret string // Services Pairs *PairsService Stats *StatsService Ticker *TickerService Account *AccountService Balances *BalancesService Offers *OffersService Credits *CreditsService Deposit *DepositService Lendbook *LendbookService MarginInfo *MarginInfoService MarginFunding *MarginFundingService OrderBook *OrderBookService Orders *OrderService Trades *TradesService Positions *PositionsService History *HistoryService WebSocket *WebSocketService Wallet *WalletService }
Client manages all the communication with the Bitfinex API.
type CreditsService ¶
type CreditsService struct {
// contains filtered or unexported fields
}
func (*CreditsService) All ¶
func (c *CreditsService) All() ([]Credit, error)
Returns an array of Credit
type DepositResponse ¶
func (*DepositResponse) Success ¶
func (d *DepositResponse) Success() (bool, error)
type DepositService ¶
type DepositService struct {
// contains filtered or unexported fields
}
func (*DepositService) New ¶
func (s *DepositService) New(method, walletName string, renew int) (DepositResponse, error)
type ErrorResponse ¶
ErrorResponse is the custom error type that is returned if the API returns an error.
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type HistoryService ¶
type HistoryService struct {
// contains filtered or unexported fields
}
type LendbookService ¶
type LendbookService struct {
// contains filtered or unexported fields
}
type Lends ¶
type MarginFundingService ¶
type MarginFundingService struct {
// contains filtered or unexported fields
}
func (*MarginFundingService) Cancel ¶
func (s *MarginFundingService) Cancel(offerId int64) (MarginOffer, error)
func (*MarginFundingService) Credits ¶
func (s *MarginFundingService) Credits() ([]ActiveOffer, error)
func (*MarginFundingService) NewLend ¶
func (s *MarginFundingService) NewLend(currency string, amount, rate float64, period int) (MarginOffer, error)
func (*MarginFundingService) NewLoan ¶
func (s *MarginFundingService) NewLoan(currency string, amount, rate float64, period int) (MarginOffer, error)
func (*MarginFundingService) Offers ¶
func (s *MarginFundingService) Offers() ([]ActiveOffer, error)
func (*MarginFundingService) Status ¶
func (s *MarginFundingService) Status(offerId int64) (MarginOffer, error)
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 []MarginLimit `json:"margin_limits,string"` Message string `json:"message"` }
type MarginInfoService ¶
type MarginInfoService struct {
// contains filtered or unexported fields
}
func (*MarginInfoService) All ¶
func (s *MarginInfoService) All() ([]MarginInfo, error)
GET /margin_infos
type MarginLimit ¶
type MarginOffer ¶
type MarginOffer struct { ID int64 Currency string Rate string Period int Direction string Timestamp string IsLive bool `json:"is_live"` IsCancelled bool `json:"is_cancelled"` OriginalAmount string `json:"original_amount"` RemainingAmount string `json:"remaining_amount"` ExecutedAmount string `json:"executed_amount"` OfferId int }
type MultipleOrderResponse ¶
MultipleOrderResponse bundles orders returned by the CreateMulti method.
type Offer ¶
type Offer struct { Id int64 Currency string Rate string Period int64 Direction string Timestamp string IsLive bool `json:"is_live"` IsCancelled bool `json:"is_cancelled"` OriginalAmount string `json:"original_amount:string"` RemainingAmount string `json:"remaining_amount:string"` ExecutedAmount string `json:"executed_amount:string"` OfferId int64 `json:"offer_id"` }
type OffersService ¶
type OffersService struct {
// contains filtered or unexported fields
}
type Order ¶
type Order struct { ID int64 Symbol string Exchange string Price string AvgExecutionPrice string `json:"avg_execution_price"` Side string Type string Timestamp string IsLive bool `json:"is_live"` IsCanceled bool `json:"is_cancelled"` IsHidden bool `json:"is_hidden"` WasForced bool `json:"was_forced"` OriginalAmount string `json:"original_amount"` RemainingAmount string `json:"remaining_amount"` ExecutedAmount string `json:"executed_amount"` }
Order represents one order on the bitfinex platform.
type OrderBook ¶
type OrderBook struct { Bids []OrderBookEntry Asks []OrderBookEntry }
type OrderBookEntry ¶
type OrderBookService ¶
type OrderBookService struct {
// contains filtered or unexported fields
}
type OrderService ¶
type OrderService struct {
// contains filtered or unexported fields
}
OrderService manages the Order endpoint.
func (*OrderService) All ¶
func (s *OrderService) All() ([]Order, error)
All returns all orders for the authenticated account.
func (*OrderService) Cancel ¶
func (s *OrderService) Cancel(orderID int64) error
Cancel the order with id `orderID`.
func (*OrderService) CancelAll ¶
func (s *OrderService) CancelAll() error
CancelAll active orders for the authenticated account.
func (*OrderService) CancelMulti ¶
func (s *OrderService) CancelMulti(orderIDS []int64) (string, error)
CancelMulti allows batch cancellation of orders.
func (*OrderService) Create ¶
func (s *OrderService) Create(symbol string, amount float64, price float64, orderType string) (*Order, error)
Create a new order.
func (*OrderService) CreateMulti ¶
func (s *OrderService) CreateMulti(orders []SubmitOrder) (MultipleOrderResponse, error)
CreateMulti allows batch creation of orders.
func (*OrderService) Replace ¶
func (s *OrderService) Replace(orderID int64, useRemaining bool, newOrder SubmitOrder) (Order, error)
Replace an Order
type Pair ¶
type Pair struct { Pair string PricePrecision int `json:"price_precision,int"` 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 Margin bool }
Detailed Pair
type PairsService ¶
type PairsService struct {
// contains filtered or unexported fields
}
func (*PairsService) All ¶
func (p *PairsService) All() ([]string, error)
Get all Pair names as array of strings
func (*PairsService) AllDetailed ¶
func (p *PairsService) AllDetailed() ([]Pair, error)
Return a list of detailed pairs
type Permissions ¶
type Position ¶
type Position struct { ID int Symbol string Amount string Status string Base string Timestamp string Swap string Pl string }
Position structure
type PositionsService ¶
type PositionsService struct {
// contains filtered or unexported fields
}
PositionsService structure
func (*PositionsService) All ¶
func (b *PositionsService) All() ([]Position, error)
All - gets all positions
type StatsService ¶
type StatsService struct {
// contains filtered or unexported fields
}
type SubmitOrder ¶
SubmitOrder is an order to be created on the bitfinex platform.
type Summary ¶
type Summary struct { TradeVolume SummaryVolume `json:"trade_vol_30d"` FundingProfit SummaryProfit `json:"funding_profit_30d"` MakerFee string `json:"maker_fee"` TakerFee string `json:"taker_fee"` }
type SummaryProfit ¶
type SummaryVolume ¶
type TermData ¶
type TermData struct { // Data term. E.g: ps, ws, ou, etc... See official documentation for more details. Term string // Data will contain different number of elements for each term. // Examples: // Term: ws, Data: ["exchange","BTC",0.01410829,0] // Term: oc, Data: [0,"BTCUSD",0,-0.01,"","CANCELED",270,0,"2015-10-15T11:26:13Z",0] Data []interface{} Error string }
type Tick ¶
type TickerService ¶
type TickerService struct {
// contains filtered or unexported fields
}
type Trade ¶
type TradesService ¶
type TradesService struct {
// contains filtered or unexported fields
}
type TransferStatus ¶
type WalletBalance ¶
type WalletService ¶
type WalletService struct {
// contains filtered or unexported fields
}
func (*WalletService) Transfer ¶
func (c *WalletService) Transfer(amount float64, currency, from, to string) ([]TransferStatus, error)
Transfer funds between wallets
func (*WalletService) WithdrawCrypto ¶
func (c *WalletService) WithdrawCrypto(amount float64, currency, wallet, destinationAddress string) ([]WithdrawStatus, error)
Withdraw a cryptocurrency to a digital wallet
func (*WalletService) WithdrawWire ¶
func (c *WalletService) WithdrawWire(amount float64, expressWire bool, wallet string, beneficiaryBank, intermediaryBank BankAccount, message string) ([]WithdrawStatus, error)
type WebSocketService ¶
type WebSocketService struct {
// contains filtered or unexported fields
}
WebSocketService allow to connect and receive stream data from bitfinex.com ws service. nolint:megacheck,structcheck
func NewWebSocketService ¶
func NewWebSocketService(c *Client) *WebSocketService
NewWebSocketService returns a WebSocketService using the given client.
func (*WebSocketService) AddSubscribe ¶
func (w *WebSocketService) AddSubscribe(channel string, pair string, c chan []float64)
func (*WebSocketService) ClearSubscriptions ¶
func (w *WebSocketService) ClearSubscriptions()
func (*WebSocketService) Connect ¶
func (w *WebSocketService) Connect() error
Connect create new bitfinex websocket connection
func (*WebSocketService) ConnectPrivate ¶
func (w *WebSocketService) ConnectPrivate(ch chan TermData)
func (*WebSocketService) Subscribe ¶
func (w *WebSocketService) Subscribe() error
Subscribe allows to subsribe to channels and watch for new updates. This method supports next channels: book, trade, ticker.