代码拉取完成,页面将自动刷新
package models
import (
"fmt"
"gitee.com/quant1x/engine/market"
"gitee.com/quant1x/gox/progressbar"
"gitee.com/quant1x/gox/tags"
"gitee.com/quant1x/gox/util/treemap"
"github.com/olekukonko/tablewriter"
"os"
)
// ExecuteStrategy 执行策略
func ExecuteStrategy(model Strategy, barIndex *int) {
// 加载即时行情
GetAllSnapshots(barIndex)
fmt.Println()
// 执行策略
allCodes := market.GetCodeList()
count := len(allCodes)
bar := progressbar.NewBar(*barIndex, "执行["+model.Name()+"]", count)
results := treemap.NewWithStringComparator()
for _, securityCode := range allCodes {
// 此处可以增加过滤规则
model.Evaluate(securityCode, results)
bar.Add(1)
}
// 输出一个换行符, 结束上一个进度条
fmt.Println()
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader(tags.GetHeadersByTags(ResultInfo{}))
results.Each(func(key interface{}, value interface{}) {
row := value.(ResultInfo)
table.Append(tags.GetValuesByTags(row))
})
table.Render()
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。