diff --git a/.gomarkdoc.yml b/.gomarkdoc.yml new file mode 100644 index 0000000..aed6898 --- /dev/null +++ b/.gomarkdoc.yml @@ -0,0 +1,4 @@ +excludeDirs: "./cmd/..." +output: "{{.Dir}}/README.md" +repository: + url: https://github.com/cinar/indicator diff --git a/helper/README.md b/helper/README.md index 38c5e7e..42fce4b 100644 --- a/helper/README.md +++ b/helper/README.md @@ -124,6 +124,15 @@ const ( ) ``` + + +```go +const ( + // DefaultReportDateFormat is the default date format used in the report. + DefaultReportDateFormat = "2006-01-02" +) +``` + ## func [Abs]() @@ -1041,7 +1050,7 @@ type Number interface { ``` -## type [Report]() +## type [Report]() Report generates an HTML file containing an interactive chart that visually represents the provided data and annotations. @@ -1049,12 +1058,16 @@ The generated HTML file can be opened in a web browser to explore the data visua ```go type Report struct { - // contains filtered or unexported fields + Title string + Date <-chan time.Time + Columns []ReportColumn + Views [][]int + DateFormat string } ``` -### func [NewReport]() +### func [NewReport]() ```go func NewReport(title string, date <-chan time.Time) *Report @@ -1063,7 +1076,7 @@ func NewReport(title string, date <-chan time.Time) *Report NewReport takes a channel of time as the time axis and returns a new instance of the Report struct. This instance can later be used to add data and annotations and subsequently generate a report. -### func \(\*Report\) [AddChart]() +### func \(\*Report\) [AddChart]() ```go func (r *Report) AddChart() int @@ -1072,7 +1085,7 @@ func (r *Report) AddChart() int AddChart adds a new chart to the report and returns its unique identifier. This identifier can be used later to refer to the chart and add columns to it. -### func \(\*Report\) [AddColumn]() +### func \(\*Report\) [AddColumn]() ```go func (r *Report) AddColumn(column ReportColumn, charts ...int) @@ -1081,7 +1094,7 @@ func (r *Report) AddColumn(column ReportColumn, charts ...int) AddColumn adds a new data column to the specified charts. If no chart is specified, it will be added to the main chart. -### func \(\*Report\) [WriteToFile]() +### func \(\*Report\) [WriteToFile]() ```go func (r *Report) WriteToFile(fileName string) error @@ -1090,7 +1103,7 @@ func (r *Report) WriteToFile(fileName string) error WriteToFile writes the generated report content to a file with the specified name. This allows users to conveniently save the report for later viewing or analysis. -### func \(\*Report\) [WriteToWriter]() +### func \(\*Report\) [WriteToWriter]() ```go func (r *Report) WriteToWriter(writer io.Writer) error @@ -1099,7 +1112,7 @@ func (r *Report) WriteToWriter(writer io.Writer) error WriteToWriter writes the report content to the provided io.Writer. This allows the report to be sent to various destinations, such as a file, a network socket, or even the standard output. -## type [ReportColumn]() +## type [ReportColumn]() ReportColumn defines the interface that all report data columns must implement. This interface ensures that different types of data columns can be used consistently within the report generation process. diff --git a/pre-commit.sh b/pre-commit.sh index 810afb8..5aff12d 100755 --- a/pre-commit.sh +++ b/pre-commit.sh @@ -31,12 +31,7 @@ gosec ./... revive -config=revive.toml ./... staticcheck ./... - -for package in "${PACKAGES[@]}"; -do - echo Package "$package" - gomarkdoc --output "$package"/README.md ./"$package" -done +gomarkdoc ./... markdownfmt -w README.md diff --git a/strategy/README.md b/strategy/README.md index d03f137..b0a9ef0 100644 --- a/strategy/README.md +++ b/strategy/README.md @@ -250,7 +250,7 @@ func (a *AndStrategy) Report(c <-chan *asset.Snapshot) *helper.Report Report processes the provided asset snapshots and generates a report annotated with the recommended actions. -## type [Backtest]() +## type [Backtest]() Backtest function rigorously evaluates the potential performance of the specified strategies applied to a defined set of assets. It generates comprehensive visual representations for each strategy\-asset pairing. @@ -271,12 +271,15 @@ type Backtest struct { // WriteStrategyReports indicates whether the individual strategy reports should be generated. WriteStrategyReports bool + + // DateFormat is the date format that is used in the reports. + DateFormat string // contains filtered or unexported fields } ``` -### func [NewBacktest]() +### func [NewBacktest]() ```go func NewBacktest(repository asset.Repository, outputDir string) *Backtest @@ -285,7 +288,7 @@ func NewBacktest(repository asset.Repository, outputDir string) *Backtest NewBacktest function initializes a new backtest instance. -### func \(\*Backtest\) [Run]() +### func \(\*Backtest\) [Run]() ```go func (b *Backtest) Run() error diff --git a/trend/README.md b/trend/README.md index ea325f9..5a4bd0f 100644 --- a/trend/README.md +++ b/trend/README.md @@ -682,7 +682,7 @@ func (h *Hma[T]) String() string String is the string representation of the HMA. -## type [Kama]() +## type [Kama]() Kama represents the parameters for calculating the Kaufman's Adaptive Moving Average \(KAMA\). It is a type of moving average that adapts to market noise or volatility. It tracks prices closely during periods of small price swings and low noise. @@ -715,7 +715,7 @@ type Kama[T helper.Number] struct { ``` -### func [NewKama]() +### func [NewKama]() ```go func NewKama[T helper.Number]() *Kama[T] @@ -724,7 +724,7 @@ func NewKama[T helper.Number]() *Kama[T] NewKama function initializes a new KAMA instance with the default parameters. -### func [NewKamaWith]() +### func [NewKamaWith]() ```go func NewKamaWith[T helper.Number](erPeriod, fastScPeriod, slowScPeriod int) *Kama[T] @@ -733,7 +733,7 @@ func NewKamaWith[T helper.Number](erPeriod, fastScPeriod, slowScPeriod int) *Kam NewKamaWith function initializes a new KAMA instance with the given parameters. -### func \(\*Kama\[T\]\) [Compute]() +### func \(\*Kama\[T\]\) [Compute]() ```go func (k *Kama[T]) Compute(closings <-chan T) <-chan T @@ -742,7 +742,7 @@ func (k *Kama[T]) Compute(closings <-chan T) <-chan T Compute function takes a channel of numbers and computes the KAMA over the specified period. -### func \(\*Kama\[T\]\) [IdlePeriod]() +### func \(\*Kama\[T\]\) [IdlePeriod]() ```go func (k *Kama[T]) IdlePeriod() int @@ -751,7 +751,7 @@ func (k *Kama[T]) IdlePeriod() int IdlePeriod is the initial period that KAMA yield any results. -### func \(\*Kama\[T\]\) [String]() +### func \(\*Kama\[T\]\) [String]() ```go func (k *Kama[T]) String() string