matcher

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor struct {
	EtcdClient *clientv3.Client
}

func NewExecutor

func NewExecutor() *Executor

func (*Executor) NewTrade

func (e *Executor) NewTrade(initiator *model.Order, completion *model.Order, price decimal.Decimal, quantity decimal.Decimal) error

type Level

type Level struct {
	Price decimal.Decimal `json:"price"`
	Order []*model.Order  `json:"orders"`
}

type LevelHeap

type LevelHeap []Level

func (LevelHeap) Len

func (h LevelHeap) Len() int

func (LevelHeap) Less

func (h LevelHeap) Less(i, j int) bool

func (*LevelHeap) Peek

func (h *LevelHeap) Peek() *Level

Peek returns the peek of the heap.

func (*LevelHeap) Pop

func (h *LevelHeap) Pop() interface{}

func (*LevelHeap) Push

func (h *LevelHeap) Push(x interface{})

func (*LevelHeap) Remove

func (h *LevelHeap) Remove(o model.Order) error

func (LevelHeap) Swap

func (h LevelHeap) Swap(i, j int)

type MarketData

type MarketData struct {
	Executor *Executor
	// contains filtered or unexported fields
}

func NewMarketData

func NewMarketData(futuresID string) *MarketData

func (*MarketData) BroadcastOrderBook

func (m *MarketData) BroadcastOrderBook()

func (*MarketData) NewCancelOrder

func (m *MarketData) NewCancelOrder(o model.Order)

NewCancelOrder cancels a specific order.

func (*MarketData) NewLimitOrder

func (m *MarketData) NewLimitOrder(order model.Order)

NewLimitOrder creates a new limit order.

func (*MarketData) NewMarketOrder

func (m *MarketData) NewMarketOrder(order model.Order)

NewMarketOrder creates a new marker order.

func (*MarketData) NewStopOrder

func (m *MarketData) NewStopOrder(order model.Order)

NewStopOrder creates a new stop order.

func (*MarketData) TriggerStopOrder

func (m *MarketData) TriggerStopOrder(prev decimal.Decimal, current decimal.Decimal)

type MatchHandler

type MatchHandler struct {
	*Matcher
}

func (*MatchHandler) HandleMessage

func (h *MatchHandler) HandleMessage(m *nsq.Message) error

type Matcher

type Matcher struct {
	*nsq.Consumer
	MarketDataMap map[string]*MarketData
}

func NewMatcher

func NewMatcher() *Matcher

type MaxHeap

type MaxHeap struct {
	LevelHeap
}

MaxHeap defines a max heap.

func NewMaxHeap

func NewMaxHeap() *MaxHeap

func (MaxHeap) Less

func (h MaxHeap) Less(i, j int) bool

type MinHeap

type MinHeap struct {
	LevelHeap
}

MinHeap defines a min heap.

func NewMinHeap

func NewMinHeap() *MinHeap

func (MinHeap) Less

func (h MinHeap) Less(i, j int) bool

Jump to

Keyboard shortcuts

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