Skip to content

Commit

Permalink
add batch run by main.run
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricporter committed Apr 5, 2017
1 parent e6ef4f4 commit b5bfb2f
Showing 1 changed file with 56 additions and 1 deletion.
57 changes: 56 additions & 1 deletion docs/source/intro/optimizing_parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,66 @@
executor.submit(run_bt, task)
Python调用传递参数
通过函数调用传递参数
====================================

TBD

.. code-block:: python
import concurrent.futures
import multiprocessing
from rqalpha.main import run
tasks = []
for short_period in range(3, 10, 2):
for long_period in range(30, 90, 5):
config = {
"extra": {
"context_vars": {
"SHORTPERIOD": short_period,
"LONGPERIOD": long_period,
},
"log_level": "verbose",
},
"base": {
"securities": "stock",
"matching_type": "current_bar",
"start_date": "2015-01-01",
"end_date": "2016-01-01",
"stock_starting_cash": 100000,
"benchmark": "000001.XSHE",
"frequency": "1d",
"strategy_file": "rqalpha/examples/golden_cross.py",
},
"mod": {
"sys_progress": {
"enabled": True,
"show": True,
},
"sys_analyser": {
"enabled": True,
"report_save_path": "results/out-{short_period}-{long_period}.pkl".format(
short_period=short_period,
long_period=long_period,
)
},
},
}
run(config)
def run_bt(config):
run(config)
with concurrent.futures.ProcessPoolExecutor(max_workers=multiprocessing.cpu_count()) as executor:
for task in tasks:
executor.submit(run_bt, task)
==================
分析批量回测结果
Expand Down

0 comments on commit b5bfb2f

Please sign in to comment.