Documentation ¶
Index ¶
- Constants
- func SplitSymbol(symbol string) (string, string)
- type Account
- type Balance
- type Client
- func (c *Client) CancelOrder(req global.CancelReq) error
- func (c *Client) GetAllAccountID() ([]Account, error)
- func (c *Client) GetAllSymbol() ([]global.TradeSymbol, error)
- func (c *Client) GetDepth(sreq global.TradeSymbol) (global.Depth, error)
- func (c *Client) GetFund(req global.FundReq) ([]global.Fund, error)
- func (c *Client) GetKline(req global.KlineReq) ([]global.Kline, error)
- func (c *Client) GetMatchDetail(orderno string) ([]MatchDetail, error)
- func (c *Client) GetOrders(symbol, status string) ([]OrderDetail, error)
- func (c *Client) InsertOrder(req global.InsertReq) (global.InsertRsp, error)
- func (c *Client) OrderStatus(req global.StatusReq) (global.StatusRsp, error)
- func (c *Client) SubDepth(sreq global.TradeSymbol) (chan global.Depth, error)
- func (c *Client) SubLateTrade(sreq global.TradeSymbol) (chan global.LateTrade, error)
- func (c *Client) SubTicker(sreq global.TradeSymbol) (chan global.Ticker, error)
- type InsertOrderReq
- type Kline
- type MatchDetail
- type OrderDetail
- type TradePair
Constants ¶
View Source
const ( Period1Min = "1min" Period5Min = "5min" Period15Min = "15min" Period30Min = "30min" Period60Min = "60min" Period1Day = "1day" Period1Mon = "1mon" Period1Week = "1week" Period1Year = "1year" TypeStep0 = "step0" TypeStep1 = "step1" TypeStep2 = "step2" TypeStep3 = "step3" TypeStep4 = "step4" TypeStep5 = "step5" )
consts
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Account ¶
type Account struct { AccountID int64 `json:"id"` Status string `json:"state"` // working:正常, lock:账户被锁定 AccountType string `json:"type"` // spot:现货账户 }
Account ...
type Balance ¶
type Balance struct { Amount string `json:"balance"` // 余额 CurrencyNo string `json:"currency"` //币种 BType string `json:"type"` // trade: 交易余额,frozen: 冻结余额 }
Balance ...
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client 是huobi sdk的调用客户端
func (*Client) CancelOrder ¶
CancelOrder 撤销一个订单请求 注意,返回OK表示撤单请求成功。订单是否撤销成功请调用订单查询接口查询该订单状态
func (*Client) GetAllAccountID ¶
GetAllAccountID 获取用户的所有accountid GET /v1/account/accounts 查询当前用户的所有账户(即account-id),Pro站和HADAX account-id通用
func (*Client) GetAllSymbol ¶
func (c *Client) GetAllSymbol() ([]global.TradeSymbol, error)
GetAllSymbol 获取所有的可交易对
func (*Client) GetMatchDetail ¶
func (c *Client) GetMatchDetail(orderno string) ([]MatchDetail, error)
GetMatchDetail 查询某个订单的成交明细
func (*Client) GetOrders ¶
func (c *Client) GetOrders(symbol, status string) ([]OrderDetail, error)
GetOrders 查询当前委托、历史委托 @parm symbol 交易对 btcusdt, bchbtc, rcneth ... @parm status 查询的订单状态组合,使用','分割
pre-submitted 准备提交, submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销
func (*Client) InsertOrder ¶
InsertOrder 下单 @return string: orderNo
func (*Client) OrderStatus ¶
OrderStatus 查询某个订单详情
func (*Client) SubDepth ¶
SubDepth 查询市场深度数据 type 可选值:{ step0, step1, step2, step3, step4, step5 } (合并深度0-5); step0时,不合并深度
func (*Client) SubLateTrade ¶
SubLateTrade 查询交易详细数据
type InsertOrderReq ¶
type InsertOrderReq struct { AccountID string `json:"account-id"` // 账户ID Amount string `json:"amount"` // 限价表示下单数量, 市价买单时表示买多少钱, 市价卖单时表示卖多少币 Price string `json:"price,omitempty"` // 下单价格, 市价单不传该参数 Source string `json:"source"` // 订单来源, api: API调用, margin-api: 借贷资产交易 Symbol string `json:"symbol"` // 交易对, btcusdt, bccbtc...... OrderType string `json:"type"` // 订单类型, buy-market: 市价买, sell-market: 市价卖, buy-limit: 限价买, sell-limit: 限价卖 }
InsertOrderReq ...
type Kline ¶
type Kline struct { Base string Quote string Timestamp float64 `json:"id"` // 时间戳 Volume float64 `json:"vol"` // 交易量 Close float64 `json:"close"` // 收盘价 High float64 `json:"high"` // 最高价 Low float64 `json:"low"` // 最低价 Open float64 `json:"open"` // 开盘价 }
Kline k线数据
type MatchDetail ¶
type MatchDetail struct { MatchTime int64 `json:"created-at"` //成交时间 MatchNum string `json:"filled-amount"` //成交数量 MatchFee string `json:"filled-fees"` //成交手续费 MatchNo int64 `json:"id"` //订单成交记录ID MatchMarkNo int64 `json:"match-id"` //撮合ID OrderNo int64 `json:"order-id"` // 订单 ID MatchPrice string `json:"price"` //成交价格 OrderSource string `json:"source"` //订单来源 api Symbol string `json:"symbol"` //交易对 btcusdt, bchbtc, rcneth ... OrderType string `json:"type"` //订单类型 buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖 }
MatchDetail ...
type OrderDetail ¶
type OrderDetail struct { AccountID int64 `json:"account-id"` //账户 ID Num int64 `json:"amount"` //订单数量 CancelTime int64 `json:"canceled-at"` //订单撤销时间 CreateTime int64 `json:"created-at"` //订单创建时间 TradeNum string `json:"field-amount"` //已成交数量 TradePrice string `json:"field-cash-amount"` //已成交总金额 TradeFee string `json:"field-fees"` //已成交手续费(买入为币,卖出为钱) TradeTime int64 `json:"finished-at"` // 最后成交时间 MatchNo int64 `json:"id"` //订单ID InsertPrice string `json:"price"` //订单价格 InsertSource string `json:"source"` //订单来源 api OrderStatus string `json:"state"` //订单状态 pre-submitted 准备提交, submitting , submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销 Symbol string `json:"symbol"` // 交易对 btcusdt, bchbtc, rcneth ... OrderType string `json:"type"` // 订单类型 buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖 }
OrderDetail ...
Click to show internal directories.
Click to hide internal directories.