-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.go
81 lines (73 loc) · 1.69 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package main
import (
"log"
"strings"
"github.com/carusyte/stock/cmd"
"github.com/carusyte/stock/conf"
"github.com/carusyte/stock/model"
"github.com/pkg/profile"
"github.com/sirupsen/logrus"
"github.com/carusyte/stock/getd"
"github.com/carusyte/stock/global"
"github.com/carusyte/stock/score"
"github.com/carusyte/stock/util"
)
func main() {
switch strings.ToLower(conf.Args.Profiling) {
case "cpu":
defer profile.Start().Stop()
case "mem":
defer profile.Start(profile.MemProfile).Stop()
}
cmd.Execute()
}
func fixVarate() {
getd.FixVarate()
logrus.Info("all varate has been fixed.")
}
func test() {
// stocks := new(model.Stocks)
// s := &model.Stock{}
// s.Code = "000009"
// s.Name = "中国宝安"
// stocks.Add(s)
// getd.GetKlines(stocks,
// model.KLINE_DAY,
// model.KLINE_WEEK,
// model.KLINE_MONTH,
// model.KLINE_MONTH_NR,
// model.KLINE_DAY_NR,
// model.KLINE_WEEK_NR,
// )
allstk := getd.StocksDb()
stocks := new(model.Stocks)
stocks.Add(allstk...)
getd.GetKlines(stocks,
model.KLINE_WEEK,
model.KLINE_MONTH,
model.KLINE_DAY,
model.KLINE_DAY_NR,
model.KLINE_WEEK_NR,
model.KLINE_MONTH_NR)
e := getd.AppendVarateRgl(allstk...)
if e != nil {
log.Println(e)
} else {
log.Printf("%v stocks varate_rgl fixed", len(allstk))
}
}
func pruneKdjFd(resume bool) {
getd.PruneKdjFeatDat(getd.KDJ_FD_PRUNE_PREC, getd.KDJ_PRUNE_RATE, resume)
}
func renewKdjStats(resume bool) {
kv := new(score.KdjV)
if resume {
sql, e := global.Dot.Raw("KDJV_STATS_UNDONE")
util.CheckErr(e, "failed to get sql KDJV_STATS_UNDONE")
var stocks []string
_, e = global.Dbmap.Select(&stocks, sql)
kv.RenewStats(false, stocks...)
} else {
kv.RenewStats(false)
}
}