dca

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: AGPL-3.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ID = "dca"

Variables

This section is empty.

Functions

This section is empty.

Types

type BudgetPeriod

type BudgetPeriod string
const (
	BudgetPeriodDay   BudgetPeriod = "day"
	BudgetPeriodWeek  BudgetPeriod = "week"
	BudgetPeriodMonth BudgetPeriod = "month"
)

func (BudgetPeriod) Duration

func (b BudgetPeriod) Duration() time.Duration

type Strategy

type Strategy struct {
	Environment *bbgo.Environment
	Symbol      string `json:"symbol"`
	Market      types.Market

	// BudgetPeriod is how long your budget quota will be reset.
	// day, week, month
	BudgetPeriod BudgetPeriod `json:"budgetPeriod"`

	// Budget is the amount you invest per budget period
	Budget fixedpoint.Value `json:"budget"`

	// InvestmentInterval is the interval of each investment
	InvestmentInterval types.Interval `json:"investmentInterval"`

	Position              *types.Position    `persistence:"position"`
	ProfitStats           *types.ProfitStats `persistence:"profit_stats"`
	BudgetQuota           fixedpoint.Value   `persistence:"budget_quota"`
	BudgetPeriodStartTime time.Time          `persistence:"budget_period_start_time"`

	bbgo.StrategyController
	// contains filtered or unexported fields
}

Strategy is the Dollar-Cost-Average strategy

func (*Strategy) ClosePosition

func (s *Strategy) ClosePosition(ctx context.Context, percentage fixedpoint.Value) error

func (*Strategy) ID

func (s *Strategy) ID() string

func (*Strategy) InstanceID

func (s *Strategy) InstanceID() string

func (*Strategy) Run

func (*Strategy) Subscribe

func (s *Strategy) Subscribe(session *bbgo.ExchangeSession)

Jump to

Keyboard shortcuts

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