filter

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyFrom       = errors.New("strategy not found")
	ErrMalformedWhere  = errors.New("where clauses must take the form [OP].[value]")
	ErrUnknownOperator = errors.New("unknown operator")
)

Functions

func BuildQuery

func BuildQuery(from string, fields []string, safeFields []string, where map[string]string, order string) (string, []interface{}, error)

Types

type Database

type Database struct {
	PortfolioID string
	UserID      string
}

func (*Database) GetHoldings

func (f *Database) GetHoldings(frequency dataframe.Frequency, since time.Time) ([]byte, error)

func (*Database) GetMeasurements

func (f *Database) GetMeasurements(field1 string, field2 string, since time.Time) ([]byte, error)

func (*Database) GetTransactions

func (f *Database) GetTransactions(since time.Time) ([]byte, error)

type Filterable

type Filterable interface {
	GetMeasurements(field1 string, field2 string, since time.Time) ([]byte, error)
	GetHoldings(frequency dataframe.Frequency, since time.Time) ([]byte, error)
	GetTransactions(since time.Time) ([]byte, error)
}

func New

func New(portfolioID string, userID string) Filterable

type InMemory

type InMemory struct {
	Portfolio   *portfolio.Portfolio
	Performance *portfolio.Performance
}

func (*InMemory) GetHoldings

func (f *InMemory) GetHoldings(frequency dataframe.Frequency, since time.Time) ([]byte, error)

GetHoldings returns holdings at the requested `frequency` after `since`

func (*InMemory) GetMeasurements

func (f *InMemory) GetMeasurements(field1 string, field2 string, since time.Time) ([]byte, error)

func (*InMemory) GetTransactions

func (f *InMemory) GetTransactions(since time.Time) ([]byte, error)

GetTransactions after since

Jump to

Keyboard shortcuts

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