Skip to content

Latest commit

 

History

History
67 lines (45 loc) · 1.88 KB

strategy.md

File metadata and controls

67 lines (45 loc) · 1.88 KB

Strategies

The strategies are where the results from one or more indicators gets combined to produce a recommended action.

The information provided on this project is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.

Asset

The stragies operates on an Asset with the following members.

type Asset struct {
	Date    []time.Time
	Opening []float64
	Closing []float64
	High    []float64
	Low     []float64
	Volume  []int64
}

Strategy Function

The StrategyFunction takes an Asset, and provides an array of Action for each row.

// Strategy function.
type StrategyFunction func(Asset) []Action

Action

The following Action values are currently provided.

type Action int

const (
	SELL Action = -1
	HOLD Action = 0
	BUY  Action = 1
)

Buy and Hold Strategy

The BuyAndHoldStrategy provides a simple strategy to buy the given asset and hold it. It provides a good indicator for the change of asset's value without any other strategy is used.

actions := indicator.BuyAndHoldStrategy(asset)

Disclaimer

The information provided on this project is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.

License

Copyright (c) 2021 Onur Cinar. All Rights Reserved.

The source code is provided under MIT License.