mirror of
https://github.com/c9s/bbgo.git
synced 2024-09-20 08:11:08 +00:00
clean up
This commit is contained in:
parent
f19bbbc5aa
commit
0c2f4aef9d
|
@ -15,13 +15,13 @@ const (
|
||||||
DailyToAnnualFactor = 252 // todo does this apply to crypto at all?
|
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 {
|
func AnnualHistoricVolatility(data Series) float64 {
|
||||||
var sd = Stdev(data, data.Length(), 1)
|
var sd = Stdev(data, data.Length(), 1)
|
||||||
return sd * math.Sqrt(DailyToAnnualFactor)
|
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 {
|
func CAGR(initial, final float64, days int) float64 {
|
||||||
var (
|
var (
|
||||||
growthRate = (final - initial) / initial
|
growthRate = (final - initial) / initial
|
||||||
|
|
|
@ -219,24 +219,6 @@ type TradeStats struct {
|
||||||
consecutiveSide int
|
consecutiveSide int
|
||||||
consecutiveCounter int
|
consecutiveCounter int
|
||||||
consecutiveAmount fixedpoint.Value
|
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 {
|
func NewTradeStats(symbol string) *TradeStats {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user