Documentation
¶
Index ¶
- Constants
- func Init(ctx context.Context) error
- func NewDepthHighFreq(symbol string, size DepthSize) exchange.Channel
- func NewOrdersChannel(symbol string) exchange.Channel
- func ParseDepth(raw json.RawMessage) (interface{}, error)
- func ParseOrder(raw []byte) (*exchange.Order, error)
- func ParseSymbol(sym string) (exchange.SwapSymbol, error)
- type AuthResponse
- type CodeC
- type ContractInfo
- type Data
- type Depth
- type DepthHighFreqChannel
- type DepthSize
- type OrderNotify
- type OrderNotifyTrade
- type OrderReq
- type OrderResp
- type PingResponse
- type PrivateCodeC
- type PrivateWSClient
- type Response
- type RestClient
- func (rc *RestClient) PrivatePostReq(ctx context.Context, endPoint string, sr Serializer, dst interface{}) error
- func (rc *RestClient) SwapCancel(ctx context.Context, req *SwapCancelReq) (*SwapCancelResp, error)
- func (rc *RestClient) SwapOrder(ctx context.Context, req *OrderReq) (*OrderResp, error)
- func (rc *RestClient) Transfer(ctx context.Context, req *TransferReq) (*TransferResp, error)
- type Serializer
- type SwapCancelError
- type SwapCancelReq
- type SwapCancelResp
- type Symbol
- type TransferReq
- type TransferResp
- type WSClient
Constants ¶
View Source
const ( TransferEndPoint = "/v2/account/transfer" TransferSpotAccount = "spot" TransferSwapAccount = "swap" )
View Source
const ( SwapHost = "api.hbdm.com" SwapProHost = "api.huobi.pro" )
View Source
const ( SwapOrderEndPoint = "/swap-api/v1/swap_order" SwapCancelEndPoint = "/swap-api/v1/swap_cancel" OrderDirectionBuy = "buy" OrderDirectionSell = "sell" OrderOffsetOpen = "open" OrderOffsetClose = "close" OrderPriceLimit = "limit" OrderPriceMarket = "opponent" )
View Source
const (
ContractEndPoint = "/swap-api/v1/swap_contract_info"
)
View Source
const (
SwapPrivateAddr = "wss://api.hbdm.com/swap-notification"
)
View Source
const (
SwapWSAddr = "wss://api.hbdm.com/swap-ws"
)
Variables ¶
This section is empty.
Functions ¶
func NewDepthHighFreq ¶ added in v0.5.0
func NewOrdersChannel ¶ added in v0.5.0
func ParseDepth ¶ added in v0.5.0
func ParseDepth(raw json.RawMessage) (interface{}, error)
func ParseSymbol ¶ added in v0.5.0
func ParseSymbol(sym string) (exchange.SwapSymbol, error)
Types ¶
type AuthResponse ¶ added in v0.5.0
type ContractInfo ¶
type Data ¶
type Data struct { Symbol string `json:"symbol"` ContractCode string `json:"contract_code"` ContractSize float64 `json:"contract_size"` PriceTick float64 `json:"price_tick"` CreateDate string `json:"create_date"` ContractStatus int `json:"contract_status"` SettlementDate string `json:"settlement_date"` }
type DepthHighFreqChannel ¶ added in v0.5.0
type DepthHighFreqChannel struct {
// contains filtered or unexported fields
}
func (*DepthHighFreqChannel) String ¶ added in v0.5.0
func (ch *DepthHighFreqChannel) String() string
type OrderNotify ¶ added in v0.5.0
type OrderNotify struct { Op string `json:"op"` Topic string `json:"topic"` TS int64 `json:"ts"` //ping message and auth message ts field have different type Symbol string `json:"symbol"` ContractCode string `json:"contract_code"` Volume float64 `json:"volume"` Price float64 `json:"price"` OrderPriceType string `json:"order_price_type"` Direction string `json:"direction"` Offset string `json:"offset"` Status int `json:"status"` LeverRate int `json:"lever_rate"` OrderID int64 `json:"order_id"` OrderIDStr string `json:"order_id_str"` ClientOrderID int64 `json:"client_order_id"` OrderType int `json:"order_type"` CreatedAt int64 `json:"created_at"` TradeVolume int `json:"trade_volume"` TradeTurnOver float64 `json:"trade_turnover"` Fee float64 `json:"fee"` FeeAsset string `json:"fee_asset"` TradeAvgPrice float64 `json:"trade_avg_price"` CanceledAt int64 `json:"canceled_at"` RealProfit float64 `json:"real_profit"` Trades []OrderNotifyTrade `json:"trade"` }
type OrderNotifyTrade ¶ added in v0.5.0
type OrderNotifyTrade struct { TradeFee float64 `json:"trade_fee"` FeeAsset string `json:"fee_asset"` TradeID int64 `json:"trade_id"` ID string `json:"id"` TradeVolume int `json:"trade_volume"` TradePrice float64 `json:"trade_price"` TradeTurnOver float64 `json:"trade_turnover"` CreatedAt int64 `json:"created_at"` Profit float64 `json:"profit"` RealProfit float64 `json:"real_profit"` }
type OrderReq ¶ added in v0.5.0
type OrderReq struct {
// contains filtered or unexported fields
}
func NewOrderReq ¶ added in v0.5.0
type PingResponse ¶ added in v0.5.0
type PrivateCodeC ¶ added in v0.5.0
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 (ws *PrivateWSClient) Auth(ctx context.Context) error
func (*PrivateWSClient) Handle ¶ added in v0.5.0
func (ws *PrivateWSClient) Handle(ctx context.Context, notify *rpc.Notify)
type RestClient ¶
type RestClient struct {
*huobi.RestClient
}
func NewRestClient ¶
func NewRestClient(key string, secret string) *RestClient
func NewRestClientWithHost ¶ added in v0.5.0
func NewRestClientWithHost(key, secret, host string) *RestClient
func (*RestClient) PrivatePostReq ¶ added in v0.5.0
func (rc *RestClient) PrivatePostReq(ctx context.Context, endPoint string, sr Serializer, dst interface{}) error
func (*RestClient) SwapCancel ¶ added in v0.5.0
func (rc *RestClient) SwapCancel(ctx context.Context, req *SwapCancelReq) (*SwapCancelResp, error)
func (*RestClient) Transfer ¶ added in v0.5.0
func (rc *RestClient) Transfer(ctx context.Context, req *TransferReq) (*TransferResp, error)
type Serializer ¶ added in v0.5.0
type SwapCancelError ¶ added in v0.5.0
type SwapCancelReq ¶ added in v0.5.0
type SwapCancelReq struct {
// contains filtered or unexported fields
}
func NewSwapCancelReq ¶ added in v0.5.0
func NewSwapCancelReq(symbol string) *SwapCancelReq
func (*SwapCancelReq) ClientOrderIDs ¶ added in v0.5.0
func (scr *SwapCancelReq) ClientOrderIDs(ids ...string) *SwapCancelReq
func (*SwapCancelReq) Orders ¶ added in v0.5.0
func (scr *SwapCancelReq) Orders(ids ...string) *SwapCancelReq
func (*SwapCancelReq) Serialize ¶ added in v0.5.0
func (scr *SwapCancelReq) Serialize() ([]byte, error)
type SwapCancelResp ¶ added in v0.5.0
type SwapCancelResp struct { Errors []SwapCancelError `json:"errors"` Successes string `json:"successes"` //id1,id2,id3 ... }
type Symbol ¶
type Symbol struct {
*exchange.BaseSwapSymbol
}
type TransferReq ¶ added in v0.5.0
type TransferReq struct {
// contains filtered or unexported fields
}
func NewTransferReq ¶ added in v0.5.0
func NewTransferReq(from, to, currency string, amount float64) *TransferReq
func (*TransferReq) Serialize ¶ added in v0.5.0
func (tr *TransferReq) Serialize() ([]byte, error)
type TransferResp ¶ added in v0.5.0
Click to show internal directories.
Click to hide internal directories.