bitfinex

package
v0.0.0-...-5439e55 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID           = 18
	DEFAULT_TAKER_FEE    = 0.002
	DEFAULT_MAKER_FEE    = 0.001
	DEFAULT_LOT_SIZE     = 0.00000001
	DEFAULT_PRICE_FILTER = 0.00000001 //PRICE FILTER
	DEFAULT_TXFEE        = 0.005
	DEFAULT_WITHDRAW     = true
	DEFAULT_DEPOSIT      = true
	DEFAULT_CONFIRMATION = 2
)
View Source
const (
	API_URL = "https://api.bitfinex.com"
)

The Base Endpoint URL

Variables

This section is empty.

Functions

func ComputeHmac512_384NoDecode

func ComputeHmac512_384NoDecode(strMessage string, strSecret string) string

Types

type AccountBalances

type AccountBalances []struct {
	Type      string `json:"type"`
	Currency  string `json:"currency"`
	Amount    string `json:"amount"`
	Available string `json:"available"`
}

type Bitfinex

type Bitfinex struct {
	ID      int
	Name    string `bson:"name"`
	Website string `bson:"website"`

	API_KEY    string
	API_SECRET string

	Source    exchange.DataSource // / exchange API / microservicve api 1 / PSQL
	SourceURI string
}

func CreateBitfinex

func CreateBitfinex(config *exchange.Config) *Bitfinex

*************************************************

func (*Bitfinex) ApiKeyPost

func (e *Bitfinex) ApiKeyPost(mapParams map[string]interface{}, strRequestPath string) string

************** Signature Http Request ************** Method: API Request and Signature is required Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Create mapParams Depend on API Signature request Step 3: Add HttpGetRequest below strUrl if API has different requests

func (*Bitfinex) CanDeposit

func (e *Bitfinex) CanDeposit(coin *coin.Coin) bool

func (*Bitfinex) CanWithdraw

func (e *Bitfinex) CanWithdraw(coin *coin.Coin) bool

func (*Bitfinex) CancelAllOrder

func (e *Bitfinex) CancelAllOrder() error

func (*Bitfinex) CancelOrder

func (e *Bitfinex) CancelOrder(order *exchange.Order) error

func (*Bitfinex) DeleteCoin

func (e *Bitfinex) DeleteCoin(coin *coin.Coin)

func (*Bitfinex) DeletePair

func (e *Bitfinex) DeletePair(pair *pair.Pair)

func (*Bitfinex) DoAccountOperation

func (e *Bitfinex) DoAccountOperation(operation *exchange.AccountOperation) error

************** Private API **************

func (*Bitfinex) GetBalance

func (e *Bitfinex) GetBalance(coin *coin.Coin) float64

func (*Bitfinex) GetCoinBySymbol

func (e *Bitfinex) GetCoinBySymbol(symbol string) *coin.Coin

func (*Bitfinex) GetCoinConstraint

func (e *Bitfinex) GetCoinConstraint(coin *coin.Coin) *exchange.CoinConstraint

************** Coins on the Exchanges **************

func (*Bitfinex) GetCoins

func (e *Bitfinex) GetCoins() []*coin.Coin

func (*Bitfinex) GetCoinsData

func (e *Bitfinex) GetCoinsData() error

************** Public API ************** Get Coins Information (If API provide) Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Add Model of API Response Step 3: Modify API Path(strRequestUrl)

func (*Bitfinex) GetConfirmation

func (e *Bitfinex) GetConfirmation(coin *coin.Coin) int

func (*Bitfinex) GetConstraintFetchMethod

func (e *Bitfinex) GetConstraintFetchMethod(pair *pair.Pair) *exchange.ConstrainFetchMethod

*************** Exchange Constraint ***************

func (*Bitfinex) GetFee

func (e *Bitfinex) GetFee(pair *pair.Pair) float64

*************** Pair Constraint ***************

func (*Bitfinex) GetID

func (e *Bitfinex) GetID() int

*************** Exchange Information ***************

func (*Bitfinex) GetLotSize

func (e *Bitfinex) GetLotSize(pair *pair.Pair) float64

func (*Bitfinex) GetName

func (e *Bitfinex) GetName() exchange.ExchangeName

func (*Bitfinex) GetPairBySymbol

func (e *Bitfinex) GetPairBySymbol(symbol string) *pair.Pair

func (*Bitfinex) GetPairConstraint

func (e *Bitfinex) GetPairConstraint(pair *pair.Pair) *exchange.PairConstraint

************** Pairs on the Exchanges **************

func (*Bitfinex) GetPairs

func (e *Bitfinex) GetPairs() []*pair.Pair

func (*Bitfinex) GetPairsData

func (e *Bitfinex) GetPairsData() error
GetPairsData - Get Pairs Information (If API provide)

Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Add Model of API Response Step 3: Modify API Path(strRequestUrl)

func (*Bitfinex) GetPriceFilter

func (e *Bitfinex) GetPriceFilter(pair *pair.Pair) float64

func (*Bitfinex) GetSymbolByCoin

func (e *Bitfinex) GetSymbolByCoin(coin *coin.Coin) string

func (*Bitfinex) GetSymbolByPair

func (e *Bitfinex) GetSymbolByPair(pair *pair.Pair) string

func (*Bitfinex) GetTradingWebURL

func (e *Bitfinex) GetTradingWebURL(pair *pair.Pair) string

func (*Bitfinex) GetTxFee

func (e *Bitfinex) GetTxFee(coin *coin.Coin) float64

*************** Coin Constraint ***************

func (*Bitfinex) GetWithdrawFees

func (e *Bitfinex) GetWithdrawFees() error

func (*Bitfinex) HasPair

func (e *Bitfinex) HasPair(pair *pair.Pair) bool

func (*Bitfinex) InitData

func (e *Bitfinex) InitData() error

func (*Bitfinex) LimitBuy

func (e *Bitfinex) LimitBuy(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)

func (*Bitfinex) LimitSell

func (e *Bitfinex) LimitSell(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)

func (*Bitfinex) ListOrders

func (e *Bitfinex) ListOrders() ([]*exchange.Order, error)

func (*Bitfinex) LoadPublicData

func (e *Bitfinex) LoadPublicData(operation *exchange.PublicOperation) error

func (*Bitfinex) OrderBook

func (e *Bitfinex) OrderBook(p *pair.Pair) (*exchange.Maker, error)

Get Pair Market Depth Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Add Model of API Response Step 3: Get Exchange Pair Code ex. symbol := e.GetPairCode(p) Step 4: Modify API Path(strRequestUrl) Step 5: Add Params - Depend on API request Step 6: Convert the response to Standard Maker struct

func (*Bitfinex) OrderStatus

func (e *Bitfinex) OrderStatus(order *exchange.Order) error

func (*Bitfinex) SetCoinConstraint

func (e *Bitfinex) SetCoinConstraint(coinConstraint *exchange.CoinConstraint)

func (*Bitfinex) SetPairConstraint

func (e *Bitfinex) SetPairConstraint(pairConstraint *exchange.PairConstraint)

func (*Bitfinex) UpdateAllBalances

func (e *Bitfinex) UpdateAllBalances()

func (*Bitfinex) UpdateConstraint

func (e *Bitfinex) UpdateConstraint()

func (*Bitfinex) Withdraw

func (e *Bitfinex) Withdraw(coin *coin.Coin, quantity float64, addr, tag string) bool

Withdraw(coin *coin.Coin, quantity float64, addr, tag string)

type CoinsData

type CoinsData [][][]string

type OrderBook

type OrderBook struct {
	Bids []struct {
		Price     string `json:"price"`
		Amount    string `json:"amount"`
		Timestamp string `json:"timestamp"`
	} `json:"bids"`
	Asks []struct {
		Price     string `json:"price"`
		Amount    string `json:"amount"`
		Timestamp string `json:"timestamp"`
	} `json:"asks"`
}

type PairsData

type PairsData []struct {
	Pair             string `json:"pair"`
	PricePrecision   int    `json:"price_precision"`
	InitialMargin    string `json:"initial_margin"`
	MinimumMargin    string `json:"minimum_margin"`
	MaximumOrderSize string `json:"maximum_order_size"`
	MinimumOrderSize string `json:"minimum_order_size"`
	Expiration       string `json:"expiration"`
	Margin           bool   `json:"margin"`
}

type PlaceOrder

type PlaceOrder struct {
	ID                int64       `json:"id"`
	Cid               int         `json:"cid"`
	CidDate           string      `json:"cid_date"`
	Gid               interface{} `json:"gid"`
	Symbol            string      `json:"symbol"`
	Exchange          string      `json:"exchange"`
	Price             string      `json:"price"`
	AvgExecutionPrice string      `json:"avg_execution_price"`
	Side              string      `json:"side"`
	Type              string      `json:"type"`
	Timestamp         string      `json:"timestamp"`
	IsLive            bool        `json:"is_live"`
	IsCancelled       bool        `json:"is_cancelled"`
	IsHidden          bool        `json:"is_hidden"`
	OcoOrder          interface{} `json:"oco_order"`
	WasForced         bool        `json:"was_forced"`
	OriginalAmount    string      `json:"original_amount"`
	RemainingAmount   string      `json:"remaining_amount"`
	ExecutedAmount    string      `json:"executed_amount"`
	Src               string      `json:"src"`
	OrderID           int64       `json:"order_id"`
	Message           string      `json:"message"`
}

type TradeHistory

type TradeHistory [][]float64

type Withdraw

type Withdraw []struct {
	Status       string `json:"status"`
	Message      string `json:"message"`
	WithdrawalID int    `json:"withdrawal_id"`
}

type WithdrawFee

type WithdrawFee struct {
	Withdraw map[string]interface{}
}

Jump to

Keyboard shortcuts

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