strategy

package
v0.0.0-...-66ed2bb Latest Latest
Warning

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

Go to latest
Published: May 5, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var START_VALUE float64 = 1000

START_VALUE is how much money the strategy starts with when tracking trades

Functions

func CalculateDailyPortfolioValues

func CalculateDailyPortfolioValues(outcomes *StrategyOutcomes, pricesPtr *[]metric.Metric) *[]float64

Types

type Position

type Position struct {
	Date       time.Time `json:"date"`
	NumUnits   float64   `json:"numUnits"`
	Cash       float64   `json:"cash"`
	LastAction string    `json:"lastAction"`
}

type StrategyOutcomes

type StrategyOutcomes struct {
	PurchaseDates []time.Time       `json:"purchaseDates"`
	SellDates     []time.Time       `json:"sellDates"`
	FinalValue    float64           `json:"finalValue"`
	Positions     []Position        `json:"positions"`
	Settings      map[string]string `json:"settings"`
}

func RunBuyAndHold

func RunBuyAndHold(firstAllowedBuyDate time.Time, pricesPtr *[]metric.Metric) *StrategyOutcomes

func RunMovingAverageCrossover

func RunMovingAverageCrossover(fastAvgPeriod int, slowAvgPeriod int, firstAllowedBuyDate time.Time, pricesPtr *[]metric.Metric) *StrategyOutcomes

Jump to

Keyboard shortcuts

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