forwardtest

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEmptyAccounts is returned when the accounts are empty.
	ErrEmptyAccounts = errors.New("empty accounts")
	// ErrInvalidExchange is returned when the exchange is invalid.
	ErrInvalidExchange = errors.New("invalid exchange")
)
View Source
var (
	// ErrInvalidStatus is returned when the status is invalid.
	ErrInvalidStatus = errors.New("invalid status")
)

Functions

This section is empty.

Types

type Forwardtest

type Forwardtest struct {
	ID        uuid.UUID
	UpdatedAt time.Time
	Accounts  map[string]account.Account
	Orders    []order.Order
	Callbacks runtime.Callbacks
	Status    Status
}

Forwardtest is a forwardtest.

func New

func New(params NewForwardtestParams) (Forwardtest, error)

New creates a new forwardtest.

func (*Forwardtest) AddOrder

func (ft *Forwardtest) AddOrder(o order.Order, cs candlestick.Candlestick) error

AddOrder adds an order to the forwardtest.

func (Forwardtest) GetAccountsSymbols

func (ft Forwardtest) GetAccountsSymbols() []string

GetAccountsSymbols returns the list of symbols used in the accounts.

type NewForwardtestParams

type NewForwardtestParams struct {
	Accounts  map[string]account.Account
	Callbacks runtime.Callbacks
}

NewForwardtestParams is the params for the New function.

func (NewForwardtestParams) Validate

func (np NewForwardtestParams) Validate() error

Validate validates the NewParams.

type Status

type Status string

Status represents the status of a forwardtest.

const (
	// StatusReady indicates that the forwardtest is ready to start.
	StatusReady Status = "ready"
	// StatusRunning indicates that the forwardtest is currently running.
	StatusRunning Status = "running"
	// StatusFinished indicates that the forwardtest has finished.
	StatusFinished Status = "finished"
)

func (Status) String added in v1.1.1

func (s Status) String() string

String returns the string representation of the status.

func (Status) Validate added in v1.1.1

func (s Status) Validate() error

Validate checks if the status is valid.

Jump to

Keyboard shortcuts

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