Documentation
¶
Index ¶
- func ToAccountModels(balances []Balance) map[string]account.Account
- func ToOrderModels(orders []Order) ([]order.Order, error)
- func ToTickSubscriptionModels(entities []TickSubscription) []tick.Subscription
- type Backtest
- type BacktestData
- type Balance
- type CallbackWorkflow
- type Callbacks
- type Order
- type Parameters
- type TickSubscription
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToAccountModels ¶
ToAccountModels transforms account entities to account models.
func ToOrderModels ¶
ToOrderModels converts a slice of entities to a slice of models.
func ToTickSubscriptionModels ¶
func ToTickSubscriptionModels(entities []TickSubscription) []tick.Subscription
ToTickSubscriptionModels converts a slice of entities to a slice of models.
Types ¶
type Backtest ¶
Backtest is the entity for a backtest.
func FromBacktestModel ¶
FromBacktestModel converts a model into an entity.
type BacktestData ¶
type BacktestData struct {
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
Mode string `json:"mode"`
PricePeriod string `json:"price_period"`
CurrentTime time.Time `json:"current_time"`
CurrentPriceType string `json:"current_price_type"`
Balances []Balance `json:"balances"`
Orders []Order `json:"orders"`
TickSubscriptions []TickSubscription `json:"tick_subscriptions"`
Callbacks Callbacks `json:"callbacks"`
}
BacktestData is the entity for the backtest data.
type Balance ¶
type Balance struct {
AssetName string `json:"asset_name"`
Exchange string `json:"exchange"`
Balance float64 `json:"balance"`
}
Balance is the entity for a balance.
type CallbackWorkflow ¶ added in v1.1.1
type CallbackWorkflow struct {
Name string `json:"name"`
TaskQueueName string `json:"task_queue_name"`
ExecutionTimeout time.Duration `json:"execution_timeout"`
}
CallbackWorkflow is the entity for a callback workflow.
func FromCallbackWorkflowModel ¶ added in v1.1.1
func FromCallbackWorkflowModel(cw runtime.CallbackWorkflow) CallbackWorkflow
FromCallbackWorkflowModel converts a runtime.CallbackWorkflow model to a CallbackWorkflow entity.
func (CallbackWorkflow) ToCallbackWorkflowModel ¶ added in v1.1.1
func (cw CallbackWorkflow) ToCallbackWorkflowModel() runtime.CallbackWorkflow
ToCallbackWorkflowModel converts a CallbackWorkflow entity to a runtime.CallbackWorkflow model.
type Callbacks ¶ added in v1.1.1
type Callbacks struct {
OnInitCallback CallbackWorkflow `json:"on_init_callback"`
OnNewPricesCallback CallbackWorkflow `json:"on_new_prices_callback"`
OnExitCallback CallbackWorkflow `json:"on_exit_callback"`
}
Callbacks is the entity for callbacks.
func FromCallbacksModel ¶ added in v1.1.1
FromCallbacksModel converts a runtime.Callbacks model to a Callbacks entity.
func (Callbacks) ToCallbacksModel ¶ added in v1.1.1
ToCallbacksModel converts a Callbacks entity to a runtime.Callbacks model.
type Order ¶
type Order struct {
ID string `json:"id"`
ExecutionTime *time.Time `json:"execution_time"`
Type string `json:"type"`
Exchange string `json:"exchange"`
Pair string `json:"pair"`
Side string `json:"side"`
Quantity float64 `json:"quantity"`
Price float64 `json:"price"`
}
Order is the entity for an order.
func FromOrderModel ¶
FromOrderModel converts a model into an entity.
func FromOrderModels ¶
FromOrderModels converts a slice of models into a slice of entities.
type Parameters ¶
type Parameters struct {
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
Mode string `json:"mode"`
PricePeriod string `json:"price_period"`
}
Parameters is the entity for the parameters of a backtest.
type TickSubscription ¶
TickSubscription is the entity for a tick subscription.
func FromTickSubscriptionModel ¶
func FromTickSubscriptionModel(m tick.Subscription) TickSubscription
FromTickSubscriptionModel converts a model to an entity.
func FromTickSubscriptionModels ¶
func FromTickSubscriptionModels(models []tick.Subscription) []TickSubscription
FromTickSubscriptionModels converts a slice of models to a slice of entities.
func (TickSubscription) ToModel ¶
func (ts TickSubscription) ToModel() tick.Subscription
ToModel converts the entity to a model.