bibox

package
v0.0.0-...-db5ea55 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID           = 12
	DEFAULT_MAKER_FEE    = 0.001
	DEFAULT_TAKER_FEE    = 0.001
	DEFAULT_LOT_SIZE     = 0.0001
	DEFAULT_PRICE_FILTER = 0.00000001
	USDT_PRICE_FILTER    = 0.0001
	DEFAULT_CONFIRMATION = 2
	DEFAULT_LISTED       = true
)
View Source
const (
	API_URL string = "https://api.bibox.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances []struct {
	Result struct {
		TotalBtc   string `json:"total_btc"`
		TotalCny   string `json:"total_cny"`
		TotalUsd   string `json:"total_usd"`
		AssetsList []struct {
			CoinSymbol string `json:"coin_symbol"`
			Balance    string `json:"balance"`
			Freeze     string `json:"freeze"`
			BTCValue   string `json:"BTCValue"`
			CNYValue   string `json:"CNYValue"`
			USDValue   string `json:"USDValue"`
		} `json:"assets_list"`
	} `json:"result"`
	Cmd string `json:"cmd"`
}

type Bibox

type Bibox 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 CreateBibox

func CreateBibox(config *exchange.Config) *Bibox

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

func (*Bibox) ApiKeyPOST

func (e *Bibox) 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 (*Bibox) ApiKeyPOSTInner

func (e *Bibox) ApiKeyPOSTInner(strRequestPath string, mapParams map[string]interface{}) string

func (*Bibox) CanDeposit

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

func (*Bibox) CanWithdraw

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

func (*Bibox) CancelAllOrder

func (e *Bibox) CancelAllOrder() error

func (*Bibox) CancelOrder

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

func (*Bibox) DeleteCoin

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

func (*Bibox) DeletePair

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

func (*Bibox) DoAccountOperation

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

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

func (*Bibox) GetBalance

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

func (*Bibox) GetCoinBySymbol

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

func (*Bibox) GetCoinConstraint

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

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

func (*Bibox) GetCoins

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

func (*Bibox) GetCoinsData

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

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

func (*Bibox) GetConstraintFetchMethod

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

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

func (*Bibox) GetFee

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

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

func (*Bibox) GetID

func (e *Bibox) GetID() int

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

func (*Bibox) GetLotSize

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

func (*Bibox) GetName

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

func (*Bibox) GetPairBySymbol

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

func (*Bibox) GetPairConstraint

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

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

func (*Bibox) GetPairs

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

func (*Bibox) GetPairsData

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

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

func (*Bibox) GetSymbolByCoin

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

func (*Bibox) GetSymbolByPair

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

func (*Bibox) GetTradingWebURL

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

func (*Bibox) GetTxFee

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

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

func (*Bibox) HasPair

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

func (*Bibox) InitData

func (e *Bibox) InitData() error

func (*Bibox) LimitBuy

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

func (*Bibox) LimitSell

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

func (*Bibox) ListOrders

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

func (*Bibox) LoadPublicData

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

func (*Bibox) OrderBook

func (e *Bibox) 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 (*Bibox) OrderStatus

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

func (*Bibox) SetCoinConstraint

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

func (*Bibox) SetPairConstraint

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

func (*Bibox) UpdateAllBalances

func (e *Bibox) UpdateAllBalances()

func (*Bibox) UpdateConstraint

func (e *Bibox) UpdateConstraint()

func (*Bibox) Withdraw

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

googleAuth: google验证码 tag: 提现地址备注 memo: 提现标签(can be "", not required) need to update interface to use more params

type CancelOrder

type CancelOrder []struct {
	Result string `json:"result"`
	Cmd    string `json:"cmd"`
}

type CoinsData

type CoinsData []struct {
	Result []struct {
		CoinSymbol       string  `json:"coin_symbol"`
		IsActive         int     `json:"is_active"`
		OriginalDecimals int     `json:"original_decimals"`
		EnableDeposit    int     `json:"enable_deposit"`
		EnableWithdraw   int     `json:"enable_withdraw"`
		WithdrawFee      float64 `json:"withdraw_fee"`
		WithdrawMin      float64 `json:"withdraw_min"`
	} `json:"result"`
	Cmd string `json:"cmd"`
}

type Error

type Error struct {
	Code string `json:"code"`
	Msg  string `json:"msg"`
}

type InnerTrans

type InnerTrans struct {
	Result struct {
		ID    string `json:"id"`
		State int    `json:"state"`
	} `json:"result"`
}

type JsonResponse

type JsonResponse struct {
	Error  Error           `json:"error"`
	Result json.RawMessage `json:"result"`
	Cmd    string          `json:"cmd"`
	Ver    string          `json:"ver"`
}

type OrderBook

type OrderBook struct {
	UpdateTime int64 `json:"update_time"`
	Asks       []struct {
		Volume string `json:"volume"`
		Price  string `json:"price"`
	} `json:"asks"`
	Bids []struct {
		Volume string `json:"volume"`
		Price  string `json:"price"`
	} `json:"bids"`
	Pair string `json:"pair"`
}

type OrderStatus

type OrderStatus []struct {
	Result struct {
		ID             int    `json:"id"`
		CreatedAt      int64  `json:"createdAt"`
		AccountType    int    `json:"account_type"`
		Pair           string `json:"pair"`
		CoinSymbol     string `json:"coin_symbol"`
		CurrencySymbol string `json:"currency_symbol"`
		OrderSide      int    `json:"order_side"`
		OrderType      int    `json:"order_type"`
		Price          string `json:"price"`
		DealPrice      string `json:"deal_price"`
		Amount         string `json:"amount"`
		Money          string `json:"money"`
		DealAmount     string `json:"deal_amount"`
		DealPercent    string `json:"deal_percent"`
		DealMoney      string `json:"deal_money"`
		Status         int    `json:"status"`
		Unexecuted     string `json:"unexecuted"`
		OrderFrom      int    `json:"order_from"`
	} `json:"result"`
	Cmd string `json:"cmd"`
}

type PairsData

type PairsData []struct {
	ID       int    `json:"id"`
	Pair     string `json:"pair"`
	PairType int    `json:"pair_type"`
	AreaID   int    `json:"area_id"`
	IsHide   int    `json:"is_hide"`
}

type PlaceOrder

type PlaceOrder []struct {
	Result string `json:"result"`
	Cmd    string `json:"cmd"`
}

type Withdraw

type Withdraw struct {
	Result int    `json:"result"`
	Cmd    string `json:"cmd"`
}

Jump to

Keyboard shortcuts

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