-
Notifications
You must be signed in to change notification settings - Fork 331
/
main.py
88 lines (83 loc) · 2.2 KB
/
main.py
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
from Chan import CChan
from ChanConfig import CChanConfig
from Common.CEnum import AUTYPE, DATA_SRC, KL_TYPE
from Plot.AnimatePlotDriver import CAnimateDriver
from Plot.PlotDriver import CPlotDriver
if __name__ == "__main__":
code = "sz.000001"
begin_time = "2018-01-01"
end_time = None
data_src = DATA_SRC.BAO_STOCK
lv_list = [KL_TYPE.K_DAY]
config = CChanConfig({
"bi_strict": True,
"trigger_step": False,
"skip_step": 0,
"divergence_rate": float("inf"),
"bsp2_follow_1": False,
"bsp3_follow_1": False,
"min_zs_cnt": 0,
"bs1_peak": False,
"macd_algo": "peak",
"bs_type": '1,2,3a,1p,2s,3b',
"print_warning": True,
"zs_algo": "normal",
})
plot_config = {
"plot_kline": True,
"plot_kline_combine": True,
"plot_bi": True,
"plot_seg": True,
"plot_eigen": False,
"plot_zs": True,
"plot_macd": False,
"plot_mean": False,
"plot_channel": False,
"plot_bsp": True,
"plot_extrainfo": False,
"plot_demark": False,
"plot_marker": False,
"plot_rsi": False,
"plot_kdj": False,
}
plot_para = {
"seg": {
# "plot_trendline": True,
},
"bi": {
# "show_num": True,
# "disp_end": True,
},
"figure": {
"x_range": 200,
},
"marker": {
# "markers": { # text, position, color
# '2023/06/01': ('marker here', 'up', 'red'),
# '2023/06/08': ('marker here', 'down')
# },
}
}
chan = CChan(
code=code,
begin_time=begin_time,
end_time=end_time,
data_src=data_src,
lv_list=lv_list,
config=config,
autype=AUTYPE.QFQ,
)
if not config.trigger_step:
plot_driver = CPlotDriver(
chan,
plot_config=plot_config,
plot_para=plot_para,
)
plot_driver.figure.show()
plot_driver.save2img("./test.png")
else:
CAnimateDriver(
chan,
plot_config=plot_config,
plot_para=plot_para,
)