Documentation ¶
Index ¶
- Constants
- func Init(ctx context.Context) error
- func NewMBPChannel(sym exchange.Symbol, size int) exchange.Channel
- func ParseDepth(ch string, ts int64, tick json.RawMessage) (interface{}, error)
- func ParseOrder(data json.RawMessage) (interface{}, error)
- func ParseOrderStatus(state string) (exchange.OrderStatus, error)
- func ParseOrderType(oType string) (exchange.OrderSide, exchange.OrderType, error)
- func ParseSymbol(symbol string) (exchange.SpotSymbol, error)
- type Account
- type Balance
- type BalanceReq
- type BalanceResp
- type CodeC
- type Depth
- type Direct
- type MBPChannel
- type MBPDepthDS
- type MBPFullReq
- type MBPFullResp
- type MatchResult
- type MatchResultReq
- type OrderData
- type OrdersChannel
- type OrdersReq
- type OrdersResp
- type OrdersRespDetail
- type PlaceReq
- func (pr *PlaceReq) ClientOrderID(coi string) *PlaceReq
- func (pr *PlaceReq) Operator(op string) *PlaceReq
- func (pr *PlaceReq) Price(price string) *PlaceReq
- func (pr *PlaceReq) Serialize() ([]byte, error)
- func (pr *PlaceReq) Source(source string) *PlaceReq
- func (pr *PlaceReq) StopPrice(sp string) *PlaceReq
- type PlaceResp
- type PrivateCodeC
- type PrivateWSClient
- type PrivateWSReq
- type PrivateWSResp
- type RestClient
- func (rc *RestClient) Accounts(ctx context.Context) ([]Account, error)
- func (rc *RestClient) Balance(ctx context.Context, req *BalanceReq) (*BalanceResp, error)
- func (rc *RestClient) FeeRate(ctx context.Context, symbols []exchange.Symbol) ([]*exchange.TradeFee, error)
- func (rc *RestClient) FetchBalance(ctx context.Context, currencies ...string) (*exchange.Balances, error)
- func (rc *RestClient) FetchOrder(ctx context.Context, order *exchange.Order) (*exchange.Order, error)
- func (rc *RestClient) FetchSymbols(ctx context.Context) ([]Symbol, error)
- func (rc *RestClient) Init(ctx context.Context) error
- func (rc *RestClient) MatchResult(ctx context.Context, req *MatchResultReq) ([]MatchResult, error)
- func (rc *RestClient) MatchResults(ctx context.Context, symbol string, types []string, st int64, et int64, ...) ([]MatchResult, error)
- func (rc *RestClient) Orders(ctx context.Context, req *OrdersReq) (*OrdersResp, error)
- func (rc *RestClient) Place(ctx context.Context, req *PlaceReq) (*PlaceResp, error)
- func (rc *RestClient) SubmitCancel(ctx context.Context, req *SubmitCancelReq) (*PlaceResp, error)
- func (rc *RestClient) Symbols(ctx context.Context) ([]exchange.SpotSymbol, error)
- func (rc *RestClient) Trades(ctx context.Context, req *exchange.TradeReqParam) ([]exchange.Trade, error)
- func (rc *RestClient) TransactFeeRate(ctx context.Context, symbols []string) ([]TransactFeeRate, error)
- type SpotSymbol
- type SubmitCancelReq
- type Symbol
- type SymbolResp
- type TransactFeeRate
- type WSClient
Constants ¶
View Source
const ( AccountsEndPoint = "/v1/account/accounts" TypeFrozen = "frozen" TypeTrade = "trade" )
View Source
const ( ActionPing = "ping" ActionPong = "pong" ActionReq = "req" ActionSub = "sub" ActionPush = "push" )
View Source
const ( DirectNone Direct = "" DirectPrev Direct = "forward" DirectNext Direct = "next" MatchResutEndPoint = "/v1/order/matchresults" MatchRoleMaker = "maker" MatchRoleTaker = "taker" )
View Source
const (
MBPAddr = "wss://api-aws.huobi.pro/feed"
)
View Source
const (
PlaceOrderEndPoint = "/v1/order/orders/place"
)
View Source
const (
PrivateWSClientAddr = "wss://api.huobi.pro/ws/v2"
)
View Source
const (
SpotHost = "api.huobi.pro"
)
View Source
const (
TransactFeeRateEndPoint = "/v2/reference/transact-fee-rate"
)
Variables ¶
This section is empty.
Functions ¶
func NewMBPChannel ¶ added in v0.5.0
func ParseDepth ¶ added in v0.5.0
func ParseDepth(ch string, ts int64, tick json.RawMessage) (interface{}, error)
func ParseOrder ¶ added in v0.5.0
func ParseOrder(data json.RawMessage) (interface{}, error)
func ParseOrderStatus ¶ added in v0.5.0
func ParseOrderStatus(state string) (exchange.OrderStatus, error)
func ParseOrderType ¶ added in v0.5.0
func ParseSymbol ¶ added in v0.3.0
func ParseSymbol(symbol string) (exchange.SpotSymbol, error)
Types ¶
type BalanceReq ¶ added in v0.5.2
type BalanceReq struct {
AccountID int
}
type BalanceResp ¶ added in v0.5.2
type MBPChannel ¶ added in v0.5.0
type MBPChannel struct {
// contains filtered or unexported fields
}
func (*MBPChannel) String ¶ added in v0.5.0
func (mc *MBPChannel) String() string
type MBPDepthDS ¶ added in v0.5.0
type MBPDepthDS struct {
// contains filtered or unexported fields
}
MBPDepthDS build depth according incremental updates and refresh message the ds is inited which means the refresh message has been push int ods
func NewMBPDepthDS ¶ added in v0.5.0
func NewMBPDepthDS(symbol exchange.Symbol) *MBPDepthDS
func (*MBPDepthDS) AddRefresh ¶ added in v0.5.0
func (ds *MBPDepthDS) AddRefresh(d *Depth)
type MBPFullReq ¶ added in v0.5.0
func NewMBPFullReq ¶ added in v0.5.0
func NewMBPFullReq(symbol exchange.Symbol, size int) *MBPFullReq
type MBPFullResp ¶ added in v0.5.0
type MatchResult ¶ added in v0.3.0
type MatchResult struct { ID int64 `json:"id"` MatchID int64 `json:"match-id"` OrderID int64 `json:"order-id"` TradeID int64 `json:"trade-id"` CreatedAt int64 `json:"created-at"` FilledAmount decimal.Decimal `json:"filled-amount"` FilledFees decimal.Decimal `json:"filled-fees"` FilledPoints decimal.Decimal `json:"filled-points"` FeeCurrency string `json:"fee-currency"` Price decimal.Decimal `json:"price"` Source string `json:"source"` Symbol string `json:"symbol"` Type string `json:"type"` Role string `json:"role"` FeeDeductCurrency string `json:"fee-deduct-currency"` FeeDeductState string `json:"fee-deduct-state"` }
type MatchResultReq ¶ added in v0.5.0
type MatchResultReq OrdersReq
func NewMatchResultReq ¶ added in v0.5.0
func NewMatchResultReq(orderID string) *MatchResultReq
type OrderData ¶ added in v0.5.0
type OrderData struct { EventType string `json:"eventType"` Symbol string `json:"symbol"` AccountID int64 `json:"accountId"` OrderID int64 `json:"orderId"` ClientOrderID string `json:"clientOrderId"` OrderStatus string `json:"orderStatus"` OrderPrice string `json:"orderPrice"` OrderSize string `json:"orderSize"` OrderValue string `json:"orderValue"` Type string `json:"type"` OrderCreateTime int64 `json:"orderCreateTime"` OrderSource string `json:"orderSource"` TradePrice string `json:"tradePrice"` TradeVolume string `json:"tradeVolume"` TradeID int64 `json:"tradeId"` TradeTime int64 `json:"tradeTime"` Aggressor bool `json:"aggressor"` RemainAmt string `json:"remainAmt"` ExecAmt string `json:"execAmt"` LastActTime int64 `json:"lastActTime"` }
type OrdersChannel ¶ added in v0.5.0
type OrdersChannel struct {
// contains filtered or unexported fields
}
func NewOrdersChannel ¶ added in v0.5.0
func NewOrdersChannel(sym string) *OrdersChannel
func (*OrdersChannel) String ¶ added in v0.5.0
func (oc *OrdersChannel) String() string
type OrdersReq ¶ added in v0.5.0
type OrdersReq struct {
OrderID string
}
func NewOrdersReq ¶ added in v0.5.0
type OrdersResp ¶ added in v0.5.0
type OrdersResp struct {
Data OrdersRespDetail `json:"data"`
}
type OrdersRespDetail ¶ added in v0.5.0
type OrdersRespDetail struct { ID int64 `json:"id"` Symbol string `json:"symbol"` AccountID int64 `json:"account-id"` Amount string `json:"amount"` Price string `json:"price"` CreatedAt int64 `json:"created-at"` Type string `json:"type"` FilledAmount string `json:"filled-amount"` FilledCashAmount string `json:"filled-cash-amount"` FilledFees string `json:"filled-fees"` FinishedAt int64 `json:"finished-at"` UserID int64 `json:"user-id"` Source string `json:"source"` State string `json:"state"` CanceledAt int64 `json:"canceled-at"` }
type PlaceReq ¶ added in v0.5.0
type PlaceReq struct {
// contains filtered or unexported fields
}
func NewPlaceReq ¶ added in v0.5.0
func (*PlaceReq) ClientOrderID ¶ added in v0.5.0
type PrivateCodeC ¶ added in v0.5.0
type PrivateCodeC struct { }
func NewPrivateCodeC ¶ added in v0.5.0
func NewPrivateCodeC() *PrivateCodeC
type PrivateWSClient ¶ added in v0.5.0
func NewPrivateWSClient ¶ added in v0.5.0
func NewPrivateWSClient(key, secret string, data chan interface{}) *PrivateWSClient
func (*PrivateWSClient) Auth ¶ added in v0.5.0
func (pws *PrivateWSClient) Auth(ctx context.Context) error
func (*PrivateWSClient) Handle ¶ added in v0.5.0
func (pws *PrivateWSClient) Handle(ctx context.Context, n *rpc.Notify)
type PrivateWSReq ¶ added in v0.5.0
type PrivateWSResp ¶ added in v0.5.0
type PrivateWSResp struct { Action string `json:"action"` Code int `json:"code"` Ch string `json:"ch"` Data json.RawMessage `json:"data"` }
type RestClient ¶
type RestClient struct { *huobi.RestClient // contains filtered or unexported fields }
func NewRestClient ¶
func NewRestClient(key, secret string) *RestClient
func (*RestClient) Accounts ¶ added in v0.5.0
func (rc *RestClient) Accounts(ctx context.Context) ([]Account, error)
func (*RestClient) Balance ¶ added in v0.5.2
func (rc *RestClient) Balance(ctx context.Context, req *BalanceReq) (*BalanceResp, error)
func (*RestClient) FetchBalance ¶ added in v0.5.2
func (*RestClient) FetchOrder ¶ added in v0.5.0
func (*RestClient) FetchSymbols ¶ added in v0.3.0
func (rc *RestClient) FetchSymbols(ctx context.Context) ([]Symbol, error)
func (*RestClient) Init ¶
func (rc *RestClient) Init(ctx context.Context) error
Init spot account id for Balance request
func (*RestClient) MatchResult ¶ added in v0.5.0
func (rc *RestClient) MatchResult(ctx context.Context, req *MatchResultReq) ([]MatchResult, error)
func (*RestClient) MatchResults ¶ added in v0.3.0
func (*RestClient) Orders ¶ added in v0.5.0
func (rc *RestClient) Orders(ctx context.Context, req *OrdersReq) (*OrdersResp, error)
func (*RestClient) SubmitCancel ¶ added in v0.5.0
func (rc *RestClient) SubmitCancel(ctx context.Context, req *SubmitCancelReq) (*PlaceResp, error)
func (*RestClient) Symbols ¶ added in v0.3.0
func (rc *RestClient) Symbols(ctx context.Context) ([]exchange.SpotSymbol, error)
func (*RestClient) Trades ¶ added in v0.3.0
func (rc *RestClient) Trades(ctx context.Context, req *exchange.TradeReqParam) ([]exchange.Trade, error)
func (*RestClient) TransactFeeRate ¶ added in v0.3.0
func (rc *RestClient) TransactFeeRate(ctx context.Context, symbols []string) ([]TransactFeeRate, error)
type SpotSymbol ¶
type SpotSymbol struct { *exchange.BaseSpotSymbol Symbol string }
func (*SpotSymbol) String ¶
func (ss *SpotSymbol) String() string
type SubmitCancelReq ¶ added in v0.5.0
type SubmitCancelReq OrdersReq
func NewSubmitCancelReq ¶ added in v0.5.0
func NewSubmitCancelReq(orderID string) *SubmitCancelReq
type Symbol ¶
type Symbol struct { BaseCurrency string `json:"base-currency"` QuoteCurreny string `json:"quote-currency"` Symbol string `json:"symbol"` MinOrderAmt float64 `json:"min-order-amt"` MaxOrderAmt float64 `json:"max-order-amt"` MinOrderValue float64 `json:"min-order-value"` PricePrecision int `json:"price-precision"` AmountPrecision int `json:"amount-precision"` ValuePrecision int `json:"value-precision"` }
TODO add precision
type SymbolResp ¶
Click to show internal directories.
Click to hide internal directories.