entities

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromAccountModels

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

FromAccountModels converts a map of account.Account to a map of Account.

func ToAccountModels

func ToAccountModels(accounts map[string]Account) map[string]account.Account

ToAccountModels converts a map of Account to a map of account.Account.

func ToOrderModels

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

ToOrderModels converts a list of Order to a list of order.Order.

Types

type Account

type Account struct {
	Balances map[string]float64 `json:"balances"`
}

Account is the entity for an account.

type Forwardtest

type Forwardtest struct {
	ID        string    `db:"id"`
	UpdatedAt time.Time `db:"updated_at"`
	Data      []byte    `db:"data"`
}

Forwardtest is the entity for a forwardtest.

func FromForwardtestModel

func FromForwardtestModel(ft forwardtest.Forwardtest) (Forwardtest, error)

FromForwardtestModel converts a Forwardtest model to a Forwardtest entity.

func (Forwardtest) ToModel

func (ft Forwardtest) ToModel() (forwardtest.Forwardtest, error)

ToModel converts a Forwardtest entity to a Forwardtest model.

type ForwardtestData

type ForwardtestData struct {
	Accounts map[string]Account `json:"accounts"`
	Orders   []Order            `json:"orders"`
}

ForwardtestData is the data for a forwardtest.

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

func FromOrderModel(m order.Order) Order

FromOrderModel converts an Order model to an entity.

func FromOrderModels

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

FromOrderModels converts a list of order.Order to a list of Order.

func (Order) ToModel

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

ToModel converts an Order to an order.Order.

Jump to

Keyboard shortcuts

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