Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEmptyWorkflowName is returned when the workflow name is empty. ErrEmptyWorkflowName = errors.New("workflow name is empty") // ErrEmptyTaskQueueName is returned when the task queue name is empty. ErrEmptyTaskQueueName = errors.New("task queue name is empty") )
var ( // ErrInvalidMode is returned when the mode is invalid. ErrInvalidMode = errors.New("invalid mode") )
Functions ¶
Types ¶
type CallbackWorkflow ¶ added in v1.3.0
CallbackWorkflow is the parameters of a callback workflow.
func (CallbackWorkflow) Validate ¶ added in v1.5.0
func (cw CallbackWorkflow) Validate() error
Validate validates the 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.
func RegisterRunnable ¶ added in v1.6.0
RegisterRunnable registers a runnable to a worker and returns the callbacks.
type Context ¶
type Context 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
}
Context is the context of a run that contains several information about the run.
type Mode ¶
type Mode string
Mode is the mode in which a run is executed.
type OnExitCallbackWorkflowParams ¶ added in v1.3.0
type OnExitCallbackWorkflowParams struct {
Context Context
}
OnExitCallbackWorkflowParams is the parameters of the OnExitCallbackWorkflow callback workflow.
type OnInitCallbackWorkflowParams ¶ added in v1.3.0
type OnInitCallbackWorkflowParams struct {
Context Context
}
OnInitCallbackWorkflowParams is the parameters of the OnInitCallbackWorkflow callback workflow.
type OnNewPricesCallbackWorkflowParams ¶ added in v1.3.0
OnNewPricesCallbackWorkflowParams is the parameters of the OnNewPricesCallbackWorkflow callback workflow.
type Runnable ¶ added in v1.6.0
type Runnable interface {
Name() string
OnInit(ctx workflow.Context, params OnInitCallbackWorkflowParams) error
OnNewPrices(ctx workflow.Context, params OnNewPricesCallbackWorkflowParams) error
OnExit(ctx workflow.Context, params OnExitCallbackWorkflowParams) error
}
Runnable is the interface for a struct that can be run on Cryptellation.