hoo

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           = 68
	DEFAULT_TAKER_FEE    = 0.002
	DEFAULT_MAKER_FEE    = 0.002
	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.hoo.co"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances []struct {
	Amount string `json:"amount"`
	Symbol string `json:"symbol"`
	Freeze string `json:"freeze"`
}

type Hoo

type Hoo 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 CreateHoo

func CreateHoo(config *exchange.Config) *Hoo

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

func (*Hoo) ApiKeyGET

func (e *Hoo) ApiKeyGET(strRequestPath string, mapParams map[string]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 (*Hoo) ApiKeyRequest

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

func (*Hoo) CanDeposit

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

func (*Hoo) CanWithdraw

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

func (*Hoo) CancelAllOrder

func (e *Hoo) CancelAllOrder() error

func (*Hoo) CancelOrder

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

func (*Hoo) DeleteCoin

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

func (*Hoo) DeletePair

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

func (*Hoo) DoAccountOperation

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

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

func (*Hoo) GetBalance

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

func (*Hoo) GetCoinBySymbol

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

func (*Hoo) GetCoinConstraint

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

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

func (*Hoo) GetCoins

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

func (*Hoo) GetCoinsData

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

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

func (*Hoo) GetConstraintFetchMethod

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

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

func (*Hoo) GetFee

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

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

func (*Hoo) GetID

func (e *Hoo) GetID() int

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

func (*Hoo) GetLotSize

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

func (*Hoo) GetName

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

func (*Hoo) GetPairBySymbol

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

func (*Hoo) GetPairConstraint

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

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

func (*Hoo) GetPairs

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

func (*Hoo) GetPairsData

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

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

func (*Hoo) GetSymbolByCoin

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

func (*Hoo) GetSymbolByPair

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

func (*Hoo) GetTradingWebURL

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

func (*Hoo) GetTxFee

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

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

func (*Hoo) HasPair

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

func (*Hoo) InitData

func (e *Hoo) InitData() error

func (*Hoo) LimitBuy

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

func (*Hoo) LimitSell

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

func (*Hoo) ListOrders

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

func (*Hoo) LoadPublicData

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

************** Public API **************

func (*Hoo) OrderBook

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

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

order has delay, should not use OrderStatus immediately after order change

func (*Hoo) SetCoinConstraint

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

func (*Hoo) SetPairConstraint

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

func (*Hoo) UpdateAllBalances

func (e *Hoo) UpdateAllBalances()

func (*Hoo) UpdateConstraint

func (e *Hoo) UpdateConstraint()

func (*Hoo) Withdraw

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

type JsonResponse

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

type OrderBook

type OrderBook struct {
	Bids []struct {
		Price    string `json:"price"`
		Quantity string `json:"quantity"`
	} `json:"bids"`
	Asks []struct {
		Price    string `json:"price"`
		Quantity string `json:"quantity"`
	} `json:"asks"`
}

type OrderStatus

type OrderStatus struct {
	CreateAt   int64         `json:"create_at"`
	Fee        string        `json:"fee"`
	MatchAmt   string        `json:"match_amt"`
	MatchPrice string        `json:"match_price"`
	MatchQty   string        `json:"match_qty"`
	OrderID    string        `json:"order_id"`
	OrderType  int           `json:"order_type"`
	Price      string        `json:"price"`
	Quantity   string        `json:"quantity"`
	Side       int           `json:"side"`
	Status     int           `json:"status"`
	Ticker     string        `json:"ticker"`
	TradeNo    string        `json:"trade_no"`
	Trades     []interface{} `json:"trades"`
}

type PairsData

type PairsData []struct {
	Amount string `json:"amount"`
	AmtNum int    `json:"amt_num"`
	Change string `json:"change"`
	High   string `json:"high"`
	Low    string `json:"low"`
	Price  string `json:"price"`
	QtyNum int    `json:"qty_num"`
	Symbol string `json:"symbol"`
	Volume string `json:"volume"`
}

type PlaceOrder

type PlaceOrder struct {
	OrderID string `json:"order_id"`
	TradeNo string `json:"trade_no"`
}

Jump to

Keyboard shortcuts

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