order

package
v0.0.0-...-34c3f81 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOrderNotFound    = errors.New("Order not found")
	ErrOrderBookIsEmpty = errors.New("Order Book is empty")
)
View Source
var Orders = cmap.New()

Orders represent Orders

Functions

This section is empty.

Types

type MarketSnapshot

type MarketSnapshot struct {
	Asks   []MarketSnapshotItem `json:"asks,omitempty"`
	Bids   []MarketSnapshotItem `json:"bids,omitempty"`
	Spread float64              `json:"spread"`
}

MarketSnapshot represents Market Data snapshot

func (MarketSnapshot) Sort

func (m MarketSnapshot) Sort()

Sort the Asks and Bids orders

type MarketSnapshotItem

type MarketSnapshotItem struct {
	Price    float64 `json:"price"`
	Quantity int64   `json:"quantity"`
}

MarketSnapshotItem represents item for Market Data snapshot

type Order

type Order struct {
	ID        string  `json:"id,omitempty"`
	UUID      string  `json:"uuid,omitempty"`
	Side      string  `json:"side"`
	Price     float64 `json:"price"`
	Quantity  int     `json:"quantity"`
	Status    string  `json:"status,omitempty"`
	Timestamp int64   `json:"timestamp,omitempty"`
}

Order represents an order

type OrderService

type OrderService interface {
	Create(ctx context.Context, order Order) (string, error)
	GetByID(ctx context.Context, id string) (Order, error)
	RemoveByID(ctx context.Context, id string) error
	GetMarketSnapshot(ctx context.Context) (MarketSnapshot, error)
}

OrderService describes the Order service.

func NewService

func NewService(logger log.Logger) OrderService

NewService creates and returns a new Order service instance

type Prices

type Prices struct {
	AskMinPrice, BidMaxPrice float64
	AskMinID, BidMaxID       string
}

Prices represents the min and max

Jump to

Keyboard shortcuts

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