Documentation ¶
Index ¶
Constants ¶
View Source
const ( // FAILED 下单失败 FAILED = (100) // HANGING 挂起 包含未成交和部分成交 HANGING = (200) // HALFTRADE 部分成交 HALFTRADE = (300) // COMPLETETRADE 已成交 订单完全成交 COMPLETETRADE = (301) // CANCELING 取消中 CANCELING = (400) // CANCELED 已取消 CANCELED = (401) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIif ¶
type APIif interface { ////////////////////////////////////////////////////////////// // 查询所有交易对 GetAllSymbol() ([]TradeSymbol, error) // 查询kline数据 GetKline(KlineReq) ([]Kline, error) ////////////////////////////////////////////////////////////// // 获取资金信息 GetFund(FundReq) ([]Fund, error) // 下单,只支持限价和市价 InsertOrder(InsertReq) (InsertRsp, error) // 获取订单状态 OrderStatus(StatusReq) (StatusRsp, error) // 取消订单 CancelOrder(CancelReq) error }
APIif 各个交易所需要实现的接口
type CancelReq ¶
type CancelReq struct { APIKey string `json:"apikey"` // weex 需要 Base string `json:"base"` Quote string `json:"quote"` OrderNo string `json:"orderno"` }
CancelReq 撤单请求参数
type Depth ¶
type Depth struct { Base string `json:"base"` // eg BTC Quote string `json:"quote"` // eg USDT Asks []DepthPair `json:"asks"` // 卖 Bids []DepthPair `json:"bids"` // 买 }
Depth 深度行情数据
type Fund ¶
type Fund struct { Base string `json:"base"` // e.g BTC Available float64 `json:"available"` // 可用 Frozen float64 `json:"frozen"` // 冻结 }
Fund 资金账户情况
type InsertReq ¶
type InsertReq struct { APIKey string `json:"apikey"` // weex 需要 Base string `json:"base"` Quote string `json:"quote"` Price float64 `json:"price"` Num float64 `json:"num"` Type int `json:"type"` // 0 - limit, 1- market Direction int `json:"direction"` // 0 - buy, 1- sell }
InsertReq 请求下单参数
type Kline ¶
type Kline struct { Base string `json:"base"` // eg BTC Quote string `json:"quote"` // eg USDT Timestamp int64 `json:"time"` // 时间戳 Open float64 `json:"open"` // 最高价 Low float64 `json:"low"` // 最低价 High float64 `json:"high"` // 开盘价 Close float64 `json:"close"` // 收盘价 Volume float64 `json:"volume"` // 成交量 }
Kline K线数据
type KlineReq ¶
type KlineReq struct { Base string `json:"base"` Quote string `json:"quote"` Period string `json:"period"` Count int64 `json:"count"` Begin string `json:"begin"` End string `json:"end"` }
KlineReq 请求查询k线数据
type LateTrade ¶
type LateTrade struct { Base string `json:"base"` // eg BTC Quote string `json:"quote"` // eg USDT DateTime string `json:"date"` // 订单时间 Num float64 `json:"amount"` // 成交币种数量 Price float64 `json:"rate"` // 币种单价 Dircetion string `json:"type"` // 买卖类型, buy买 sell卖 Total float64 `json:"total"` // 订单总额 }
LateTrade 最近成交记录
type StatusReq ¶
type StatusReq struct { APIKey string `json:"apikey"` // weex 需要 Base string `json:"base"` Quote string `json:"quote"` OrderNo string `json:"orderno"` }
StatusReq 查询订单状态
type StatusRsp ¶
type StatusRsp struct { TradePrice float64 `json:"tradeprice"` TradeNum float64 `json:"tradenum"` Status int `json:"status"` StatusMsg string `json:"statusmsg"` }
StatusRsp 订单状态
type Ticker ¶
type Ticker struct { Base string `json:"base"` // eg BTC Quote string `json:"quote"` // eg USDT PriceChange float64 `json:"price_change"` // 涨跌值 PriceChangePercent float64 `json:"price_change_percent"` // 涨跌幅 LastPrice float64 `json:"lastprice"` // 最新价 HighPrice float64 `json:"highprice"` // 最高价 LowPrice float64 `json:"lowprice"` // 最低价 Volume float64 `json:"volume"` // 成交量 }
Ticker 实时行情数据
type TradeSymbol ¶
TradeSymbol 交易对
type WSif ¶
type WSif interface { // 订阅ticker SubTicker(TradeSymbol) (chan Ticker, error) // 订阅深度行情 SubDepth(TradeSymbol) (chan Depth, error) // 订阅最近成交 SubLateTrade(TradeSymbol) (chan LateTrade, error) // 查询深度行情 GetDepth(TradeSymbol) (Depth, error) }
WSif websocket实时推送需要实现的接口
Click to show internal directories.
Click to hide internal directories.