Documentation
¶
Index ¶
- Constants
- Variables
- func CollectOptLog(args *config.CmdArgs) *errs.Error
- func CompareExgBTOrders(args []string)
- func DescGroups(items []*OptInfo) ([]*OptInfo, []*OptInfo)
- func RunBTOverOpt(args *config.CmdArgs) *errs.Error
- func RunOptimize(args *config.CmdArgs) *errs.Error
- func RunRollBTPicker(args *config.CmdArgs) *errs.Error
- type BTResult
- type BackTest
- type FnCalcOptBest
- type FuncOptTask
- type GroupScore
- type OptGroup
- type OptInfo
- type PlotData
- type RowItem
- type RowPart
- type ValItem
Constants ¶
const (
ShowNum = 600
)
Variables ¶
var ( MapCalcOptBest = map[string]FnCalcOptBest{ "score": getBestByScore, "good3": optGood3, "good0t3": optGood0t3, "goodAvg": optGoodMa, "good1t4": optGood1t4, "good4": optGood4, "good2": optGood2, "good5": optGood5, "good7": optGood7, "good2t5": optGood2t5, "good3t7": optGood3t7, "good0t7": optGood0t7, "good3t10": optGood3t10, } DefCalcOptBest = "good3" )
var (
PairPickers = make(map[string]func(r *BTResult) []string)
)
Functions ¶
func CollectOptLog ¶
CollectOptLog Collect and analyze the logs generated by RunOptimize Sorts all policy tasks in reverse score order of output. 收集分析RunOptimize生成的日志 将所有策略任务按分数倒序排列输出。
func CompareExgBTOrders ¶
func CompareExgBTOrders(args []string)
CompareExgBTOrders Compare the exchange export order records with the backtest order records. 对比交易所导出订单记录和回测订单记录。
func DescGroups ¶
DescGroups Divide the parameter group into profit and loss groups, both in descending order of scores; Return: Profit group, loss group 将参数组划分为盈利和亏损两组,都按分数降序;返回:盈利组,亏损组
func RunBTOverOpt ¶
RunBTOverOpt Backtesting mode based on continuous parameter tuning. Approach the real situation and avoid using future information to adjust parameters for backtesting. 基于持续调参的回测模式。接近实盘情况,避免使用未来信息调参回测。
Types ¶
type BTResult ¶
type BTResult struct {
MaxOpenOrders int `json:"maxOpenOrders"`
MinReal float64 `json:"minReal"`
MaxReal float64 `json:"maxReal"` // Maximum Assets 最大资产
MaxDrawDownPct float64 `json:"maxDrawDownPct"` // Maximum drawdown percentage 最大回撤百分比
ShowDrawDownPct float64 `json:"showDrawDownPct"` // Displays the maximum drawdown percentage 显示最大回撤百分比
BarNum int `json:"barNum"`
TimeNum int `json:"timeNum"`
OrderNum int `json:"orderNum"`
Plots *PlotData `json:"plots"`
StartMS int64 `json:"startMS"`
EndMS int64 `json:"endMS"`
PlotEvery int `json:"plotEvery"`
TotalInvest float64 `json:"totalInvest"`
OutDir string `json:"outDir"`
PairGrps []*RowItem `json:"pairGrps"`
DateGrps []*RowItem `json:"dateGrps"`
EnterGrps []*RowItem `json:"enterGrps"`
ExitGrps []*RowItem `json:"exitGrps"`
ProfitGrps []*RowItem `json:"profitGrps"`
TotProfit float64 `json:"totProfit"`
TotCost float64 `json:"totCost"`
TotFee float64 `json:"totFee"`
TotProfitPct float64 `json:"totProfitPct"`
SharpeRatio float64 `json:"sharpeRatio"`
SortinoRatio float64 `json:"sortinoRatio"`
// contains filtered or unexported fields
}
func NewBTResult ¶
func NewBTResult() *BTResult
type BackTest ¶
func NewBackTest ¶
type FnCalcOptBest ¶
type GroupScore ¶
type GroupScore struct {
Items []*config.RunPolicyConfig
Score float64
}
type OptInfo ¶
func AvgGoodDesc ¶
AvgGoodDesc For profitable groups, cut the specified range in descending order of scores and take the average of the parameters 对盈利的组,按分数降序,截取指定范围,取参数平均值
type RowPart ¶
type RowPart struct {
WinCount int `json:"winCount"`
ProfitSum float64 `json:"profitSum"`
ProfitPctSum float64 `json:"profitPctSum"`
CostSum float64 `json:"costSum"`
Durations []int `json:"durations"`
Orders []*orm.InOutOrder `json:"-"`
Sharpe float64 `json:"sharpe"` // 夏普比率
Sortino float64 `json:"sortino"`
}