Documentation ¶
Index ¶
- Constants
- func CreateSign(mapParams map[string]string, ...) string
- func MapSortByKey(mapValue map[string]string) string
- type AccountBalances
- type AccountsReturn
- type CoinsData
- type DWHistory
- type DepositAddress
- type Huobi
- func (e *Huobi) ApiKeyRequest(strMethod string, mapParams map[string]string, strRequestPath string) string
- func (e *Huobi) CanDeposit(coin *coin.Coin) bool
- func (e *Huobi) CanWithdraw(coin *coin.Coin) bool
- func (e *Huobi) CancelAllOrder() error
- func (e *Huobi) CancelOrder(order *exchange.Order) error
- func (e *Huobi) DeleteCoin(coin *coin.Coin)
- func (e *Huobi) DeletePair(pair *pair.Pair)
- func (e *Huobi) DoAccountOperation(operation *exchange.AccountOperation) error
- func (e *Huobi) GetAccounts() string
- func (e *Huobi) GetBalance(coin *coin.Coin) float64
- func (e *Huobi) GetCoinBySymbol(symbol string) *coin.Coin
- func (e *Huobi) GetCoinConstraint(coin *coin.Coin) *exchange.CoinConstraint
- func (e *Huobi) GetCoins() []*coin.Coin
- func (e *Huobi) GetCoinsData() error
- func (e *Huobi) GetConfirmation(coin *coin.Coin) int
- func (e *Huobi) GetConstraintFetchMethod(pair *pair.Pair) *exchange.ConstrainFetchMethod
- func (e *Huobi) GetFee(pair *pair.Pair) float64
- func (e *Huobi) GetID() int
- func (e *Huobi) GetLotSize(pair *pair.Pair) float64
- func (e *Huobi) GetName() exchange.ExchangeName
- func (e *Huobi) GetPairBySymbol(symbol string) *pair.Pair
- func (e *Huobi) GetPairConstraint(pair *pair.Pair) *exchange.PairConstraint
- func (e *Huobi) GetPairs() []*pair.Pair
- func (e *Huobi) GetPairsData() error
- func (e *Huobi) GetPriceFilter(pair *pair.Pair) float64
- func (e *Huobi) GetSymbolByCoin(coin *coin.Coin) string
- func (e *Huobi) GetSymbolByPair(pair *pair.Pair) string
- func (e *Huobi) GetTradingWebURL(pair *pair.Pair) string
- func (e *Huobi) GetTxFee(coin *coin.Coin) float64
- func (e *Huobi) HasPair(pair *pair.Pair) bool
- func (e *Huobi) InitData() error
- func (e *Huobi) LimitBuy(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)
- func (e *Huobi) LimitSell(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)
- func (e *Huobi) ListOrders() ([]*exchange.Order, error)
- func (e *Huobi) LoadPublicData(operation *exchange.PublicOperation) error
- func (e *Huobi) OrderBook(pair *pair.Pair) (*exchange.Maker, error)
- func (e *Huobi) OrderStatus(order *exchange.Order) error
- func (e *Huobi) SetCoinConstraint(coinConstraint *exchange.CoinConstraint)
- func (e *Huobi) SetPairConstraint(pairConstraint *exchange.PairConstraint)
- func (e *Huobi) UpdateAllBalances()
- func (e *Huobi) UpdateConstraint()
- func (e *Huobi) Withdraw(coin *coin.Coin, quantity float64, addr, tag string) bool
- type JsonResponse
- type KLines
- type OrderBook
- type OrderStatus
- type PairsData
- type SubAccountBalances
- type SubAccountList
- type SubAllAccountBalances
- type SubTransfer
- type TickerPrice
- type TradeHistory
- type TransferHistory
Constants ¶
const ( DEFAULT_ID = 11 DEFAULT_TAKER_FEE = 0.002 DEFAULT_MAKER_FEE = 0.002 DEFAULT_LOT_SIZE = 0.00000001 DEFAULT_PRICE_FILTER = 0.00000001 DEFAULT_TXFEE = 0.005 TRADE_HISTORY_MAX_LIMIT = 2000 )
const (
API_URL string = "https://api.huobi.pro"
)
Variables ¶
This section is empty.
Functions ¶
func CreateSign ¶
func MapSortByKey ¶
Types ¶
type AccountBalances ¶
type AccountsReturn ¶
type CoinsData ¶
type CoinsData []struct { Currency string `json:"currency"` Chains []struct { Chain string `json:"chain"` NumOfConfirmations int `json:"numOfConfirmations"` NumOfFastConfirmations int `json:"numOfFastConfirmations"` DepositStatus string `json:"depositStatus"` MinDepositAmt string `json:"minDepositAmt"` WithdrawStatus string `json:"withdrawStatus"` MinWithdrawAmt string `json:"minWithdrawAmt"` WithdrawPrecision int `json:"withdrawPrecision"` MaxWithdrawAmt string `json:"maxWithdrawAmt"` WithdrawQuotaPerDay string `json:"withdrawQuotaPerDay"` WithdrawQuotaPerYear string `json:"withdrawQuotaPerYear"` WithdrawQuotaTotal string `json:"withdrawQuotaTotal"` WithdrawFeeType string `json:"withdrawFeeType"` TransactFeeWithdraw string `json:"transactFeeWithdraw"` MinTransactFeeWithdraw string `json:"minTransactFeeWithdraw"` } `json:"chains"` InstStatus string `json:"instStatus"` }
type DWHistory ¶
type DWHistory struct { ID int `json:"id"` Type string `json:"type"` Currency string `json:"currency"` TxHash string `json:"tx-hash"` Amount float64 `json:"amount"` Address string `json:"address"` AddressTag string `json:"address-tag"` Fee int `json:"fee"` State string `json:"state"` CreatedAt int64 `json:"created-at"` UpdatedAt int64 `json:"updated-at"` }
type DepositAddress ¶
type Huobi ¶
type Huobi struct { ID int Name string `bson:"name"` Website string `bson:"website"` API_KEY string API_SECRET string Account_ID string Source exchange.DataSource // / exchange API / microservicve api 1 / PSQL SourceURI string }
func CreateHuobi ¶
*************************************************
func (*Huobi) ApiKeyRequest ¶
func (e *Huobi) ApiKeyRequest(strMethod string, mapParams map[string]string, strRequestPath 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 (*Huobi) CancelAllOrder ¶
func (*Huobi) DeleteCoin ¶
func (*Huobi) DeletePair ¶
func (*Huobi) DoAccountOperation ¶
func (e *Huobi) DoAccountOperation(operation *exchange.AccountOperation) error
func (*Huobi) GetAccounts ¶
************** Private API **************
func (*Huobi) GetCoinConstraint ¶
func (e *Huobi) GetCoinConstraint(coin *coin.Coin) *exchange.CoinConstraint
************** Coins on the Exchanges **************
func (*Huobi) GetCoinsData ¶
************** 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 (*Huobi) GetConstraintFetchMethod ¶
func (e *Huobi) GetConstraintFetchMethod(pair *pair.Pair) *exchange.ConstrainFetchMethod
*************** Exchange Constraint ***************
func (*Huobi) GetName ¶
func (e *Huobi) GetName() exchange.ExchangeName
func (*Huobi) GetPairConstraint ¶
func (e *Huobi) GetPairConstraint(pair *pair.Pair) *exchange.PairConstraint
************** Pairs on the Exchanges **************
func (*Huobi) GetPairsData ¶
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 (*Huobi) LoadPublicData ¶
func (e *Huobi) LoadPublicData(operation *exchange.PublicOperation) error
************** PUBLIC API **************
func (*Huobi) OrderBook ¶
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 (*Huobi) SetCoinConstraint ¶
func (e *Huobi) SetCoinConstraint(coinConstraint *exchange.CoinConstraint)
func (*Huobi) SetPairConstraint ¶
func (e *Huobi) SetPairConstraint(pairConstraint *exchange.PairConstraint)
func (*Huobi) UpdateAllBalances ¶
func (e *Huobi) UpdateAllBalances()
func (*Huobi) UpdateConstraint ¶
func (e *Huobi) UpdateConstraint()
type JsonResponse ¶
type JsonResponse struct { Code int `json:"code"` Message string `json:"message"` Status string `json:"status"` Data json.RawMessage `json:"data"` Tick json.RawMessage `json:"tick"` ErrCode string `json:"err-code"` ErrMsg string `json:"err-msg"` }
type OrderStatus ¶
type OrderStatus struct { ID int `json:"id"` Symbol string `json:"symbol"` AccountID int `json:"account-id"` Amount string `json:"amount"` Price string `json:"price"` CreatedAt int64 `json:"created-at"` Type string `json:"type"` FieldAmount string `json:"field-amount"` FieldCashAmount string `json:"field-cash-amount"` FieldFees string `json:"field-fees"` FilledAmount string `json:"filled-amount"` FilledCashAmount string `json:"filled-cash-amount"` FilledFees string `json:"filled-fees"` FinishedAt int64 `json:"finished-at"` UserID int `json:"user-id"` Source string `json:"source"` State string `json:"state"` CanceledAt int `json:"canceled-at"` Exchange string `json:"exchange"` Batch string `json:"batch"` }
type PairsData ¶
type PairsData []struct { BaseCurrency string `json:"base-currency"` QuoteCurrency string `json:"quote-currency"` PricePrecision int `json:"price-precision"` AmountPrecision int `json:"amount-precision"` SymbolPartition string `json:"symbol-partition"` Symbol string `json:"symbol"` State string `json:"state"` ValuePrecision int `json:"value-precision"` MinOrderAmt float64 `json:"min-order-amt"` MaxOrderAmt float64 `json:"max-order-amt"` MinOrderValue float64 `json:"min-order-value"` LeverageRatio float64 `json:"leverage-ratio,omitempty"` SuperMarginLeverageRatio float64 `json:"super-margin-leverage-ratio,omitempty"` FundingLeverageRatio float64 `json:"funding-leverage-ratio,omitempty"` }
type SubAccountBalances ¶
type SubAccountList ¶
type SubAllAccountBalances ¶
type SubTransfer ¶
type TickerPrice ¶
type TickerPrice []struct { Symbol string `json:"symbol"` Open float64 `json:"open"` High float64 `json:"high"` Low float64 `json:"low"` Close float64 `json:"close"` Amount float64 `json:"amount"` Vol float64 `json:"vol"` Count int `json:"count"` Bid float64 `json:"bid"` BidSize float64 `json:"bidSize"` Ask float64 `json:"ask"` AskSize float64 `json:"askSize"` }
type TradeHistory ¶
type TradeHistory struct { Status string `json:"status"` Ch string `json:"ch"` Ts uint `json:"ts"` Data []struct { ID uint `json:"id"` Ts uint `json:"ts"` Data []struct { Amount float64 `json:"amount"` TradeID uint `json:"trade-id"` Ts int64 `json:"ts"` // ID uint64 `json:"id"` Price float64 `json:"price"` Direction string `json:"direction"` } `json:"data"` } `json:"data"` }
type TransferHistory ¶
type TransferHistory []struct { AccountID int `json:"accountId"` Currency string `json:"currency"` TransactAmt float64 `json:"transactAmt"` TransactType string `json:"transactType"` TransferType string `json:"transferType"` TransactID int `json:"transactId"` TransactTime int64 `json:"transactTime"` Transferer int `json:"transferer"` Transferee int `json:"transferee"` }