This commit is contained in:
Sven Woldt 2023-11-02 02:28:00 +01:00
parent f19bbbc5aa
commit 0c2f4aef9d
No known key found for this signature in database
GPG Key ID: D08249FCD4B52446
2 changed files with 2 additions and 20 deletions

View File

@ -15,13 +15,13 @@ const (
DailyToAnnualFactor = 252 // todo does this apply to crypto at all?
)
// HistVolAnn is the annualized historic volatility of daily returns.
// AnnualHistoricVolatility is the historic volatility of the equity curve as annualized std dev.
func AnnualHistoricVolatility(data Series) float64 {
var sd = Stdev(data, data.Length(), 1)
return sd * math.Sqrt(DailyToAnnualFactor)
}
// CAGR Compound Annual Growth Rate
// CAGR is the Compound Annual Growth Rate of the equity curve.
func CAGR(initial, final float64, days int) float64 {
var (
growthRate = (final - initial) / initial

View File

@ -219,24 +219,6 @@ type TradeStats struct {
consecutiveSide int
consecutiveCounter int
consecutiveAmount fixedpoint.Value
// CAGR is the Compound Annual Growth Rate of the equity curve.
CAGR float64
// MaxDrawdown is the maximum percentage drawdown of the equity curve
MaxDrawdown float64
// MDDRecovery is the recovery time of the maximum drawdown of the equity curve.
MDDRecovery time.Duration
// HistVolAnn is the historic volatility of the equity curve as annualized std dev.
HistVolAnn float64
// Sharpe is the Sharpe ratio of the equity curve.
Sharpe float64
// Calmar is the Calmar ratio of the equity curve.
Calmar float64
}
func NewTradeStats(symbol string) *TradeStats {