runtime

package module
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: MIT Imports: 5 Imported by: 16

README

runtime

Cryptellation RunTime Library

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidMode is returned when the mode is invalid.
	ErrInvalidMode = errors.New("invalid mode")
)

Functions

func WithMode

func WithMode(ctx workflow.Context, mode Mode) workflow.Context

WithMode sets the mode in the context.

Types

type CallbackWorkflow added in v1.3.0

type CallbackWorkflow struct {
	Name             string
	TaskQueueName    string
	ExecutionTimeout time.Duration
}

CallbackWorkflow is the parameters of a callback workflow.

type Callbacks added in v1.3.0

type Callbacks struct {
	OnInitCallback      CallbackWorkflow
	OnNewPricesCallback CallbackWorkflow
	OnExitCallback      CallbackWorkflow
}

Callbacks is the struct representing callbacks for ans automation through cryptellation API.

type Mode

type Mode string

Mode is the mode in which a run is executed.

const (
	// ModeBacktest is the backtest mode.
	ModeBacktest Mode = "backtest"
	// ModeForwardtest is the forwardtest mode.
	ModeForwardtest Mode = "forwardtest"
	// ModeLive is the live mode.
	ModeLive Mode = "live"
)

func GetMode

func GetMode(ctx workflow.Context) Mode

GetMode returns the mode from the context.

func (Mode) String

func (m Mode) String() string

String returns the string representation of the mode.

func (Mode) Validate

func (m Mode) Validate() error

Validate validates the mode.

type OnExitCallbackWorkflowParams added in v1.3.0

type OnExitCallbackWorkflowParams struct {
	Run Run
}

OnExitCallbackWorkflowParams is the parameters of the OnExitCallbackWorkflow callback workflow.

type OnInitCallbackWorkflowParams added in v1.3.0

type OnInitCallbackWorkflowParams struct {
	Run Run
}

OnInitCallbackWorkflowParams is the parameters of the OnInitCallbackWorkflow callback workflow.

type OnNewPricesCallbackWorkflowParams added in v1.3.0

type OnNewPricesCallbackWorkflowParams struct {
	Run   Run
	Ticks []tick.Tick
}

OnNewPricesCallbackWorkflowParams is the parameters of the OnNewPricesCallbackWorkflow callback workflow.

type Run added in v1.4.2

type Run struct {
	// ID is the ID of the run that corresponds to a backtest, a forwardtest or a live run.
	ID uuid.UUID
	// Mode is the mode of the run (backtests, forwardtest or live run).
	Mode Mode
	// Now is the time of the run.
	// It is used to simulate the time of the run for backtests.
	// On forwardtests and live runs, it is the current time.
	Now time.Time
	// ParentTaskQueue is the task queue of the parent workflow.
	// It's the one that called the callback.
	ParentTaskQueue string
}

Run is the context of a run that contains several information about the run.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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