Documentation ¶
Index ¶
- type App
- func (a *App) DecideToBuy(price float32, currentTime time.Time) error
- func (a *App) DecideToSell(price float32, currentTime time.Time) error
- func (a *App) FetchAssets() (*[]domain.Asset, error)
- func (a *App) GetAccountAmount() (float32, error)
- func (a *App) GetState() interface{}
- func (a *App) OnNewAssetPrice(ohlc *domain.OHLC)
- func (a *App) RegistOnNewAssetPrice(observable domain.OnNewAssetPrice)
- func (a *App) SetEventsLog(eventsLog domain.EventsLog)
- func (a *App) Start()
- func (a *App) Stop()
- type Repository
- func (r *Repository) Create(asset string, options domain.ApplicationOptions, accountID primitive.ObjectID) (*domain.Application, error)
- func (r *Repository) DeleteByID(id string) error
- func (r *Repository) FindAll() (*[]domain.Application, error)
- func (r *Repository) FindByID(id string) (*domain.Application, error)
- type Service
- func (a *Service) DeleteByID(id string) error
- func (a *Service) FindAll() (*[]domain.Application, error)
- func (a *Service) GetLastState(appID primitive.ObjectID) (*domain.ApplicationExecutionState, error)
- func (a *Service) GetLogEvents(appID primitive.ObjectID) (*[]domain.EventLog, error)
- func (a *Service) GetStateAggregated(appID string, startDate, endDate time.Time) (*[]bson.M, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { Asset string // contains filtered or unexported fields }
App holds instances of each application dependency and executes program
func NewApp ¶
func NewApp( collectors *[]domain.Collector, decisionMaker domain.DecisionMaker, trader domain.Trader, accountService domain.AccountService, ) *App
NewApp returns an instance of App
func (*App) DecideToBuy ¶
DecideToBuy do operations to check if an asset should be bought
func (*App) DecideToSell ¶
DecideToSell do operations to check if an asset should be sold
func (*App) FetchAssets ¶
FetchAssets returns all assets
func (*App) GetAccountAmount ¶
GetAccountAmount returns the account service amount
func (*App) OnNewAssetPrice ¶
OnNewAssetPrice do operations based on asset new price
func (*App) RegistOnNewAssetPrice ¶
func (a *App) RegistOnNewAssetPrice(observable domain.OnNewAssetPrice)
RegistOnNewAssetPrice executes function when the collector receives a change
func (*App) SetEventsLog ¶
SetEventsLog sets events logs repository
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository stores and gets applications from database
func NewRepository ¶
func NewRepository(repo domain.Repository) *Repository
NewRepository returns an instance of applications repository
func (*Repository) Create ¶
func (r *Repository) Create(asset string, options domain.ApplicationOptions, accountID primitive.ObjectID) (*domain.Application, error)
Create creates an application object
func (*Repository) DeleteByID ¶
func (r *Repository) DeleteByID(id string) error
DeleteByID deletes an application with the id passed by argument
func (*Repository) FindAll ¶
func (r *Repository) FindAll() (*[]domain.Application, error)
FindAll returns all applications
func (*Repository) FindByID ¶
func (r *Repository) FindByID(id string) (*domain.Application, error)
FindByID returns an application with the id
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service interacts with applications, log events and application state repositories
func NewService ¶
func NewService( repo *Repository, stateRepo domain.ApplicationExecutionStateRepository, eventsLogRepo domain.EventsLog, notificationsRepo domain.NotificationsRepository) *Service
NewService returns an instance of applications service
func (*Service) DeleteByID ¶
DeleteByID deletes the application with the id passed by argument
func (*Service) FindAll ¶
func (a *Service) FindAll() (*[]domain.Application, error)
FindAll returns all applications in the repository
func (*Service) GetLastState ¶
GetLastState returns the last application state
func (*Service) GetLogEvents ¶
GetLogEvents returns all log events generated by a application