app

package
v0.0.0-...-f351f3f Latest Latest
Warning

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

Go to latest
Published: May 16, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actions

type Actions struct {
	// contains filtered or unexported fields
}

func GetAppActions

func GetAppActions(storage AppStorage, exchange AppExchange, appLogger domain.LoggerRepo) *Actions

func (Actions) AddExchange

func (a Actions) AddExchange(user domain.User, exchangeNumber int, data []byte) error

func (Actions) AgentCreate

func (a Actions) AgentCreate(user domain.User, strategyId domain.StrategyId, data []byte, exchanges []ExchangeData) (*domain.Agent, error)

func (Actions) AgentSetStatus

func (a Actions) AgentSetStatus(agent *domain.Agent, status domain.AgentStatus) error

func (Actions) AgentUpdateData

func (a Actions) AgentUpdateData(agent *domain.Agent, data []byte) error

func (Actions) FindAgents

func (a Actions) FindAgents(filter AgentFilter) ([]domain.Agent, error)

func (Actions) FindExchanges

func (a Actions) FindExchanges(filter ExchangeFilter) ([]ExchangeData, error)

func (Actions) GetAgentInfo

func (a Actions) GetAgentInfo(agent domain.Agent) *AgentInfo

func (Actions) GetUserAgents

func (a Actions) GetUserAgents(user domain.User) ([]domain.Agent, error)

func (Actions) StartAgents

func (a Actions) StartAgents(ctx context.Context) error

func (Actions) UserGetOrCreate

func (a Actions) UserGetOrCreate(name string, links UserLinks) (*domain.User, error)

type AgentFilter

type AgentFilter struct {
	Id     int64
	Status domain.AgentStatus
	UserId int64
}

type AgentInfo

type AgentInfo struct {
	Name         string
	StrategyName string
	Exchanges    []string
	Parameters   []domain.StrategyParameter
}

type AgentRepo

type AgentRepo struct {
	// contains filtered or unexported fields
}

func (AgentRepo) FindAgents

func (a AgentRepo) FindAgents(active bool) ([]domain.Agent, error)

type AppExchange

type AppExchange interface {
	GetExchangeByJson(exchangeId int, data []byte) domain.Exchange
}

type AppStorage

type AppStorage interface {
	// User
	UserGetOrCreate(links UserLinks) (*domain.User, error)
	// Agent
	FindAgents(filter AgentFilter) ([]domain.Agent, error)
	AgentSave(agent domain.Agent) (*domain.Agent, error)
	AgentSetStatus(agent *domain.Agent, status domain.AgentStatus) error
	AgentUpdateData(agent *domain.Agent, data []byte) error
	//GetStrategyData(agentId string) []byte
	GetAgentStorage(strategyId domain.Agent) interface{}
	GetAgentExchanges(agentId int64) ([]ExchangeData, error)
	FindExchanges(filter ExchangeFilter) ([]ExchangeData, error)
	AddExchange(userId int64, exchangeNumber int, data []byte) error
	AgentAddExchange(agent *domain.Agent, exchanges []ExchangeData) error
}

type ExchangeData

type ExchangeData struct {
	Id   int
	Data []byte
}

type ExchangeFilter

type ExchangeFilter struct {
	UserId         int64
	ExchangeNumber int
}

type ExchangeRepo

type ExchangeRepo struct {
	// contains filtered or unexported fields
}

func (ExchangeRepo) GetAgentExchanges

func (e ExchangeRepo) GetAgentExchanges(agentId int64) ([]domain.Exchange, error)

type StorageRepo

type StorageRepo struct {
	// contains filtered or unexported fields
}

func (StorageRepo) GetAgentStorage

func (s StorageRepo) GetAgentStorage(agent domain.Agent) interface{}
type UserLinks struct {
	Telegram int64 `json:"telegram"`
}

Directories

Path Synopsis
tests/mocks
Package mock_domain is a generated GoMock package.
Package mock_domain is a generated GoMock package.

Jump to

Keyboard shortcuts

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