bfxapi

package
v1.64.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package bfxapi implements Bitfinex API integration.

Code generated by go:generate; DO NOT EDIT.

Code generated by go:generate; DO NOT EDIT.

Code generated by go:generate; DO NOT EDIT.

Code generated by go:generate; DO NOT EDIT.

Index

Constants

View Source
const (
	PermissionRead  = "r"
	PermissionWrite = "w"
)
View Source
const PrivateWebSocketURL = "wss://api.bitfinex.com/ws/2"
View Source
const PublicWebSocketURL = "wss://api-pub.bitfinex.com/ws/2"

Public channels should use the domain: wss://api-pub.bitfinex.com/

The domain: wss://api.bitfinex.com/ Should only be used for channels that require authentication.

The rate limit for the wss://api-pub.bitfinex.com/ domain is set at 20 connections per minute.

Variables

View Source
var AllOrderFlags = map[OrderFlag]struct{}{
	OrderFlagHidden:     {},
	OrderFlagClose:      {},
	OrderFlagReduceOnly: {},
	OrderFlagPostOnly:   {},
	OrderFlagOCO:        {},
	OrderFlagNoVarRate:  {},
}
View Source
var AllOrderStatuss = map[OrderStatus]struct{}{
	OrderStatusActive:            {},
	OrderStatusExecuted:          {},
	OrderStatusPartiallyFilled:   {},
	OrderStatusCanceled:          {},
	OrderStatusPostponed:         {},
	OrderStatusInsufficientBal:   {},
	OrderStatusStopped:           {},
	OrderStatusRejected:          {},
	OrderStatusExpired:           {},
	OrderStatusPending:           {},
	OrderStatusPartiallyCanceled: {},
}
View Source
var AllOrderTypes = map[OrderType]struct{}{
	OrderTypeLimit:                {},
	OrderTypeExchangeLimit:        {},
	OrderTypeMarket:               {},
	OrderTypeExchangeMarket:       {},
	OrderTypeStop:                 {},
	OrderTypeExchangeStop:         {},
	OrderTypeStopLimit:            {},
	OrderTypeExchangeStopLimit:    {},
	OrderTypeTrailingStop:         {},
	OrderTypeExchangeTrailingStop: {},
	OrderTypeFOK:                  {},
	OrderTypeExchangeFOK:          {},
	OrderTypeIOC:                  {},
	OrderTypeExchangeIOC:          {},
}
View Source
var AllTimeFrames = map[TimeFrame]struct{}{
	TimeFrame1m:  {},
	TimeFrame5m:  {},
	TimeFrame15m: {},
	TimeFrame30m: {},
	TimeFrame1h:  {},
	TimeFrame3h:  {},
	TimeFrame6h:  {},
	TimeFrame12h: {},
	TimeFrame1D:  {},
	TimeFrame1W:  {},
	TimeFrame14D: {},
	TimeFrame1M:  {},
}

Functions

func OrderFlagStrings

func OrderFlagStrings(slice []OrderFlag) (out []string)

func OrderStatusStrings

func OrderStatusStrings(slice []OrderStatus) (out []string)

func OrderTypeStrings

func OrderTypeStrings(slice []OrderType) (out []string)

func ParseChannelKey

func ParseChannelKey(key string) []string

ParseChannelKey splits a Bitfinex channel key string by ':' and returns non-empty parts. Example: "trade:1m:tBTCUSD" => ["trade", "1m", "tBTCUSD"]

func TimeFrameStrings

func TimeFrameStrings(slice []TimeFrame) (out []string)

func ValidateOrderFlag

func ValidateOrderFlag(ch OrderFlag) bool

ValidateOrderFlag validates a value of type OrderFlag

func ValidateOrderStatus

func ValidateOrderStatus(ch OrderStatus) bool

ValidateOrderStatus validates a value of type OrderStatus

func ValidateOrderType

func ValidateOrderType(ch OrderType) bool

ValidateOrderType validates a value of type OrderType

func ValidateTimeFrame

func ValidateTimeFrame(ch TimeFrame) bool

ValidateTimeFrame validates a value of type TimeFrame

Types

type AuthCaps

type AuthCaps struct {
	BfxPay     *Permission `json:"bfxpay"`
	Orders     *Permission `json:"orders"`
	Account    *Permission `json:"account"`
	Funding    *Permission `json:"funding"`
	History    *Permission `json:"history"`
	Wallets    *Permission `json:"wallets"`
	Settings   *Permission `json:"settings"`
	Withdraw   *Permission `json:"withdraw"`
	Positions  *Permission `json:"positions"`
	UIWithdraw *Permission `json:"ui_withdraw"`
}

AuthCaps represents the capabilities in the Bitfinex auth response.

func (*AuthCaps) UnmarshalJSON

func (c *AuthCaps) UnmarshalJSON(data []byte) error

type AutoRenewFundingRequest

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

AutoRenewFundingRequest represents a Bitfinex funding auto-renew request. API: https://docs.bitfinex.com/reference/rest-auth-funding-auto-renew

Body Params:

  • status (int32, required): 1 to activate, 0 to deactivate
  • currency (string, required): currency for which to enable auto-renew
  • amount (string, optional): amount to be auto-renewed
  • rate (string, optional): percentage rate at which to auto-renew
  • period (int32, optional): period in days

func (*AutoRenewFundingRequest) Amount

* Amount sets amount is the amount to be auto-renewed (Minimum 50 USD equivalent). Defaultst to the amount currently provided if omitted.

func (*AutoRenewFundingRequest) Currency

* Currency sets currency is required, Defaults to USD

func (*AutoRenewFundingRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*AutoRenewFundingRequest) GetParameters

func (a *AutoRenewFundingRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*AutoRenewFundingRequest) GetParametersJSON

func (a *AutoRenewFundingRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*AutoRenewFundingRequest) GetParametersQuery

func (a *AutoRenewFundingRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*AutoRenewFundingRequest) GetPath

func (a *AutoRenewFundingRequest) GetPath() string

GetPath returns the request path of the API

func (*AutoRenewFundingRequest) GetQueryParameters

func (a *AutoRenewFundingRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*AutoRenewFundingRequest) GetSlugParameters

func (a *AutoRenewFundingRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*AutoRenewFundingRequest) GetSlugsMap

func (a *AutoRenewFundingRequest) GetSlugsMap() (map[string]string, error)

func (*AutoRenewFundingRequest) Period

* Period sets period Defaults to 2

func (*AutoRenewFundingRequest) Rate

* Rate sets rate is the percentage rate at which to auto-renew. (rate == 0 to renew at FRR). Defaults to FRR if omitted

func (*AutoRenewFundingRequest) Status

* Status sets status - 1 to activate, 0 to deactivate

type AutoRenewFundingResponse

type AutoRenewFundingResponse struct {
	Time        types.MillisecondTimestamp
	Type        string
	MessageID   any
	Placeholder any
	Offer       *RenewedFundingOffer
	Code        any
	Status      string
	Text        string
}

AutoRenewFundingResponse represents the response for funding auto-renew.

func (*AutoRenewFundingResponse) UnmarshalJSON

func (r *AutoRenewFundingResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the JSON array into the AutoRenewFundingResponse struct fields.

type BalanceUpdateEvent

type BalanceUpdateEvent struct {
	AUM    fixedpoint.Value
	AUMNet fixedpoint.Value
}

BalanceUpdateEvent represents a Bitfinex balance update event.

type BookEntry

type BookEntry struct {
	Price  fixedpoint.Value
	Count  int64
	Amount fixedpoint.Value
}

BookEntry represents a trading pair book entry.

type BookResponse

type BookResponse struct {
	BookEntries    []BookEntry
	FundingEntries []FundingBookEntry
}

BookResponse holds the parsed book entries.

func (*BookResponse) UnmarshalJSON

func (r *BookResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the Bitfinex book response. It uses parseRawArray to fill BookEntries or FundingEntries.

type BookSnapshotEvent

type BookSnapshotEvent struct {
	ChannelID int64
	Entries   []BookEntry
}

type BookUpdateEvent

type BookUpdateEvent struct {
	ChannelID int64

	Entry BookEntry
}

BookUpdateEvent represents an order book update or snapshot event.

type CancelFundingOfferRequest

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

CancelFundingOfferRequest represents a request to cancel a funding offer. API: https://docs.bitfinex.com/reference/rest-auth-cancel-funding-offer

func (*CancelFundingOfferRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*CancelFundingOfferRequest) GetParameters

func (c *CancelFundingOfferRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*CancelFundingOfferRequest) GetParametersJSON

func (c *CancelFundingOfferRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*CancelFundingOfferRequest) GetParametersQuery

func (c *CancelFundingOfferRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*CancelFundingOfferRequest) GetPath

func (c *CancelFundingOfferRequest) GetPath() string

GetPath returns the request path of the API

func (*CancelFundingOfferRequest) GetQueryParameters

func (c *CancelFundingOfferRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*CancelFundingOfferRequest) GetSlugParameters

func (c *CancelFundingOfferRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*CancelFundingOfferRequest) GetSlugsMap

func (c *CancelFundingOfferRequest) GetSlugsMap() (map[string]string, error)

func (*CancelFundingOfferRequest) Id

* Id sets

type CancelFundingOfferResponse

type CancelFundingOfferResponse struct {
	Mts       types.MillisecondTimestamp // response timestamp
	Type      string                     // response type
	MessageID *int64                     // message ID

	FundingOffer FundingOffer // funding offer details
	Code         *int64       // response code
	Status       string       // response status
	Text         *string      // response text (nullable)
	// contains filtered or unexported fields
}

CancelFundingOfferResponse represents the response for canceling a funding offer.

func (*CancelFundingOfferResponse) UnmarshalJSON

func (r *CancelFundingOfferResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the Bitfinex array response into CancelFundingOfferResponse.

type CancelOrderRequest

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

API: https://docs.bitfinex.com/reference/rest-auth-cancel-order CancelOrderRequest represents a Bitfinex order cancellation request.

CancelOrderRequest is used to cancel an order by ID, GID, or ClientOrderID.

func (*CancelOrderRequest) ClientOrderID

func (c *CancelOrderRequest) ClientOrderID(clientOrderID int64) *CancelOrderRequest

* ClientOrderID sets clientOrderID is the client order ID to cancel

func (*CancelOrderRequest) ClientOrderIDDate

func (c *CancelOrderRequest) ClientOrderIDDate(clientOrderIDDate string) *CancelOrderRequest

* ClientOrderIDDate sets cid_date is required if cid is used, format: "YYYY-MM-DD"

func (*CancelOrderRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*CancelOrderRequest) GetParameters

func (c *CancelOrderRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*CancelOrderRequest) GetParametersJSON

func (c *CancelOrderRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*CancelOrderRequest) GetParametersQuery

func (c *CancelOrderRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*CancelOrderRequest) GetPath

func (c *CancelOrderRequest) GetPath() string

GetPath returns the request path of the API

func (*CancelOrderRequest) GetQueryParameters

func (c *CancelOrderRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*CancelOrderRequest) GetSlugParameters

func (c *CancelOrderRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*CancelOrderRequest) GetSlugsMap

func (c *CancelOrderRequest) GetSlugsMap() (map[string]string, error)

func (*CancelOrderRequest) GroupID

func (c *CancelOrderRequest) GroupID(groupID int64) *CancelOrderRequest

* GroupID sets groupID is the group ID to cancel

func (*CancelOrderRequest) OrderID

func (c *CancelOrderRequest) OrderID(orderID int64) *CancelOrderRequest

* OrderID sets orderID is the order ID to cancel

type CancelOrderResponse

type CancelOrderResponse struct {
	Time      types.MillisecondTimestamp
	Type      string
	MessageID *int

	Data   Order
	Code   *int64
	Status string
	Text   string
	// contains filtered or unexported fields
}

CancelOrderResponse represents the response from Bitfinex order cancellation.

func (*CancelOrderResponse) UnmarshalJSON

func (r *CancelOrderResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the Bitfinex array response into CancelOrderResponse.

type Candle

type Candle struct {
	Time types.MillisecondTimestamp // millisecond timestamp

	Open   fixedpoint.Value // open price
	Close  fixedpoint.Value // close price
	High   fixedpoint.Value // high price
	Low    fixedpoint.Value // low price
	Volume fixedpoint.Value // volume
}

Candle represents a single candlestick returned by Bitfinex API.

func (*Candle) UnmarshalJSON

func (c *Candle) UnmarshalJSON(data []byte) error

UnmarshalJSON parses a JSON array into a Candle struct.

type CandleEvent

type CandleEvent struct {
	ChannelID int64

	Candle Candle
}

CandleEvent represents a kline/candle update or snapshot event.

type CandleSnapshotEvent

type CandleSnapshotEvent struct {
	ChannelID int64
	Candles   []Candle
}

type CandlesResponse

type CandlesResponse []Candle

CandlesResponse represents multiple candles response.

type Channel

type Channel string
const (
	ChannelTicker  Channel = "ticker"
	ChannelTrades  Channel = "trades"
	ChannelBook    Channel = "book"
	ChannelCandles Channel = "candles"
	ChannelStatus  Channel = "status"
)

type Client

type Client struct {
	requestgen.BaseAPIClient
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *Client

mock me in tests

func (*Client) Auth

func (c *Client) Auth(key string, secret string) *Client

func (*Client) Funding

func (c *Client) Funding() *FundingService

func (*Client) NewAuthenticatedRequest

func (c *Client) NewAuthenticatedRequest(
	ctx context.Context, method, refURL string, params url.Values, payload interface{},
) (*http.Request, error)

NewAuthenticatedRequest creates new http request for authenticated routes. Create a new authenticated GET request with the given permission type and endpoint url For example permissionType = "r" and refUrl = "/orders" then the target endpoint will be https://api.bitfinex.com/v2/auth/r/orders/:Symbol

func (*Client) NewCancelOrderRequest

func (c *Client) NewCancelOrderRequest() *CancelOrderRequest

NewCancelOrderRequest creates a new CancelOrderRequest.

func (*Client) NewGetBookRequest

func (c *Client) NewGetBookRequest() *GetBookRequest

NewGetBookRequest creates a new GetBookRequest.

func (*Client) NewGetCandlesRequest

func (c *Client) NewGetCandlesRequest() *GetCandlesRequest

NewGetCandlesRequest creates a new GetCandlesRequest.

func (*Client) NewGetDepositAddressRequest

func (c *Client) NewGetDepositAddressRequest() *GetDepositAddressRequest

NewGetDepositAddressRequest creates a new deposit address request.

func (*Client) NewGetMovementHistoryRequest

func (c *Client) NewGetMovementHistoryRequest() *GetMovementHistoryRequest

NewGetMovementHistoryRequest creates a new GetMovementHistoryRequest.

func (*Client) NewGetOrderHistoryBySymbolRequest

func (c *Client) NewGetOrderHistoryBySymbolRequest() *GetOrderHistoryBySymbolRequest

NewGetOrderHistoryRequest creates a new GetOrderHistoryBySymbolRequest.

func (*Client) NewGetOrderHistoryRequest

func (c *Client) NewGetOrderHistoryRequest() *GetOrderHistoryRequest

NewGetOrderHistoryRequest creates a new GetOrderHistoryRequest.

func (*Client) NewGetOrderTradesRequest

func (c *Client) NewGetOrderTradesRequest() *GetOrderTradesRequest

NewGetOrderTradesRequest creates a new GetOrderTradesRequest instance.

func (*Client) NewGetPairConfigRequest

func (c *Client) NewGetPairConfigRequest() *GetPairConfigRequest

NewGetPairConfigRequest creates a new request for pair config info.

func (*Client) NewGetPublicTradeHistoryBySymbolRequest

func (c *Client) NewGetPublicTradeHistoryBySymbolRequest() *GetPublicTradeHistoryBySymbolRequest

func (*Client) NewGetSummaryRequest

func (c *Client) NewGetSummaryRequest() *GetSummaryRequest

NewGetSummaryRequest creates a new GetSummaryRequest.

func (*Client) NewGetTickerRequest

func (c *Client) NewGetTickerRequest() *GetTickerRequest

func (*Client) NewGetTickersRequest

func (c *Client) NewGetTickersRequest() *GetTickersRequest

NewGetTickersRequest creates a new GetTickersRequest.

func (*Client) NewGetTradeHistoryBySymbolRequest

func (c *Client) NewGetTradeHistoryBySymbolRequest() *GetTradeHistoryBySymbolRequest

NewGetTradeHistoryBySymbolRequest creates a new GetTradeHistoryBySymbolRequest.

func (*Client) NewGetTradeHistoryRequest

func (c *Client) NewGetTradeHistoryRequest() *GetTradeHistoryRequest

NewGetTradeHistoryRequest creates a new GetTradeHistoryRequest

func (*Client) NewGetUserInfoRequest

func (c *Client) NewGetUserInfoRequest() *GetUserInfoRequest

NewGetUserInfoRequest creates a new GetUserInfoRequest.

func (*Client) NewGetWalletsRequest

func (c *Client) NewGetWalletsRequest() *GetWalletsRequest

NewGetWalletsRequest creates a new instance of GetWalletsRequest.

func (*Client) NewRetrieveOrderBySymbolRequest

func (c *Client) NewRetrieveOrderBySymbolRequest() *RetrieveOrderBySymbolRequest

NewRetrieveOrderRequest creates a new RetrieveOrderRequest.

func (*Client) NewRetrieveOrderRequest

func (c *Client) NewRetrieveOrderRequest() *RetrieveOrderRequest

NewRetrieveOrderRequest creates a new RetrieveOrderRequest.

func (*Client) NewSubmitOrderRequest

func (c *Client) NewSubmitOrderRequest() *SubmitOrderRequest

NewSubmitOrderRequest creates a new SubmitOrderRequest.

type CloseFundingRequest

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

CloseFundingRequest represents a Bitfinex funding close request. API: https://docs.bitfinex.com/reference/rest-auth-funding-close

func (*CloseFundingRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*CloseFundingRequest) GetParameters

func (c *CloseFundingRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*CloseFundingRequest) GetParametersJSON

func (c *CloseFundingRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*CloseFundingRequest) GetParametersQuery

func (c *CloseFundingRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*CloseFundingRequest) GetPath

func (c *CloseFundingRequest) GetPath() string

GetPath returns the request path of the API

func (*CloseFundingRequest) GetQueryParameters

func (c *CloseFundingRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*CloseFundingRequest) GetSlugParameters

func (c *CloseFundingRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*CloseFundingRequest) GetSlugsMap

func (c *CloseFundingRequest) GetSlugsMap() (map[string]string, error)

func (*CloseFundingRequest) Id

* Id sets id is the Offer ID (retrievable via the Funding Loans and Funding Credits endpoints)

type CloseFundingResponse

type CloseFundingResponse struct {
	Time types.MillisecondTimestamp
	Type string

	Status string
	// contains filtered or unexported fields
}

CloseFundingResponse represents the response for funding close.

func (*CloseFundingResponse) UnmarshalJSON

func (r *CloseFundingResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the JSON array into the CloseFundingResponse struct fields.

type DepositAddress

type DepositAddress struct {
	Method       string
	CurrencyCode string

	Address     string
	PoolAddress *string
	// contains filtered or unexported fields
}

DepositAddress represents the nested address array in the response.

func (*DepositAddress) UnmarshalJSON

func (r *DepositAddress) UnmarshalJSON(data []byte) error

type DepositAddressResponse

type DepositAddressResponse struct {
	MTS          int64
	Type         string
	MessageID    *string
	Placeholder  *string
	AddressArray DepositAddress
	Code         *string
	Status       string
	Text         string
}

DepositAddressResponse represents the response for deposit address.

func (*DepositAddressResponse) UnmarshalJSON

func (r *DepositAddressResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the JSON array response into DepositAddressResponse.

type ErrorResponse

type ErrorResponse struct {
	Type    string
	Code    int
	Message string
}

func (ErrorResponse) Error

func (e ErrorResponse) Error() string

type FeeInfo

type FeeInfo struct {
	CryptoFee fixedpoint.Value
	StableFee fixedpoint.Value
	FiatFee   fixedpoint.Value

	DerivRebate fixedpoint.Value
	// contains filtered or unexported fields
}

func (*FeeInfo) UnmarshalJSON

func (f *FeeInfo) UnmarshalJSON(data []byte) error

type FeeInfoArray

type FeeInfoArray struct {
	MakerFeeInfo FeeInfo
	TakerFeeInfo FeeInfo
}

FeeInfoArray contains maker/taker fee info.

func (*FeeInfoArray) UnmarshalJSON

func (f *FeeInfoArray) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the JSON array into the FeeInfoArray struct fields.

type Filter

type Filter string

Filter represents Bitfinex WebSocket auth filter type.

const (
	FilterTrading       Filter = "trading"
	FilterTradingBTCUSD Filter = "trading-tBTCUSD"
	FilterFunding       Filter = "funding"
	FilterFundingBTC    Filter = "funding-fBTC"
	FilterFundingUSD    Filter = "funding-fUSD"
	FilterFundingUST    Filter = "funding-fUST"

	FilterWallet            Filter = "wallet"
	FilterWalletExchangeBTC Filter = "wallet-exchange-BTC"

	FilterAlgo    Filter = "algo"
	FilterBalance Filter = "balance"
	FilterNotify  Filter = "notify"
)

type FundingBookEntry

type FundingBookEntry struct {
	Rate   fixedpoint.Value
	Period int64
	Count  int64
	Amount fixedpoint.Value
}

FundingBookEntry represents a funding currency book entry.

type FundingBookSnapshotEvent

type FundingBookSnapshotEvent struct {
	ChannelID int64
	Entries   []FundingBookEntry
}

type FundingBookUpdateEvent

type FundingBookUpdateEvent struct {
	ChannelID int64
	Entry     FundingBookEntry
}

FundingBookUpdateEvent represents a funding book entry event.

type FundingEarnings

type FundingEarnings struct {
	Placeholder1           any
	FundingEarningsPerCurr map[string]fixedpoint.Value
	FundingEarningsTotal   fixedpoint.Value
}

FundingEarnings contains funding earnings info.

func (*FundingEarnings) UnmarshalJSON

func (f *FundingEarnings) UnmarshalJSON(data []byte) error

type FundingInfo

type FundingInfo struct {
	YieldLoan    fixedpoint.Value // [0] YIELD_LOAN
	YieldLend    fixedpoint.Value // [1] YIELD_LEND
	DurationLoan fixedpoint.Value // [2] DURATION_LOAN
	DurationLend fixedpoint.Value // [3] DURATION_LEND
}

FundingInfo represents the inner funding info array.

func (*FundingInfo) UnmarshalJSON

func (i *FundingInfo) UnmarshalJSON(data []byte) error

type FundingInfoDetails

type FundingInfoDetails struct {
	YieldLoan    fixedpoint.Value
	YieldLend    fixedpoint.Value
	DurationLoan float64
	DurationLend float64
}

func (*FundingInfoDetails) UnmarshalJSON

func (d *FundingInfoDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the JSON array into the FundingInfoDetails struct fields.

type FundingInfoEvent

type FundingInfoEvent struct {
	UpdateType string      // [0] UPDATE_TYPE (e.g. "sym")
	Symbol     string      // [1] SYMBOL (e.g. "fUSD")
	Info       FundingInfo // [2] FundingInfo array
}

FundingInfoEvent represents the wrapper for Bitfinex funding info update event.

type FundingInfoResponse

type FundingInfoResponse struct {
	Type    string
	Symbol  string
	Details FundingInfoDetails
}

FundingInfoResponse represents the response for funding info.

func (*FundingInfoResponse) UnmarshalJSON

func (r *FundingInfoResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the JSON array into the FundingInfoResponse struct fields.

type FundingOffer

type FundingOffer struct {
	ID         int64                      // offer ID
	Symbol     string                     // funding currency symbol
	CreatedAt  types.MillisecondTimestamp // creation timestamp
	UpdatedAt  types.MillisecondTimestamp // update timestamp
	Amount     fixedpoint.Value           // amount
	AmountOrig fixedpoint.Value           // original amount
	OfferType  FundingOfferType           // offer type

	Flags       *int64             // flags
	OfferStatus FundingOfferStatus // offer status

	Rate   fixedpoint.Value // rate
	Period fixedpoint.Value // period in days
	Notify *boolint.Value   // notify
	Hidden *boolint.Value   // hidden

	Renew boolint.Value // auto renew
	Extra any
	// contains filtered or unexported fields
}

FundingOffer represents the funding offer details in the response.

func (*FundingOffer) UnmarshalJSON

func (f *FundingOffer) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the funding offer array into FundingOffer struct.

type FundingOfferStatus

type FundingOfferStatus string

FundingOfferStatus represents the status of a funding offer.

const (
	FundingOfferStatusActive          FundingOfferStatus = "ACTIVE"
	FundingOfferStatusPartiallyFilled FundingOfferStatus = "PARTIALLY FILLED"
)

func (FundingOfferStatus) String

func (s FundingOfferStatus) String() string

String returns the string representation of the FundingOfferStatus.

type FundingOfferType

type FundingOfferType string

FundingOfferType represents the type of funding order for Bitfinex API.

const (
	FundingOfferTypeLimit       FundingOfferType = "LIMIT"       // Place an order at an explicit, static rate
	FundingOfferTypeFRRDeltaFix FundingOfferType = "FRRDELTAFIX" // Place an order at an implicit, static rate, relative to the FRR
	FundingOfferTypeFRRDeltaVar FundingOfferType = "FRRDELTAVAR" // Place an order at an implicit, dynamic rate, relative to the FRR
)

func (FundingOfferType) String

func (t FundingOfferType) String() string

String returns the string representation of the FundingOfferType.

type FundingOfferUpdateEvent

type FundingOfferUpdateEvent struct {
	OfferID    int64                      // [0] OFFER_ID
	Symbol     string                     // [1] SYMBOL
	MtsCreated types.MillisecondTimestamp // [2] MTS_CREATED
	MtsUpdated types.MillisecondTimestamp // [3] MTS_UPDATED
	Amount     fixedpoint.Value           // [4] AMOUNT
	AmountOrig fixedpoint.Value           // [5] AMOUNT_ORIG
	OfferType  string                     // [6] OFFER_TYPE

	Flags  int64  // [9] FLAGS
	Status string // [10] STATUS

	Rate   fixedpoint.Value // [14] RATE
	Period int64            // [15] PERIOD
	Notify int64            // [16] NOTIFY
	Hidden int64            // [17] HIDDEN

	Renew    int64 // [19] RENEW
	RateReal any   // [20] RATE_REAL (nullable)
	// contains filtered or unexported fields
}

FundingOfferUpdateEvent represents a Bitfinex funding offer update event.

type FundingService

type FundingService struct {
	*Client
}

func (*FundingService) NewAutoRenewFundingRequest

func (c *FundingService) NewAutoRenewFundingRequest() *AutoRenewFundingRequest

NewAutoRenewFundingRequest creates a new AutoRenewFundingRequest.

func (*FundingService) NewCancelFundingOfferRequest

func (c *FundingService) NewCancelFundingOfferRequest() *CancelFundingOfferRequest

NewCancelFundingOfferRequest creates a new CancelFundingOfferRequest instance.

func (*FundingService) NewCloseFundingRequest

func (c *FundingService) NewCloseFundingRequest() *CloseFundingRequest

NewCloseFundingRequest creates a new CloseFundingRequest.

func (*FundingService) NewGetActiveFundingOffersRequest

func (c *FundingService) NewGetActiveFundingOffersRequest() *GetActiveFundingOffersRequest

NewGetActiveFundingOffersRequest creates a new GetActiveFundingOffersRequest instance.

func (*FundingService) NewGetFundingInfoRequest

func (c *FundingService) NewGetFundingInfoRequest() *GetFundingInfoRequest

NewGetFundingInfoRequest creates a new GetFundingInfoRequest.

func (*FundingService) NewGetFundingOfferHistoryRequest

func (c *FundingService) NewGetFundingOfferHistoryRequest() *GetFundingOfferHistoryRequest

NewGetFundingOfferHistoryRequest creates a new GetFundingOfferHistoryRequest.

func (*FundingService) NewGetFundingTradeHistoryRequest

func (c *FundingService) NewGetFundingTradeHistoryRequest() *GetFundingTradeHistoryRequest

NewGetFundingTradeHistoryRequest creates a new GetFundingTradeHistoryRequest.

func (*FundingService) NewSubmitFundingOfferRequest

func (c *FundingService) NewSubmitFundingOfferRequest() *SubmitFundingOfferRequest

NewSubmitFundingOfferRequest creates a new SubmitFundingOfferRequest instance.

type FundingTicker

type FundingTicker struct {
	Symbol              string
	FRR                 fixedpoint.Value
	Bid                 fixedpoint.Value
	BidPeriod           fixedpoint.Value
	BidSize             fixedpoint.Value
	Ask                 fixedpoint.Value
	AskPeriod           fixedpoint.Value
	AskSize             fixedpoint.Value
	DailyChange         fixedpoint.Value
	DailyChangeRelative fixedpoint.Value
	LastPrice           fixedpoint.Value
	Volume              fixedpoint.Value
	High                fixedpoint.Value
	Low                 fixedpoint.Value
	P1                  any
	P2                  any
	FRRAmountAvailable  *fixedpoint.Value // nullable
}

FundingTicker for funding tickers (symbol starts with 'f')

func (*FundingTicker) UnmarshalJSON

func (r *FundingTicker) UnmarshalJSON(data []byte) error

UnmarshalJSON parses a futures ticker response from a JSON array.

type FundingTickerEvent

type FundingTickerEvent struct {
	ChannelID int64

	FRR       fixedpoint.Value
	Bid       fixedpoint.Value
	BidPeriod int64
	BidSize   fixedpoint.Value

	Ask       fixedpoint.Value
	AskPeriod int64
	AskSize   fixedpoint.Value

	DailyChange         fixedpoint.Value
	DailyChangeRelative fixedpoint.Value
	LastPrice           fixedpoint.Value
	Volume              fixedpoint.Value
	High                fixedpoint.Value
	Low                 fixedpoint.Value

	FRRAmountAvailable fixedpoint.Value
	// contains filtered or unexported fields
}

FundingTickerEvent represents a funding ticker update or snapshot event.

type FundingTrade

type FundingTrade struct {
	ID        int64
	Currency  string
	CreatedAt types.MillisecondTimestamp
	OfferID   int64
	Amount    fixedpoint.Value
	Rate      fixedpoint.Value
	Period    int
	// contains filtered or unexported fields
}

FundingTrade represents a single funding trade returned by Bitfinex.

func (*FundingTrade) UnmarshalJSON

func (t *FundingTrade) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the JSON array into the FundingTrade struct fields.

type GetActiveFundingOffersRequest

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

GetActiveFundingOffersRequest represents a request for active funding offers. API: https://docs.bitfinex.com/reference/rest-auth-funding-offers

func (*GetActiveFundingOffersRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetActiveFundingOffersRequest) GetParameters

func (g *GetActiveFundingOffersRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetActiveFundingOffersRequest) GetParametersJSON

func (g *GetActiveFundingOffersRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetActiveFundingOffersRequest) GetParametersQuery

func (g *GetActiveFundingOffersRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetActiveFundingOffersRequest) GetPath

GetPath returns the request path of the API

func (*GetActiveFundingOffersRequest) GetQueryParameters

func (g *GetActiveFundingOffersRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetActiveFundingOffersRequest) GetSlugParameters

func (g *GetActiveFundingOffersRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetActiveFundingOffersRequest) GetSlugsMap

func (g *GetActiveFundingOffersRequest) GetSlugsMap() (map[string]string, error)

func (*GetActiveFundingOffersRequest) Symbol

* Symbol sets

type GetBookRequest

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

GetBookRequest represents a request for Bitfinex order book.

func (*GetBookRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetBookRequest) GetParameters

func (g *GetBookRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetBookRequest) GetParametersJSON

func (g *GetBookRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetBookRequest) GetParametersQuery

func (g *GetBookRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetBookRequest) GetPath

func (g *GetBookRequest) GetPath() string

GetPath returns the request path of the API

func (*GetBookRequest) GetQueryParameters

func (g *GetBookRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetBookRequest) GetSlugParameters

func (g *GetBookRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetBookRequest) GetSlugsMap

func (g *GetBookRequest) GetSlugsMap() (map[string]string, error)

func (*GetBookRequest) Length

func (g *GetBookRequest) Length(length int) *GetBookRequest

* Length sets

func (*GetBookRequest) Precision

func (g *GetBookRequest) Precision(precision string) *GetBookRequest

* Precision sets

func (*GetBookRequest) Symbol

func (g *GetBookRequest) Symbol(symbol string) *GetBookRequest

* Symbol sets

type GetCandlesRequest

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

GetCandlesRequest represents a request for Bitfinex public candles endpoint.

func (*GetCandlesRequest) Candle

func (g *GetCandlesRequest) Candle(candle string) *GetCandlesRequest

* Candle sets

func (*GetCandlesRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetCandlesRequest) End

* End sets end: If end is given, only records with MTS <= end (milliseconds) will be given as response.

func (*GetCandlesRequest) GetParameters

func (g *GetCandlesRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetCandlesRequest) GetParametersJSON

func (g *GetCandlesRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetCandlesRequest) GetParametersQuery

func (g *GetCandlesRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetCandlesRequest) GetPath

func (g *GetCandlesRequest) GetPath() string

GetPath returns the request path of the API

func (*GetCandlesRequest) GetQueryParameters

func (g *GetCandlesRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetCandlesRequest) GetSlugParameters

func (g *GetCandlesRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetCandlesRequest) GetSlugsMap

func (g *GetCandlesRequest) GetSlugsMap() (map[string]string, error)

func (*GetCandlesRequest) Limit

func (g *GetCandlesRequest) Limit(limit int) *GetCandlesRequest

* Limit sets limit: Number of records in response (max. 10000).

func (*GetCandlesRequest) Section

func (g *GetCandlesRequest) Section(section string) *GetCandlesRequest

* Section sets

func (*GetCandlesRequest) Sort

func (g *GetCandlesRequest) Sort(sort int) *GetCandlesRequest

* Sort sets sort: +1: sort in ascending order | -1: sort in descending order (by MTS field).

func (*GetCandlesRequest) Start

func (g *GetCandlesRequest) Start(start int64) *GetCandlesRequest

* Start sets start: If start is given, only records with MTS >= start (milliseconds) will be given as response.

type GetDepositAddressRequest

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

GetDepositAddressRequest represents a request for deposit address.

func (*GetDepositAddressRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetDepositAddressRequest) GetParameters

func (g *GetDepositAddressRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetDepositAddressRequest) GetParametersJSON

func (g *GetDepositAddressRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetDepositAddressRequest) GetParametersQuery

func (g *GetDepositAddressRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetDepositAddressRequest) GetPath

func (g *GetDepositAddressRequest) GetPath() string

GetPath returns the request path of the API

func (*GetDepositAddressRequest) GetQueryParameters

func (g *GetDepositAddressRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetDepositAddressRequest) GetSlugParameters

func (g *GetDepositAddressRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetDepositAddressRequest) GetSlugsMap

func (g *GetDepositAddressRequest) GetSlugsMap() (map[string]string, error)

func (*GetDepositAddressRequest) Method

* Method sets method - method of deposit (methods accepted: “bitcoin”, “litecoin”, “ethereum”, ...) For an up-to-date listing of supported currencies see: https://api-pub.bitfinex.com//v2/conf/pub:map:tx:method

func (*GetDepositAddressRequest) OpRenew

* OpRenew sets opRenew - Input 1 to generate a new deposit address (old addresses remain valid). Defaults to 0 if omitted, which will return the existing deposit address

func (*GetDepositAddressRequest) Wallet

* Wallet sets wallet - Select the wallet from which to transfer (exchange, margin, funding (can also use the old labels which are exchange, trading and deposit respectively))

type GetFundingInfoRequest

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

GetFundingInfoRequest represents a Bitfinex funding info request. API: https://docs.bitfinex.com/reference/rest-auth-info-funding

func (*GetFundingInfoRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetFundingInfoRequest) GetParameters

func (g *GetFundingInfoRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetFundingInfoRequest) GetParametersJSON

func (g *GetFundingInfoRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetFundingInfoRequest) GetParametersQuery

func (g *GetFundingInfoRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetFundingInfoRequest) GetPath

func (g *GetFundingInfoRequest) GetPath() string

GetPath returns the request path of the API

func (*GetFundingInfoRequest) GetQueryParameters

func (g *GetFundingInfoRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetFundingInfoRequest) GetSlugParameters

func (g *GetFundingInfoRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetFundingInfoRequest) GetSlugsMap

func (g *GetFundingInfoRequest) GetSlugsMap() (map[string]string, error)

func (*GetFundingInfoRequest) Key

* Key sets

type GetFundingOfferHistoryRequest

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

GetFundingOfferHistoryRequest represents a Bitfinex funding offer history request. API: https://docs.bitfinex.com/reference/rest-auth-funding-offers-hist

func (*GetFundingOfferHistoryRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetFundingOfferHistoryRequest) GetParameters

func (g *GetFundingOfferHistoryRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetFundingOfferHistoryRequest) GetParametersJSON

func (g *GetFundingOfferHistoryRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetFundingOfferHistoryRequest) GetParametersQuery

func (g *GetFundingOfferHistoryRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetFundingOfferHistoryRequest) GetPath

GetPath returns the request path of the API

func (*GetFundingOfferHistoryRequest) GetQueryParameters

func (g *GetFundingOfferHistoryRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetFundingOfferHistoryRequest) GetSlugParameters

func (g *GetFundingOfferHistoryRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetFundingOfferHistoryRequest) GetSlugsMap

func (g *GetFundingOfferHistoryRequest) GetSlugsMap() (map[string]string, error)

type GetFundingTradeHistoryRequest

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

GetFundingTradeHistoryRequest represents a Bitfinex funding trade history request. API: https://docs.bitfinex.com/reference/rest-auth-funding-trades-hist

func (*GetFundingTradeHistoryRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetFundingTradeHistoryRequest) GetParameters

func (g *GetFundingTradeHistoryRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetFundingTradeHistoryRequest) GetParametersJSON

func (g *GetFundingTradeHistoryRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetFundingTradeHistoryRequest) GetParametersQuery

func (g *GetFundingTradeHistoryRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetFundingTradeHistoryRequest) GetPath

GetPath returns the request path of the API

func (*GetFundingTradeHistoryRequest) GetQueryParameters

func (g *GetFundingTradeHistoryRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetFundingTradeHistoryRequest) GetSlugParameters

func (g *GetFundingTradeHistoryRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetFundingTradeHistoryRequest) GetSlugsMap

func (g *GetFundingTradeHistoryRequest) GetSlugsMap() (map[string]string, error)

func (*GetFundingTradeHistoryRequest) Symbol

* Symbol sets

type GetMovementHistoryRequest

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

GetMovementHistoryRequest represents a Bitfinex movements history request.

func (*GetMovementHistoryRequest) AddId

func (*GetMovementHistoryRequest) Address

* Address sets

func (*GetMovementHistoryRequest) Currency

* Currency sets

func (*GetMovementHistoryRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetMovementHistoryRequest) End

* End sets

func (*GetMovementHistoryRequest) GetParameters

func (g *GetMovementHistoryRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetMovementHistoryRequest) GetParametersJSON

func (g *GetMovementHistoryRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetMovementHistoryRequest) GetParametersQuery

func (g *GetMovementHistoryRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetMovementHistoryRequest) GetPath

func (g *GetMovementHistoryRequest) GetPath() string

GetPath returns the request path of the API

func (*GetMovementHistoryRequest) GetQueryParameters

func (g *GetMovementHistoryRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetMovementHistoryRequest) GetSlugParameters

func (g *GetMovementHistoryRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetMovementHistoryRequest) GetSlugsMap

func (g *GetMovementHistoryRequest) GetSlugsMap() (map[string]string, error)

func (*GetMovementHistoryRequest) Id

* Id sets

func (*GetMovementHistoryRequest) Limit

* Limit sets

func (*GetMovementHistoryRequest) Start

* Start sets

type GetOrderHistoryBySymbolRequest

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

GetOrderHistoryBySymbolRequest retrieves all user's closed/cancelled orders up to 2 weeks in the past by trading pair symbol (e.g. tBTCUSD, tLTCBTC, ...). API: https://docs.bitfinex.com/reference/rest-auth-orders-history-by-symbol

func (*GetOrderHistoryBySymbolRequest) AddOrderId

func (*GetOrderHistoryBySymbolRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetOrderHistoryBySymbolRequest) End

* End sets

func (*GetOrderHistoryBySymbolRequest) GetParameters

func (g *GetOrderHistoryBySymbolRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetOrderHistoryBySymbolRequest) GetParametersJSON

func (g *GetOrderHistoryBySymbolRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetOrderHistoryBySymbolRequest) GetParametersQuery

func (g *GetOrderHistoryBySymbolRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetOrderHistoryBySymbolRequest) GetPath

GetPath returns the request path of the API

func (*GetOrderHistoryBySymbolRequest) GetQueryParameters

func (g *GetOrderHistoryBySymbolRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetOrderHistoryBySymbolRequest) GetSlugParameters

func (g *GetOrderHistoryBySymbolRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetOrderHistoryBySymbolRequest) GetSlugsMap

func (g *GetOrderHistoryBySymbolRequest) GetSlugsMap() (map[string]string, error)

func (*GetOrderHistoryBySymbolRequest) Limit

* Limit sets

func (*GetOrderHistoryBySymbolRequest) OrderId

* OrderId sets

func (*GetOrderHistoryBySymbolRequest) Start

* Start sets

func (*GetOrderHistoryBySymbolRequest) Symbol

* Symbol sets

type GetOrderHistoryRequest

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

GetOrderHistoryRequest used to retrieve the order history for a specific trading pair on Bitfinex. API: https://docs.bitfinex.com/reference/rest-auth-orders-history

func (*GetOrderHistoryRequest) AddOrderId

func (g *GetOrderHistoryRequest) AddOrderId(orderId ...int64) *GetOrderHistoryRequest

func (*GetOrderHistoryRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetOrderHistoryRequest) End

* End sets

func (*GetOrderHistoryRequest) GetParameters

func (g *GetOrderHistoryRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetOrderHistoryRequest) GetParametersJSON

func (g *GetOrderHistoryRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetOrderHistoryRequest) GetParametersQuery

func (g *GetOrderHistoryRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetOrderHistoryRequest) GetPath

func (g *GetOrderHistoryRequest) GetPath() string

GetPath returns the request path of the API

func (*GetOrderHistoryRequest) GetQueryParameters

func (g *GetOrderHistoryRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetOrderHistoryRequest) GetSlugParameters

func (g *GetOrderHistoryRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetOrderHistoryRequest) GetSlugsMap

func (g *GetOrderHistoryRequest) GetSlugsMap() (map[string]string, error)

func (*GetOrderHistoryRequest) Limit

* Limit sets

func (*GetOrderHistoryRequest) OrderId

func (g *GetOrderHistoryRequest) OrderId(orderId []int64) *GetOrderHistoryRequest

* OrderId sets

func (*GetOrderHistoryRequest) Start

* Start sets

type GetOrderTradesRequest

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

GetOrderTradesRequest represents a request for Bitfinex order trades API. API: https://docs.bitfinex.com/reference/rest-auth-order-trades

func (*GetOrderTradesRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetOrderTradesRequest) GetParameters

func (g *GetOrderTradesRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetOrderTradesRequest) GetParametersJSON

func (g *GetOrderTradesRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetOrderTradesRequest) GetParametersQuery

func (g *GetOrderTradesRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetOrderTradesRequest) GetPath

func (g *GetOrderTradesRequest) GetPath() string

GetPath returns the request path of the API

func (*GetOrderTradesRequest) GetQueryParameters

func (g *GetOrderTradesRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetOrderTradesRequest) GetSlugParameters

func (g *GetOrderTradesRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetOrderTradesRequest) GetSlugsMap

func (g *GetOrderTradesRequest) GetSlugsMap() (map[string]string, error)

func (*GetOrderTradesRequest) Id

* Id sets

func (*GetOrderTradesRequest) Symbol

* Symbol sets

type GetPairConfigRequest

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

GetPairConfigRequest for Bitfinex conf endpoint.

func (*GetPairConfigRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetPairConfigRequest) GetParameters

func (g *GetPairConfigRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetPairConfigRequest) GetParametersJSON

func (g *GetPairConfigRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetPairConfigRequest) GetParametersQuery

func (g *GetPairConfigRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetPairConfigRequest) GetPath

func (g *GetPairConfigRequest) GetPath() string

GetPath returns the request path of the API

func (*GetPairConfigRequest) GetQueryParameters

func (g *GetPairConfigRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetPairConfigRequest) GetSlugParameters

func (g *GetPairConfigRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetPairConfigRequest) GetSlugsMap

func (g *GetPairConfigRequest) GetSlugsMap() (map[string]string, error)

type GetPublicTradeHistoryBySymbolRequest

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

GetPublicTradeHistoryBySymbolRequest API: https://docs.bitfinex.com/reference/rest-public-trades

func (*GetPublicTradeHistoryBySymbolRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetPublicTradeHistoryBySymbolRequest) End

* End sets

func (*GetPublicTradeHistoryBySymbolRequest) GetParameters

func (g *GetPublicTradeHistoryBySymbolRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetPublicTradeHistoryBySymbolRequest) GetParametersJSON

func (g *GetPublicTradeHistoryBySymbolRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetPublicTradeHistoryBySymbolRequest) GetParametersQuery

func (g *GetPublicTradeHistoryBySymbolRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetPublicTradeHistoryBySymbolRequest) GetPath

GetPath returns the request path of the API

func (*GetPublicTradeHistoryBySymbolRequest) GetQueryParameters

func (g *GetPublicTradeHistoryBySymbolRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetPublicTradeHistoryBySymbolRequest) GetSlugParameters

func (g *GetPublicTradeHistoryBySymbolRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetPublicTradeHistoryBySymbolRequest) GetSlugsMap

func (g *GetPublicTradeHistoryBySymbolRequest) GetSlugsMap() (map[string]string, error)

func (*GetPublicTradeHistoryBySymbolRequest) Limit

* Limit sets

func (*GetPublicTradeHistoryBySymbolRequest) Sort

* Sort sets

func (*GetPublicTradeHistoryBySymbolRequest) Start

* Start sets

func (*GetPublicTradeHistoryBySymbolRequest) Symbol

* Symbol sets

type GetSummaryRequest

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

GetSummaryRequest represents a Bitfinex summary request. API: https://docs.bitfinex.com/reference/rest-auth-summary

func (*GetSummaryRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetSummaryRequest) GetParameters

func (g *GetSummaryRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetSummaryRequest) GetParametersJSON

func (g *GetSummaryRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetSummaryRequest) GetParametersQuery

func (g *GetSummaryRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetSummaryRequest) GetPath

func (g *GetSummaryRequest) GetPath() string

GetPath returns the request path of the API

func (*GetSummaryRequest) GetQueryParameters

func (g *GetSummaryRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetSummaryRequest) GetSlugParameters

func (g *GetSummaryRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetSummaryRequest) GetSlugsMap

func (g *GetSummaryRequest) GetSlugsMap() (map[string]string, error)

type GetTickerRequest

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

API: https://api-pub.bitfinex.com/v2/ticker/{symbol}

func (*GetTickerRequest) Do

func (g *GetTickerRequest) Do(ctx context.Context) (*Ticker, error)

Do generates the request object and send the request object to the API endpoint

func (*GetTickerRequest) GetParameters

func (g *GetTickerRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetTickerRequest) GetParametersJSON

func (g *GetTickerRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetTickerRequest) GetParametersQuery

func (g *GetTickerRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetTickerRequest) GetPath

func (g *GetTickerRequest) GetPath() string

GetPath returns the request path of the API

func (*GetTickerRequest) GetQueryParameters

func (g *GetTickerRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetTickerRequest) GetSlugParameters

func (g *GetTickerRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetTickerRequest) GetSlugsMap

func (g *GetTickerRequest) GetSlugsMap() (map[string]string, error)

func (*GetTickerRequest) Symbol

func (g *GetTickerRequest) Symbol(symbol string) *GetTickerRequest

* Symbol sets

type GetTickersRequest

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

func (*GetTickersRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetTickersRequest) GetParameters

func (g *GetTickersRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetTickersRequest) GetParametersJSON

func (g *GetTickersRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetTickersRequest) GetParametersQuery

func (g *GetTickersRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetTickersRequest) GetPath

func (g *GetTickersRequest) GetPath() string

GetPath returns the request path of the API

func (*GetTickersRequest) GetQueryParameters

func (g *GetTickersRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetTickersRequest) GetSlugParameters

func (g *GetTickersRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetTickersRequest) GetSlugsMap

func (g *GetTickersRequest) GetSlugsMap() (map[string]string, error)

func (*GetTickersRequest) Symbols

func (g *GetTickersRequest) Symbols(symbols string) *GetTickersRequest

* Symbols sets

type GetTradeHistoryBySymbolRequest

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

GetTradeHistoryBySymbolRequest API: https://docs.bitfinex.com/reference/rest-auth-trades-by-symbol

func (*GetTradeHistoryBySymbolRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetTradeHistoryBySymbolRequest) End

* End sets

func (*GetTradeHistoryBySymbolRequest) GetParameters

func (g *GetTradeHistoryBySymbolRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetTradeHistoryBySymbolRequest) GetParametersJSON

func (g *GetTradeHistoryBySymbolRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetTradeHistoryBySymbolRequest) GetParametersQuery

func (g *GetTradeHistoryBySymbolRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetTradeHistoryBySymbolRequest) GetPath

GetPath returns the request path of the API

func (*GetTradeHistoryBySymbolRequest) GetQueryParameters

func (g *GetTradeHistoryBySymbolRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetTradeHistoryBySymbolRequest) GetSlugParameters

func (g *GetTradeHistoryBySymbolRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetTradeHistoryBySymbolRequest) GetSlugsMap

func (g *GetTradeHistoryBySymbolRequest) GetSlugsMap() (map[string]string, error)

func (*GetTradeHistoryBySymbolRequest) Limit

* Limit sets

func (*GetTradeHistoryBySymbolRequest) Sort

* Sort sets

func (*GetTradeHistoryBySymbolRequest) Start

* Start sets

func (*GetTradeHistoryBySymbolRequest) Symbol

* Symbol sets

type GetTradeHistoryRequest

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

GetTradeHistoryRequest API: https://docs.bitfinex.com/reference/rest-auth-trades

func (*GetTradeHistoryRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetTradeHistoryRequest) End

* End sets

func (*GetTradeHistoryRequest) GetParameters

func (g *GetTradeHistoryRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetTradeHistoryRequest) GetParametersJSON

func (g *GetTradeHistoryRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetTradeHistoryRequest) GetParametersQuery

func (g *GetTradeHistoryRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetTradeHistoryRequest) GetPath

func (g *GetTradeHistoryRequest) GetPath() string

GetPath returns the request path of the API

func (*GetTradeHistoryRequest) GetQueryParameters

func (g *GetTradeHistoryRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetTradeHistoryRequest) GetSlugParameters

func (g *GetTradeHistoryRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetTradeHistoryRequest) GetSlugsMap

func (g *GetTradeHistoryRequest) GetSlugsMap() (map[string]string, error)

func (*GetTradeHistoryRequest) Limit

* Limit sets

func (*GetTradeHistoryRequest) Sort

* Sort sets

func (*GetTradeHistoryRequest) Start

* Start sets

type GetUserInfoRequest

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

GetUserInfoRequest represents a Bitfinex user info request. API: https://docs.bitfinex.com/reference/rest-auth-info-user

func (*GetUserInfoRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetUserInfoRequest) GetParameters

func (g *GetUserInfoRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetUserInfoRequest) GetParametersJSON

func (g *GetUserInfoRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetUserInfoRequest) GetParametersQuery

func (g *GetUserInfoRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetUserInfoRequest) GetPath

func (g *GetUserInfoRequest) GetPath() string

GetPath returns the request path of the API

func (*GetUserInfoRequest) GetQueryParameters

func (g *GetUserInfoRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetUserInfoRequest) GetSlugParameters

func (g *GetUserInfoRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetUserInfoRequest) GetSlugsMap

func (g *GetUserInfoRequest) GetSlugsMap() (map[string]string, error)

type GetWalletsRequest

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

GetWalletsRequest represents the request structure for the authenticated wallets endpoint. API: https://docs.bitfinex.com/reference/rest-auth-wallets

func (*GetWalletsRequest) Do

func (g *GetWalletsRequest) Do(ctx context.Context) ([]Wallet, error)

Do generates the request object and send the request object to the API endpoint

func (*GetWalletsRequest) GetParameters

func (g *GetWalletsRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetWalletsRequest) GetParametersJSON

func (g *GetWalletsRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetWalletsRequest) GetParametersQuery

func (g *GetWalletsRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetWalletsRequest) GetPath

func (g *GetWalletsRequest) GetPath() string

GetPath returns the request path of the API

func (*GetWalletsRequest) GetQueryParameters

func (g *GetWalletsRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetWalletsRequest) GetSlugParameters

func (g *GetWalletsRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetWalletsRequest) GetSlugsMap

func (g *GetWalletsRequest) GetSlugsMap() (map[string]string, error)

type HeartBeatEvent

type HeartBeatEvent struct {
	ChannelID int64
	Channel   Channel
}

HeartBeatEvent represents a heartbeat event from Bitfinex WebSocket.

type LeoInfo

type LeoInfo struct {
	LeoLev       fixedpoint.Value `json:"leo_lev"`
	LeoAmountAvg fixedpoint.Value `json:"leo_amount_avg"`
}

LeoInfo contains LEO token info.

type Meta

type Meta struct {
	AffCode          string `json:"aff_code,omitempty"`          // affiliate code
	MakeVisible      int    `json:"make_visible,omitempty"`      // 1 to make visible on hit for hidden orders
	ProtectSelfMatch int    `json:"protect_selfmatch,omitempty"` // 1 to cancel submitted order if it would match with own order
}

Meta defines optional metadata for Bitfinex order submission.

type Movement

type Movement struct {
	ID           int64
	Currency     string
	CurrencyName string

	MtsStarted types.MillisecondTimestamp
	MtsUpdated types.MillisecondTimestamp

	Status string

	Amount fixedpoint.Value
	Fees   fixedpoint.Value

	DestinationAddress *string
	PaymentID          *string

	TransactionID *string
	WithdrawNote  *string
	// contains filtered or unexported fields
}

Movement represents a single deposit or withdrawal movement from Bitfinex API.

func (*Movement) UnmarshalJSON

func (m *Movement) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the Bitfinex movement array response into Movement fields.

type Order

type Order struct {
	OrderID       int64
	GroupOrderID  *int64
	ClientOrderID *int64
	Symbol        string
	CreatedAt     types.MillisecondTimestamp
	UpdatedAt     types.MillisecondTimestamp
	Amount        fixedpoint.Value
	AmountOrig    fixedpoint.Value

	OrderType OrderType
	TypePrev  *string

	// MtsTif - Millisecond epoch timestamp for TIF (Time-In-Force)
	MtsTif *int64

	Flags  OrderFlag
	Status OrderStatus

	Price         fixedpoint.Value
	PriceAvg      fixedpoint.Value
	PriceTrailing fixedpoint.Value
	PriceAuxLimit fixedpoint.Value

	Notify   int64
	Hidden   int64
	PlacedID *int64

	Routing string

	Meta json.RawMessage
	// contains filtered or unexported fields
}

Order represents a single order in the response DATA array.

func (*Order) String

func (o *Order) String() string

String returns a human readable summary of the order data, skipping nil or empty fields.

func (*Order) UnmarshalJSON

func (o *Order) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the Bitfinex Order JSON array.

type OrderFlag

type OrderFlag int
const (
	OrderFlagHidden     OrderFlag = 64    // hidden order
	OrderFlagClose      OrderFlag = 512   // close position
	OrderFlagReduceOnly OrderFlag = 1024  // reduce-only
	OrderFlagPostOnly   OrderFlag = 4096  // post-only order
	OrderFlagOCO        OrderFlag = 16384 // one-cancels-other
	OrderFlagNoVarRate  OrderFlag = 524288
)

func OrderFlagKeys

func OrderFlagKeys(values map[OrderFlag]struct{}) (slice []OrderFlag)

OrderFlagKeys converts a map of OrderFlag to a slice of OrderFlag

type OrderStatus

type OrderStatus string

OrderStatus represents the status of an order in Bitfinex. https://docs.bitfinex.com/docs/abbreviations-glossary#order-status

const (
	OrderStatusActive            OrderStatus = "ACTIVE"               // order is active
	OrderStatusExecuted          OrderStatus = "EXECUTED"             // order has been fully filled
	OrderStatusPartiallyFilled   OrderStatus = "PARTIALLY FILLED"     // order has been partially filled
	OrderStatusCanceled          OrderStatus = "CANCELED"             // order has been canceled
	OrderStatusPostponed         OrderStatus = "POSTPONED"            // order has been postponed
	OrderStatusInsufficientBal   OrderStatus = "INSUFFICIENT BALANCE" // insufficient balance
	OrderStatusStopped           OrderStatus = "STOPPED"              // order stopped
	OrderStatusRejected          OrderStatus = "REJECTED"             // order rejected
	OrderStatusExpired           OrderStatus = "EXPIRED"              // order expired
	OrderStatusPending           OrderStatus = "PENDING"              // order pending
	OrderStatusPartiallyCanceled OrderStatus = "PARTIALLY CANCELED"   // order partially canceled
)

func OrderStatusKeys

func OrderStatusKeys(values map[OrderStatus]struct{}) (slice []OrderStatus)

OrderStatusKeys converts a map of OrderStatus to a slice of OrderStatus

func (*OrderStatus) UnmarshalJSON

func (s *OrderStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom unmarshaling for OrderStatus. It parses status strings like "EXECUTED @ 107.6(-0.2)", "CANCELED was: PARTIALLY FILLED @ ...", etc.

type OrderTradeDetail

type OrderTradeDetail struct {
	TradeID    int64                      // trade ID
	Symbol     string                     // trading pair symbol
	Time       types.MillisecondTimestamp // timestamp in ms
	OrderID    int64                      // order ID
	ExecAmount fixedpoint.Value           // executed amount
	ExecPrice  fixedpoint.Value           // executed price

	// Maker field: 1 if true, -1 if false
	Maker int // maker flag

	Fee           fixedpoint.Value // fee amount
	FeeCurrency   string           // fee currency
	ClientOrderID int64            // client order ID
	// contains filtered or unexported fields
}

OrderTradeDetail represents a trade detail for a Bitfinex order trade API response. It matches the array response format from Bitfinex.

func (*OrderTradeDetail) UnmarshalJSON

func (t *OrderTradeDetail) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the Bitfinex order trades API array response into OrderTradeDetail fields.

type OrderType

type OrderType string
const (
	OrderTypeLimit         OrderType = "LIMIT"          // limit order
	OrderTypeExchangeLimit OrderType = "EXCHANGE LIMIT" // exchange limit order

	OrderTypeMarket               OrderType = "MARKET"                 // market order
	OrderTypeExchangeMarket       OrderType = "EXCHANGE MARKET"        // exchange market order
	OrderTypeStop                 OrderType = "STOP"                   // stop order
	OrderTypeExchangeStop         OrderType = "EXCHANGE STOP"          // exchange stop order
	OrderTypeStopLimit            OrderType = "STOP LIMIT"             // stop limit order
	OrderTypeExchangeStopLimit    OrderType = "EXCHANGE STOP LIMIT"    // exchange stop limit order
	OrderTypeTrailingStop         OrderType = "TRAILING STOP"          // trailing stop order
	OrderTypeExchangeTrailingStop OrderType = "EXCHANGE TRAILING STOP" // exchange trailing stop order
	OrderTypeFOK                  OrderType = "FOK"                    // fill-or-kill order
	OrderTypeExchangeFOK          OrderType = "EXCHANGE FOK"           // exchange fill-or-kill order
	OrderTypeIOC                  OrderType = "IOC"                    // immediate-or-cancel order
	OrderTypeExchangeIOC          OrderType = "EXCHANGE IOC"           // exchange immediate-or-cancel order
)

func OrderTypeKeys

func OrderTypeKeys(values map[OrderType]struct{}) (slice []OrderType)

OrderTypeKeys converts a map of OrderType to a slice of OrderType

type PairConfig

type PairConfig struct {
	Pair string

	MinOrderSize fixedpoint.Value
	MaxOrderSize fixedpoint.Value

	InitialMargin fixedpoint.Value
	MinMargin     fixedpoint.Value
	// contains filtered or unexported fields
}

type PairConfigResponse

type PairConfigResponse struct {
	Pairs []PairConfig
}

PairConfigResponse represents the config info for a trading pair from Bitfinex conf endpoint.

func (*PairConfigResponse) UnmarshalJSON

func (r *PairConfigResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the Bitfinex conf/pub:info:pair response format. Example response: [[PAIR, [[_, _, _, MIN_ORDER_SIZE, MAX_ORDER_SIZE, _, _, _, INITIAL_MARGIN, MIN_MARGIN], ...]]]

type Parser

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

Parser maintains channelID mapping and parses Bitfinex messages.

func NewParser

func NewParser() *Parser

NewParser creates a new Bitfinex Parser.

func (*Parser) GetChannelResponse

func (p *Parser) GetChannelResponse(channelID int64) (*WebSocketResponse, bool)

func (*Parser) Parse

func (p *Parser) Parse(message []byte) (interface{}, error)

Parse parses a Bitfinex websocket message.

type Permission

type Permission struct {
	Read  int `json:"read,omitempty"`
	Write int `json:"write,omitempty"`
}

type PermissionType

type PermissionType string

type PositionStatus

type PositionStatus string

PositionStatus represents the status of a Bitfinex user position.

const (
	PositionStatusActive PositionStatus = "ACTIVE"
	PositionStatusClosed PositionStatus = "CLOSED"
)

type PublicFundingTrade

type PublicFundingTrade struct {
	// ID of the trade
	ID int64

	// CreatedAt is the Millisecond epoch timestamp
	CreatedAt types.MillisecondTimestamp

	// Amount is How much was bought (positive) or sold (negative)
	Amount fixedpoint.Value

	Rate fixedpoint.Value

	Period int
}

type PublicFundingTradeEvent

type PublicFundingTradeEvent struct {
	ChannelID int64

	Trade PublicFundingTrade
}

PublicFundingTradeEvent represents a funding trade execution event ("fte") in trades channel and funding trade snapshot.

type PublicFundingTradeSnapshotEvent

type PublicFundingTradeSnapshotEvent struct {
	Trades []PublicFundingTrade
}

type PublicTrade

type PublicTrade struct {
	ID     int64
	Time   types.MillisecondTimestamp
	Amount fixedpoint.Value
	Price  fixedpoint.Value
}

type PublicTradeEvent

type PublicTradeEvent struct {
	ChannelID int64

	Trade PublicTrade
}

PublicTradeEvent represents a trade update or snapshot event.

type PublicTradeHistoryResponse

type PublicTradeHistoryResponse struct {
	Trades        []PublicTrade
	FundingTrades []PublicFundingTrade
}

func (*PublicTradeHistoryResponse) UnmarshalJSON

func (r *PublicTradeHistoryResponse) UnmarshalJSON(data []byte) error

type PublicTradeSnapshotEvent

type PublicTradeSnapshotEvent struct {
	Trades []PublicTrade
}

type RenewedFundingOffer

type RenewedFundingOffer struct {
	Currency string

	// Period is the period in days for the funding offer.
	Period int

	// Rate is the percentage rate for the funding offer.
	// Rate of the offer (percentage expressed as decimal number i.e. 1% = 0.01)
	Rate fixedpoint.Value

	// Threshold is the max amount to be auto-renewed
	Threshold int
}

FundingOfferArray represents the funding offer array in the response.

func (*RenewedFundingOffer) UnmarshalJSON

func (o *RenewedFundingOffer) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the JSON array into the FundingOfferArray struct fields.

type RetrieveOrderBySymbolRequest

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

API: https://docs.bitfinex.com/reference/rest-auth-retrieve-orders-by-symbol RetrieveOrderBySymbolRequest gets all the current user's active orders.

func (*RetrieveOrderBySymbolRequest) AddId

func (*RetrieveOrderBySymbolRequest) Cid

* Cid sets cid filters based on Client ID (requires cid_date)

func (*RetrieveOrderBySymbolRequest) CidDate

* CidDate sets cid_date must be provided with cid, format: "YYYY-MM-DD"

func (*RetrieveOrderBySymbolRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*RetrieveOrderBySymbolRequest) GetParameters

func (r *RetrieveOrderBySymbolRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*RetrieveOrderBySymbolRequest) GetParametersJSON

func (r *RetrieveOrderBySymbolRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*RetrieveOrderBySymbolRequest) GetParametersQuery

func (r *RetrieveOrderBySymbolRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*RetrieveOrderBySymbolRequest) GetPath

func (r *RetrieveOrderBySymbolRequest) GetPath() string

GetPath returns the request path of the API

func (*RetrieveOrderBySymbolRequest) GetQueryParameters

func (r *RetrieveOrderBySymbolRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*RetrieveOrderBySymbolRequest) GetSlugParameters

func (r *RetrieveOrderBySymbolRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*RetrieveOrderBySymbolRequest) GetSlugsMap

func (r *RetrieveOrderBySymbolRequest) GetSlugsMap() (map[string]string, error)

func (*RetrieveOrderBySymbolRequest) Gid

* Gid sets gid filters results based on Group ID

func (*RetrieveOrderBySymbolRequest) Id

* Id sets id allows retrieving specific orders by order ID

func (*RetrieveOrderBySymbolRequest) Symbol

* Symbol sets

type RetrieveOrderRequest

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

API: https://docs.bitfinex.com/reference/rest-auth-retrieve-orders RetrieveOrderRequest gets all the current user's active orders.

func (*RetrieveOrderRequest) AddId

func (*RetrieveOrderRequest) Cid

* Cid sets cid filters based on Client ID (requires cid_date)

func (*RetrieveOrderRequest) CidDate

func (r *RetrieveOrderRequest) CidDate(cidDate string) *RetrieveOrderRequest

* CidDate sets cid_date must be provided with cid, format: "YYYY-MM-DD"

func (*RetrieveOrderRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*RetrieveOrderRequest) GetParameters

func (r *RetrieveOrderRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*RetrieveOrderRequest) GetParametersJSON

func (r *RetrieveOrderRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*RetrieveOrderRequest) GetParametersQuery

func (r *RetrieveOrderRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*RetrieveOrderRequest) GetPath

func (r *RetrieveOrderRequest) GetPath() string

GetPath returns the request path of the API

func (*RetrieveOrderRequest) GetQueryParameters

func (r *RetrieveOrderRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*RetrieveOrderRequest) GetSlugParameters

func (r *RetrieveOrderRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*RetrieveOrderRequest) GetSlugsMap

func (r *RetrieveOrderRequest) GetSlugsMap() (map[string]string, error)

func (*RetrieveOrderRequest) Gid

* Gid sets gid filters results based on Group ID

func (*RetrieveOrderRequest) Id

* Id sets id allows retrieving specific orders by order ID

type RetrieveOrderResponse

type RetrieveOrderResponse struct {
	Orders []Order
}

RetrieveOrderResponse represents the response from Bitfinex order retrieval.

func (*RetrieveOrderResponse) UnmarshalJSON

func (r *RetrieveOrderResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the Bitfinex array response into RetrieveOrderResponse.

type StatusEvent

type StatusEvent struct {
	ChannelID int64
	Symbol    string
	TimeMs    int64

	DerivPrice fixedpoint.Value
	SpotPrice  fixedpoint.Value

	InsuranceFundBalance fixedpoint.Value

	NextFundingEventTsMs int64
	NextFundingAccrued   fixedpoint.Value
	NextFundingStep      int64

	CurrentFunding fixedpoint.Value

	MarkPrice fixedpoint.Value

	OpenInterest fixedpoint.Value

	ClampMin fixedpoint.Value
	ClampMax fixedpoint.Value
	// contains filtered or unexported fields
}

StatusEvent represents a status channel event.

type StreamName

type StreamName string

StreamName represents the stream name for private user data.

const (
	StreamOrderSnapshot StreamName = "os" // order snapshot
	StreamOrderNew      StreamName = "on" // order new
	StreamOrderUpdate   StreamName = "ou" // order update
	StreamOrderCancel   StreamName = "oc" // order cancel

	StreamPositionSnapshot StreamName = "ps" // position snapshot
	StreamPositionNew      StreamName = "pn" // position new
	StreamPositionUpdate   StreamName = "pu" // position update
	StreamPositionClose    StreamName = "pc" // position close

	StreamTradeExecuted StreamName = "te" // trade executed
	StreamTradeUpdate   StreamName = "tu" // trade execution update

	StreamFundingOfferSnapshot StreamName = "fos" // funding offer snapshot
	StreamFundingOfferNew      StreamName = "fon" // funding offer new
	StreamFundingOfferUpdate   StreamName = "fou" // funding offer update
	StreamFundingOfferCancel   StreamName = "foc" // funding offer cancel

	StreamFundingCreditSnapshot StreamName = "fcs" // funding credits snapshot
	StreamFundingCreditNew      StreamName = "fcn" // funding credits new
	StreamFundingCreditUpdate   StreamName = "fcu" // funding credits update
	StreamFundingCreditClose    StreamName = "fcc" // funding credits close

	StreamFundingLoanSnapshot StreamName = "fls" // funding loans snapshot
	StreamFundingLoanNew      StreamName = "fln" // funding loans new
	StreamFundingLoanUpdate   StreamName = "flu" // funding loans update
	StreamFundingLoanClose    StreamName = "flc" // funding loans close

	StreamWalletSnapshot StreamName = "ws" // wallet snapshot
	StreamWalletUpdate   StreamName = "wu" // wallet update

	StreamBalanceUpdate     StreamName = "bu"  // balance update
	StreamMarginInfoUpdate  StreamName = "miu" // margin info update
	StreamFundingInfoUpdate StreamName = "fiu" // funding info update

	StreamFundingTradeExecuted StreamName = "fte" // funding trade executed
	StreamFundingTradeUpdate   StreamName = "ftu" // funding trade update

	StreamNotification StreamName = "n" // notification

	StreamHeartBeat StreamName = "hb" // heartbeat
)

type SubmitFundingOfferRequest

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

SubmitFundingOfferRequest represents a request to submit a funding offer to Bitfinex. API: https://docs.bitfinex.com/reference/rest-auth-submit-funding-offer

func (*SubmitFundingOfferRequest) Amount

* Amount sets

func (*SubmitFundingOfferRequest) AutoRenew

func (s *SubmitFundingOfferRequest) AutoRenew(autoRenew bool) *SubmitFundingOfferRequest

* AutoRenew sets

func (*SubmitFundingOfferRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*SubmitFundingOfferRequest) Flags

* Flags sets

func (*SubmitFundingOfferRequest) GetParameters

func (s *SubmitFundingOfferRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*SubmitFundingOfferRequest) GetParametersJSON

func (s *SubmitFundingOfferRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*SubmitFundingOfferRequest) GetParametersQuery

func (s *SubmitFundingOfferRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*SubmitFundingOfferRequest) GetPath

func (s *SubmitFundingOfferRequest) GetPath() string

GetPath returns the request path of the API

func (*SubmitFundingOfferRequest) GetQueryParameters

func (s *SubmitFundingOfferRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*SubmitFundingOfferRequest) GetSlugParameters

func (s *SubmitFundingOfferRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*SubmitFundingOfferRequest) GetSlugsMap

func (s *SubmitFundingOfferRequest) GetSlugsMap() (map[string]string, error)

func (*SubmitFundingOfferRequest) Hidden

* Hidden sets

func (*SubmitFundingOfferRequest) Notify

* Notify sets

func (*SubmitFundingOfferRequest) OfferType

* OfferType sets

func (*SubmitFundingOfferRequest) Period

* Period sets

func (*SubmitFundingOfferRequest) Rate

* Rate sets

func (*SubmitFundingOfferRequest) Symbol

* Symbol sets

type SubmitFundingOfferResponse

type SubmitFundingOfferResponse struct {
	Mts       types.MillisecondTimestamp // response timestamp
	Type      string                     // response type
	MessageID *int64                     // message ID

	FundingOffer FundingOffer // funding offer details
	Code         *int64       // response code
	Status       string       // response status
	Text         string       // response text
	// contains filtered or unexported fields
}

SubmitFundingOfferResponse represents the response for submitting a funding offer.

func (*SubmitFundingOfferResponse) UnmarshalJSON

func (r *SubmitFundingOfferResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the Bitfinex array response into SubmitFundingOfferResponse.

type SubmitOrderRequest

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

SubmitOrderRequest represents a Bitfinex order submission request.

func (*SubmitOrderRequest) Amount

func (s *SubmitOrderRequest) Amount(amount string) *SubmitOrderRequest

* Amount sets

func (*SubmitOrderRequest) ClientOrderId

func (s *SubmitOrderRequest) ClientOrderId(clientOrderId int64) *SubmitOrderRequest

* ClientOrderId sets

func (*SubmitOrderRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*SubmitOrderRequest) Flags

* Flags sets

func (*SubmitOrderRequest) GetDefaultMeta

func (r *SubmitOrderRequest) GetDefaultMeta() *Meta

func (*SubmitOrderRequest) GetParameters

func (s *SubmitOrderRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*SubmitOrderRequest) GetParametersJSON

func (s *SubmitOrderRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*SubmitOrderRequest) GetParametersQuery

func (s *SubmitOrderRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*SubmitOrderRequest) GetPath

func (s *SubmitOrderRequest) GetPath() string

GetPath returns the request path of the API

func (*SubmitOrderRequest) GetQueryParameters

func (s *SubmitOrderRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*SubmitOrderRequest) GetSlugParameters

func (s *SubmitOrderRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*SubmitOrderRequest) GetSlugsMap

func (s *SubmitOrderRequest) GetSlugsMap() (map[string]string, error)

func (*SubmitOrderRequest) GroupId

func (s *SubmitOrderRequest) GroupId(groupId int64) *SubmitOrderRequest

* GroupId sets

func (*SubmitOrderRequest) Meta

* Meta sets

func (*SubmitOrderRequest) OrderType

func (s *SubmitOrderRequest) OrderType(orderType OrderType) *SubmitOrderRequest

* OrderType sets

func (*SubmitOrderRequest) Price

func (s *SubmitOrderRequest) Price(price string) *SubmitOrderRequest

* Price sets

func (*SubmitOrderRequest) PriceAuxLimit

func (s *SubmitOrderRequest) PriceAuxLimit(priceAuxLimit string) *SubmitOrderRequest

* PriceAuxLimit sets

func (*SubmitOrderRequest) PriceOcoStop

func (s *SubmitOrderRequest) PriceOcoStop(priceOcoStop string) *SubmitOrderRequest

* PriceOcoStop sets

func (*SubmitOrderRequest) Symbol

func (s *SubmitOrderRequest) Symbol(symbol string) *SubmitOrderRequest

* Symbol sets

func (*SubmitOrderRequest) Tif

* Tif sets Time-In-Force: datetime for automatic order cancellation (e.g. 2020-01-15 10:45:23).

type SubmitOrderResponse

type SubmitOrderResponse struct {
	Time types.MillisecondTimestamp
	Type string // Notification's type ("on-req")

	MessageID *int // Unique notification's ID

	Data   []Order
	Code   *int64 // W.I.P. (work in progress)
	Status string
	Text   string // Additional notification description
	// contains filtered or unexported fields
}

SubmitOrderResponse represents the response from Bitfinex order submission.

func (*SubmitOrderResponse) UnmarshalJSON

func (r *SubmitOrderResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the Bitfinex SubmitOrderResponse JSON array.

type SummaryResponse

type SummaryResponse struct {

	// Array with info on your current fee rates
	FeeInfo *FeeInfoArray

	// Array with data on your trading volume and fees paid
	TradingVolAndFee *TradingVolAndFee

	// Array with data on your funding earnings
	FundingEarnings *FundingEarnings

	// LeoInfo: Object with info on your LEO level and holdings. Keys: "leo_lev" (to see your current LEO level) and "leo_amount_avg" (to see your average LEO amount held in the past 30 days)
	LeoInfo *LeoInfo
	// contains filtered or unexported fields
}

SummaryResponse represents the response for summary API.

func (*SummaryResponse) UnmarshalJSON

func (r *SummaryResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the JSON array into the SummaryResponse struct fields.

type Ticker

type Ticker struct {
	Symbol string

	Bid     fixedpoint.Value
	BidSize fixedpoint.Value

	Ask     fixedpoint.Value
	AskSize fixedpoint.Value

	DailyChange         fixedpoint.Value
	DailyChangeRelative fixedpoint.Value

	LastPrice fixedpoint.Value
	Volume    fixedpoint.Value

	High fixedpoint.Value
	Low  fixedpoint.Value
}

Ticker for trading pairs (symbol starts with 't')

func (*Ticker) UnmarshalJSON

func (r *Ticker) UnmarshalJSON(data []byte) error

type TickerEvent

type TickerEvent struct {
	ChannelID int64

	Ticker Ticker
}

TickerEvent represents a ticker update or snapshot event.

type TickersResponse

type TickersResponse struct {
	FundingTickers []FundingTicker
	TradingTickers []Ticker
}

TickersResponse is a slice of interface{} (Ticker or FundingTicker)

func (*TickersResponse) UnmarshalJSON

func (r *TickersResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the /v2/tickers response.

type TimeFrame

type TimeFrame string

CandleTimeFrames defines available Bitfinex candle time frames.

const (
	TimeFrame1m  TimeFrame = "1m"
	TimeFrame5m  TimeFrame = "5m"
	TimeFrame15m TimeFrame = "15m"
	TimeFrame30m TimeFrame = "30m"
	TimeFrame1h  TimeFrame = "1h"
	TimeFrame3h  TimeFrame = "3h"
	TimeFrame6h  TimeFrame = "6h"
	TimeFrame12h TimeFrame = "12h"
	TimeFrame1D  TimeFrame = "1D"
	TimeFrame1W  TimeFrame = "1W"
	TimeFrame14D TimeFrame = "14D"
	TimeFrame1M  TimeFrame = "1M"
)

func TimeFrameKeys

func TimeFrameKeys(values map[TimeFrame]struct{}) (slice []TimeFrame)

TimeFrameKeys converts a map of TimeFrame to a slice of TimeFrame

type TradeUpdateEvent

type TradeUpdateEvent struct {
	ID         int64                      // [0] TRADE ID
	Symbol     string                     // [1] SYMBOL
	Time       types.MillisecondTimestamp // [2] MTS_CREATE
	OrderID    int64                      // [3] ORDER_ID
	ExecAmount fixedpoint.Value           // [4] EXEC_AMOUNT
	ExecPrice  fixedpoint.Value           // [5] EXEC_PRICE

	OrderType  string           // [6] ORDER_TYPE
	OrderPrice fixedpoint.Value // [7] ORDER_PRICE

	// Maker field: 1 if true, -1 if false
	Maker int // [8] MAKER

	Fee         *fixedpoint.Value // [9] FEE (nullable, only for 'tu')
	FeeCurrency *string           // [10] FEE_CURRENCY (nullable, only for 'tu')

	ClientOrderID int64 // [11] ClientOrderID (Client Order ID)
}

TradeUpdateEvent represents a Bitfinex user trade from private WS API.

type TradeVol30dEntry

type TradeVol30dEntry struct {
	Curr        string            `json:"curr"`
	Vol         fixedpoint.Value  `json:"vol"`
	VolSafe     *fixedpoint.Value `json:"vol_safe,omitempty"`
	VolMaker    *fixedpoint.Value `json:"vol_maker,omitempty"`
	VolBFX      *fixedpoint.Value `json:"vol_BFX,omitempty"`
	VolBFXSafe  *fixedpoint.Value `json:"vol_BFX_safe,omitempty"`
	VolBFXMaker *fixedpoint.Value `json:"vol_BFX_maker,omitempty"`
}

type TradingVolAndFee

type TradingVolAndFee struct {
	TradeVol30d         []TradeVol30dEntry
	FeesTrading30d      map[string]fixedpoint.Value
	FeesTradingTotal30d fixedpoint.Value
}

TradingVolAndFee contains trading volume and fee info.

func (*TradingVolAndFee) UnmarshalJSON

func (t *TradingVolAndFee) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the JSON array into the TradingVolAndFee struct fields.

type UserInfoResponse

type UserInfoResponse struct {
	ID                int64
	Email             string
	Username          string
	AccountCreatedAt  types.MillisecondTimestamp
	Verified          int
	VerificationLevel int

	Timezone      string
	Locale        string
	Company       string
	EmailVerified int

	SubaccountType *string

	MasterAccountCreatedAt           types.MillisecondTimestamp
	GroupID                          int64
	MasterAccountID                  int64
	InheritMasterAccountVerification int
	IsGroupMaster                    int
	GroupWithdrawEnabled             int

	PPTEnabled         *int
	MerchantEnabled    int
	CompetitionEnabled *int

	TwoFAModes []string

	IsSecuritiesMaster             int
	SecuritiesEnabled              *int
	IsSecuritiesInvestorAccredited *int
	IsSecuritiesElSalvador         *int

	AllowDisableCtxSwitch int
	CtxSwitchDisabled     int

	TimeLastLogin *string

	VerificationLevelSubmitted *int

	CompCountries      []string
	CompCountriesResid []string
	ComplAccountType   *string

	IsMerchantEnterprise int
	// contains filtered or unexported fields
}

UserInfoResponse represents the response from Bitfinex user info endpoint.

func (*UserInfoResponse) UnmarshalJSON

func (r *UserInfoResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the Bitfinex user info response array.

type UserOrder

type UserOrder struct {
	OrderID    int64                      // [0] ID
	GID        *int64                     // [1] GID
	CID        *int64                     // [2] CID
	Symbol     string                     // [3] SYMBOL
	CreatedAt  types.MillisecondTimestamp // [4] MTS_CREATE
	UpdatedAt  types.MillisecondTimestamp // [5] MTS_UPDATE
	Amount     fixedpoint.Value           // [6] AMOUNT
	AmountOrig fixedpoint.Value           // [7] AMOUNT_ORIG

	OrderType OrderType // [8] ORDER_TYPE
	TypePrev  *string   // [9] TYPE_PREV

	// MtsTif - Millisecond epoch timestamp for TIF (Time-In-Force)
	MtsTIF *int64 // [10] MTS_TIF

	Flags *int64 // [12] FLAGS

	Status OrderStatus // [13] STATUS

	Price         fixedpoint.Value // [16] PRICE
	PriceAvg      fixedpoint.Value // [17] PRICE_AVG
	PriceTrailing fixedpoint.Value // [18] PRICE_TRAILING
	PriceAuxLimit fixedpoint.Value // [19] PRICE_AUX_LIMIT

	Notify   *int64 // [23] NOTIFY
	Hidden   *int64 // [24] HIDDEN
	PlacedID *int64 // [25] PLACED_ID

	Routing *string // [28] ROUTING

	Meta map[string]any // [31] META (object)
	// contains filtered or unexported fields
}

UserOrder represents a private user order from Bitfinex API. The fields are mapped by array position according to Bitfinex's documentation.

type UserOrderSnapshotEvent

type UserOrderSnapshotEvent struct {
	Orders []UserOrder
}

type UserPosition

type UserPosition struct {
	Symbol            string                      // [0] SYMBOL
	Status            PositionStatus              // [1] STATUS
	Amount            fixedpoint.Value            // [2] AMOUNT
	BasePrice         fixedpoint.Value            // [3] BASE_PRICE
	MarginFunding     fixedpoint.Value            // [4] MARGIN_FUNDING
	MarginFundingType int64                       // [5] MARGIN_FUNDING_TYPE
	PL                *fixedpoint.Value           // [6] PL
	PLPerc            *fixedpoint.Value           // [7] PL_PERC
	PriceLiq          *fixedpoint.Value           // [8] PRICE_LIQ
	Leverage          *fixedpoint.Value           // [9] LEVERAGE
	Flags             *int64                      // [10] FLAGS
	PositionID        int64                       // [11] POSITION_ID
	MtsCreate         *types.MillisecondTimestamp // [12] MTS_CREATE
	MtsUpdate         *types.MillisecondTimestamp // [13] MTS_UPDATE

	Type int64 // [15] TYPE

	Collateral    fixedpoint.Value  // [17] COLLATERAL
	CollateralMin *fixedpoint.Value // [18] COLLATERAL_MIN
	Meta          map[string]any    // [19] META
	// contains filtered or unexported fields
}

UserPosition represents a Bitfinex user position from private WS API.

type UserPositionSnapshotEvent

type UserPositionSnapshotEvent struct {
	Positions []UserPosition
}

type Wallet

type Wallet struct {
	Type               WalletType       // Wallet type (e.g., "exchange", "margin", etc.)
	Currency           string           // Currency code (e.g., "UST", "BTC", etc.)
	Balance            fixedpoint.Value // Total balance
	UnsettledInterest  fixedpoint.Value // Unsettled interest
	AvailableBalance   fixedpoint.Value // Available balance
	LastChange         string
	LastChangeMetaData *WalletMetaData
}

Wallet represents the response structure for the authenticated wallets endpoint. API response example: [

"exchange",          // TYPE
"UST",               // CURRENCY
19788.6529257,       // BALANCE
0,                   // UNSETTLED_INTEREST
19788.6529257        // AVAILABLE_BALANCE
"USD",              // MARGIN_CURRENCY (optional)
]

JSON: [

  "exchange", //WALLET_TYPE
  "BTC", //CURRENCY
  1.61169184, //BALANCE
  0, //UNSETTLED_INTEREST
  null, //BALANCE_AVAILABLE
  "Exchange 0.01 BTC for USD @ 7804.6", //DESCRIPTION
  {
    "reason":"TRADE",
    "order_id":34988418651,
    "order_id_oppo":34990541044,
    "trade_price":"7804.6",
    "trade_amount":"0.01"
  } //META
] //WALLET_ARRAY

func (*Wallet) UnmarshalJSON

func (r *Wallet) UnmarshalJSON(data []byte) error

UnmarshalJSON maps the JSON array response to the Wallet struct fields.

type WalletMetaData

type WalletMetaData struct {
	Reason string `json:"reason"`
	Data   any    `json:"-"`
}

func (*WalletMetaData) UnmarshalJSON

func (m *WalletMetaData) UnmarshalJSON(data []byte) error

type WalletSnapshotEvent

type WalletSnapshotEvent struct {
	Wallets []Wallet
}

type WalletTradeDetail

type WalletTradeDetail struct {
	Reason      string           `json:"reason"`
	OrderId     int64            `json:"order_id"`
	OrderIdOppo int64            `json:"order_id_oppo"`
	TradePrice  fixedpoint.Value `json:"trade_price"`
	TradeAmount fixedpoint.Value `json:"trade_amount"`
	OrderCid    int64            `json:"order_cid"`
	OrderGid    int64            `json:"order_gid"`
}

type WalletType

type WalletType string

Wallet type could be (exchange, margin, funding)

const (
	WalletTypeExchange WalletType = "exchange"
	WalletTypeMargin   WalletType = "margin"
	WalletTypeFunding  WalletType = "funding"
)

type WebSocketAuthRequest

type WebSocketAuthRequest struct {
	Event       string   `json:"event"`
	ApiKey      string   `json:"apiKey"`
	AuthSig     string   `json:"authSig"`
	AuthPayload string   `json:"authPayload"`
	AuthNonce   string   `json:"authNonce"`
	Filter      []Filter `json:"filter,omitempty"`
}

WebSocketAuthRequest represents Bitfinex private websocket authentication request.

func GenerateAuthRequest

func GenerateAuthRequest(apiKey, apiSecret string, filter ...Filter) WebSocketAuthRequest

GenerateAuthRequest generates a Bitfinex WebSocketAuthRequest for authentication.

type WebSocketRequest

type WebSocketRequest struct {
	Event   string  `json:"event"`
	Channel Channel `json:"channel"`
	Symbol  string  `json:"symbol"`

	// Prec is the level of price aggregation (P0, P1, P2, P3, P4).
	// The default is P0
	Prec string `json:"prec,omitempty"`

	// Frequency is the frequency of updates (F0, F1).
	// F0=realtime / F1=2sec.
	// The default is F0.
	Frequency string `json:"freq,omitempty"`

	Key string `json:"key,omitempty"`

	// Length is the number of price points ("1", "25", "100", "250") [default="25"]
	Length string `json:"length,omitempty"`
}

type WebSocketResponse

type WebSocketResponse struct {
	Event string `json:"event"`

	//
	Channel Channel `json:"channel"`

	// ChanId is the identification number assigned to the channel for the duration of this connection.
	ChanId any    `json:"chanId"`
	Symbol string `json:"symbol"`

	// Pair is the trading pair for ticker and trades channels, e.g., "tBTCUSD".
	Pair string `json:"pair"`

	// Currency is the funding currency for funding ticker and book channels, e.g., "USD".
	//
	// {"event":"subscribed","channel":"ticker","chanId":232591,"symbol":"fUSD","currency":"USD"}
	Currency string `json:"currency"`

	// Key
	//
	// Derivative pair status
	//
	//   {"event":"subscribed","channel":"status","chanId":335856,"key":"deriv:tBTCF0:USTF0"}
	//
	// Liquidation feed
	//
	//   {"event":"subscribed","channel":"status","chanId":91684,"key":"liq:global"}
	Key string `json:"key,omitempty"`

	Version  int    `json:"version,omitempty"`
	ServerID string `json:"serverId,omitempty"`

	// Status = "OK" or "FAIL"
	Status string `json:"status"`

	UserId int64 `json:"userId"`

	// AuthID is an UUID like 'a26236f1-ef44-4671-be32-197ce190348f'
	AuthID string `json:"auth_id,omitempty"`

	Caps *AuthCaps `json:"caps,omitempty"`

	Message *string `json:"msg,omitempty"`

	Code int64 `json:"code,omitempty"`
}

Source Files

Jump to

Keyboard shortcuts

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