Documentation ¶
Index ¶
Constants ¶
View Source
const ( Add opType = iota + 1 Delete )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CancelResp ¶
type DepthHandler ¶
type DepthHandler struct { ChangedPosition chan DepthData // contains filtered or unexported fields }
func NewDepthHandler ¶
func NewDepthHandler(version int64, c *config.Config, proxyClient ws.ProxyClient) *DepthHandler
type DepthPosition ¶
type MatchEngine ¶
type MatchEngine struct {
// contains filtered or unexported fields
}
MatchEngine 撮合引擎
func NewMatchEngine ¶
func NewMatchEngine(c *config.Config, producer pulsar.Producer, proxyClient ws.ProxyClient) *MatchEngine
func (*MatchEngine) GetDepth ¶
func (m *MatchEngine) GetDepth(level int32) DepthData
func (*MatchEngine) HandleOrder ¶
func (m *MatchEngine) HandleOrder(order *Order)
func (*MatchEngine) SendMatchResult ¶
func (m *MatchEngine) SendMatchResult(matchResult *MatchResult)
SendMatchResult 发送撮合结果,这个操作不异步。
type MatchResult ¶
type MatchResult struct { //每一次匹配的结构 MatchedRecords []*MatchedRecord //本次撮合的id MatchID string CancelResp *CancelResp //撮合时间 MatchTime int64 //taker为买单 TakerIsBuy bool }
type MatchedRecord ¶
type MatchedRecord struct { Price decimal.Decimal Qty decimal.Decimal Amount decimal.Decimal MatchedRecordID string //最新的taker订单的状态 Taker Order //最新的maker订单的状态 Maker Order }
MatchedRecord 一次撮合匹配的结果,一次撮合会多次匹配
type Order ¶
type Order struct { OrderID string SequenceId int64 CreateTime int64 IsCancel bool Uid int64 //用户id Price decimal.Decimal //价格 Qty decimal.Decimal //数量 市价单位零 OrderType enum.OrderType //订单类型 市价单 限价单 Amount decimal.Decimal //金额 Side enum.Side //方向 OrderStatus enum.OrderStatus //订单状态 UnfilledQty decimal.Decimal //未成交数量 FilledQty decimal.Decimal //已成交数量 UnfilledAmount decimal.Decimal //未成交金额 FilledAmount decimal.Decimal //成交金额 }
Order 订单
type OrderBook ¶
type OrderBook struct {
// contains filtered or unexported fields
}
OrderBook 订单簿
func NewOrderBook ¶
func (*OrderBook) PriceComparator ¶
Click to show internal directories.
Click to hide internal directories.