Skip to content

Commit f6982fc

Browse files
committed
fix turnover of BJSE
1 parent 9e47d06 commit f6982fc

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • rqalpha/mod/rqalpha_mod_sys_analyser

rqalpha/mod/rqalpha_mod_sys_analyser/mod.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# 详细的授权流程,请联系 public@ricequant.com 获取。
1717

1818
import os
19+
import re
1920
import pandas
2021
import pickle
2122
import jsonpickle
@@ -51,6 +52,9 @@ def _get_yearly_risk_free_rates(
5152
start_date = datetime.date(year + 1, 1, 1)
5253

5354

55+
EQUITIES_OID_RE = re.compile(r"^\d{6}\.(XSHE|XSHG|BJSE)$")
56+
57+
5458
class AnalyserMod(AbstractMod):
5559
def __init__(self):
5660
self._env = None
@@ -434,7 +438,7 @@ def tear_down(self, code, exception=None):
434438
}
435439

436440
if not trades.empty and all(
437-
trades.order_book_id.str.endswith(".XSHE") | trades.order_book_id.str.endswith(".XSHG")
441+
EQUITIES_OID_RE.match(trade.order_book_id) for trade in trades.itertuples() # type: ignore
438442
):
439443
# 策略仅交易股票、指数、场内基金等品种时才计算换手率
440444
trades_values = trades.last_price * trades.last_quantity

0 commit comments

Comments
 (0)