report

package
v0.0.0-...-83dca6d Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: MIT Imports: 17 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 ChartPlot

type ChartPlot struct {
	Value     float64
	UnixMilli int64
	Flag      string
}

ChartPlot holds value data for a chart

type Data

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

Data holds all statistical information required to output detailed backtesting results

func (*Data) AddKlineItem

func (d *Data) AddKlineItem(k *kline.Item)

AddKlineItem appends a SET of candles for the report to enhance upon generation

func (*Data) CreateHoldingsOverTimeChart

func (d *Data) CreateHoldingsOverTimeChart() []TotalsChart

CreateHoldingsOverTimeChart used for creating a chart in the HTML report to show how many holdings of each type was held over the time of backtesting

func (*Data) CreateUSDTotalsChart

func (d *Data) CreateUSDTotalsChart() []TotalsChart

CreateUSDTotalsChart used for creating a chart in the HTML report to show how much the overall assets are worth over time

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) UpdateItem

func (d *Data) UpdateItem(k *kline.Item)

UpdateItem 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 DetailedKline

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

DetailedKline enhances kline details for the purpose of rich reporting results

type Handler

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

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

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 TotalsChart

type TotalsChart struct {
	Name       string
	DataPoints []ChartPlot
}

TotalsChart holds chart plot data to render charts in the report

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