Skip to content

Commit

Permalink
新增北交所回测
Browse files Browse the repository at this point in the history
  • Loading branch information
Lin-Dongzhao committed Dec 25, 2024
1 parent 29a2003 commit c762c92
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions rqalpha/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ class EXCHANGE(CustomEnum):
CZCE = "CZCE"
CFFEX = "CFFEX"
SGEX = "SGEX"
BJSE = "BJSE"


# noinspection PyPep8Naming
Expand Down
2 changes: 0 additions & 2 deletions rqalpha/data/base_data_source/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ def _p(name):
instruments.append(Instrument(
i,
lambda i: self._future_info_store.get_tick_size(i),
# lambda i, dt: env.data_proxy.get_futures_trading_parameters(i, dt).long_margin_ratio,
# lambda i, dt: env.data_proxy.get_futures_trading_parameters(i, dt).short_margin_ratio
))
for ins_type in self.DEFAULT_INS_TYPES:
self.register_instruments_store(InstrumentStore(instruments, ins_type))
Expand Down
8 changes: 4 additions & 4 deletions rqalpha/data/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,19 +419,19 @@ def __call__(self, path, fields, **kwargs):
h5.close()


def process_init(args: Optional[Synchronized] = None):
def process_init(args: Optional[Synchronized] = None, enable_bjse: bool = False):
import warnings
with warnings.catch_warnings(record=True):
# catch warning: rqdatac is already inited. Settings will be changed
rqdatac.init()
rqdatac.init(enable_bjse=enable_bjse)
init_logger()
# Initialize process shared variables
if args:
global sval
sval = args


def update_bundle(path, create, enable_compression=False, concurrency=1):
def update_bundle(path, create, enable_compression=False, concurrency=1, enable_bjse: bool = False):
if create:
_DayBarTask = GenerateDayBarTask
else:
Expand All @@ -458,7 +458,7 @@ def update_bundle(path, create, enable_compression=False, concurrency=1):

succeed = multiprocessing.Value(c_bool, True)
with ProgressedProcessPoolExecutor(
max_workers=concurrency, initializer=process_init, initargs=(succeed, )
max_workers=concurrency, initializer=process_init, initargs=(succeed, enable_bjse)
) as executor:
# windows上子进程需要执行rqdatac.init, 其他os则需要执行rqdatac.reset; rqdatac.init包含了rqdatac.reset的功能
for func in gen_file_funcs:
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[metadata]
name = rqalpha
version = 5.4.3
version = 5.5.0

[versioneer]
VCS = git
Expand Down

0 comments on commit c762c92

Please sign in to comment.