huobidm

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           = 42
	DEFAULT_TAKER_FEE    = 0.0003
	DEFAULT_MAKER_FEE    = 0.0002
	DEFAULT_LOT_SIZE     = 1
	DEFAULT_PRICE_FILTER = 0.01 //PRICE FILTER
	DEFAULT_TXFEE        = 0.05
	DEFAULT_WITHDRAW     = false
	DEFAULT_DEPOSIT      = false
	DEFAULT_CONFIRMATION = 2
	DEFAULT_LISTED       = true
)
View Source
const (
	API_URL = "https://api.hbdm.com"
)

The Base Endpoint URL

Variables

This section is empty.

Functions

func GetContractName

func GetContractName(code string) string

Types

type AccountBalances

type AccountBalances []struct {
	Asset     string  `json:"asset"`
	Total     float64 `json:"total"`
	Available float64 `json:"available"`
	Locked    float64 `json:"locked"`
}

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

type ContractsData

type ContractsData []struct {
	Symbol         string  `json:"symbol"`
	ContractCode   string  `json:"contract_code"`
	ContractType   string  `json:"contract_type"`
	ContractSize   float64 `json:"contract_size"`
	PriceTick      float64 `json:"price_tick"`
	DeliveryDate   string  `json:"delivery_date"`
	CreateDate     string  `json:"create_date"`
	ContractStatus int     `json:"contract_status"`
}

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

type Huobidm

type Huobidm 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 CreateHuobidm

func CreateHuobidm(config *exchange.Config) *Huobidm

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

func (*Huobidm) ApiKeyGet

func (e *Huobidm) 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 (*Huobidm) ApiKeyRequest

func (e *Huobidm) 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 (*Huobidm) CanDeposit

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

func (*Huobidm) CanWithdraw

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

func (*Huobidm) CancelAllOrder

func (e *Huobidm) CancelAllOrder() error

func (*Huobidm) CancelOrder

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

func (*Huobidm) DeleteCoin

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

func (*Huobidm) DeletePair

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

func (*Huobidm) DoAccountOperation

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

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

func (*Huobidm) GetBalance

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

func (*Huobidm) GetCoinBySymbol

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

func (*Huobidm) GetCoinConstraint

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

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

func (*Huobidm) GetCoins

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

func (*Huobidm) GetCoinsData

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

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

func (*Huobidm) GetConstraintFetchMethod

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

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

func (*Huobidm) GetFee

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

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

func (*Huobidm) GetID

func (e *Huobidm) GetID() int

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

func (*Huobidm) GetLotSize

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

func (*Huobidm) GetName

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

func (*Huobidm) GetPairBySymbol

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

func (*Huobidm) GetPairConstraint

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

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

func (*Huobidm) GetPairs

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

func (*Huobidm) GetPairsData

func (e *Huobidm) GetPairsData() error

func (*Huobidm) GetPriceFilter

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

func (*Huobidm) GetSymbolByCoin

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

func (*Huobidm) GetSymbolByPair

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

func (*Huobidm) GetTradingWebURL

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

func (*Huobidm) GetTxFee

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

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

func (*Huobidm) HasPair

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

func (*Huobidm) InitData

func (e *Huobidm) InitData() error

func (*Huobidm) LimitBuy

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

func (*Huobidm) LimitSell

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

func (*Huobidm) ListOrders

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

func (*Huobidm) LoadPublicData

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

func (*Huobidm) OrderBook

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

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

func (*Huobidm) SetCoinConstraint

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

func (*Huobidm) SetPairConstraint

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

func (*Huobidm) UpdateAllBalances

func (e *Huobidm) UpdateAllBalances()

func (*Huobidm) UpdateConstraint

func (e *Huobidm) UpdateConstraint()

func (*Huobidm) Withdraw

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

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

type JsonResponse

type JsonResponse struct {
	Status string          `json:"status"`
	Data   json.RawMessage `json:"data"`
	Ts     int64           `json:"ts"`
}

type JsonResponse2

type JsonResponse2 struct {
	Ch     string          `json:"ch"`
	Status string          `json:"status"`
	Tick   json.RawMessage `json:"tick"`
	Ts     int64           `json:"ts"`
}

type OrderBook

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

type PairsData

type PairsData []struct {
	Symbol      string  `json:"symbol"`
	Status      string  `json:"status"`
	BaseAsset   string  `json:"baseAsset"`
	QuoteAsset  string  `json:"quoteAsset"`
	MakerFee    float64 `json:"makerFee"`
	TakerFee    float64 `json:"takerFee"`
	PriceFilter float64 `json:"priceFilter"`
	LotSize     float64 `json:"lotSize"`
}

type PlaceOrder

type PlaceOrder struct {
	Symbol       string `json:"symbol"`
	OrderID      string `json:"orderId"`
	Side         string `json:"side"`
	Type         string `json:"type"`
	Price        string `json:"price"`
	AveragePrice string `json:"executedQty"`
	OrigQty      string `json:"origQty"`
	ExecutedQty  string `json:"executedQty"`
	Status       string `json:"status"`
	TimeInForce  string `json:"timeInForce"`
}

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