hibitex

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

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID           = 60
	DEFAULT_TAKER_FEE    = 0.002
	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 = "https://openapi.hibitex.com"
)

The Base Endpoint URL

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances struct {
	TotalAsset float64 `json:"total_asset"`
	CoinList   []struct {
		Coin        string  `json:"coin"`
		Normal      float64 `json:"normal"`
		Locked      float64 `json:"locked"`
		BtcValuatin float64 `json:"btcValuatin"`
	} `json:"coin_list"`
}

********* Private API Structure*********

type CoinsData

type CoinsData []Ticker

type Hibitex

type Hibitex 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 CreateHibitex

func CreateHibitex(config *exchange.Config) *Hibitex

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

func (*Hibitex) ApiKeyGet

func (e *Hibitex) ApiKeyGet(strRequestPath string, mapParams map[string]string) string

************** Signature Http Request ************** Method: API Get 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 (*Hibitex) ApiKeyRequest

func (e *Hibitex) ApiKeyRequest(strMethod, strRequestPath string, mapParams map[string]string) string

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

func (*Hibitex) CanDeposit

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

func (*Hibitex) CanWithdraw

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

func (*Hibitex) CancelAllOrder

func (e *Hibitex) CancelAllOrder() error

func (*Hibitex) CancelOrder

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

func (*Hibitex) DeleteCoin

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

func (*Hibitex) DeletePair

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

func (*Hibitex) DoAccountOperation

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

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

func (*Hibitex) GetBalance

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

func (*Hibitex) GetCoinBySymbol

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

func (*Hibitex) GetCoinConstraint

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

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

func (*Hibitex) GetCoins

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

func (*Hibitex) GetCoinsData

func (e *Hibitex) 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(strRequestPath)

func (*Hibitex) GetConfirmation

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

func (*Hibitex) GetConstraintFetchMethod

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

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

func (*Hibitex) GetFee

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

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

func (*Hibitex) GetID

func (e *Hibitex) GetID() int

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

func (*Hibitex) GetLotSize

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

func (*Hibitex) GetName

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

func (*Hibitex) GetPairBySymbol

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

func (*Hibitex) GetPairConstraint

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

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

func (*Hibitex) GetPairs

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

func (*Hibitex) GetPairsData

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

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

func (*Hibitex) GetSymbolByCoin

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

func (*Hibitex) GetSymbolByPair

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

func (*Hibitex) GetTradingWebURL

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

func (*Hibitex) GetTxFee

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

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

func (*Hibitex) HasPair

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

func (*Hibitex) InitData

func (e *Hibitex) InitData() error

func (*Hibitex) LimitBuy

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

func (*Hibitex) LimitSell

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

func (*Hibitex) ListOrders

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

func (*Hibitex) LoadPublicData

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

func (*Hibitex) OrderBook

func (e *Hibitex) 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.GetSymbolByPair(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 (*Hibitex) OrderStatus

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

func (*Hibitex) SetCoinConstraint

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

func (*Hibitex) SetPairConstraint

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

func (*Hibitex) UpdateAllBalances

func (e *Hibitex) UpdateAllBalances()

func (*Hibitex) UpdateConstraint

func (e *Hibitex) UpdateConstraint()

func (*Hibitex) Withdraw

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

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

type JsonResponse

type JsonResponse struct {
	Code    string          `json:"code"`
	Msg     string          `json:"msg"`
	Message interface{}     `json:"message"`
	Data    json.RawMessage `json:"data"`
}

type OrderBook

type OrderBook struct {
	Tick struct {
		Asks [][]float64 `json:"asks"`
		Bids [][]float64 `json:"bids"`
		Time interface{} `json:"time"`
	} `json:"tick"`
}

type OrderStatus

type OrderStatus struct {
	Count      int `json:"count"`
	ResultList []struct {
		Side         string `json:"side"`
		TotalPrice   string `json:"total_price"`
		CreatedAt    int64  `json:"created_at"`
		AvgPrice     string `json:"avg_price"`
		CountCoin    string `json:"countCoin"`
		Source       int    `json:"source"`
		Type         int    `json:"type"`
		SideMsg      string `json:"side_msg"`
		Volume       string `json:"volume"`
		Price        string `json:"price"`
		SourceMsg    string `json:"source_msg"`
		StatusMsg    string `json:"status_msg"`
		DealVolume   string `json:"deal_volume"`
		ID           int    `json:"id"`
		RemainVolume string `json:"remain_volume"`
		BaseCoin     string `json:"baseCoin"`
		Status       int    `json:"status"`
	} `json:"resultList"`
}

type PairsData

type PairsData []Ticker

type PlaceOrder

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

type Ticker

type Ticker struct {
	Symbol          string `json:"symbol"`
	CountCoin       string `json:"count_coin"`
	AmountPrecision int    `json:"amount_precision"`
	BaseCoin        string `json:"base_coin"`
	PricePrecision  int    `json:"price_precision"`
}

********* Public API Structure*********

type WithdrawResponse

type WithdrawResponse struct {
	Msg     string `json:"msg"`
	Success bool   `json:"success"`
	ID      string `json:"id"`
}

Jump to

Keyboard shortcuts

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