report

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 20 Imported by: 0

README

GoCryptoTrader Backtester: Report package

Build Status Software License GoDoc Coverage Status Go Report Card

This report package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progress on this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

Report package overview

The report package helps generates the output under the results folder.

As the application is run, many statistics such as purchase events are tracked. These events are utilised and enhanced in the report package in order to render an HTML report for easy comparison and historical strategy effectiveness.

The report utilises the following sweet technologies:

Output example: example

Please click GoDocs chevron above to view current GoDoc information for this package

Contribution

Please feel free to submit any pull requests or suggest any desired features to be added.

When submitting a PR, please abide by our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Code must adhere to our coding style.
  • Pull requests need to be based on and opened against the master branch.

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chart

type Chart struct {
	AxisType           string
	ShowZeroDisclaimer bool
	Data               []ChartLine
}

Chart holds chart data along with an axis

type ChartLine

type ChartLine struct {
	Name      string
	LinePlots []LinePlot
}

ChartLine holds chart plot data to render charts in the report

type Data

type Data struct {
	OriginalCandles       []*kline.Item
	EnhancedCandles       []EnhancedKline
	Statistics            *statistics.Statistic
	Config                *config.Config
	TemplatePath          string
	OutputPath            string
	Warnings              []Warning
	UseDarkTheme          bool
	USDTotalsChart        *Chart
	HoldingsOverTimeChart *Chart
	PNLOverTimeChart      *Chart
	FuturesSpotDiffChart  *Chart
	Prettify              PrettyNumbers
}

Data holds all statistical information required to output detailed backtesting results

func (*Data) GenerateReport

func (d *Data) GenerateReport() error

GenerateReport sends final data from statistics to a template to create a lovely final report for someone to view

func (*Data) SetKlineData

func (d *Data) SetKlineData(k *kline.Item) error

SetKlineData updates an existing kline item for LIVE data usage

func (*Data) UseDarkMode

func (d *Data) UseDarkMode(use bool)

UseDarkMode sets whether to use a dark theme by default for the html generated report

type DetailedCandle

type DetailedCandle struct {
	UnixMilli      int64
	Open           float64
	High           float64
	Low            float64
	Close          float64
	Volume         float64
	VolumeColour   string
	MadeOrder      bool
	OrderDirection order.Side
	OrderAmount    decimal.Decimal
	Shape          string
	Text           string
	Position       string
	Colour         string
	PurchasePrice  float64
}

DetailedCandle contains extra details to enable rich reporting results

type EnhancedKline

type EnhancedKline struct {
	IsOverLimit bool
	Watermark   string
	Exchange    string
	Asset       asset.Item
	Pair        currency.Pair
	Interval    kline.Interval
	Candles     []DetailedCandle
}

EnhancedKline enhances kline details for the purpose of rich reporting results

type Handler

type Handler interface {
	GenerateReport() error
	SetKlineData(*kline.Item) error
	UseDarkMode(bool)
}

Handler contains all functions required to generate statistical reporting for backtesting results

type LinePlot

type LinePlot struct {
	Value     float64
	UnixMilli int64
	Flag      string
}

LinePlot holds value data for a chart

type PrettyNumbers

type PrettyNumbers struct{}

PrettyNumbers is used for report rendering one cannot access packages when rendering data in a template this struct exists purely to help make numbers look pretty

func (*PrettyNumbers) Decimal2

func (p *PrettyNumbers) Decimal2(d decimal.Decimal) string

Decimal2 renders a decimal nicely with 2 decimal places

func (*PrettyNumbers) Decimal64

func (p *PrettyNumbers) Decimal64(d decimal.Decimal) string

Decimal64 renders a decimal nicely with the idea not to limit decimal places and to make you nostalgic for Nintendo

func (*PrettyNumbers) Decimal8

func (p *PrettyNumbers) Decimal8(d decimal.Decimal) string

Decimal8 renders a decimal nicely with 8 decimal places

func (*PrettyNumbers) Float8

func (p *PrettyNumbers) Float8(f float64) string

Float8 renders a float nicely with 8 decimal places

func (*PrettyNumbers) Int

func (p *PrettyNumbers) Int(i int64) string

Int renders an int nicely

type Warning

type Warning struct {
	Exchange string
	Asset    asset.Item
	Pair     currency.Pair
	Message  string
}

Warning holds any candle warnings

Jump to

Keyboard shortcuts

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