strategy

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2017 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Basic

type Basic struct {
}

Basic is a basic test strategy, which interprets every DataEvent as a signal to buy

func (*Basic) CalculateSignal

func (s *Basic) CalculateSignal(e bt.DataEventHandler, data bt.DataHandler, p bt.PortfolioHandler) (bt.SignalEvent, error)

CalculateSignal handles the single Event

type BuyAndHold

type BuyAndHold struct {
}

BuyAndHold is a basic test strategy, which interprets the first DataEvent on a symbal as a signal to buy if the portfolio is not already invested.

func (*BuyAndHold) CalculateSignal

func (s *BuyAndHold) CalculateSignal(e bt.DataEventHandler, data bt.DataHandler, p bt.PortfolioHandler) (bt.SignalEvent, error)

CalculateSignal handles the single Event

type MovingAverageCross added in v0.2.1

type MovingAverageCross struct {
	ShortWindow int
	LongWindow  int
}

MovingAverageCross is a test strategy, which interprets the SMA on a series of data events specified by ShortWindow (SW) and LongWindow (LW). If SW bigger tha LW and there is not already an invested BOT position, the strategy creates a buy signal. If SW falls below LW and there is an invested BOT position, the strategy creates an exit signal.

func (*MovingAverageCross) CalculateSignal added in v0.2.1

CalculateSignal handles the single Event

Jump to

Keyboard shortcuts

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