Documentation
¶
Index ¶
- Variables
- type AccountFees
- type AccountInfo
- type AccountInfoFees
- type AccountInfoFull
- type AccountSummary
- type Balance
- type BalanceHistory
- type Bitfinex
- func (b *Bitfinex) AuthenticateWebsocket() error
- func (b *Bitfinex) CalculateTradingFee(accountInfos []AccountInfo, purchasePrice, amount float64, c currency.Code, ...) (fee float64, err error)
- func (b *Bitfinex) CancelAllExistingOrders() (string, error)
- func (b *Bitfinex) CancelAllOrders(_ *exchange.OrderCancellation) (exchange.CancelAllOrdersResponse, error)
- func (b *Bitfinex) CancelExistingOrder(orderID int64) (Order, error)
- func (b *Bitfinex) CancelMultipleOrders(orderIDs []int64) (string, error)
- func (b *Bitfinex) CancelOffer(offerID int64) (Offer, error)
- func (b *Bitfinex) CancelOrder(order *exchange.OrderCancellation) error
- func (b *Bitfinex) ClaimPosition(positionID int) (Position, error)
- func (b *Bitfinex) CloseMarginFunding(swapID int64) (Offer, error)
- func (b *Bitfinex) ConvertSymbolToDepositMethod(c currency.Code) (method string, err error)
- func (b *Bitfinex) ConvertSymbolToWithdrawalType(c currency.Code) string
- func (b *Bitfinex) GenerateDefaultSubscriptions()
- func (b *Bitfinex) GetAccountBalance() ([]Balance, error)
- func (b *Bitfinex) GetAccountFees() (AccountFees, error)
- func (b *Bitfinex) GetAccountInfo() (exchange.AccountInfo, error)
- func (b *Bitfinex) GetAccountInformation() ([]AccountInfo, error)
- func (b *Bitfinex) GetAccountSummary() (AccountSummary, error)
- func (b *Bitfinex) GetActiveCredits() ([]Offer, error)
- func (b *Bitfinex) GetActiveMarginFunding() ([]MarginFunds, error)
- func (b *Bitfinex) GetActiveOffers() ([]Offer, error)
- func (b *Bitfinex) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
- func (b *Bitfinex) GetActivePositions() ([]Position, error)
- func (b *Bitfinex) GetBalanceHistory(symbol string, timeSince, timeUntil time.Time, limit int, wallet string) ([]BalanceHistory, error)
- func (b *Bitfinex) GetCryptocurrencyWithdrawalFee(c currency.Code, accountFees AccountFees) (fee float64, err error)
- func (b *Bitfinex) GetDepositAddress(cryptocurrency currency.Code, accountID string) (string, error)
- func (b *Bitfinex) GetExchangeHistory(p currency.Pair, assetType string) ([]exchange.TradeHistory, error)
- func (b *Bitfinex) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)
- func (b *Bitfinex) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)
- func (b *Bitfinex) GetFundingBook(symbol string) (FundingBook, error)
- func (b *Bitfinex) GetFundingHistory() ([]exchange.FundHistory, error)
- func (b *Bitfinex) GetInactiveOrders() ([]Order, error)
- func (b *Bitfinex) GetKeyPermissions() (KeyPermissions, error)
- func (b *Bitfinex) GetLatestSpotPrice(symbol string) (float64, error)
- func (b *Bitfinex) GetLendbook(symbol string, values url.Values) (Lendbook, error)
- func (b *Bitfinex) GetLends(symbol string, values url.Values) ([]Lends, error)
- func (b *Bitfinex) GetMarginInfo() ([]MarginInfo, error)
- func (b *Bitfinex) GetMarginTotalTakenFunds() ([]MarginTotalTakenFunds, error)
- func (b *Bitfinex) GetMovementHistory(symbol, method string, timeSince, timeUntil time.Time, limit int) ([]MovementHistory, error)
- func (b *Bitfinex) GetOfferStatus(offerID int64) (Offer, error)
- func (b *Bitfinex) GetOpenOrders() ([]Order, error)
- func (b *Bitfinex) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
- func (b *Bitfinex) GetOrderInfo(orderID string) (exchange.OrderDetail, error)
- func (b *Bitfinex) GetOrderStatus(orderID int64) (Order, error)
- func (b *Bitfinex) GetOrderbook(currencyPair string, values url.Values) (Orderbook, error)
- func (b *Bitfinex) GetOrderbookEx(p currency.Pair, assetType string) (orderbook.Base, error)
- func (b *Bitfinex) GetOrderbookV2(symbol, precision string, values url.Values) (OrderbookV2, error)
- func (b *Bitfinex) GetPlatformStatus() (int, error)
- func (b *Bitfinex) GetStats(symbol string) ([]Stat, error)
- func (b *Bitfinex) GetSubscriptions() ([]wshandler.WebsocketChannelSubscription, error)
- func (b *Bitfinex) GetSymbols() ([]string, error)
- func (b *Bitfinex) GetSymbolsDetails() ([]SymbolDetails, error)
- func (b *Bitfinex) GetTicker(symbol string) (Ticker, error)
- func (b *Bitfinex) GetTickerPrice(p currency.Pair, assetType string) (ticker.Price, error)
- func (b *Bitfinex) GetTickerV2(symb string) (Tickerv2, error)
- func (b *Bitfinex) GetTickersV2(symbols string) ([]Tickersv2, error)
- func (b *Bitfinex) GetTradeHistory(currencyPair string, timestamp, until time.Time, limit, reverse int) ([]TradeHistory, error)
- func (b *Bitfinex) GetTrades(currencyPair string, values url.Values) ([]TradeStructure, error)
- func (b *Bitfinex) GetTradesV2(currencyPair string, timestampStart, timestampEnd int64, reOrderResp bool) ([]TradeStructureV2, error)
- func (b *Bitfinex) GetUnusedMarginFunds() ([]MarginFunds, error)
- func (b *Bitfinex) GetWebsocket() (*wshandler.Websocket, error)
- func (b *Bitfinex) ModifyOrder(action *exchange.ModifyOrder) (string, error)
- func (b *Bitfinex) NewDeposit(method, walletName string, renew int) (DepositResponse, error)
- func (b *Bitfinex) NewOffer(symbol string, amount, rate float64, period int64, direction string) (Offer, error)
- func (b *Bitfinex) NewOrder(currencyPair string, amount, price float64, buy bool, orderType string, ...) (Order, error)
- func (b *Bitfinex) NewOrderMulti(orders []PlaceOrder) (OrderMultiResponse, error)
- func (b *Bitfinex) ReplaceOrder(orderID int64, symbol string, amount, price float64, buy bool, ...) (Order, error)
- func (b *Bitfinex) Run()
- func (b *Bitfinex) SendAuthenticatedHTTPRequest(method, path string, params map[string]interface{}, result interface{}) error
- func (b *Bitfinex) SendHTTPRequest(path string, result interface{}, verbose bool) error
- func (b *Bitfinex) SetDefaults()
- func (b *Bitfinex) Setup(exch *config.ExchangeConfig)
- func (b *Bitfinex) Start(wg *sync.WaitGroup)
- func (b *Bitfinex) SubmitOrder(p currency.Pair, side exchange.OrderSide, orderType exchange.OrderType, ...) (exchange.SubmitOrderResponse, error)
- func (b *Bitfinex) Subscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error
- func (b *Bitfinex) SubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
- func (b *Bitfinex) Unsubscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error
- func (b *Bitfinex) UnsubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
- func (b *Bitfinex) UpdateOrderbook(p currency.Pair, assetType string) (orderbook.Base, error)
- func (b *Bitfinex) UpdateTicker(p currency.Pair, assetType string) (ticker.Price, error)
- func (b *Bitfinex) WalletTransfer(amount float64, currency, walletFrom, walletTo string) ([]WalletTransfer, error)
- func (b *Bitfinex) WithdrawCryptocurrency(withdrawType, wallet, address, paymentID string, amount float64, ...) ([]Withdrawal, error)
- func (b *Bitfinex) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
- func (b *Bitfinex) WithdrawFIAT(withdrawalType, walletType string, withdrawRequest *exchange.WithdrawRequest) ([]Withdrawal, error)
- func (b *Bitfinex) WithdrawFiatFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
- func (b *Bitfinex) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.WithdrawRequest) (string, error)
- func (b *Bitfinex) WsAddSubscriptionChannel(chanID int, channel, pair string)
- func (b *Bitfinex) WsConnect() error
- func (b *Bitfinex) WsDataHandler()
- func (b *Bitfinex) WsInsertSnapshot(p currency.Pair, assetType string, books []WebsocketBook) error
- func (b *Bitfinex) WsPingHandler() error
- func (b *Bitfinex) WsSendAuth() error
- func (b *Bitfinex) WsSendUnauth() error
- func (b *Bitfinex) WsUpdateOrderbook(p currency.Pair, assetType string, book []WebsocketBook) error
- type Book
- type BookV2
- type Currency
- type DepositResponse
- type ErrorCapture
- type Fee
- type FundingBook
- type GenericResponse
- type KeyPermissions
- type Lendbook
- type Lends
- type MarginData
- type MarginFunds
- type MarginInfo
- type MarginLimits
- type MarginTotalTakenFunds
- type MovementHistory
- type Offer
- type Order
- type OrderMultiResponse
- type Orderbook
- type OrderbookV2
- type Permission
- type PlaceOrder
- type Position
- type Stat
- type SymbolDetails
- type Ticker
- type Tickersv2
- type Tickerv2
- type TimeInterval
- type TradeHistory
- type TradeStructure
- type TradeStructureV2
- type WalletTransfer
- type WebsocketBook
- type WebsocketChanInfo
- type WebsocketHandshake
- type WebsocketOrder
- type WebsocketPosition
- type WebsocketTicker
- type WebsocketTrade
- type WebsocketTradeData
- type WebsocketTradeExecuted
- type WebsocketWallet
- type Withdrawal
Constants ¶
This section is empty.
Variables ¶
var ( TimeIntervalMinute = TimeInterval("1m") TimeIntervalFiveMinutes = TimeInterval("5m") TimeIntervalFifteenMinutes = TimeInterval("15m") TimeIntervalThirtyMinutes = TimeInterval("30m") TimeIntervalHour = TimeInterval("1h") TimeIntervalThreeHours = TimeInterval("3h") TimeIntervalSixHours = TimeInterval("6h") TimeIntervalTwelveHours = TimeInterval("12h") TimeIntervalDay = TimeInterval("1d") TimeIntervalSevenDays = TimeInterval("7d") TimeIntervalFourteenDays = TimeInterval("14d") TimeIntervalMonth = TimeInterval("1M") )
TimeInvterval vars
Functions ¶
This section is empty.
Types ¶
type AccountFees ¶
type AccountFees struct {
Withdraw map[string]interface{} `json:"withdraw"`
}
AccountFees stores withdrawal account fee data from Bitfinex
type AccountInfo ¶
type AccountInfo struct { MakerFees float64 `json:"maker_fees,string"` TakerFees float64 `json:"taker_fees,string"` Fees []AccountInfoFees `json:"fees"` Message string `json:"message"` }
AccountInfo general account information with fees
type AccountInfoFees ¶
type AccountInfoFees struct { Pairs string `json:"pairs"` MakerFees float64 `json:"maker_fees,string"` TakerFees float64 `json:"taker_fees,string"` }
AccountInfoFees general account information with fees
type AccountInfoFull ¶
type AccountInfoFull struct { Info []AccountInfo Message string `json:"message"` }
AccountInfoFull adds the error message to Account info
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 string `json:"type"` Currency string `json:"currency"` Amount float64 `json:"amount,string"` Available float64 `json:"available,string"` }
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 *wshandler.WebsocketConnection WebsocketSubdChannels map[int]WebsocketChanInfo }
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) AuthenticateWebsocket ¶
AuthenticateWebsocket sends an authentication message to the websocket
func (*Bitfinex) CalculateTradingFee ¶
func (b *Bitfinex) CalculateTradingFee(accountInfos []AccountInfo, purchasePrice, amount float64, c currency.Code, isMaker bool) (fee float64, err error)
CalculateTradingFee returns an estimate of fee based on type of whether is maker or taker fee
func (*Bitfinex) CancelAllExistingOrders ¶
CancelAllExistingOrders cancels all active and open orders
func (*Bitfinex) CancelAllOrders ¶
func (b *Bitfinex) CancelAllOrders(_ *exchange.OrderCancellation) (exchange.CancelAllOrdersResponse, error)
CancelAllOrders cancels all orders associated with a currency pair
func (*Bitfinex) CancelExistingOrder ¶
CancelExistingOrder cancels a single order by OrderID
func (*Bitfinex) CancelMultipleOrders ¶
CancelMultipleOrders cancels multiple orders
func (*Bitfinex) CancelOffer ¶
CancelOffer cancels offer by offerID
func (*Bitfinex) CancelOrder ¶
func (b *Bitfinex) CancelOrder(order *exchange.OrderCancellation) error
CancelOrder cancels an order by its corresponding ID number
func (*Bitfinex) ClaimPosition ¶
ClaimPosition allows positions to be claimed
func (*Bitfinex) CloseMarginFunding ¶
CloseMarginFunding closes an unused or used taken fund
func (*Bitfinex) ConvertSymbolToDepositMethod ¶
ConvertSymbolToDepositMethod returns a converted currency deposit method
func (*Bitfinex) ConvertSymbolToWithdrawalType ¶
ConvertSymbolToWithdrawalType You need to have specific withdrawal types to withdraw from Bitfinex
func (*Bitfinex) GenerateDefaultSubscriptions ¶
func (b *Bitfinex) GenerateDefaultSubscriptions()
GenerateDefaultSubscriptions Adds default subscriptions to websocket to be handled by ManageSubscriptions()
func (*Bitfinex) GetAccountBalance ¶
GetAccountBalance returns full wallet balance information
func (*Bitfinex) GetAccountFees ¶
func (b *Bitfinex) GetAccountFees() (AccountFees, error)
GetAccountFees - Gets all fee rates for all currencies
func (*Bitfinex) GetAccountInfo ¶
func (b *Bitfinex) GetAccountInfo() (exchange.AccountInfo, error)
GetAccountInfo retrieves balances for all enabled currencies on the Bitfinex exchange
func (*Bitfinex) GetAccountInformation ¶
func (b *Bitfinex) GetAccountInformation() ([]AccountInfo, error)
GetAccountInformation 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 ¶
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 ¶
GetActiveOffers returns all current active offers
func (*Bitfinex) GetActiveOrders ¶
func (b *Bitfinex) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
GetActiveOrders retrieves any orders that are active/open
func (*Bitfinex) GetActivePositions ¶
GetActivePositions returns an array of active positions
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) GetCryptocurrencyWithdrawalFee ¶
func (b *Bitfinex) GetCryptocurrencyWithdrawalFee(c currency.Code, accountFees AccountFees) (fee float64, err error)
GetCryptocurrencyWithdrawalFee returns an estimate of fee based on type of transaction
func (*Bitfinex) GetDepositAddress ¶
func (b *Bitfinex) GetDepositAddress(cryptocurrency currency.Code, accountID string) (string, error)
GetDepositAddress returns a deposit address for a specified currency
func (*Bitfinex) GetExchangeHistory ¶
func (b *Bitfinex) GetExchangeHistory(p currency.Pair, assetType string) ([]exchange.TradeHistory, error)
GetExchangeHistory returns historic trade data since exchange opening.
func (*Bitfinex) GetFee ¶
func (b *Bitfinex) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)
GetFee returns an estimate of fee based on type of transaction
func (*Bitfinex) GetFeeByType ¶
func (b *Bitfinex) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)
GetFeeByType returns an estimate of fee based on type of transaction
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) GetFundingHistory ¶
func (b *Bitfinex) GetFundingHistory() ([]exchange.FundHistory, error)
GetFundingHistory returns funding history, deposits and withdrawals
func (*Bitfinex) GetInactiveOrders ¶
GetInactiveOrders returns order status information
func (*Bitfinex) GetKeyPermissions ¶
func (b *Bitfinex) GetKeyPermissions() (KeyPermissions, error)
GetKeyPermissions checks the permissions of the key being used to generate this request.
func (*Bitfinex) GetLatestSpotPrice ¶
GetLatestSpotPrice returns latest spot price of symbol
symbol: string of currency pair
func (*Bitfinex) GetLendbook ¶
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 ¶
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) 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 ¶
GetOfferStatus checks offer status whether it has been cancelled, execute or is still active
func (*Bitfinex) GetOpenOrders ¶
GetOpenOrders returns all active orders and statuses
func (*Bitfinex) GetOrderHistory ¶
func (b *Bitfinex) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
GetOrderHistory retrieves account order information Can Limit response to specific order status
func (*Bitfinex) GetOrderInfo ¶
func (b *Bitfinex) GetOrderInfo(orderID string) (exchange.OrderDetail, error)
GetOrderInfo returns information on a current open order
func (*Bitfinex) GetOrderStatus ¶
GetOrderStatus returns order status information
func (*Bitfinex) GetOrderbook ¶
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 ¶
GetOrderbookEx returns the orderbook for a currency pair
func (*Bitfinex) GetOrderbookV2 ¶
GetOrderbookV2 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. symbol - Example "tBTCUSD" precision - P0,P1,P2,P3,R0 Values can contain limit amounts for both the asks and bids - Example "len" = 1000
func (*Bitfinex) GetPlatformStatus ¶
GetPlatformStatus returns the Bifinex platform status
func (*Bitfinex) GetSubscriptions ¶
func (b *Bitfinex) GetSubscriptions() ([]wshandler.WebsocketChannelSubscription, error)
GetSubscriptions returns a copied list of subscriptions
func (*Bitfinex) GetSymbols ¶
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) GetTickerPrice ¶
GetTickerPrice returns the ticker for a currency pair
func (*Bitfinex) GetTickerV2 ¶
GetTickerV2 returns ticker information
func (*Bitfinex) GetTickersV2 ¶
GetTickersV2 returns ticker information for multiple symbols
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 ¶
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) GetTradesV2 ¶
func (b *Bitfinex) GetTradesV2(currencyPair string, timestampStart, timestampEnd int64, reOrderResp bool) ([]TradeStructureV2, error)
GetTradesV2 uses the V2 API to get historic trades that occurred on the exchange
currencyPair e.g. "tBTCUSD" v2 prefixes currency pairs with t. (?) timestampStart is an int64 unix epoch time timestampEnd is an int64 unix epoch time, make sure this is always there or you will get the most recent trades. reOrderResp reorders the returned data.
func (*Bitfinex) GetUnusedMarginFunds ¶
func (b *Bitfinex) GetUnusedMarginFunds() ([]MarginFunds, error)
GetUnusedMarginFunds returns an array of funding borrowed but not currently used
func (*Bitfinex) GetWebsocket ¶
GetWebsocket returns a pointer to the exchange websocket
func (*Bitfinex) ModifyOrder ¶
func (b *Bitfinex) ModifyOrder(action *exchange.ModifyOrder) (string, error)
ModifyOrder will allow of changing orderbook placement and limit to market conversion
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 string, amount, price float64, buy bool, orderType string, hidden bool) (Order, error)
NewOrder submits a new order and returns a order information Major Upgrade needed on this function to include all query params
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, price float64, buy bool, orderType string, hidden bool) (Order, error)
ReplaceOrder replaces an older order with a new order
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) SendHTTPRequest ¶
SendHTTPRequest sends an unauthenticated request
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) SubmitOrder ¶
func (b *Bitfinex) SubmitOrder(p currency.Pair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, _ string) (exchange.SubmitOrderResponse, error)
SubmitOrder submits a new order
func (*Bitfinex) Subscribe ¶
func (b *Bitfinex) Subscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error
Subscribe sends a websocket message to receive data from the channel
func (*Bitfinex) SubscribeToWebsocketChannels ¶
func (b *Bitfinex) SubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
SubscribeToWebsocketChannels appends to ChannelsToSubscribe which lets websocket.manageSubscriptions handle subscribing
func (*Bitfinex) Unsubscribe ¶
func (b *Bitfinex) Unsubscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error
Unsubscribe sends a websocket message to stop receiving data from the channel
func (*Bitfinex) UnsubscribeToWebsocketChannels ¶
func (b *Bitfinex) UnsubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
UnsubscribeToWebsocketChannels removes from ChannelsToSubscribe which lets websocket.manageSubscriptions handle unsubscribing
func (*Bitfinex) UpdateOrderbook ¶
UpdateOrderbook updates and returns the orderbook for a currency pair
func (*Bitfinex) UpdateTicker ¶
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) WithdrawCryptocurrency ¶
func (b *Bitfinex) WithdrawCryptocurrency(withdrawType, wallet, address, paymentID string, amount float64, c currency.Code) ([]Withdrawal, error)
WithdrawCryptocurrency requests a withdrawal from one of your wallets. For FIAT, use WithdrawFIAT
func (*Bitfinex) WithdrawCryptocurrencyFunds ¶
func (b *Bitfinex) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted
func (*Bitfinex) WithdrawFIAT ¶
func (b *Bitfinex) WithdrawFIAT(withdrawalType, walletType string, withdrawRequest *exchange.WithdrawRequest) ([]Withdrawal, error)
WithdrawFIAT Sends an authenticated request to withdraw FIAT currency
func (*Bitfinex) WithdrawFiatFunds ¶
func (b *Bitfinex) WithdrawFiatFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted Returns comma delimited withdrawal IDs
func (*Bitfinex) WithdrawFiatFundsToInternationalBank ¶
func (b *Bitfinex) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.WithdrawRequest) (string, error)
WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted Returns comma delimited withdrawal IDs
func (*Bitfinex) WsAddSubscriptionChannel ¶
WsAddSubscriptionChannel adds a new subscription channel to the WebsocketSubdChannels map in bitfinex.go (Bitfinex struct)
func (*Bitfinex) WsDataHandler ¶
func (b *Bitfinex) WsDataHandler()
WsDataHandler handles data from WsReadData
func (*Bitfinex) WsInsertSnapshot ¶
WsInsertSnapshot add the initial orderbook snapshot when subscribed to a channel
func (*Bitfinex) WsPingHandler ¶
WsPingHandler sends a ping request to the websocket server
func (*Bitfinex) WsSendAuth ¶
WsSendAuth sends a autheticated event payload
func (*Bitfinex) WsSendUnauth ¶
WsSendUnauth sends an unauthenticated payload
func (*Bitfinex) WsUpdateOrderbook ¶
WsUpdateOrderbook updates the orderbook list, removing and adding to the orderbook sides
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 FundingBook ¶
type FundingBook struct { Bids []Book `json:"bids"` Asks []Book `json:"asks"` Message string `json:"message"` }
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 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 string `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,omitempty"` }
Order holds order information when an order is in the market
type OrderMultiResponse ¶
OrderMultiResponse holds order information on the executed orders
type OrderbookV2 ¶
OrderbookV2 holds orderbook information from bid and ask sides
type Permission ¶
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 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"` Message string `json:"message"` }
Ticker holds basic ticker information from the exchange
type Tickerv2 ¶
type Tickerv2 struct { FlashReturnRate float64 Bid float64 BidPeriod int64 BidSize float64 Ask float64 AskPeriod int64 AskSize float64 DailyChange float64 DailyChangePerc float64 Last float64 Volume float64 High float64 Low float64 }
Tickerv2 holds the version 2 ticker information
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 TradeStructureV2 ¶
type TradeStructureV2 struct { Timestamp int64 TID int64 Price float64 Amount float64 Exchange string Type string }
TradeStructureV2 holds resp information
type WalletTransfer ¶
WalletTransfer holds status of wallet to wallet content transfer on exchange
type WebsocketBook ¶
WebsocketBook holds booking information
type WebsocketChanInfo ¶
WebsocketChanInfo holds websocket channel information
type WebsocketHandshake ¶
type WebsocketHandshake struct { Event string `json:"event"` Code int64 `json:"code"` Version float64 `json:"version"` }
WebsocketHandshake defines the communication between the websocket API for initial connection
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 ¶
WebsocketTrade holds trade information
type WebsocketTradeData ¶
type WebsocketTradeData struct { TradeID int64 Pair string Timestamp int64 OrderID int64 AmountExecuted float64 PriceExecuted float64 Fee float64 FeeCurrency string }
WebsocketTradeData holds executed trade data
type WebsocketTradeExecuted ¶
type WebsocketTradeExecuted struct { TradeID int64 Pair string Timestamp int64 OrderID int64 AmountExecuted float64 PriceExecuted float64 }
WebsocketTradeExecuted holds executed trade data