bitforex

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: 16 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID           = 22
	DEFAULT_TAKER_FEE    = 0.001
	DEFAULT_MAKER_FEE    = 0.001
	DEFAULT_LOT_SIZE     = 0.00000001
	DEFAULT_PRICE_FILTER = 0.00000001
	DEFAULT_TXFEE        = 0.005
	DEFAULT_WITHDRAW     = true
	DEFAULT_DEPOSIT      = true
	DEFAULT_CONFIRMATION = 2
	DEFAULT_LISTED       = true
)
View Source
const (
	API_URL string = "https://api.bitforex.com/api"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances []struct {
	Fix      string `json:"fix"`
	Frozen   string `json:"frozen"`
	Active   string `json:"active"`
	Currency string `json:"currency"`
}

type Bitforex

type Bitforex 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 CreateBitforex

func CreateBitforex(config *exchange.Config) *Bitforex

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

func (*Bitforex) ApiKeyGET

func (e *Bitforex) ApiKeyGET(strRequestPath string, mapParams map[string]string) string

func (*Bitforex) ApiKeyPost

func (e *Bitforex) ApiKeyPost(strRequestPath string, mapParams map[string]interface{}) 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 (*Bitforex) CanDeposit

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

func (*Bitforex) CanWithdraw

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

func (*Bitforex) CancelAllOrder

func (e *Bitforex) CancelAllOrder() error

func (*Bitforex) CancelOrder

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

func (*Bitforex) DeleteCoin

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

func (*Bitforex) DeletePair

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

func (*Bitforex) DoAccountOperation

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

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

func (*Bitforex) GetBalance

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

func (*Bitforex) GetCoinBySymbol

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

func (*Bitforex) GetCoinConstraint

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

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

func (*Bitforex) GetCoins

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

func (*Bitforex) GetCoinsData

func (e *Bitforex) 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 (*Bitforex) GetConfirmation

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

func (*Bitforex) GetConstraintFetchMethod

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

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

func (*Bitforex) GetFee

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

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

func (*Bitforex) GetID

func (e *Bitforex) GetID() int

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

func (*Bitforex) GetLotSize

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

func (*Bitforex) GetName

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

func (*Bitforex) GetPairBySymbol

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

func (*Bitforex) GetPairConstraint

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

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

func (*Bitforex) GetPairs

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

func (*Bitforex) GetPairsData

func (e *Bitforex) 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 (*Bitforex) GetPriceFilter

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

func (*Bitforex) GetSymbolByCoin

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

func (*Bitforex) GetSymbolByPair

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

func (*Bitforex) GetTradingWebURL

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

func (*Bitforex) GetTxFee

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

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

func (*Bitforex) HasPair

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

func (*Bitforex) InitData

func (e *Bitforex) InitData() error

func (*Bitforex) LimitBuy

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

func (*Bitforex) LimitSell

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

func (*Bitforex) ListOrders

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

func (*Bitforex) LoadPublicData

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

func (*Bitforex) OrderBook

func (e *Bitforex) OrderBook(pair *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 (*Bitforex) OrderStatus

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

func (*Bitforex) SetCoinConstraint

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

func (*Bitforex) SetPairConstraint

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

func (*Bitforex) UpdateAllBalances

func (e *Bitforex) UpdateAllBalances()

func (*Bitforex) UpdateConstraint

func (e *Bitforex) UpdateConstraint()

func (*Bitforex) Withdraw

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

type CancelOrder

type CancelOrder struct {
	Cancel bool `json:"data"`
}

type JsonResponse

type JsonResponse struct {
	Success bool            `json:"success"`
	Code    string          `json:"code"`
	Message string          `json:"message"`
	Data    json.RawMessage `json:"data"`
}

type OrderBook

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

type OrderStatus

type OrderStatus struct {
	AvgPrice    int         `json:"avgPrice"`
	CreateTime  int64       `json:"createTime"`
	DealAmount  interface{} `json:"dealAmount"`
	LastTime    int64       `json:"lastTime"`
	OrderAmount interface{} `json:"orderAmount"`
	OrderID     int         `json:"orderId"`
	OrderPrice  interface{} `json:"orderPrice"`
	OrderState  int         `json:"orderState"`
	Symbol      string      `json:"symbol"`
	TradeFee    int         `json:"tradeFee"`
	TradeType   int         `json:"tradeType"`
}

type PairsData

type PairsData []struct {
	AmountPrecision int     `json:"amountPrecision"`
	MinOrderAmount  float64 `json:"minOrderAmount"`
	PricePrecision  int     `json:"pricePrecision"`
	Symbol          string  `json:"symbol"`
}

type PlaceOrder

type PlaceOrder struct {
	OrderID int `json:"orderId"`
}

Jump to

Keyboard shortcuts

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