2 Star 14 Fork 16

王布衣/engine

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
command_backtesting.go 1.04 KB
Copy Edit Raw Blame History
package command
import (
"gitee.com/quant1x/engine/models"
"gitee.com/quant1x/engine/tracker"
"gitee.com/quant1x/exchange"
cmder "github.com/spf13/cobra"
"strings"
)
var (
days int // 统计多少天
topN int // 统计前N
strategyCode uint64 // 策略ID
securityCode string // 证券代码
)
// CmdBackTesting 回测
var CmdBackTesting = &cmder.Command{
Use: "backtesting",
Short: "回测",
Run: func(cmd *cmder.Command, args []string) {
securityCode = strings.TrimSpace(securityCode)
securityCode = exchange.CorrectSecurityCode(securityCode)
if len(securityCode) > 0 {
tracker.CheckStrategy(strategyCode, securityCode)
} else {
tracker.BackTesting(days, topN)
}
},
}
func initBackTesting() {
CmdBackTesting.Flags().IntVar(&days, "count", 0, "统计多少天")
CmdBackTesting.Flags().IntVar(&topN, "top", models.AllStockTopN(), "输出前排几名")
CmdBackTesting.Flags().Uint64Var(&strategyCode, "strategy", 0, "策略ID")
CmdBackTesting.Flags().StringVar(&securityCode, "code", "", "证券代码")
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/quant1x/engine.git
git@gitee.com:quant1x/engine.git
quant1x
engine
engine
v1.3.5

Search