order

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2025 License: MIT Imports: 3 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidOrderQty is the error for an invalid order quantity.
	ErrInvalidOrderQty = errors.New("invalid-order-quantity")
)
View Source
var (
	// ErrInvalidSide is the error for an invalid order side.
	ErrInvalidSide = errors.New("invalid-order-side")
)
View Source
var (
	// ErrInvalidType is the error for an invalid order type.
	ErrInvalidType = errors.New("invalid-order-type")
)
View Source
var (
	// Sides is the list of all the possible sides for an order.
	Sides = []Side{
		SideIsBuy,
		SideIsSell,
	}
)
View Source
var (
	// Types is the list of order types.
	Types = []Type{
		TypeIsMarket,
	}
)

Functions

This section is empty.

Types

type Order

type Order struct {
	ID            uuid.UUID  `json:"id"`
	ExecutionTime *time.Time `json:"execution_time"`
	Type          Type       `json:"type"`
	Exchange      string     `json:"exchange"`
	Pair          string     `json:"pair"`
	Side          Side       `json:"side"`
	Quantity      float64    `json:"quantity"`
	Price         float64    `json:"price"`
}

Order is the struct for an order.

func (Order) Validate

func (o Order) Validate() error

Validate validates the order.

type Side

type Side string

Side is the side of an order.

const (
	// SideIsBuy is the buy side of an order.
	SideIsBuy Side = "buy"
	// SideIsSell is the sell side of an order.
	SideIsSell Side = "sell"
)

func (Side) String

func (s Side) String() string

String returns the string representation of the order side.

func (Side) Validate

func (s Side) Validate() error

Validate validates the order side.

type Type

type Type string

Type is the order type.

const (
	// TypeIsMarket is the market order type.
	TypeIsMarket Type = "market"
)

func (Type) String

func (t Type) String() string

String returns the string representation of the order type.

func (Type) Validate

func (t Type) Validate() error

Validate validates the order type.

Jump to

Keyboard shortcuts

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