client

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedMode = errors.New("unsupported mode")
)

Functions

This section is empty.

Types

type Backtest

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

func NewBacktest

func NewBacktest(
	ctx context.Context,
	services Services,
	parameters backtests.BacktestCreationPayload,
	bot Bot,
) (*Backtest, error)

func (*Backtest) Run

func (b *Backtest) Run(ctx context.Context) error

type Bot

type Bot interface {
	OnInit(ctx context.Context, run *Run)
	OnTick(ctx context.Context, t tick.Tick) error
	OnExit(ctx context.Context) error

	TicksToListen(ctx context.Context) []event.PricesSubscription
}

type ForwardTest

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

func NewForwardTest

func NewForwardTest(
	ctx context.Context,
	services Services,
	parameters forwardtest.NewPayload,
	bot Bot,
) (*ForwardTest, error)

func (*ForwardTest) Run

func (ft *ForwardTest) Run(ctx context.Context) error

type Mode

type Mode string
const (
	ModeIsBacktest    Mode = "backtest"
	ModeIsForwardTest Mode = "forwardtest"
	ModeIsLive        Mode = "live"
)

func (Mode) IsValid

func (m Mode) IsValid() bool

func (Mode) String

func (m Mode) String() string

type Run

type Run struct {
	ID       uuid.UUID
	Mode     Mode
	Services Services
	Time     time.Time
}

func (Run) CreateOrder

func (r Run) CreateOrder(ctx context.Context, payload client.OrderCreationPayload) error

func (Run) GetAccounts

func (r Run) GetAccounts(ctx context.Context) (map[string]account.Account, error)

type Services

type Services struct {
	Backtests    backtests.Client
	Candlesticks candlesticks.Client
	Exchanges    exchanges.Client
	Forwardtests forwardtests.Client
	Indicators   indicators.Client
	Ticks        ticks.Client
}

func NewServices

func NewServices(c config.NATS) (svc Services, err error)

func (*Services) Close

func (c *Services) Close(ctx context.Context)

func (Services) ServicesInfo

func (c Services) ServicesInfo(ctx context.Context) (servicesInfo map[string]client.ServiceInfo, err error)

Jump to

Keyboard shortcuts

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