matcher

package
v0.0.0-...-f290d7c Latest Latest
Warning

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

Go to latest
Published: May 25, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package matcher is an engine that receives and matches orders.

Package orderitem contains implementations of btree.Item interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	TradingPair() pb.TradingPair
	OrderBook(snapshotTime time.Time) (*pb.OrderBook, error)
	CreateOrder(order *pb.Order) ([]*pb.TradeEvent, []*pb.OrderBookEvent, error)
}

type Matcher

type Matcher struct {
	// contains filtered or unexported fields
}

func New

func New(tradingPair pb.TradingPair) *Matcher

func (*Matcher) CreateOrder

func (m *Matcher) CreateOrder(order *pb.Order) ([]*pb.TradeEvent, []*pb.OrderBookEvent, error)

CreateOrder submits an order, and gets corresponding trade and order book events.

func (*Matcher) OrderBook

func (m *Matcher) OrderBook(snapshotTime time.Time) (*pb.OrderBook, error)

OrderBook gets the orderbook. This function should be called infrequently to ensure the performance of the matching engine. A separate routine should be used for updating the orderbook by listening to OrderBookEvent. This function should only be served as a periodical check point to ensure the correctness.

func (*Matcher) TradingPair

func (m *Matcher) TradingPair() pb.TradingPair

TradingPair gets the trading pair of the matcher.

Directories

Path Synopsis
Package matcher is a generated protocol buffer package.
Package matcher is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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