Documentation
¶
Index ¶
- Constants
- type IndexMinPQ
- func (pq *IndexMinPQ) Change(i int, key float64)
- func (pq *IndexMinPQ) Contains(i int) bool
- func (pq *IndexMinPQ) DelTop() int
- func (pq *IndexMinPQ) Delete(i int)
- func (pq *IndexMinPQ) Insert(i int, key float64)
- func (pq *IndexMinPQ) IsEmpty() bool
- func (pq *IndexMinPQ) Size() int
- func (pq *IndexMinPQ) Top() float64
- func (pq *IndexMinPQ) TopIndex() int
- type LimitOrder
- type MinPQ
- type Node
- type Order
- type Orderbook
- func (book *Orderbook) ALength() int
- func (book *Orderbook) Add(price float64, o *Order)
- func (book *Orderbook) BLength() int
- func (book *Orderbook) Cancel(o *Order)
- func (book *Orderbook) ClearAskLimit(price float64)
- func (book *Orderbook) ClearBidLimit(price float64)
- func (book *Orderbook) DeleteAskLimit(price float64)
- func (book *Orderbook) DeleteBidLimit(price float64)
- func (book *Orderbook) GetBestBid() float64
- func (book *Orderbook) GetBestOffer() float64
- func (book *Orderbook) GetVolumeAtAskLimit(price float64) float64
- func (book *Orderbook) GetVolumeAtBidLimit(price float64) float64
- func (book *Orderbook) NewOrder() *Order
- type OrdersQueue
- type Tree
- func (t *Tree) Ceiling(key float64) float64
- func (t *Tree) Contains(key float64) bool
- func (t *Tree) Delete(key float64)
- func (t *Tree) DeleteMax()
- func (t *Tree) DeleteMin()
- func (t *Tree) Floor(key float64) float64
- func (t *Tree) Get(key float64) *LimitOrder
- func (t *Tree) Height() int
- func (t *Tree) IsEmpty() bool
- func (t *Tree) IsRedBlack() bool
- func (t *Tree) Keys(lo, hi float64) []float64
- func (t *Tree) Max() float64
- func (t *Tree) MaxPointer() *Node
- func (t *Tree) MaxValue() *LimitOrder
- func (t *Tree) Min() float64
- func (t *Tree) MinPointer() *Node
- func (t *Tree) MinValue() *LimitOrder
- func (t *Tree) Print()
- func (t *Tree) Put(key float64, value *LimitOrder)
- func (t *Tree) Rank(key float64) int
- func (t *Tree) Select(k int) float64
- func (t *Tree) Size() int
Constants ¶
View Source
const MaxLimitsNum int = 10000
MaxLimitsNum maximum limits per order book side to pre-allocate memory
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IndexMinPQ ¶
type IndexMinPQ struct {
// contains filtered or unexported fields
}
IndexMinPQ Indexed minimum oriented Priority Queue
func NewIndexMinPQ ¶
func NewIndexMinPQ(size int) IndexMinPQ
func (*IndexMinPQ) Change ¶
func (pq *IndexMinPQ) Change(i int, key float64)
func (*IndexMinPQ) Contains ¶
func (pq *IndexMinPQ) Contains(i int) bool
func (*IndexMinPQ) DelTop ¶
func (pq *IndexMinPQ) DelTop() int
DelTop removes minimal element and returns its index
func (*IndexMinPQ) Delete ¶
func (pq *IndexMinPQ) Delete(i int)
func (*IndexMinPQ) Insert ¶
func (pq *IndexMinPQ) Insert(i int, key float64)
func (*IndexMinPQ) IsEmpty ¶
func (pq *IndexMinPQ) IsEmpty() bool
func (*IndexMinPQ) Size ¶
func (pq *IndexMinPQ) Size() int
func (*IndexMinPQ) Top ¶
func (pq *IndexMinPQ) Top() float64
func (*IndexMinPQ) TopIndex ¶
func (pq *IndexMinPQ) TopIndex() int
type LimitOrder ¶
type LimitOrder struct {
Price float64
// contains filtered or unexported fields
}
LimitOrder price orders combined as a FIFO queue
func NewLimitOrder ¶
func NewLimitOrder(price float64) LimitOrder
func (*LimitOrder) Clear ¶
func (lo *LimitOrder) Clear()
func (*LimitOrder) Delete ¶
func (lo *LimitOrder) Delete(o *Order)
func (*LimitOrder) Dequeue ¶
func (lo *LimitOrder) Dequeue() *Order
func (*LimitOrder) Enqueue ¶
func (lo *LimitOrder) Enqueue(o *Order)
func (*LimitOrder) Size ¶
func (lo *LimitOrder) Size() int
func (*LimitOrder) TotalVolume ¶
func (lo *LimitOrder) TotalVolume() float64
type MinPQ ¶
type MinPQ struct {
// contains filtered or unexported fields
}
MinPQ Minimum Oriented Priority Queue
type Node ¶
type Node struct {
Key float64
Value *LimitOrder
Next *Node
Prev *Node
// contains filtered or unexported fields
}
type Orderbook ¶
func NewOrderbook ¶
func NewOrderbook() *Orderbook
func (*Orderbook) ClearAskLimit ¶
func (*Orderbook) ClearBidLimit ¶
func (*Orderbook) DeleteAskLimit ¶
func (*Orderbook) DeleteBidLimit ¶
func (*Orderbook) GetBestBid ¶
func (*Orderbook) GetBestOffer ¶
func (*Orderbook) GetVolumeAtAskLimit ¶
func (*Orderbook) GetVolumeAtBidLimit ¶
type OrdersQueue ¶
type OrdersQueue struct {
// contains filtered or unexported fields
}
OrdersQueue Doubly linked orders queue TODO: this should be compared with ring buffer queue performance
func NewOrdersQueue ¶
func NewOrdersQueue() OrdersQueue
func (*OrdersQueue) Delete ¶
func (q *OrdersQueue) Delete(o *Order)
func (*OrdersQueue) Dequeue ¶
func (q *OrdersQueue) Dequeue() *Order
func (*OrdersQueue) Enqueue ¶
func (q *OrdersQueue) Enqueue(o *Order)
func (*OrdersQueue) IsEmpty ¶
func (q *OrdersQueue) IsEmpty() bool
func (*OrdersQueue) Size ¶
func (q *OrdersQueue) Size() int
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
func (*Tree) Get ¶
func (t *Tree) Get(key float64) *LimitOrder
func (*Tree) IsRedBlack ¶
func (*Tree) MaxPointer ¶
func (*Tree) MaxValue ¶
func (t *Tree) MaxValue() *LimitOrder
func (*Tree) MinPointer ¶
func (*Tree) MinValue ¶
func (t *Tree) MinValue() *LimitOrder
func (*Tree) Put ¶
func (t *Tree) Put(key float64, value *LimitOrder)
Click to show internal directories.
Click to hide internal directories.