Skip to content

Commit

Permalink
0.7.4 fix check operate(waditu#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
zengbin93 committed Aug 16, 2021
1 parent 448b6c1 commit a91d0b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions czsc/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def _cal_signals(self):
s.update(self.kas['1分钟'].bars_raw[-1].__dict__)
return s

def check_operate(self, bar: RawBar, stoploss: float = 0.1, timeout: int = 1000) -> dict:
def check_operate_old(self, bar: RawBar, stoploss: float = 0.1, timeout: int = 1000) -> dict:
"""更新信号,计算下一个操作动作
:param timeout: 超时退出参数,数值表示持仓1分钟K线数量
Expand Down Expand Up @@ -578,7 +578,7 @@ def check_operate(self, bar: RawBar, stoploss: float = 0.1, timeout: int = 1000)
self.op = op
return op

def check_operate_v1(self, bar: RawBar, stoploss: float = 0.1, timeout: int = 1000) -> dict:
def check_operate(self, bar: RawBar, stoploss: float = 0.1, timeout: int = 1000) -> dict:
"""更新信号,计算下一个操作动作
:param timeout: 超时退出参数,数值表示持仓1分钟K线数量
Expand Down
3 changes: 1 addition & 2 deletions test/test_analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ def test_czsc_trader():
ct = CzscTrader(kg, get_signals=get_default_signals, events=events)
assert len(ct.s) == 190
for row in bars[-10000:]:
# op = ct.check_operate(row)
op = ct.check_operate_v1(row)
op = ct.check_operate(row)
print(" : op : ", op)
print(" : cache : ", dict(ct.cache), "\n")
assert len(ct.s) == 190
Expand Down

0 comments on commit a91d0b9

Please sign in to comment.