test

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: BlueOak-1.0.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComparePrefix

func ComparePrefix(p1, p2 *order.Prefix) error

ComparePrefix compares the prefixes field-by-field and returns an error if a mismatch is found.

func CompareTrade

func CompareTrade(t1, t2 *order.Trade) error

CompareTrade compares the MarketOrders field-by-field and returns an error if a mismatch is found.

func CompareUserMatch

func CompareUserMatch(m1, m2 *order.UserMatch) error

CompareUserMatch compares the UserMatches field-by-field and returns an error if a mismatch is found.

func MustCompareCancelOrders

func MustCompareCancelOrders(t testKiller, c1, c2 *order.CancelOrder)

MustCompareCancelOrders compares the CancelOrders field-by-field and calls the Fatalf method on the supplied testKiller if a mismatch is encountered.

func MustCompareLimitOrders

func MustCompareLimitOrders(t testKiller, l1, l2 *order.LimitOrder)

MustCompareUserMatch compares the LimitOrders field-by-field and calls the Fatalf method on the supplied testKiller if a mismatch is encountered.

func MustCompareMarketOrders

func MustCompareMarketOrders(t testKiller, m1, m2 *order.MarketOrder)

MustCompareMarketOrders compares the MarketOrders field-by-field and calls the Fatalf method on the supplied testKiller if a mismatch is encountered.

func MustCompareOrders

func MustCompareOrders(t testKiller, o1, o2 order.Order)

MustCompareOrders compares the Orders field-by-field and calls the Fatalf method on the supplied testKiller if a mismatch is encountered.

func MustComparePrefix

func MustComparePrefix(t testKiller, p1, p2 *order.Prefix)

MustComparePrefix compares the Prefix field-by-field and calls the Fatalf method on the supplied testKiller if a mismatch is encountered.

func MustCompareTrade

func MustCompareTrade(t testKiller, t1, t2 *order.Trade)

MustCompareTrade compares the MarketOrders field-by-field and calls the Fatalf method on the supplied testKiller if a mismatch is encountered.

func MustCompareUserMatch

func MustCompareUserMatch(t testKiller, m1, m2 *order.UserMatch)

MustCompareUserMatch compares the UserMatches field-by-field and calls the Fatalf method on the supplied testKiller if a mismatch is encountered.

func NextAccount

func NextAccount() account.AccountID

NextAccount gets a unique account ID.

func RandomAddress

func RandomAddress() string

A random base-58 string.

func RandomCancelOrder

func RandomCancelOrder() (*order.CancelOrder, order.Preimage)

RandomCancelOrder creates a random cancel order with a random writer.

func RandomCommitment

func RandomCommitment() (com order.Commitment)

RandomCommitment creates a random order commitment. Use RandomPreimage followed by Preimage.Commit() if you require a matching commitment.

func RandomLimitOrder

func RandomLimitOrder() (*order.LimitOrder, order.Preimage)

RandomLimitOrder creates a random limit order with a random writer.

func RandomMarketOrder

func RandomMarketOrder() (*order.MarketOrder, order.Preimage)

RandomMarketOrder creates a random market order with a random writer.

func RandomMatchID

func RandomMatchID() order.MatchID

RandomMatchID creates a random match ID.

func RandomOrderID

func RandomOrderID() order.OrderID

RandomOrderID creates a random order ID.

func RandomPreimage

func RandomPreimage() (pi order.Preimage)

RandomPreimage creates a random order preimage.

func RandomUserMatch

func RandomUserMatch() *order.UserMatch

RandomUserMatch creates a random UserMatch.

func WriteCancelOrder

func WriteCancelOrder(writer *Writer, targetOrderID order.OrderID, timeOffset int64) (*order.CancelOrder, order.Preimage)

WriteCancelOrder creates a cancel order with the specified order ID.

func WriteLimitOrder

func WriteLimitOrder(writer *Writer, rate, lots uint64, force order.TimeInForce, timeOffset int64) (*order.LimitOrder, order.Preimage)

WriteLimitOrder creates a limit order with the specified writer and order values.

func WriteMarketOrder

func WriteMarketOrder(writer *Writer, lots uint64, timeOffset int64) (*order.MarketOrder, order.Preimage)

WriteMarketOrder creates a market order with the specified writer and quantity.

Types

type Market

type Market struct {
	Base    uint32
	Quote   uint32
	LotSize uint64
}

Market is a exchange market.

type Writer

type Writer struct {
	Addr   string
	Acct   account.AccountID
	Sell   bool
	Market *Market
}

Writer represents a client that places orders on one side of a market.

func RandomWriter

func RandomWriter() *Writer

RandomWriter creates a random Writer.

Jump to

Keyboard shortcuts

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