Skip to content

Commit

Permalink
fix: typo of trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
Vespa314 committed Dec 30, 2023
1 parent c1d840d commit c137aeb
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions Chan.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(

self.do_init()

if not config.triger_step:
if not config.trigger_step:
for _ in self.load():
...

Expand Down Expand Up @@ -137,10 +137,10 @@ def get_next_lv_klu(self, lv_idx):
raise

def step_load(self):
assert self.conf.triger_step
assert self.conf.trigger_step
self.do_init() # 清空数据,防止再次重跑没有数据
yielded = False # 是否曾经返回过结果
for idx, snapshot in enumerate(self.load(self.conf.triger_step)):
for idx, snapshot in enumerate(self.load(self.conf.trigger_step)):
if idx < self.conf.skip_step:
continue
yield snapshot
Expand Down
2 changes: 1 addition & 1 deletion ChanConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self, conf=None):
zs_algo=conf.get("zs_algo", "normal"),
)

self.triger_step = conf.get("triger_step", False)
self.trigger_step = conf.get("trigger_step", False)
self.skip_step = conf.get("skip_step", 0)

self.kl_data_check = conf.get("kl_data_check", True)
Expand Down
2 changes: 1 addition & 1 deletion Debug/strategy_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
lv_list = [KL_TYPE.K_DAY]

config = CChanConfig({
"triger_step": True, # 打开开关!
"trigger_step": True, # 打开开关!
"divergence_rate": 0.8,
"min_zs_cnt": 1,
})
Expand Down
2 changes: 1 addition & 1 deletion Debug/strategy_demo2.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
lv_list = [KL_TYPE.K_DAY]

config = CChanConfig({
"triger_step": True,
"trigger_step": True,
"divergence_rate": 0.8,
"min_zs_cnt": 1,
})
Expand Down
2 changes: 1 addition & 1 deletion Debug/strategy_demo3.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def combine_60m_klu_form_15m(klu_15m_lst: List[CKLine_Unit]) -> CKLine_Unit:
lv_list = [KL_TYPE.K_60M, KL_TYPE.K_15M]

config = CChanConfig({
"triger_step": True,
"trigger_step": True,
})

# 快照
Expand Down
2 changes: 1 addition & 1 deletion Debug/strategy_demo4.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
lv_list = [KL_TYPE.K_DAY, KL_TYPE.K_30M]

config = CChanConfig({
"triger_step": True,
"trigger_step": True,
"divergence_rate": 0.8,
"min_zs_cnt": 1,
})
Expand Down
2 changes: 1 addition & 1 deletion KLine/KLine_List.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def cal_seg_and_zs(self):
self.bs_point_lst.cal(self.bi_list, self.seg_list) # 再算笔买卖点

def need_cal_step_by_step(self):
return self.config.triger_step
return self.config.trigger_step

def add_single_klu(self, klu: CKLine_Unit):
klu.set_metric(self.metric_model_lst)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ plot_para = {
},
} # 空格绘图元素详细配置,详见后文
if not config.triger_step: # 绘制静态图
if not config.trigger_step: # 绘制静态图
plot_driver = CPlotDriver(
chan,
plot_config=plot_config,
Expand Down Expand Up @@ -612,9 +612,9 @@ else: # 绘制动画
- cal_kdj: 是否计算kdj指标,默认为False
- kdj:
- kdj_cycle: kdj计算周期,默认为9
- triger_step:是否回放逐步返回,默认为 False
- trigger_step:是否回放逐步返回,默认为 False
- 用于逐步回放绘图时使用,此时 CChan 会变成一个生成器,每读取一根新K线就会计算一次当前所有指标,返回当前帧指标状况;常用于返回给 CAnimateDriver 绘图
- skip_step:triger_step 为 True 时有效,指定跳过前面几根K线,默认为 0;
- skip_step:trigger_step 为 True 时有效,指定跳过前面几根K线,默认为 0;
- kl_data_check:是否需要检验K线数据,检查项包括时间线是否有乱序,大小级别K线是否有缺失;默认为 True
- max_kl_misalgin_cnt:在次级别找不到K线最大条数,默认为 2(次级别数据有缺失),`kl_data_check` 为 True 时生效
- max_kl_inconsistent_cnt:天K线以下(包括)子级别和父级别日期不一致最大允许条数(往往是父级别数据有缺失),默认为 5,`kl_data_check` 为 True 时生效
Expand Down Expand Up @@ -697,7 +697,7 @@ config = CChanConfig({
"zs_combine_mode": "zs",
"bi_strict": True,
"mean_metrics": [],
"triger_step": False,
"trigger_step": False,
"skip_step": 0,
"seg_algo": "chan",
"divergence_rate": 0.9,
Expand Down
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

config = CChanConfig({
"bi_strict": True,
"triger_step": False,
"trigger_step": False,
"skip_step": 0,
"divergence_rate": float("inf"),
"bsp2_follow_1": False,
Expand Down Expand Up @@ -72,7 +72,7 @@
autype=AUTYPE.QFQ,
)

if not config.triger_step:
if not config.trigger_step:
plot_driver = CPlotDriver(
chan,
plot_config=plot_config,
Expand Down
2 changes: 1 addition & 1 deletion quick_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ item_dict为一个字典:
## 策略实现 & 回测
具体demo参见[strategy_demo.py](./Debug/strategy_demo.py)

原理就是:打开CChanConfig中的`triger_step`开关,那么CChan初始化的时候就不会做任何计算;
原理就是:打开CChanConfig中的`trigger_step`开关,那么CChan初始化的时候就不会做任何计算;

而手动调用CChan.step_load(),才会启动计算;
- 多少根K线就返回多少次
Expand Down

0 comments on commit c137aeb

Please sign in to comment.