Documentation ¶
Index ¶
- Constants
- Variables
- func SubscribeAccount(conf *okex.Config, handler AccountHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
- func SubscribeBalanceAndPosition(conf *okex.Config, handler BalanceAndPositionHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
- func SubscribeDepthServe(symbolLevels []string, channel DepthChannel, handler DepthHandler, ...) (doneC, stopC chan struct{}, err error)
- func SubscribeOrders(conf *okex.Config, instType common.InstType, handler OrdersHandler, ...) (doneC, stopC chan struct{}, err error)
- func SubscribePositions(conf *okex.Config, instType common.InstType, handler PositionsHandler, ...) (doneC, stopC chan struct{}, err error)
- type AccountArg
- type AccountData
- type AccountDetails
- type AccountEvent
- type AccountHandler
- type Arg
- type BalData
- type BalanceAndPositionArg
- type BalanceAndPositionData
- type BalanceAndPositionEvent
- type BalanceAndPositionHandler
- type BaseEvent
- type ChannelType
- type CreateOrder
- type CreateOrderEvent
- type Data
- type DepthChannel
- type DepthEvent
- type DepthHandler
- type ErrHandler
- type EventType
- type Handler
- type OrderArgs
- func (o *OrderArgs) SetBanAmend(banAmend string) *OrderArgs
- func (o *OrderArgs) SetCcy(ccy string) *OrderArgs
- func (o *OrderArgs) SetClOrdID(clOrdID string) *OrderArgs
- func (o *OrderArgs) SetInstID(instID string) *OrderArgs
- func (o *OrderArgs) SetOrdType(ordType common.OrderType) *OrderArgs
- func (o *OrderArgs) SetPosSide(posSide common.PosSide) *OrderArgs
- func (o *OrderArgs) SetPx(px string) *OrderArgs
- func (o *OrderArgs) SetReduceOnly(reduceOnly string) *OrderArgs
- func (o *OrderArgs) SetSide(side common.SideType) *OrderArgs
- func (o *OrderArgs) SetSz(sz string) *OrderArgs
- func (o *OrderArgs) SetTag(tag string) *OrderArgs
- func (o *OrderArgs) SetTdMode(tdMode common.TdMode) *OrderArgs
- func (o *OrderArgs) SetTgtCcy(tgtCcy string) *OrderArgs
- type OrderData
- type OrdersArg
- type OrdersData
- type OrdersEvent
- type OrdersHandler
- type PosData
- type PositionsArg
- type PositionsData
- type PositionsEvent
- type PositionsHandler
- type WebsocketTrade
- type WsHandler
Constants ¶
View Source
const ( PUBLIC ChannelType = "public" // 公共频道 PRIVATE ChannelType = "private" // 私有频道 PublicUrl common.BaseURL = "wss://ws.okex.com:8443/ws/v5/public" // 实盘公共API交易地址 PrivateUrl common.BaseURL = "wss://ws.okex.com:8443/ws/v5/private" // 实盘私有API交易地址 AwsPublicUrl common.BaseURL = "wss://wsaws.okex.com:8443/ws/v5/public" // AWS公共地址 AwsPrivateUrl common.BaseURL = "wss://wsaws.okex.com:8443/ws/v5/private" // AWS私有地址 SimulatePublicUrl common.BaseURL = "wss://wspap.okex.com:8443/ws/v5/public?brokerId=9999" // 模拟盘公共 SimulatePrivateUrl common.BaseURL = "wss://wspap.okex.com:8443/ws/v5/private?brokerId=9999" // 模拟盘私有 AccountEventType EventType = "account" // 账户信息 PositionsEventType EventType = "positions" // 持仓信息 BalanceAndPositionEventType EventType = "balance_and_position" // 账户余额和持仓信息 OrdersEventType EventType = "orders" // 订单信息 )
Variables ¶
Functions ¶
func SubscribeAccount ¶ added in v0.1.1
func SubscribeAccount(conf *okex.Config, handler AccountHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
SubscribeAccount 订阅账户信息
func SubscribeBalanceAndPosition ¶ added in v0.1.1
func SubscribeBalanceAndPosition(conf *okex.Config, handler BalanceAndPositionHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
SubscribeBalanceAndPosition 订阅账户余额和持仓频道信息
func SubscribeDepthServe ¶ added in v0.1.1
func SubscribeDepthServe(symbolLevels []string, channel DepthChannel, handler DepthHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
SubscribeDepthServe 订阅深度信息
func SubscribeOrders ¶ added in v0.1.1
func SubscribeOrders(conf *okex.Config, instType common.InstType, handler OrdersHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
SubscribeOrders 订阅订单信息
func SubscribePositions ¶ added in v0.1.1
func SubscribePositions(conf *okex.Config, instType common.InstType, handler PositionsHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
SubscribePositions 订阅持仓信息
Types ¶
type AccountArg ¶ added in v0.1.1
type AccountData ¶ added in v0.1.1
type AccountData struct { UTime string `json:"uTime"` TotalEq string `json:"totalEq"` IsoEq string `json:"isoEq"` AdjEq string `json:"adjEq"` OrdFroz string `json:"ordFroz"` Imr string `json:"imr"` Mmr string `json:"mmr"` NotionalUsd string `json:"notionalUsd"` MgnRatio string `json:"mgnRatio"` Details []AccountDetails `json:"details"` }
type AccountDetails ¶ added in v0.1.1
type AccountDetails struct { AvailBal string `json:"availBal"` AvailEq string `json:"availEq"` Ccy string `json:"ccy"` CashBal string `json:"cashBal"` UTime string `json:"uTime"` DisEq string `json:"disEq"` Eq string `json:"eq"` EqUsd string `json:"eqUsd"` FrozenBal string `json:"frozenBal"` Interest string `json:"interest"` IsoEq string `json:"isoEq"` Liab string `json:"liab"` MaxLoan string `json:"maxLoan"` MgnRatio string `json:"mgnRatio"` NotionalLever string `json:"notionalLever"` OrdFrozen string `json:"ordFrozen"` Upl string `json:"upl"` UplLiab string `json:"uplLiab"` CrossLiab string `json:"crossLiab"` IsoLiab string `json:"isoLiab"` CoinUsdPrice string `json:"coinUsdPrice"` StgyEq string `json:"stgyEq"` SpotInUseAmt string `json:"spotInUseAmt"` IsoUpl string `json:"isoUpl"` }
type AccountEvent ¶ added in v0.1.1
type AccountEvent struct { BaseEvent EventType EventType Arg AccountArg `json:"arg"` Data []AccountData `json:"data"` }
AccountEvent 账户信息
type AccountHandler ¶ added in v0.1.1
type AccountHandler func(event *AccountEvent)
type BalanceAndPositionArg ¶ added in v0.1.1
type BalanceAndPositionData ¶ added in v0.1.1
type BalanceAndPositionEvent ¶ added in v0.1.1
type BalanceAndPositionEvent struct { BaseEvent EventType EventType Arg BalanceAndPositionArg `json:"arg"` Data []BalanceAndPositionData `json:"data"` }
BalanceAndPositionEvent 账户余额和持仓频道数据
type BalanceAndPositionHandler ¶ added in v0.1.1
type BalanceAndPositionHandler func(event *BalanceAndPositionEvent)
type ChannelType ¶
type ChannelType string
type CreateOrder ¶ added in v0.1.1
type CreateOrder struct { Id string `json:"id,omitempty"` Op common.Operate `json:"op,omitempty"` ExpTime string `json:"expTime,omitempty"` Args []*OrderArgs `json:"args,omitempty"` }
CreateOrder 创建订单
func NewBatchOrder ¶ added in v0.1.5
func NewBatchOrder() *CreateOrder
func NewCreateOrder ¶ added in v0.1.1
func NewCreateOrder(op common.Operate) *CreateOrder
func NewOrder ¶ added in v0.1.5
func NewOrder() *CreateOrder
func (*CreateOrder) SetArgs ¶ added in v0.1.1
func (o *CreateOrder) SetArgs(args *OrderArgs) *CreateOrder
func (*CreateOrder) SetExpTime ¶ added in v0.1.1
func (o *CreateOrder) SetExpTime(expTime string) *CreateOrder
func (*CreateOrder) SetId ¶ added in v0.1.1
func (o *CreateOrder) SetId(id string) *CreateOrder
type CreateOrderEvent ¶ added in v0.1.1
type DepthChannel ¶
type DepthChannel string
DepthChannel 深度频道
const ( DepthBooks DepthChannel = "books" DepthBooks5 DepthChannel = "books5" DepthBooks12tbt DepthChannel = "books-12-tbt" DepthBooks5012tbt DepthChannel = "books50-12-tbt" )
type DepthEvent ¶ added in v0.1.1
type DepthEvent struct { BaseEvent Arg Arg `json:"arg"` Action string `json:"action"` Data []Data `json:"data"` }
DepthEvent 深度数据
type Handler ¶ added in v0.1.1
type Handler interface {
// contains filtered or unexported methods
}
type OrderArgs ¶ added in v0.1.1
type OrderArgs struct { Side common.SideType `json:"side,omitempty"` // 订单方向 PosSide common.PosSide `json:"posSide,omitempty"` // 持仓方向 InstID string `json:"instId,omitempty"` TdMode common.TdMode `json:"tdMode,omitempty"` OrdType common.OrderType `json:"ordType,omitempty"` Sz string `json:"sz,omitempty"` Ccy string `json:"ccy,omitempty"` ClOrdID string `json:"clOrdId,omitempty"` Tag string `json:"tag,omitempty"` Px string `json:"px,omitempty"` ReduceOnly string `json:"reduceOnly,omitempty"` TgtCcy string `json:"tgtCcy,omitempty"` BanAmend string `json:"banAmend,omitempty"` }
func NewOrderArgs ¶ added in v0.1.1
func NewOrderArgs() *OrderArgs
func (*OrderArgs) SetBanAmend ¶ added in v0.1.1
func (*OrderArgs) SetClOrdID ¶ added in v0.1.1
func (*OrderArgs) SetOrdType ¶ added in v0.1.1
func (*OrderArgs) SetPosSide ¶ added in v0.1.1
func (*OrderArgs) SetReduceOnly ¶ added in v0.1.1
type OrdersData ¶ added in v0.1.1
type OrdersData struct { AccFillSz string `json:"accFillSz"` AmendResult string `json:"amendResult"` AvgPx string `json:"avgPx"` CTime string `json:"cTime"` Category string `json:"category"` Ccy string `json:"ccy"` ClOrdID string `json:"clOrdId"` Code string `json:"code"` ExecType string `json:"execType"` Fee string `json:"fee"` FeeCcy string `json:"feeCcy"` FillFee string `json:"fillFee"` FillFeeCcy string `json:"fillFeeCcy"` FillNotionalUsd string `json:"fillNotionalUsd"` FillPx string `json:"fillPx"` FillSz string `json:"fillSz"` FillTime string `json:"fillTime"` InstID string `json:"instId"` InstType string `json:"instType"` Lever string `json:"lever"` Msg string `json:"msg"` NotionalUsd string `json:"notionalUsd"` OrdID string `json:"ordId"` OrdType string `json:"ordType"` Pnl string `json:"pnl"` PosSide string `json:"posSide"` Px string `json:"px"` Rebate string `json:"rebate"` RebateCcy string `json:"rebateCcy"` ReduceOnly string `json:"reduceOnly"` ReqID string `json:"reqId"` Side string `json:"side"` SlOrdPx string `json:"slOrdPx"` SlTriggerPx string `json:"slTriggerPx"` SlTriggerPxType string `json:"slTriggerPxType"` Source string `json:"source"` State string `json:"state"` Sz string `json:"sz"` Tag string `json:"tag"` TdMode string `json:"tdMode"` TgtCcy string `json:"tgtCcy"` TpOrdPx string `json:"tpOrdPx"` TpTriggerPx string `json:"tpTriggerPx"` TpTriggerPxType string `json:"tpTriggerPxType"` TradeID string `json:"tradeId"` UTime string `json:"uTime"` }
type OrdersEvent ¶ added in v0.1.1
type OrdersEvent struct { BaseEvent EventType EventType Arg OrdersArg `json:"arg"` Data []OrdersData `json:"data"` }
OrdersEvent 订单信息
type OrdersHandler ¶ added in v0.1.1
type OrdersHandler func(event *OrdersEvent)
type PosData ¶ added in v0.1.1
type PosData struct { PosID string `json:"posId"` TradeID string `json:"tradeId"` InstID string `json:"instId"` InstType string `json:"instType"` MgnMode string `json:"mgnMode"` PosSide string `json:"posSide"` Pos string `json:"pos"` Ccy string `json:"ccy"` PosCcy string `json:"posCcy"` AvgPx string `json:"avgPx"` UTime string `json:"uTime"` }
type PositionsArg ¶ added in v0.1.1
type PositionsData ¶ added in v0.1.1
type PositionsData struct { Adl string `json:"adl"` AvailPos string `json:"availPos"` AvgPx string `json:"avgPx"` CTime string `json:"cTime"` Ccy string `json:"ccy"` DeltaBS string `json:"deltaBS"` DeltaPA string `json:"deltaPA"` GammaBS string `json:"gammaBS"` GammaPA string `json:"gammaPA"` Imr string `json:"imr"` InstID string `json:"instId"` InstType string `json:"instType"` Interest string `json:"interest"` Last string `json:"last"` Lever string `json:"lever"` Liab string `json:"liab"` LiabCcy string `json:"liabCcy"` LiqPx string `json:"liqPx"` MarkPx string `json:"markPx"` Margin string `json:"margin"` MgnMode string `json:"mgnMode"` MgnRatio string `json:"mgnRatio"` Mmr string `json:"mmr"` NotionalUsd string `json:"notionalUsd"` OptVal string `json:"optVal"` PTime string `json:"pTime"` Pos string `json:"pos"` PosCcy string `json:"posCcy"` PosID string `json:"posId"` PosSide string `json:"posSide"` SpotInUseAmt string `json:"spotInUseAmt"` SpotInUseCcy string `json:"spotInUseCcy"` ThetaBS string `json:"thetaBS"` ThetaPA string `json:"thetaPA"` TradeID string `json:"tradeId"` UTime string `json:"uTime"` Upl string `json:"upl"` UplRatio string `json:"uplRatio"` VegaBS string `json:"vegaBS"` VegaPA string `json:"vegaPA"` }
type PositionsEvent ¶ added in v0.1.1
type PositionsEvent struct { BaseEvent EventType EventType Arg PositionsArg `json:"arg"` Data []PositionsData `json:"data"` }
PositionsEvent 持仓信息
type PositionsHandler ¶ added in v0.1.1
type PositionsHandler func(event *PositionsEvent)
type WebsocketTrade ¶ added in v0.1.1
type WebsocketTrade struct { Handler Handler // contains filtered or unexported fields }
func NewWebsocketTrade ¶ added in v0.1.1
func NewWebsocketTrade(conf *okex.Config, errHandler ErrHandler) (w *WebsocketTrade)
func (*WebsocketTrade) Dail ¶ added in v0.1.1
func (w *WebsocketTrade) Dail() (doneC, stopC chan struct{})
func (*WebsocketTrade) Order ¶ added in v0.1.1
func (w *WebsocketTrade) Order(param *CreateOrder) (event CreateOrderEvent, err error)
Click to show internal directories.
Click to hide internal directories.