-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
100 lines (97 loc) · 2.18 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package main
import (
"log"
"os"
"github.com/jaysinco/Pgold/control"
"github.com/jaysinco/Pgold/market"
"github.com/jaysinco/Pgold/pg"
"github.com/jaysinco/Pgold/policy"
"github.com/jaysinco/Pgold/policy/deep"
"github.com/jaysinco/Pgold/server"
_ "github.com/lib/pq"
"github.com/urfave/cli"
)
func main() {
app := cli.NewApp()
app.Version = "0.1.0"
app.Name = "pgold"
app.Usage = "ICBC paper gold trader assist system"
app.Flags = []cli.Flag{
pg.ConfigFlag,
}
app.Commands = []cli.Command{
cli.Command{
Name: "market",
Usage: "Crawl market data into database continuously",
Action: pg.Setup(market.Run),
},
cli.Command{
Name: "export",
Usage: "Export market data from database into file",
Flags: []cli.Flag{
pg.OutfileFlag,
pg.StartDateFlag,
pg.EndDateFlag,
pg.OnlyTxOpenFlag,
},
Action: pg.Setup(market.Export),
},
cli.Command{
Name: "import",
Usage: "Import market data from file into database",
Flags: []cli.Flag{
pg.InfileFlag,
pg.StartDateFlag,
pg.EndDateFlag,
pg.OnlyTxOpenFlag,
},
Action: pg.Setup(market.Import),
},
cli.Command{
Name: "autosave",
Usage: "Autosave market data into file daily",
Action: pg.Setup(market.Autosave),
},
cli.Command{
Name: "server",
Usage: "Run http server showing market history data ",
Action: pg.Setup(server.Run),
},
cli.Command{
Name: "realtime",
Usage: "Email trade tips continuously based on policy",
Action: pg.Setup(policy.Realtime),
},
cli.Command{
Name: "test",
Usage: "Loopback test strategy using history data",
Flags: []cli.Flag{
pg.PolicyFlag,
pg.StartDateFlag,
pg.EndDateFlag,
},
Action: pg.Setup(policy.Test),
},
cli.Command{
Name: "multitask",
Usage: "Run serveral tasks simultaneously",
Flags: []cli.Flag{
pg.TaskSetFlag,
},
Action: pg.Setup(control.MutltiTask),
},
cli.Command{
Name: "dpgen",
Usage: "Generate deep training data",
Flags: []cli.Flag{
pg.OutfileFlag,
pg.StartDateFlag,
pg.EndDateFlag,
},
Action: pg.Setup(deep.Generate),
},
}
if err := app.Run(os.Args); err != nil {
log.Fatalf("[ERROR] pgold: %v", err)
}
}