entities

package
v0.0.0-...-f05cc18 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToAccountModels

func ToAccountModels(balances []Balance) map[string]account.Account

func ToOrderModels

func ToOrderModels(orders []Order) ([]order.Order, error)

func ToTickSubscriptionModels

func ToTickSubscriptionModels(entities []TickSubscription) []event.TickSubscription

Types

type Backtest

type Backtest struct {
	ID                  string             `bson:"_id"`
	StartTime           time.Time          `bson:"start_time"`
	CurrentTime         time.Time          `bson:"current_time"`
	CurrentPriceType    string             `bson:"current_price_type"`
	EndTime             time.Time          `bson:"end_time"`
	PeriodBetweenEvents string             `bson:"period_between_events"`
	Balances            []Balance          `bson:"balances"`
	Orders              []Order            `bson:"orders"`
	TickSubscriptions   []TickSubscription `bson:"tick_subscriptions"`
}

func FromBacktestModel

func FromBacktestModel(bt backtest.Backtest) Backtest

func (Backtest) ToModel

func (bt Backtest) ToModel() (backtest.Backtest, error)

type Balance

type Balance struct {
	AssetName string  `bson:"asset_name"`
	Exchange  string  `bson:"exchange"`
	Balance   float64 `bson:"balance"`
}

func FromAccountModels

func FromAccountModels(accounts map[string]account.Account) []Balance

type Order

type Order struct {
	ID            string     `bson:"id"`
	ExecutionTime *time.Time `bson:"execution_time"`
	Type          string     `bson:"type"`
	Exchange      string     `bson:"exchange"`
	Pair          string     `bson:"pair"`
	Side          string     `bson:"side"`
	Quantity      float64    `bson:"quantity"`
	Price         float64    `bson:"price"`
}

func FromOrderModel

func FromOrderModel(m order.Order) Order

func FromOrderModels

func FromOrderModels(models []order.Order) []Order

func (Order) ToModel

func (o Order) ToModel() (order.Order, error)

type TickSubscription

type TickSubscription struct {
	Exchange string `bson:"exchange"`
	Pair     string `bson:"pair"`
}

func FromTickSubscriptionModel

func FromTickSubscriptionModel(m event.TickSubscription) TickSubscription

func FromTickSubscriptionModels

func FromTickSubscriptionModels(models []event.TickSubscription) []TickSubscription

func (TickSubscription) ToModel

Jump to

Keyboard shortcuts

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