dca

package
v1.45.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2023 License: AGPL-3.0 Imports: 7 Imported by: 1

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