Documentation
¶
Index ¶
- Constants
- Variables
- type AccountFees
- type AccountInfo
- type AccountInfoFees
- type AccountInfoFull
- type AccountSummary
- type AccountV2Data
- type Balance
- type BalanceHistory
- type Bitfinex
- func (b *Bitfinex) AuthenticateWebsocket(_ context.Context) error
- func (b *Bitfinex) CalculateTradingFee(i []AccountInfo, purchasePrice, amount float64, c currency.Code, isMaker bool) (fee float64, err error)
- func (b *Bitfinex) CancelAllExistingOrders(ctx context.Context) (string, error)
- func (b *Bitfinex) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order.CancelAllResponse, error)
- func (b *Bitfinex) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error)
- func (b *Bitfinex) CancelExistingOrder(ctx context.Context, orderID int64) (Order, error)
- func (b *Bitfinex) CancelMultipleOrders(ctx context.Context, orderIDs []int64) (string, error)
- func (b *Bitfinex) CancelOffer(ctx context.Context, offerID int64) (Offer, error)
- func (b *Bitfinex) CancelOrder(ctx context.Context, o *order.Cancel) error
- func (b *Bitfinex) ClaimPosition(ctx context.Context, positionID int) (Position, error)
- func (b *Bitfinex) CloseMarginFunding(ctx context.Context, swapID int64) (Offer, error)
- func (b *Bitfinex) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)
- func (b *Bitfinex) FetchOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
- func (b *Bitfinex) FetchTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)
- func (b *Bitfinex) FetchTradablePairs(ctx context.Context, a asset.Item) ([]string, error)
- func (b *Bitfinex) FormatExchangeKlineInterval(in kline.Interval) string
- func (b *Bitfinex) GenerateDefaultSubscriptions() ([]stream.ChannelSubscription, error)
- func (b *Bitfinex) GetAccountBalance(ctx context.Context) ([]Balance, error)
- func (b *Bitfinex) GetAccountFees(ctx context.Context) ([]AccountInfo, error)
- func (b *Bitfinex) GetAccountInfoV2(ctx context.Context) (AccountV2Data, error)
- func (b *Bitfinex) GetAccountSummary(ctx context.Context) (AccountSummary, error)
- func (b *Bitfinex) GetActiveCredits(ctx context.Context) ([]Offer, error)
- func (b *Bitfinex) GetActiveMarginFunding(ctx context.Context) ([]MarginFunds, error)
- func (b *Bitfinex) GetActiveOffers(ctx context.Context) ([]Offer, error)
- func (b *Bitfinex) GetActiveOrders(ctx context.Context, req *order.GetOrdersRequest) ([]order.Detail, error)
- func (b *Bitfinex) GetActivePositions(ctx context.Context) ([]Position, error)
- func (b *Bitfinex) GetAvailableTransferChains(ctx context.Context, cryptocurrency currency.Code) ([]string, error)
- func (b *Bitfinex) GetBalanceHistory(ctx context.Context, symbol string, timeSince, timeUntil time.Time, limit int, ...) ([]BalanceHistory, error)
- func (b *Bitfinex) GetCandles(ctx context.Context, symbol, timeFrame string, start, end int64, limit uint32, ...) ([]Candle, error)
- func (b *Bitfinex) GetConfigurations() error
- func (b *Bitfinex) GetCryptocurrencyWithdrawalFee(c currency.Code, accountFees AccountFees) (fee float64, err error)
- func (b *Bitfinex) GetDefaultConfig() (*config.Exchange, error)
- func (b *Bitfinex) GetDepositAddress(ctx context.Context, c currency.Code, accountID, chain string) (*deposit.Address, error)
- func (b *Bitfinex) GetDerivativeStatusInfo(ctx context.Context, keys, startTime, endTime string, sort, limit int64) ([]DerivativeDataResponse, error)
- func (b *Bitfinex) GetFee(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)
- func (b *Bitfinex) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)
- func (b *Bitfinex) GetForeignExchangeRate() error
- func (b *Bitfinex) GetFundingBook(ctx context.Context, symbol string) (FundingBook, error)
- func (b *Bitfinex) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error)
- func (b *Bitfinex) GetHistoricCandles(ctx context.Context, pair currency.Pair, a asset.Item, start, end time.Time, ...) (kline.Item, error)
- func (b *Bitfinex) GetHistoricCandlesExtended(ctx context.Context, pair currency.Pair, a asset.Item, start, end time.Time, ...) (kline.Item, error)
- func (b *Bitfinex) GetHistoricTrades(ctx context.Context, p currency.Pair, assetType asset.Item, ...) ([]trade.Data, error)
- func (b *Bitfinex) GetInactiveOrders(ctx context.Context) ([]Order, error)
- func (b *Bitfinex) GetKeyPermissions(ctx context.Context) (KeyPermissions, error)
- func (b *Bitfinex) GetKlines(arg interface{}) ([]*kline.Kline, error)
- func (b *Bitfinex) GetLeaderboard(ctx context.Context, key, timeframe, symbol string, sort, limit int, ...) ([]LeaderboardEntry, error)
- func (b *Bitfinex) GetLends(ctx context.Context, symbol string, values url.Values) ([]Lends, error)
- func (b *Bitfinex) GetLiquidationFeed() error
- func (b *Bitfinex) GetMarginInfo(ctx context.Context) ([]MarginInfo, error)
- func (b *Bitfinex) GetMarginPairs(ctx context.Context) ([]string, error)
- func (b *Bitfinex) GetMarginTotalTakenFunds(ctx context.Context) ([]MarginTotalTakenFunds, error)
- func (b *Bitfinex) GetMarketAveragePrice() error
- func (b *Bitfinex) GetMovementHistory(ctx context.Context, symbol, method string, timeSince, timeUntil time.Time, ...) ([]MovementHistory, error)
- func (b *Bitfinex) GetOfferStatus(ctx context.Context, offerID int64) (Offer, error)
- func (b *Bitfinex) GetOpenOrders(ctx context.Context) ([]Order, error)
- func (b *Bitfinex) GetOrderHistory(ctx context.Context, req *order.GetOrdersRequest) ([]order.Detail, error)
- func (b *Bitfinex) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error)
- func (b *Bitfinex) GetOrderStatus(ctx context.Context, orderID int64) (Order, error)
- func (b *Bitfinex) GetOrderbook(ctx context.Context, symbol, precision string, limit int64) (Orderbook, error)
- func (b *Bitfinex) GetPlatformStatus(ctx context.Context) (int, error)
- func (b *Bitfinex) GetRecentTrades(ctx context.Context, p currency.Pair, assetType asset.Item) ([]trade.Data, error)
- func (b *Bitfinex) GetStats(ctx context.Context, symbol string) ([]Stat, error)
- func (b *Bitfinex) GetStatus() error
- func (b *Bitfinex) GetTicker(ctx context.Context, symbol string) (Ticker, error)
- func (b *Bitfinex) GetTickerBatch(ctx context.Context) (map[string]Ticker, error)
- func (b *Bitfinex) GetTradeHistory(ctx context.Context, currencyPair string, timestamp, until time.Time, ...) ([]TradeHistory, error)
- func (b *Bitfinex) GetTrades(ctx context.Context, currencyPair string, ...) ([]Trade, error)
- func (b *Bitfinex) GetUnusedMarginFunds(ctx context.Context) ([]MarginFunds, error)
- func (b *Bitfinex) GetV2Balances(ctx context.Context) ([]WalletDataV2, error)
- func (b *Bitfinex) GetV2FundingInfo(ctx context.Context, key string) (MarginFundingDataV2, error)
- func (b *Bitfinex) GetV2MarginFunding(ctx context.Context, symbol, amount string, period int32) (MarginV2FundingData, error)
- func (b *Bitfinex) GetV2MarginInfo(ctx context.Context, symbol string) ([]MarginInfoV2, error)
- func (b *Bitfinex) GetWithdrawalFees(ctx context.Context) (AccountFees, error)
- func (b *Bitfinex) GetWithdrawalsHistory(ctx context.Context, c currency.Code) (resp []exchange.WithdrawalHistory, err error)
- func (b *Bitfinex) ModifyOrder(ctx context.Context, action *order.Modify) (order.Modify, error)
- func (b *Bitfinex) NewDeposit(ctx context.Context, method, walletName string, renew uint8) (*Deposit, error)
- func (b *Bitfinex) NewOffer(ctx context.Context, symbol string, amount, rate float64, period int64, ...) (Offer, error)
- func (b *Bitfinex) NewOrder(ctx context.Context, currencyPair, orderType string, amount, price float64, ...) (Order, error)
- func (b *Bitfinex) NewOrderMulti(ctx context.Context, orders []PlaceOrder) (OrderMultiResponse, error)
- func (b *Bitfinex) PopulateAcceptableMethods(ctx context.Context) error
- func (b *Bitfinex) ReplaceOrder(ctx context.Context, orderID int64, symbol string, amount, price float64, ...) (Order, error)
- func (b *Bitfinex) Run()
- func (b *Bitfinex) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.URL, method, path string, ...) error
- func (b *Bitfinex) SendAuthenticatedHTTPRequestV2(ctx context.Context, ep exchange.URL, method, path string, ...) error
- func (b *Bitfinex) SendHTTPRequest(ctx context.Context, ep exchange.URL, path string, result interface{}, ...) error
- func (b *Bitfinex) SetDefaults()
- func (b *Bitfinex) Setup(exch *config.Exchange) error
- func (b *Bitfinex) Start(wg *sync.WaitGroup) error
- func (b *Bitfinex) SubmitOrder(ctx context.Context, o *order.Submit) (order.SubmitResponse, error)
- func (b *Bitfinex) Subscribe(channelsToSubscribe []stream.ChannelSubscription) error
- func (b *Bitfinex) Unsubscribe(channelsToUnsubscribe []stream.ChannelSubscription) error
- func (b *Bitfinex) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)
- func (b *Bitfinex) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
- func (b *Bitfinex) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)
- func (b *Bitfinex) UpdateTickers(ctx context.Context, a asset.Item) error
- func (b *Bitfinex) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error
- func (b *Bitfinex) ValidateCredentials(ctx context.Context, assetType asset.Item) error
- func (b *Bitfinex) WalletTransfer(ctx context.Context, amount float64, currency, walletFrom, walletTo string) (WalletTransfer, error)
- func (b *Bitfinex) WithdrawCryptocurrency(ctx context.Context, wallet, address, paymentID, curr string, amount float64) (Withdrawal, error)
- func (b *Bitfinex) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (b *Bitfinex) WithdrawFIAT(ctx context.Context, withdrawalType, walletType string, ...) (Withdrawal, error)
- func (b *Bitfinex) WithdrawFiatFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (b *Bitfinex) WithdrawFiatFundsToInternationalBank(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (b *Bitfinex) WsAddSubscriptionChannel(chanID int, channel, pair string)
- func (b *Bitfinex) WsCancelAllOrders() error
- func (b *Bitfinex) WsCancelMultiOrders(orderIDs []int64) error
- func (b *Bitfinex) WsCancelOffer(orderID int64) error
- func (b *Bitfinex) WsCancelOrder(orderID int64) error
- func (b *Bitfinex) WsConnect() error
- func (b *Bitfinex) WsDataHandler()
- func (b *Bitfinex) WsInsertSnapshot(p currency.Pair, assetType asset.Item, books []WebsocketBook, fundingRate bool) error
- func (b *Bitfinex) WsModifyOrder(data *WsUpdateOrderRequest) error
- func (b *Bitfinex) WsNewOffer(data *WsNewOfferRequest) error
- func (b *Bitfinex) WsNewOrder(data *WsNewOrderRequest) (string, error)
- func (b *Bitfinex) WsSendAuth() error
- func (b *Bitfinex) WsUpdateOrderbook(p currency.Pair, assetType asset.Item, book []WebsocketBook, channelID int, ...) error
- type Book
- type Candle
- type Currency
- type Deposit
- type DerivativeDataResponse
- type ErrorCapture
- type Fee
- type FundingBook
- type FundingBookItem
- type GenericResponse
- type KeyPermissions
- type LeaderboardEntry
- type Lendbook
- type Lends
- type MarginData
- type MarginFundingData
- type MarginFundingDataV2
- type MarginFunds
- type MarginInfo
- type MarginInfoV2
- type MarginLimits
- type MarginTotalTakenFunds
- type MarginV2FundingData
- type MovementHistory
- type Offer
- type Order
- type OrderMultiResponse
- type Orderbook
- type Permission
- type PlaceOrder
- type Position
- type RateLimit
- type Stat
- type SymbolDetails
- type Ticker
- type Trade
- type TradeHistory
- type WalletDataV2
- type WalletTransfer
- type WebsocketBook
- type WebsocketChanInfo
- type WebsocketHandshake
- type WebsocketOrder
- type WebsocketPosition
- type WebsocketTicker
- type WebsocketTrade
- type WebsocketTradeData
- type WebsocketTradeExecuted
- type WebsocketWallet
- type Withdrawal
- type WsAuthRequest
- type WsBalanceInfo
- type WsCancelAllOrdersRequest
- type WsCancelGroupOrdersRequest
- type WsCancelOfferRequest
- type WsCancelOrderRequest
- type WsCredit
- type WsFundingInfo
- type WsFundingOffer
- type WsFundingTrade
- type WsMarginInfoBase
- type WsNewOfferRequest
- type WsNewOrderRequest
- type WsUpdateOrderRequest
- type WsWallet
Constants ¶
const ( LeaderboardUnrealisedProfitPeriodDelta = "plu_diff" LeaderboardUnrealisedProfitInception = "plu" LeaderboardVolume = "vol" LeaderbookRealisedProfit = "plr" )
Leaderboard keys
Variables ¶
var AcceptedOrderType = []string{"market", "limit", "stop", "trailing-stop",
"fill-or-kill", "exchange market", "exchange limit", "exchange stop",
"exchange trailing-stop", "exchange fill-or-kill"}
AcceptedOrderType defines the accepted market types, exchange strings denote non-contract order types.
var AcceptedWalletNames = []string{"trading", "exchange", "deposit", "margin",
"funding"}
AcceptedWalletNames defines different wallets supported by the exchange
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 AccountV2Data ¶
type AccountV2Data struct {
ID int64
Email string
Username string
MTSAccountCreate int64
Verified int64
Timezone string
}
AccountV2Data stores account v2 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
WebsocketSubdChannels map[int]WebsocketChanInfo
}
Bitfinex is the overarching type across the bitfinex package
func (*Bitfinex) AuthenticateWebsocket ¶
AuthenticateWebsocket sends an authentication message to the websocket
func (*Bitfinex) CalculateTradingFee ¶
func (b *Bitfinex) CalculateTradingFee(i []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(ctx context.Context, _ *order.Cancel) (order.CancelAllResponse, error)
CancelAllOrders cancels all orders associated with a currency pair
func (*Bitfinex) CancelBatchOrders ¶
func (b *Bitfinex) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error)
CancelBatchOrders cancels an orders by their corresponding ID numbers
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 ¶
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) FetchAccountInfo ¶
func (b *Bitfinex) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)
FetchAccountInfo retrieves balances for all enabled currencies
func (*Bitfinex) FetchOrderbook ¶
func (b *Bitfinex) FetchOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
FetchOrderbook returns the orderbook for a currency pair
func (*Bitfinex) FetchTicker ¶
func (b *Bitfinex) FetchTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)
FetchTicker returns the ticker for a currency pair
func (*Bitfinex) FetchTradablePairs ¶
FetchTradablePairs returns a list of the exchanges tradable pairs
func (*Bitfinex) FormatExchangeKlineInterval ¶
FormatExchangeKlineInterval returns Interval to exchange formatted string
func (*Bitfinex) GenerateDefaultSubscriptions ¶
func (b *Bitfinex) GenerateDefaultSubscriptions() ([]stream.ChannelSubscription, error)
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(ctx context.Context) ([]AccountInfo, error)
GetAccountFees returns information about your account trading fees
func (*Bitfinex) GetAccountInfoV2 ¶
func (b *Bitfinex) GetAccountInfoV2(ctx context.Context) (AccountV2Data, error)
GetAccountInfoV2 gets V2 account data
func (*Bitfinex) GetAccountSummary ¶
func (b *Bitfinex) GetAccountSummary(ctx context.Context) (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(ctx context.Context) ([]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(ctx context.Context, req *order.GetOrdersRequest) ([]order.Detail, error)
GetActiveOrders retrieves any orders that are active/open
func (*Bitfinex) GetActivePositions ¶
GetActivePositions returns an array of active positions
func (*Bitfinex) GetAvailableTransferChains ¶
func (b *Bitfinex) GetAvailableTransferChains(ctx context.Context, cryptocurrency currency.Code) ([]string, error)
GetAvailableTransferChains returns the available transfer blockchains for the specific cryptocurrency
func (*Bitfinex) GetBalanceHistory ¶
func (b *Bitfinex) GetBalanceHistory(ctx context.Context, symbol string, timeSince, timeUntil time.Time, limit int, wallet string) ([]BalanceHistory, error)
GetBalanceHistory returns balance history for the account
func (*Bitfinex) GetCandles ¶
func (b *Bitfinex) GetCandles(ctx context.Context, symbol, timeFrame string, start, end int64, limit uint32, historic bool) ([]Candle, error)
GetCandles returns candle chart data timeFrame values: '1m', '5m', '15m', '30m', '1h', '3h', '6h', '12h', '1D', '7D', '14D', '1M' section values: last or hist
func (*Bitfinex) GetConfigurations ¶
GetConfigurations fetchs currency and symbol site configuration data.
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) GetDefaultConfig ¶
GetDefaultConfig returns a default exchange config
func (*Bitfinex) GetDepositAddress ¶
func (b *Bitfinex) GetDepositAddress(ctx context.Context, c currency.Code, accountID, chain string) (*deposit.Address, error)
GetDepositAddress returns a deposit address for a specified currency
func (*Bitfinex) GetDerivativeStatusInfo ¶
func (b *Bitfinex) GetDerivativeStatusInfo(ctx context.Context, keys, startTime, endTime string, sort, limit int64) ([]DerivativeDataResponse, error)
GetDerivativeStatusInfo gets status data for the queried derivative
func (*Bitfinex) GetFeeByType ¶
func (b *Bitfinex) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)
GetFeeByType returns an estimate of fee based on type of transaction
func (*Bitfinex) GetForeignExchangeRate ¶
GetForeignExchangeRate calculates the exchange rate between two currencies
func (*Bitfinex) GetFundingBook ¶
GetFundingBook the entire margin funding book for both bids and asks sides per currency string symbol - example "USD" WARNING: Orderbook now has this support, will be deprecated once a full conversion to full V2 API update is done.
func (*Bitfinex) GetFundingHistory ¶
GetFundingHistory returns funding history, deposits and withdrawals
func (*Bitfinex) GetHistoricCandles ¶
func (b *Bitfinex) GetHistoricCandles(ctx context.Context, pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error)
GetHistoricCandles returns candles between a time period for a set time interval
func (*Bitfinex) GetHistoricCandlesExtended ¶
func (b *Bitfinex) GetHistoricCandlesExtended(ctx context.Context, pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error)
GetHistoricCandlesExtended returns candles between a time period for a set time interval
func (*Bitfinex) GetHistoricTrades ¶
func (b *Bitfinex) GetHistoricTrades(ctx context.Context, p currency.Pair, assetType asset.Item, timestampStart, timestampEnd time.Time) ([]trade.Data, error)
GetHistoricTrades returns historic trade data within the timeframe provided
func (*Bitfinex) GetInactiveOrders ¶
GetInactiveOrders returns order status information
func (*Bitfinex) GetKeyPermissions ¶
func (b *Bitfinex) GetKeyPermissions(ctx context.Context) (KeyPermissions, error)
GetKeyPermissions checks the permissions of the key being used to generate this request.
func (*Bitfinex) GetLeaderboard ¶
func (b *Bitfinex) GetLeaderboard(ctx context.Context, key, timeframe, symbol string, sort, limit int, start, end string) ([]LeaderboardEntry, error)
GetLeaderboard returns leaderboard standings for unrealized profit (period delta), unrealized profit (inception), volume, and realized profit. Allowed key values: "plu_diff" for unrealized profit (period delta), "plu" for unrealized profit (inception); "vol" for volume; "plr" for realized profit Allowed time frames are 3h, 1w and 1M Allowed symbols are trading pairs (e.g. tBTCUSD, tETHUSD and tGLOBAL: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) GetLiquidationFeed ¶
GetLiquidationFeed returns liquidations. By default it will retrieve the most recent liquidations, but time-specific data can be retrieved using timestamps.
func (*Bitfinex) GetMarginInfo ¶
func (b *Bitfinex) GetMarginInfo(ctx context.Context) ([]MarginInfo, error)
GetMarginInfo shows your trading wallet information for margin trading
func (*Bitfinex) GetMarginPairs ¶
GetMarginPairs gets pairs that allow margin trading
func (*Bitfinex) GetMarginTotalTakenFunds ¶
func (b *Bitfinex) GetMarginTotalTakenFunds(ctx context.Context) ([]MarginTotalTakenFunds, error)
GetMarginTotalTakenFunds returns an array of active funding used in a position
func (*Bitfinex) GetMarketAveragePrice ¶
GetMarketAveragePrice calculates the average execution price for Trading or rate for Margin funding
func (*Bitfinex) GetMovementHistory ¶
func (b *Bitfinex) GetMovementHistory(ctx context.Context, 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(ctx context.Context, req *order.GetOrdersRequest) ([]order.Detail, error)
GetOrderHistory retrieves account order information Can Limit response to specific order status
func (*Bitfinex) GetOrderInfo ¶
func (b *Bitfinex) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error)
GetOrderInfo returns order information based on order ID
func (*Bitfinex) GetOrderStatus ¶
GetOrderStatus returns order status information
func (*Bitfinex) GetOrderbook ¶
func (b *Bitfinex) GetOrderbook(ctx context.Context, symbol, precision string, limit int64) (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. symbol - Example "tBTCUSD" precision - P0,P1,P2,P3,R0 Values can contain limit amounts for both the asks and bids - Example "len" = 100
func (*Bitfinex) GetPlatformStatus ¶
GetPlatformStatus returns the Bifinex platform status
func (*Bitfinex) GetRecentTrades ¶
func (b *Bitfinex) GetRecentTrades(ctx context.Context, p currency.Pair, assetType asset.Item) ([]trade.Data, error)
GetRecentTrades returns the most recent trades for a currency and asset
func (*Bitfinex) GetStatus ¶
GetStatus returns different types of platform information - currently supports derivatives pair status only.
func (*Bitfinex) GetTickerBatch ¶
GetTickerBatch returns all supported ticker information
func (*Bitfinex) GetTradeHistory ¶
func (b *Bitfinex) GetTradeHistory(ctx context.Context, currencyPair string, timestamp, until time.Time, limit, reverse int) ([]TradeHistory, error)
GetTradeHistory returns past executed trades
func (*Bitfinex) GetTrades ¶
func (b *Bitfinex) GetTrades(ctx context.Context, currencyPair string, limit, timestampStart, timestampEnd int64, reOrderResp bool) ([]Trade, error)
GetTrades gets historic trades that occurred on the exchange
currencyPair e.g. "tBTCUSD" timestampStart is a millisecond timestamp timestampEnd is a millisecond timestamp reOrderResp reorders the returned data.
func (*Bitfinex) GetUnusedMarginFunds ¶
func (b *Bitfinex) GetUnusedMarginFunds(ctx context.Context) ([]MarginFunds, error)
GetUnusedMarginFunds returns an array of funding borrowed but not currently used
func (*Bitfinex) GetV2Balances ¶
func (b *Bitfinex) GetV2Balances(ctx context.Context) ([]WalletDataV2, error)
GetV2Balances gets v2 balances
func (*Bitfinex) GetV2FundingInfo ¶
GetV2FundingInfo gets funding info for margin pairs
func (*Bitfinex) GetV2MarginFunding ¶
func (b *Bitfinex) GetV2MarginFunding(ctx context.Context, symbol, amount string, period int32) (MarginV2FundingData, error)
GetV2MarginFunding gets borrowing rates for margin trading
func (*Bitfinex) GetV2MarginInfo ¶
GetV2MarginInfo gets v2 margin info for a symbol provided symbol: base, sym_all, any other trading symbol example tBTCUSD
func (*Bitfinex) GetWithdrawalFees ¶
func (b *Bitfinex) GetWithdrawalFees(ctx context.Context) (AccountFees, error)
GetWithdrawalFees - Gets all fee rates for withdrawals
func (*Bitfinex) GetWithdrawalsHistory ¶
func (b *Bitfinex) GetWithdrawalsHistory(ctx context.Context, c currency.Code) (resp []exchange.WithdrawalHistory, err error)
GetWithdrawalsHistory returns previous withdrawals data
func (*Bitfinex) ModifyOrder ¶
ModifyOrder will allow of changing orderbook placement and limit to market conversion
func (*Bitfinex) NewDeposit ¶
func (b *Bitfinex) NewDeposit(ctx context.Context, method, walletName string, renew uint8) (*Deposit, error)
NewDeposit returns a new deposit address Method - Example methods accepted: “bitcoin”, “litecoin”, “ethereum”, “tethers", "ethereumc", "zcash", "monero", "iota", "bcash" WalletName - accepted: "exchange", "margin", "funding" (can also use the old labels which are "exchange", "trading" and "deposit" respectively). If none is set, "funding" will be used by default renew - Default is 0. If set to 1, will return a new unused deposit address
func (*Bitfinex) NewOffer ¶
func (b *Bitfinex) NewOffer(ctx context.Context, symbol string, amount, rate float64, period int64, direction string) (Offer, error)
NewOffer submits a new offer
func (*Bitfinex) NewOrder ¶
func (b *Bitfinex) NewOrder(ctx context.Context, currencyPair, orderType string, amount, price float64, buy, 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(ctx context.Context, orders []PlaceOrder) (OrderMultiResponse, error)
NewOrderMulti allows several new orders at once
func (*Bitfinex) PopulateAcceptableMethods ¶
PopulateAcceptableMethods retrieves all accepted currency strings and populates a map to check
func (*Bitfinex) ReplaceOrder ¶
func (b *Bitfinex) ReplaceOrder(ctx context.Context, 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(ctx context.Context, ep exchange.URL, method, path string, params map[string]interface{}, result interface{}, endpoint request.EndpointLimit) error
SendAuthenticatedHTTPRequest sends an autheticated http request and json unmarshals result to a supplied variable
func (*Bitfinex) SendAuthenticatedHTTPRequestV2 ¶
func (b *Bitfinex) SendAuthenticatedHTTPRequestV2(ctx context.Context, ep exchange.URL, method, path string, params map[string]interface{}, result interface{}, endpoint request.EndpointLimit) error
SendAuthenticatedHTTPRequestV2 sends an autheticated http request and json unmarshals result to a supplied variable
func (*Bitfinex) SendHTTPRequest ¶
func (b *Bitfinex) SendHTTPRequest(ctx context.Context, ep exchange.URL, path string, result interface{}, e request.EndpointLimit) error
SendHTTPRequest sends an unauthenticated request
func (*Bitfinex) SetDefaults ¶
func (b *Bitfinex) SetDefaults()
SetDefaults sets the basic defaults for bitfinex
func (*Bitfinex) SubmitOrder ¶
SubmitOrder submits a new order
func (*Bitfinex) Subscribe ¶
func (b *Bitfinex) Subscribe(channelsToSubscribe []stream.ChannelSubscription) error
Subscribe sends a websocket message to receive data from the channel
func (*Bitfinex) Unsubscribe ¶
func (b *Bitfinex) Unsubscribe(channelsToUnsubscribe []stream.ChannelSubscription) error
Unsubscribe sends a websocket message to stop receiving data from the channel
func (*Bitfinex) UpdateAccountInfo ¶
func (b *Bitfinex) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)
UpdateAccountInfo retrieves balances for all enabled currencies on the Bitfinex exchange
func (*Bitfinex) UpdateOrderbook ¶
func (b *Bitfinex) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
UpdateOrderbook updates and returns the orderbook for a currency pair
func (*Bitfinex) UpdateTicker ¶
func (b *Bitfinex) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)
UpdateTicker updates and returns the ticker for a currency pair
func (*Bitfinex) UpdateTickers ¶
UpdateTickers updates the ticker for all currency pairs of a given asset type
func (*Bitfinex) UpdateTradablePairs ¶
UpdateTradablePairs updates the exchanges available pairs and stores them in the exchanges config
func (*Bitfinex) ValidateCredentials ¶
ValidateCredentials validates current credentials used for wrapper functionality
func (*Bitfinex) WalletTransfer ¶
func (b *Bitfinex) WalletTransfer(ctx context.Context, 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(ctx context.Context, wallet, address, paymentID, curr string, amount float64) (Withdrawal, error)
WithdrawCryptocurrency requests a withdrawal from one of your wallets. For FIAT, use WithdrawFIAT
func (*Bitfinex) WithdrawCryptocurrencyFunds ¶
func (b *Bitfinex) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted
func (*Bitfinex) WithdrawFIAT ¶
func (b *Bitfinex) WithdrawFIAT(ctx context.Context, withdrawalType, walletType string, withdrawRequest *withdraw.Request) (Withdrawal, error)
WithdrawFIAT Sends an authenticated request to withdraw FIAT currency
func (*Bitfinex) WithdrawFiatFunds ¶
func (b *Bitfinex) WithdrawFiatFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted Returns comma delimited withdrawal IDs
func (*Bitfinex) WithdrawFiatFundsToInternationalBank ¶
func (b *Bitfinex) WithdrawFiatFundsToInternationalBank(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, 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) WsCancelAllOrders ¶
WsCancelAllOrders authenticated cancel all orders request
func (*Bitfinex) WsCancelMultiOrders ¶
WsCancelMultiOrders authenticated cancel multi order request
func (*Bitfinex) WsCancelOffer ¶
WsCancelOffer authenticated cancel offer request
func (*Bitfinex) WsCancelOrder ¶
WsCancelOrder authenticated cancel order request
func (*Bitfinex) WsDataHandler ¶
func (b *Bitfinex) WsDataHandler()
WsDataHandler handles data from wsReadData
func (*Bitfinex) WsInsertSnapshot ¶
func (b *Bitfinex) WsInsertSnapshot(p currency.Pair, assetType asset.Item, books []WebsocketBook, fundingRate bool) error
WsInsertSnapshot add the initial orderbook snapshot when subscribed to a channel
func (*Bitfinex) WsModifyOrder ¶
func (b *Bitfinex) WsModifyOrder(data *WsUpdateOrderRequest) error
WsModifyOrder authenticated modify order request
func (*Bitfinex) WsNewOffer ¶
func (b *Bitfinex) WsNewOffer(data *WsNewOfferRequest) error
WsNewOffer authenticated new offer request
func (*Bitfinex) WsNewOrder ¶
func (b *Bitfinex) WsNewOrder(data *WsNewOrderRequest) (string, error)
WsNewOrder authenticated new order request
func (*Bitfinex) WsSendAuth ¶
WsSendAuth sends a autheticated event payload
type Book ¶
type Book struct {
OrderID int64
Price float64
Rate float64
Period float64
Count int64
Amount float64
}
Book holds the orderbook item
type Candle ¶
type Candle struct {
Timestamp time.Time
Open float64
Close float64
High float64
Low float64
Volume float64
}
Candle holds OHLC data
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 Deposit ¶
type Deposit struct {
Method string
CurrencyCode string
Address string // Deposit address (instead of the address, this field will show Tag/Memo/Payment_ID for currencies that require it)
PoolAddress string // Pool address (for currencies that require a Tag/Memo/Payment_ID)
}
Deposit holds the deposit address info
type DerivativeDataResponse ¶
type DerivativeDataResponse struct {
Key string
MTS float64
DerivPrice float64
SpotPrice float64
MarkPrice float64
InsuranceFundBalance float64
NextFundingEventTS float64
NextFundingAccrued float64
NextFundingStep float64
CurrentFunding float64
OpenInterest float64
}
DerivativeDataResponse stores data for queried derivative
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 []FundingBookItem `json:"bids"`
Asks []FundingBookItem `json:"asks"`
}
FundingBook holds current the full margin funding book
type FundingBookItem ¶
type FundingBookItem struct {
Rate float64 `json:"rate,string"`
Amount float64 `json:"amount,string"`
Period int `json:"period"`
Timestamp string `json:"timestamp"`
FlashReturnRate string `json:"frr"`
}
FundingBookItem is a generalised sub-type to hold book information
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 LeaderboardEntry ¶
type LeaderboardEntry struct {
Timestamp time.Time
Username string
Ranking int
Value float64
TwitterHandle string
}
LeaderboardEntry holds leaderboard data
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 MarginFundingData ¶
type MarginFundingData struct {
ID int64
Symbol string
MTSCreated int64
MTSUpdated int64
Amount float64
AmountOrig float64
OrderType string
OfferStatus string
Active string
Rate float64
Period float64
Notify bool
Renew bool
}
MarginFundingData stores data for margin funding
type MarginFundingDataV2 ¶
type MarginFundingDataV2 struct {
Sym string
Symbol string
Data struct {
YieldLoan float64
YieldLend float64
DurationLoan float64
DurationLend float64
}
}
MarginFundingDataV2 stores margin funding data
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 MarginInfoV2 ¶
type MarginInfoV2 struct {
Symbol string
UserPNL float64
UserSwaps float64
MarginBalance float64
MarginNet float64
MarginMin float64
TradableBalance float64
GrossBalance float64
BestAskAmount float64
BestBidAmount float64
}
MarginInfoV2 stores V2 margin data
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 MarginV2FundingData ¶
MarginV2FundingData stores margin funding data
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 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 RateLimit ¶
type RateLimit struct {
PlatformStatus *rate.Limiter
TickerBatch *rate.Limiter
Ticker *rate.Limiter
Trade *rate.Limiter
Orderbook *rate.Limiter
Stats *rate.Limiter
Candle *rate.Limiter
Configs *rate.Limiter
Status *rate.Limiter
Liquid *rate.Limiter
LeaderBoard *rate.Limiter
MarketAveragePrice *rate.Limiter
Fx *rate.Limiter
AccountWalletBalance *rate.Limiter
AccountWalletHistory *rate.Limiter
// Orders -
RetrieveOrder *rate.Limiter
SubmitOrder *rate.Limiter
UpdateOrder *rate.Limiter
CancelOrder *rate.Limiter
OrderBatch *rate.Limiter
CancelBatch *rate.Limiter
OrderHistory *rate.Limiter
GetOrderTrades *rate.Limiter
GetTrades *rate.Limiter
GetLedgers *rate.Limiter
// Positions -
GetAccountMarginInfo *rate.Limiter
GetActivePositions *rate.Limiter
ClaimPosition *rate.Limiter
GetPositionHistory *rate.Limiter
GetPositionAudit *rate.Limiter
UpdateCollateralOnPosition *rate.Limiter
// Margin funding -
GetActiveFundingOffers *rate.Limiter
SubmitFundingOffer *rate.Limiter
CancelFundingOffer *rate.Limiter
CancelAllFundingOffer *rate.Limiter
CloseFunding *rate.Limiter
FundingAutoRenew *rate.Limiter
KeepFunding *rate.Limiter
GetOffersHistory *rate.Limiter
GetFundingLoans *rate.Limiter
GetFundingLoanHistory *rate.Limiter
GetFundingCredits *rate.Limiter
GetFundingCreditsHistory *rate.Limiter
GetFundingTrades *rate.Limiter
GetFundingInfo *rate.Limiter
// Account actions
GetUserInfo *rate.Limiter
TransferBetweenWallets *rate.Limiter
GetDepositAddress *rate.Limiter
Withdrawal *rate.Limiter
GetMovements *rate.Limiter
GetAlertList *rate.Limiter
SetPriceAlert *rate.Limiter
DeletePriceAlert *rate.Limiter
GetBalanceForOrdersOffers *rate.Limiter
UserSettingsWrite *rate.Limiter
UserSettingsRead *rate.Limiter
UserSettingsDelete *rate.Limiter
// Account V1 endpoints
GetAccountFees *rate.Limiter
GetWithdrawalFees *rate.Limiter
GetAccountSummary *rate.Limiter
NewDepositAddress *rate.Limiter
GetKeyPermissions *rate.Limiter
GetMarginInfo *rate.Limiter
GetAccountBalance *rate.Limiter
WalletTransfer *rate.Limiter
WithdrawV1 *rate.Limiter
OrderV1 *rate.Limiter
OrderMulti *rate.Limiter
StatsV1 *rate.Limiter
Fundingbook *rate.Limiter
Lends *rate.Limiter
}
RateLimit implements the rate.Limiter interface
func SetRateLimit ¶
func SetRateLimit() *RateLimit
SetRateLimit returns the rate limit for the 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 {
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
FFRAmountAvailable float64
}
Ticker holds ticker information
type Trade ¶
type Trade struct {
Timestamp int64
TID int64
Price float64
Amount float64
Exchange string
Rate float64
Period int64
Type string
Side order.Side
}
Trade holds resp information
type TradeHistory ¶
type TradeHistory struct {
Price float64 `json:"price,string"`
Amount float64 `json:"amount,string"`
Timestamp int64 `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 WalletDataV2 ¶
type WalletDataV2 struct {
WalletType string
Currency string
Balance float64
UnsettledInterest float64
}
WalletDataV2 stores wallet data for v2
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 int64
Notify int
}
WebsocketOrder holds order data
type WebsocketPosition ¶
type WebsocketPosition struct {
Pair string
Status string
Amount float64
Price float64
MarginFunding float64
MarginFundingType int64
ProfitLoss float64
ProfitLossPercent float64
LiquidationPrice float64
Leverage float64
}
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
// Funding rate of the trade
Rate float64
// Funding offer period in days
Period int64
}
WebsocketTrade holds trade information
type WebsocketTradeData ¶
type WebsocketTradeData struct {
TradeID int64
Pair string
Timestamp int64
OrderID int64
AmountExecuted float64
PriceExecuted float64
OrderType string
OrderPrice float64
Maker bool
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
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"`
Fees string `json:"fees"`
WalletType string `json:"wallettype"`
Method string `json:"method"`
Address string `json:"address"`
Invoice string `json:"invoice"`
PaymentID string `json:"payment_id"`
Amount float64 `json:"amount,string"`
}
Withdrawal holds withdrawal status information
type WsAuthRequest ¶
type WsAuthRequest struct {
Event string `json:"event"`
APIKey string `json:"apiKey"`
AuthPayload string `json:"authPayload"`
AuthSig string `json:"authSig"`
AuthNonce string `json:"authNonce"`
DeadManSwitch int64 `json:"dms,omitempty"`
}
WsAuthRequest container for WS auth request
type WsBalanceInfo ¶
WsBalanceInfo the total and net assets in your account received via websocket
type WsCancelAllOrdersRequest ¶
type WsCancelAllOrdersRequest struct {
All int64 `json:"all"`
}
WsCancelAllOrdersRequest cancel all orders request
type WsCancelGroupOrdersRequest ¶
type WsCancelGroupOrdersRequest struct {
OrderID []int64 `json:"id,omitempty"`
CustomID [][]int64 `json:"cid,omitempty"`
GroupOrderID []int64 `json:"gid,omitempty"`
}
WsCancelGroupOrdersRequest cancel orders request...
type WsCancelOfferRequest ¶
type WsCancelOfferRequest struct {
OrderID int64 `json:"id"`
}
WsCancelOfferRequest cancel offer request
type WsCancelOrderRequest ¶
type WsCancelOrderRequest struct {
OrderID int64 `json:"id,omitempty"`
CustomID int64 `json:"cid,omitempty"`
CustomIDDate string `json:"cid_date,omitempty"`
}
WsCancelOrderRequest cancel order request...
type WsCredit ¶
type WsCredit struct {
ID int64
Symbol string
Side string
Created int64
Updated int64
Amount float64
Flags interface{}
Status string
Rate float64
Period int64
Opened int64
LastPayout int64
Notify bool
Hidden bool
Insure bool
Renew bool
RateReal float64
NoClose bool
PositionPair string
}
WsCredit credit details received via websocket
type WsFundingInfo ¶
type WsFundingInfo struct {
Symbol string
YieldLoan float64
YieldLend float64
DurationLoan float64
DurationLend float64
}
WsFundingInfo account funding info received via websocket
type WsFundingOffer ¶
type WsFundingOffer struct {
ID int64
Symbol string
Created int64
Updated int64
Amount float64
OriginalAmount float64
Type string
Flags interface{}
Status string
Rate float64
Period int64
Notify bool
Hidden bool
Insure bool
Renew bool
RateReal float64
}
WsFundingOffer funding offer received via websocket
type WsFundingTrade ¶
type WsFundingTrade struct {
ID int64
Symbol string
MTSCreated int64
OfferID int64
Amount float64
Rate float64
Period int64
Maker bool
}
WsFundingTrade recent funding trades received via websocket
type WsMarginInfoBase ¶
type WsMarginInfoBase struct {
UserProfitLoss float64
UserSwaps float64
MarginBalance float64
MarginNet float64
}
WsMarginInfoBase account margin info received via websocket
type WsNewOfferRequest ¶
type WsNewOfferRequest struct {
Type string `json:"type,omitempty"`
Symbol string `json:"symbol,omitempty"`
Amount float64 `json:"amount,string,omitempty"`
Rate float64 `json:"rate,string,omitempty"`
Period float64 `json:"period,omitempty"`
Flags int64 `json:"flags,omitempty"`
}
WsNewOfferRequest new offer request
type WsNewOrderRequest ¶
type WsNewOrderRequest struct {
GroupID int64 `json:"gid,omitempty"`
CustomID int64 `json:"cid,omitempty"`
Type string `json:"type"`
Symbol string `json:"symbol"`
Amount float64 `json:"amount,string"`
Price float64 `json:"price,string"`
Leverage int64 `json:"lev,omitempty"`
TrailingPrice float64 `json:"price_trailing,string,omitempty"`
AuxiliaryLimitPrice float64 `json:"price_aux_limit,string,omitempty"`
StopPrice float64 `json:"price_oco_stop,string,omitempty"`
Flags int64 `json:"flags,omitempty"`
TimeInForce string `json:"tif,omitempty"`
}
WsNewOrderRequest new order request...
type WsUpdateOrderRequest ¶
type WsUpdateOrderRequest struct {
OrderID int64 `json:"id,omitempty"`
CustomID int64 `json:"cid,omitempty"`
CustomIDDate string `json:"cid_date,omitempty"`
GroupID int64 `json:"gid,omitempty"`
Price float64 `json:"price,string,omitempty"`
Amount float64 `json:"amount,string,omitempty"`
Leverage int64 `json:"lev,omitempty"`
Delta float64 `json:"delta,string,omitempty"`
AuxiliaryLimitPrice float64 `json:"price_aux_limit,string,omitempty"`
TrailingPrice float64 `json:"price_trailing,string,omitempty"`
Flags int64 `json:"flags,omitempty"`
TimeInForce string `json:"tif,omitempty"`
}
WsUpdateOrderRequest update order request...