level3

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Order

type Order struct {
	OrderId string
	Side    string
	Price   decimal.Decimal
	Size    decimal.Decimal
	Time    uint64
	Info    interface{}
}

func NewOrder

func NewOrder(orderId string, side string, price string, size string, time uint64, info interface{}) (order *Order, err error)

type OrderBook

type OrderBook struct {
	Sequence  uint64             //Sequence || UpdateID
	Asks      *skiplist.SkipList //ask 是 要价,喊价 卖家 卖单 Sort price from low to high
	Bids      *skiplist.SkipList //bid 是 投标,买家 买单 Sort price from high to low
	OrderPool map[string]*Order
}

func NewOrderBook

func NewOrderBook() *OrderBook

func (*OrderBook) AddOrder

func (ob *OrderBook) AddOrder(order *Order) error

open 事件

func (*OrderBook) ChangeOrder

func (ob *OrderBook) ChangeOrder(orderId string, size decimal.Decimal) error

替换, change 事件

func (*OrderBook) GetOrder

func (ob *OrderBook) GetOrder(orderId string) *Order

func (*OrderBook) GetPartOrderBookBySide

func (ob *OrderBook) GetPartOrderBookBySide(side string, number int) [][3]string

func (*OrderBook) MarshalJSON

func (ob *OrderBook) MarshalJSON() ([]byte, error)

func (*OrderBook) MatchOrder

func (ob *OrderBook) MatchOrder(orderId string, size decimal.Decimal) error

更新, match 事件

func (*OrderBook) RemoveByOrderId

func (ob *OrderBook) RemoveByOrderId(orderId string) error

done 事件

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL