report

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: BSD-3-Clause Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Report

type Report struct {
	// contains filtered or unexported fields
}

func NewReport

func NewReport(trades []Trade, balanceInit float64) *Report

func NewReportSimple

func NewReportSimple() *Report

func (*Report) Analyzer

func (r *Report) Analyzer() (err error)

func (*Report) CalculateEquityCurve added in v0.3.3

func (r *Report) CalculateEquityCurve() []float64

CalculateEquityCurve 计算净值曲线

func (*Report) CalculateMetrics added in v0.3.3

func (r *Report) CalculateMetrics(metrics *ReportResult) (err error)

CalculateMetrics 计算所有指标

func (*Report) EndBalance added in v0.1.3

func (r *Report) EndBalance() float64

func (*Report) ExportToDB added in v0.1.2

func (r *Report) ExportToDB(dbPath string) (err error)

func (*Report) GenHTML

func (r *Report) GenHTML(w io.Writer) (err error)

func (*Report) GenHTMLReport

func (r *Report) GenHTMLReport(fPath string) (err error)

func (*Report) GenRPT

func (r *Report) GenRPT(fPath string) (err error)

func (*Report) GetReport

func (r *Report) GetReport() (report string)

func (*Report) GetResult added in v0.0.5

func (r *Report) GetResult() (ret ReportResult, err error)

func (*Report) LoseVariance added in v0.2.1

func (r *Report) LoseVariance() float64

func (*Report) MaxDrawdown

func (r *Report) MaxDrawdown() float64

MaxDrawdown get max drawdown percent

func (*Report) MaxDrawdownValue

func (r *Report) MaxDrawdownValue() float64

MaxDrawdown get max drawdown value

func (*Report) MaxLose

func (r *Report) MaxLose() (lose float64)

MaxLose max total lose

func (*Report) OnBalanceInit

func (r *Report) OnBalanceInit(balance, fee float64) (err error)

func (*Report) OnTrade

func (r *Report) OnTrade(t Trade)

func (*Report) Profit

func (r *Report) Profit() (profit float64)

func (*Report) ProfitLoseRatio added in v0.1.2

func (r *Report) ProfitLoseRatio() float64

func (*Report) ProfitPercent added in v0.1.3

func (r *Report) ProfitPercent() float64

func (*Report) ProfitVariance added in v0.2.1

func (r *Report) ProfitVariance() float64

func (*Report) ProvideResult added in v0.3.3

func (r *Report) ProvideResult() (any, error)

ProvideResult implements rpt.ResultProvider interface.

func (*Report) SetFee added in v0.0.5

func (r *Report) SetFee(fee float64)

func (*Report) SetLever added in v0.2.1

func (r *Report) SetLever(lever float64)

func (*Report) SetTimeRange added in v0.3.3

func (r *Report) SetTimeRange(start, end time.Time)

SetTimeRange set time range for report

func (*Report) WinRate

func (r *Report) WinRate() (rate float64)

type ReportResult added in v0.0.5

type ReportResult struct {
	TotalAction      int     // 总开单次数
	WinRate          float64 // 胜率
	TotalProfit      float64 // 总收益
	MaxLose          float64 // 最大单次亏损百分比
	MaxDrawdown      float64 // 最大回撤百分比
	MaxDrawdownValue float64 // 最大回撤值
	TotalFee         float64 // 总手续费
	StartBalance     float64 // 起始余额
	EndBalance       float64 // 结束余额
	ProfitPercent    float64 // 收益率
	ProfitVariance   float64 // 盈利方差
	LoseVariance     float64 // 亏损方差

	TotalReturn      float64 // 总收益率
	AnnualReturn     float64 // 年化收益率
	SharpeRatio      float64 // 夏普比率
	SortinoRatio     float64 // 索提诺比率
	Volatility       float64 // 年化波动率
	ProfitFactor     float64 // 盈亏比
	CalmarRatio      float64 // 卡玛比率
	ConsistencyScore float64 // 连续性得分
	SmoothnessScore  float64 // 平滑性得分
	OverallScore     float64 // 综合得分
	LongTrades       int     // 做多次数
	ShortTrades      int     // 做空次数

	Actions []*RptAct `json:"-"` // 所有的操作记录
}

type RptAct added in v0.0.5

type RptAct struct {
	Trade       `xorm:"extends"`
	Total       float64
	TotalProfit float64 // total profit,sum of all history profits,if action is open, total profit is zero
	Profit      float64 // profit, if action is open, profit is zero
	ProfitRate  float64
	Fee         float64
	IsFinish    bool
}

Jump to

Keyboard shortcuts

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