代码拉取完成,页面将自动刷新
package main
import (
"fmt"
"gitee.com/quant1x/engine/command"
"gitee.com/quant1x/engine/models"
"gitee.com/quant1x/engine/strategies"
"gitee.com/quant1x/engine/util/runtime"
"gitee.com/quant1x/gox/logger"
cmder "github.com/spf13/cobra"
_ "net/http/pprof"
"os"
"runtime/pprof"
"time"
)
var (
MinVersion = "1.0.0" // 版本号
strategyNumber = 0 // 策略编号
)
var (
cpuProfile = "./cpu.pprof"
memProfile = "./mem.pprof"
)
// 更新日线数据工具
func main() {
fCpu, err := os.Create(cpuProfile)
if err != nil {
logger.Fatal(err)
}
_ = pprof.StartCPUProfile(fCpu)
defer pprof.StopCPUProfile()
mainStart := time.Now()
defer func() {
runtime.CatchPanic()
elapsedTime := time.Since(mainStart) / time.Millisecond
fmt.Printf("\n总耗时: %.3fs\n", float64(elapsedTime)/1000)
}()
// stock模块内的更新版本号
command.UpdateApplicationVersion(MinVersion)
runtime.GoMaxProcs()
var rootCmd = &cmder.Command{
Use: command.Application,
Run: func(cmd *cmder.Command, args []string) {
//stat.SetAvx2Enabled(modules.CpuAvx2)
//runtime.GoMaxProcs(modules.CpuNum)
//var model models.Strategy
//switch strategyNumber {
//default:
// model = new(strategies.ModelNo1)
//}
//fmt.Printf("策略模块: %s\n", model.Name())
//if strategies.CountDays > 0 {
// tracker.BackTesting(strategies.CountDays, strategies.CountTopN)
//} else {
// // 执行策略
// barIndex := 1
// models.ExecuteStrategy(model, &barIndex)
//}
model, err := models.CheckoutStrategy(strategyNumber)
if err != nil {
fmt.Println(err)
return
}
barIndex := 1
models.ExecuteStrategy(model, &barIndex)
},
}
//rootCmd.Flags().IntVar(&strategyNumber, "strategy", models.DefaultStrategy, "策略编号")
rootCmd.Flags().IntVar(&strategyNumber, "strategy", models.DefaultStrategy, models.UsageStrategyList())
rootCmd.Flags().IntVar(&strategies.CountDays, "count", 0, "统计多少天")
rootCmd.Flags().IntVar(&strategies.CountTopN, "top", strategies.AllStockTopN(), "输出前排几名")
command.Init()
rootCmd.AddCommand(command.CmdVersion, command.CmdPrint, command.CmdBackTesting, command.CmdRule)
rootCmd.AddCommand(command.CmdUpdate, command.CmdRepair, command.CmdService)
_ = rootCmd.Execute()
fMem, err := os.Create(memProfile)
if err != nil {
logger.Fatal(err)
}
_ = pprof.WriteHeapProfile(fMem)
_ = fMem.Close()
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。