huobiotc

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: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID           = 8
	DEFAULT_TAKER_FEE    = 0.0
	DEFAULT_MAKER_FEE    = 0.001
	DEFAULT_LOT_SIZE     = 0.000001
	DEFAULT_PRICE_FILTER = 0.01 //PRICE FILTER
	DEFAULT_TXFEE        = 0.005
	DEFAULT_WITHDRAW     = true
	DEFAULT_DEPOSIT      = true
	DEFAULT_CONFIRMATION = 2
)
View Source
const (
	API_URL = "https://otc-api.eiijo.cn/v1/data"
)

The Base Endpoint URL

Variables

This section is empty.

Functions

This section is empty.

Types

type HuobiOTC

type HuobiOTC 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 CreateHuobiOTC

func CreateHuobiOTC(config *exchange.Config) *HuobiOTC

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

func (*HuobiOTC) ApiKeyPost

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

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

func (*HuobiOTC) CanWithdraw

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

func (*HuobiOTC) CancelAllOrder

func (e *HuobiOTC) CancelAllOrder() error

func (*HuobiOTC) CancelOrder

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

func (*HuobiOTC) DeleteCoin

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

func (*HuobiOTC) DeletePair

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

func (*HuobiOTC) DoAccountOperation

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

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

func (*HuobiOTC) GetBalance

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

func (*HuobiOTC) GetCoinBySymbol

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

func (*HuobiOTC) GetCoinConstraint

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

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

func (*HuobiOTC) GetCoins

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

func (*HuobiOTC) GetCoinsData

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

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

func (*HuobiOTC) GetConstraintFetchMethod

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

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

func (*HuobiOTC) GetFee

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

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

func (*HuobiOTC) GetID

func (e *HuobiOTC) GetID() int

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

func (*HuobiOTC) GetLotSize

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

func (*HuobiOTC) GetName

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

func (*HuobiOTC) GetPairBySymbol

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

func (*HuobiOTC) GetPairConstraint

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

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

func (*HuobiOTC) GetPairs

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

func (*HuobiOTC) GetPairsData

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

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

func (*HuobiOTC) GetSymbolByCoin

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

func (*HuobiOTC) GetSymbolByPair

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

func (*HuobiOTC) GetTradingWebURL

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

func (*HuobiOTC) GetTxFee

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

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

func (*HuobiOTC) HasPair

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

func (*HuobiOTC) InitData

func (e *HuobiOTC) InitData() error

func (*HuobiOTC) LimitBuy

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

func (*HuobiOTC) LimitSell

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

func (*HuobiOTC) ListOrders

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

func (*HuobiOTC) LoadPublicData

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

func (*HuobiOTC) OrderBook

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

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

func (*HuobiOTC) SetCoinConstraint

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

func (*HuobiOTC) SetPairConstraint

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

func (*HuobiOTC) UpdateAllBalances

func (e *HuobiOTC) UpdateAllBalances()

func (*HuobiOTC) UpdateConstraint

func (e *HuobiOTC) UpdateConstraint()

func (*HuobiOTC) Withdraw

func (e *HuobiOTC) 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       int             `json:"code"`
	Message    string          `json:"message"`
	TotalCount int             `json:"totalCount"`
	PageSize   int             `json:"pageSize"`
	TotalPage  int             `json:"totalPage"`
	CurrPage   int             `json:"currPage"`
	Data       json.RawMessage `json:"data"`
	Success    bool            `json:"success"`
}

type OrderBook

type OrderBook []struct {
	ID                int     `json:"id"`
	UID               int     `json:"uid"`
	UserName          string  `json:"userName"`
	MerchantLevel     int     `json:"merchantLevel"`
	CoinID            int     `json:"coinId"`
	Currency          int     `json:"currency"`
	TradeType         int     `json:"tradeType"`
	BlockType         int     `json:"blockType"`
	PayMethod         string  `json:"payMethod"`
	PayTerm           int     `json:"payTerm"`
	PayName           string  `json:"payName"`
	MinTradeLimit     float64 `json:"minTradeLimit"`
	MaxTradeLimit     float64 `json:"maxTradeLimit"`
	Price             float64 `json:"price"`
	TradeCount        float64 `json:"tradeCount"`
	IsOnline          bool    `json:"isOnline"`
	TradeMonthTimes   int     `json:"tradeMonthTimes"`
	OrderCompleteRate int     `json:"orderCompleteRate"`
	TakerLimit        int     `json:"takerLimit"`
	GmtSort           int64   `json:"gmtSort"`
}

Jump to

Keyboard shortcuts

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