{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "#%%\n", "from vnpy.app.cta_strategy.backtesting import BacktestingEngine, OptimizationSetting\n", "from vnpy.app.cta_strategy.strategies.atr_rsi_strategy import (\n", " AtrRsiStrategy,\n", ")\n", "from datetime import datetime" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "#%%\n", "engine = BacktestingEngine()\n", "engine.set_parameters(\n", " vt_symbol=\"IF88.CFFEX\",\n", " interval=\"1m\",\n", " start=datetime(2019, 1, 1),\n", " end=datetime(2019, 4, 30),\n", " rate=0.3/10000,\n", " slippage=0.2,\n", " size=300,\n", " pricetick=0.2,\n", " capital=1_000_000,\n", ")\n", "engine.add_strategy(AtrRsiStrategy, {})" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": false }, "outputs": [], "source": [ "#%%\n", "engine.load_data()\n", "engine.run_backtesting()\n", "df = engine.calculate_result()\n", "engine.calculate_statistics()\n", "engine.show_chart()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2019-05-02 22:29:22.289010\t开始运行遗传算法,每代族群总数:100, 优良品种筛选个数:80,迭代次数:300,交叉概率:0.95,突变概率:0.05\n", "2019-05-02 22:29:22.289010\t开始加载历史数据\n", "2019-05-02 22:29:24.103532\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:24.173848\t策略初始化完成\n", "2019-05-02 22:29:24.173848\t开始回放历史数据\n", "2019-05-02 22:29:24.788129\t历史数据回放结束\n", "2019-05-02 22:29:24.789106\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:24.789106\t成交记录为空,无法计算\n", "2019-05-02 22:29:24.789106\t开始计算策略统计指标\n", "2019-05-02 22:29:24.789106\t开始加载历史数据\n", "2019-05-02 22:29:24.789106\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:24.867234\t策略初始化完成\n", "2019-05-02 22:29:24.868210\t开始回放历史数据\n", "2019-05-02 22:29:25.834068\t历史数据回放结束\n", "2019-05-02 22:29:25.835044\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:25.839927\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:25.840904\t开始计算策略统计指标\n", "2019-05-02 22:29:25.856529\t开始加载历史数据\n", "2019-05-02 22:29:25.857506\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:25.939540\t策略初始化完成\n", "2019-05-02 22:29:25.939540\t开始回放历史数据\n", "2019-05-02 22:29:27.055794\t历史数据回放结束\n", "2019-05-02 22:29:27.056771\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:27.062630\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:27.062630\t开始计算策略统计指标\n", "2019-05-02 22:29:27.074350\t开始加载历史数据\n", "2019-05-02 22:29:27.074350\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:27.156384\t策略初始化完成\n", "2019-05-02 22:29:27.156384\t开始回放历史数据\n", "2019-05-02 22:29:28.159352\t历史数据回放结束\n", "2019-05-02 22:29:28.160329\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:28.165212\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:28.165212\t开始计算策略统计指标\n", "2019-05-02 22:29:28.176931\t开始加载历史数据\n", "2019-05-02 22:29:28.176931\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:28.260919\t策略初始化完成\n", "2019-05-02 22:29:28.260919\t开始回放历史数据\n", "2019-05-02 22:29:29.418190\t历史数据回放结束\n", "2019-05-02 22:29:29.418190\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:29.424049\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:29.424049\t开始计算策略统计指标\n", "2019-05-02 22:29:29.436745\t开始加载历史数据\n", "2019-05-02 22:29:29.436745\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:29.521709\t策略初始化完成\n", "2019-05-02 22:29:29.522686\t开始回放历史数据\n", "2019-05-02 22:29:30.513935\t历史数据回放结束\n", "2019-05-02 22:29:30.514911\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:30.519794\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:30.519794\t开始计算策略统计指标\n", "2019-05-02 22:29:30.531514\t开始加载历史数据\n", "2019-05-02 22:29:30.531514\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:30.611595\t策略初始化完成\n", "2019-05-02 22:29:30.611595\t开始回放历史数据\n", "2019-05-02 22:29:31.729802\t历史数据回放结束\n", "2019-05-02 22:29:31.730778\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:31.735661\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:31.735661\t开始计算策略统计指标\n", "2019-05-02 22:29:31.747381\t开始加载历史数据\n", "2019-05-02 22:29:31.747381\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:31.825509\t策略初始化完成\n", "2019-05-02 22:29:31.826485\t开始回放历史数据\n", "2019-05-02 22:29:32.840196\t历史数据回放结束\n", "2019-05-02 22:29:32.840196\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:32.846056\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:32.847032\t开始计算策略统计指标\n", "2019-05-02 22:29:32.858751\t开始加载历史数据\n", "2019-05-02 22:29:32.858751\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:32.936879\t策略初始化完成\n", "2019-05-02 22:29:32.936879\t开始回放历史数据\n", "2019-05-02 22:29:34.065829\t历史数据回放结束\n", "2019-05-02 22:29:34.066806\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:34.071689\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:34.072665\t开始计算策略统计指标\n", "2019-05-02 22:29:34.085361\t开始加载历史数据\n", "2019-05-02 22:29:34.085361\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:34.161536\t策略初始化完成\n", "2019-05-02 22:29:34.162512\t开始回放历史数据\n", "2019-05-02 22:29:35.174270\t历史数据回放结束\n", "2019-05-02 22:29:35.175247\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:35.180130\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:35.180130\t开始计算策略统计指标\n", "2019-05-02 22:29:35.192825\t开始加载历史数据\n", "2019-05-02 22:29:35.192825\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:35.274860\t策略初始化完成\n", "2019-05-02 22:29:35.274860\t开始回放历史数据\n", "2019-05-02 22:29:35.918439\t历史数据回放结束\n", "2019-05-02 22:29:35.918439\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:35.918439\t成交记录为空,无法计算\n", "2019-05-02 22:29:35.918439\t开始计算策略统计指标\n", "2019-05-02 22:29:35.918439\t开始加载历史数据\n", "2019-05-02 22:29:35.918439\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:35.999497\t策略初始化完成\n", "2019-05-02 22:29:35.999497\t开始回放历史数据\n", "2019-05-02 22:29:36.671398\t历史数据回放结束\n", "2019-05-02 22:29:36.671398\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:36.672374\t成交记录为空,无法计算\n", "2019-05-02 22:29:36.672374\t开始计算策略统计指标\n", "2019-05-02 22:29:36.673351\t开始加载历史数据\n", "2019-05-02 22:29:36.673351\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:36.761245\t策略初始化完成\n", "2019-05-02 22:29:36.762222\t开始回放历史数据\n", "2019-05-02 22:29:37.830622\t历史数据回放结束\n", "2019-05-02 22:29:37.831599\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:37.837458\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:37.837458\t开始计算策略统计指标\n", "2019-05-02 22:29:37.849177\t开始加载历史数据\n", "2019-05-02 22:29:37.849177\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:37.926329\t策略初始化完成\n", "2019-05-02 22:29:37.927305\t开始回放历史数据\n", "2019-05-02 22:29:38.877537\t历史数据回放结束\n", "2019-05-02 22:29:38.878514\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:38.884373\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:38.884373\t开始计算策略统计指标\n", "2019-05-02 22:29:38.895116\t开始加载历史数据\n", "2019-05-02 22:29:38.896093\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:38.974221\t策略初始化完成\n", "2019-05-02 22:29:38.974221\t开始回放历史数据\n", "2019-05-02 22:29:40.131492\t历史数据回放结束\n", "2019-05-02 22:29:40.131492\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:40.137351\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:40.137351\t开始计算策略统计指标\n", "2019-05-02 22:29:40.149070\t开始加载历史数据\n", "2019-05-02 22:29:40.149070\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:40.234035\t策略初始化完成\n", "2019-05-02 22:29:40.235011\t开始回放历史数据\n", "2019-05-02 22:29:41.257511\t历史数据回放结束\n", "2019-05-02 22:29:41.258488\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:41.263371\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:41.263371\t开始计算策略统计指标\n", "2019-05-02 22:29:41.275090\t开始加载历史数据\n", "2019-05-02 22:29:41.275090\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:41.353218\t策略初始化完成\n", "2019-05-02 22:29:41.353218\t开始回放历史数据\n", "2019-05-02 22:29:42.819095\t历史数据回放结束\n", "2019-05-02 22:29:42.819095\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:42.823978\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:42.823978\t开始计算策略统计指标\n", "2019-05-02 22:29:42.835697\t开始加载历史数据\n", "2019-05-02 22:29:42.836674\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:42.917731\t策略初始化完成\n", "2019-05-02 22:29:42.917731\t开始回放历史数据\n", "2019-05-02 22:29:43.901168\t历史数据回放结束\n", "2019-05-02 22:29:43.901168\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:43.907027\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:43.908004\t开始计算策略统计指标\n", "2019-05-02 22:29:43.920700\t开始加载历史数据\n", "2019-05-02 22:29:43.921676\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:44.004687\t策略初始化完成\n", "2019-05-02 22:29:44.005664\t开始回放历史数据\n", "2019-05-02 22:29:45.120941\t历史数据回放结束\n", "2019-05-02 22:29:45.121918\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:45.126801\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:45.126801\t开始计算策略统计指标\n", "2019-05-02 22:29:45.137543\t开始加载历史数据\n", "2019-05-02 22:29:45.138520\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:45.216648\t策略初始化完成\n", "2019-05-02 22:29:45.217624\t开始回放历史数据\n", "2019-05-02 22:29:46.272352\t历史数据回放结束\n", "2019-05-02 22:29:46.272352\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:46.277235\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:46.278212\t开始计算策略统计指标\n", "2019-05-02 22:29:46.289931\t开始加载历史数据\n", "2019-05-02 22:29:46.289931\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:46.372942\t策略初始化完成\n", "2019-05-02 22:29:46.372942\t开始回放历史数据\n", "2019-05-02 22:29:47.500915\t历史数据回放结束\n", "2019-05-02 22:29:47.501892\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:47.507751\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:47.507751\t开始计算策略统计指标\n", "2019-05-02 22:29:47.519471\t开始加载历史数据\n", "2019-05-02 22:29:47.519471\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:47.590762\t策略初始化完成\n", "2019-05-02 22:29:47.590762\t开始回放历史数据\n", "2019-05-02 22:29:48.230435\t历史数据回放结束\n", "2019-05-02 22:29:48.231412\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:48.231412\t成交记录为空,无法计算\n", "2019-05-02 22:29:48.231412\t开始计算策略统计指标\n", "2019-05-02 22:29:48.231412\t开始加载历史数据\n", "2019-05-02 22:29:48.231412\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:48.315400\t策略初始化完成\n", "2019-05-02 22:29:48.315400\t开始回放历史数据\n", "2019-05-02 22:29:49.317391\t历史数据回放结束\n", "2019-05-02 22:29:49.317391\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:49.323251\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:49.323251\t开始计算策略统计指标\n", "2019-05-02 22:29:49.335947\t开始加载历史数据\n", "2019-05-02 22:29:49.335947\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:49.416028\t策略初始化完成\n", "2019-05-02 22:29:49.416028\t开始回放历史数据\n", "2019-05-02 22:29:50.513726\t历史数据回放结束\n", "2019-05-02 22:29:50.513726\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:50.519586\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:50.519586\t开始计算策略统计指标\n", "2019-05-02 22:29:50.531305\t开始加载历史数据\n", "2019-05-02 22:29:50.531305\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:50.610410\t策略初始化完成\n", "2019-05-02 22:29:50.611386\t开始回放历史数据\n", "2019-05-02 22:29:51.688576\t历史数据回放结束\n", "2019-05-02 22:29:51.689553\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:51.694436\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:51.695412\t开始计算策略统计指标\n", "2019-05-02 22:29:51.707131\t开始加载历史数据\n", "2019-05-02 22:29:51.708108\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:51.804791\t策略初始化完成\n", "2019-05-02 22:29:51.807721\t开始回放历史数据\n", "2019-05-02 22:29:53.077301\t历史数据回放结束\n", "2019-05-02 22:29:53.078278\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:53.083161\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:53.083161\t开始计算策略统计指标\n", "2019-05-02 22:29:53.094880\t开始加载历史数据\n", "2019-05-02 22:29:53.094880\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:53.182774\t策略初始化完成\n", "2019-05-02 22:29:53.183751\t开始回放历史数据\n", "2019-05-02 22:29:54.420126\t历史数据回放结束\n", "2019-05-02 22:29:54.421103\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:54.425986\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:54.425986\t开始计算策略统计指标\n", "2019-05-02 22:29:54.437705\t开始加载历史数据\n", "2019-05-02 22:29:54.437705\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:54.517786\t策略初始化完成\n", "2019-05-02 22:29:54.517786\t开始回放历史数据\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "2019-05-02 22:29:55.671151\t历史数据回放结束\n", "2019-05-02 22:29:55.672127\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:55.677010\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:55.677987\t开始计算策略统计指标\n", "2019-05-02 22:29:55.689706\t开始加载历史数据\n", "2019-05-02 22:29:55.689706\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:55.767834\t策略初始化完成\n", "2019-05-02 22:29:55.767834\t开始回放历史数据\n", "2019-05-02 22:29:56.790334\t历史数据回放结束\n", "2019-05-02 22:29:56.790334\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:56.796194\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:56.796194\t开始计算策略统计指标\n", "2019-05-02 22:29:56.806937\t开始加载历史数据\n", "2019-05-02 22:29:56.807913\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:56.889948\t策略初始化完成\n", "2019-05-02 22:29:56.890924\t开始回放历史数据\n", "2019-05-02 22:29:57.607749\t历史数据回放结束\n", "2019-05-02 22:29:57.608725\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:57.608725\t成交记录为空,无法计算\n", "2019-05-02 22:29:57.608725\t开始计算策略统计指标\n", "2019-05-02 22:29:57.608725\t开始加载历史数据\n", "2019-05-02 22:29:57.609702\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:57.698572\t策略初始化完成\n", "2019-05-02 22:29:57.699549\t开始回放历史数据\n", "2019-05-02 22:29:58.882212\t历史数据回放结束\n", "2019-05-02 22:29:58.882212\t开始计算逐日盯市盈亏\n", "2019-05-02 22:29:58.888071\t逐日盯市盈亏计算完成\n", "2019-05-02 22:29:58.888071\t开始计算策略统计指标\n", "2019-05-02 22:29:58.898814\t开始加载历史数据\n", "2019-05-02 22:29:58.898814\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:29:58.986708\t策略初始化完成\n", "2019-05-02 22:29:58.987684\t开始回放历史数据\n", "2019-05-02 22:30:00.071710\t历史数据回放结束\n", "2019-05-02 22:30:00.072687\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:00.077570\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:00.081476\t开始计算策略统计指标\n", "2019-05-02 22:30:00.092219\t开始加载历史数据\n", "2019-05-02 22:30:00.095149\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:00.173277\t策略初始化完成\n", "2019-05-02 22:30:00.174253\t开始回放历史数据\n", "2019-05-02 22:30:00.906703\t历史数据回放结束\n", "2019-05-02 22:30:00.907680\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:00.907680\t成交记录为空,无法计算\n", "2019-05-02 22:30:00.908657\t开始计算策略统计指标\n", "2019-05-02 22:30:00.908657\t开始加载历史数据\n", "2019-05-02 22:30:00.908657\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:01.018036\t策略初始化完成\n", "2019-05-02 22:30:01.019012\t开始回放历史数据\n", "2019-05-02 22:30:02.128430\t历史数据回放结束\n", "2019-05-02 22:30:02.135266\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:02.141126\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:02.141126\t开始计算策略统计指标\n", "2019-05-02 22:30:02.151868\t开始加载历史数据\n", "2019-05-02 22:30:02.152845\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:02.229020\t策略初始化完成\n", "2019-05-02 22:30:02.229020\t开始回放历史数据\n", "2019-05-02 22:30:03.410706\t历史数据回放结束\n", "2019-05-02 22:30:03.411682\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:03.416565\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:03.416565\t开始计算策略统计指标\n", "2019-05-02 22:30:03.428285\t开始加载历史数据\n", "2019-05-02 22:30:03.429261\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:03.533757\t策略初始化完成\n", "2019-05-02 22:30:03.533757\t开始回放历史数据\n", "2019-05-02 22:30:04.638292\t历史数据回放结束\n", "2019-05-02 22:30:04.638292\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:04.643175\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:04.644152\t开始计算策略统计指标\n", "2019-05-02 22:30:04.654894\t开始加载历史数据\n", "2019-05-02 22:30:04.654894\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:04.738882\t策略初始化完成\n", "2019-05-02 22:30:04.738882\t开始回放历史数据\n", "2019-05-02 22:30:05.721341\t历史数据回放结束\n", "2019-05-02 22:30:05.722318\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:05.728178\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:05.728178\t开始计算策略统计指标\n", "2019-05-02 22:30:05.739897\t开始加载历史数据\n", "2019-05-02 22:30:05.739897\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:05.824861\t策略初始化完成\n", "2019-05-02 22:30:05.825838\t开始回放历史数据\n", "2019-05-02 22:30:06.928419\t历史数据回放结束\n", "2019-05-02 22:30:06.928419\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:06.933302\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:06.934279\t开始计算策略统计指标\n", "2019-05-02 22:30:06.945998\t开始加载历史数据\n", "2019-05-02 22:30:06.945998\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:07.024126\t策略初始化完成\n", "2019-05-02 22:30:07.025102\t开始回放历史数据\n", "2019-05-02 22:30:08.041743\t历史数据回放结束\n", "2019-05-02 22:30:08.042720\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:08.048579\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:08.048579\t开始计算策略统计指标\n", "2019-05-02 22:30:08.062252\t开始加载历史数据\n", "2019-05-02 22:30:08.062252\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:08.145263\t策略初始化完成\n", "2019-05-02 22:30:08.145263\t开始回放历史数据\n", "2019-05-02 22:30:09.292768\t历史数据回放结束\n", "2019-05-02 22:30:09.293744\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:09.298627\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:09.298627\t开始计算策略统计指标\n", "2019-05-02 22:30:09.311323\t开始加载历史数据\n", "2019-05-02 22:30:09.311323\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:09.393357\t策略初始化完成\n", "2019-05-02 22:30:09.393357\t开始回放历史数据\n", "2019-05-02 22:30:10.363121\t历史数据回放结束\n", "2019-05-02 22:30:10.363121\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:10.368981\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:10.369957\t开始计算策略统计指标\n", "2019-05-02 22:30:10.380700\t开始加载历史数据\n", "2019-05-02 22:30:10.381677\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:10.459805\t策略初始化完成\n", "2019-05-02 22:30:10.459805\t开始回放历史数据\n", "2019-05-02 22:30:11.536994\t历史数据回放结束\n", "2019-05-02 22:30:11.536994\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:11.542854\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:11.542854\t开始计算策略统计指标\n", "2019-05-02 22:30:11.554573\t开始加载历史数据\n", "2019-05-02 22:30:11.554573\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:11.638561\t策略初始化完成\n", "2019-05-02 22:30:11.639537\t开始回放历史数据\n", "2019-05-02 22:30:12.632740\t历史数据回放结束\n", "2019-05-02 22:30:12.633716\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:12.638599\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:12.639576\t开始计算策略统计指标\n", "2019-05-02 22:30:12.650318\t开始加载历史数据\n", "2019-05-02 22:30:12.651295\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:12.733329\t策略初始化完成\n", "2019-05-02 22:30:12.734306\t开始回放历史数据\n", "2019-05-02 22:30:13.352494\t历史数据回放结束\n", "2019-05-02 22:30:13.353470\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:13.353470\t成交记录为空,无法计算\n", "2019-05-02 22:30:13.353470\t开始计算策略统计指标\n", "2019-05-02 22:30:13.354447\t开始加载历史数据\n", "2019-05-02 22:30:13.354447\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:13.436481\t策略初始化完成\n", "2019-05-02 22:30:13.436481\t开始回放历史数据\n", "2019-05-02 22:30:14.540039\t历史数据回放结束\n", "2019-05-02 22:30:14.541016\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:14.546876\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:14.546876\t开始计算策略统计指标\n", "2019-05-02 22:30:14.558595\t开始加载历史数据\n", "2019-05-02 22:30:14.558595\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:14.650395\t策略初始化完成\n", "2019-05-02 22:30:14.650395\t开始回放历史数据\n", "2019-05-02 22:30:15.294951\t历史数据回放结束\n", "2019-05-02 22:30:15.294951\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:15.294951\t成交记录为空,无法计算\n", "2019-05-02 22:30:15.294951\t开始计算策略统计指标\n", "2019-05-02 22:30:15.294951\t开始加载历史数据\n", "2019-05-02 22:30:15.294951\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:15.377962\t策略初始化完成\n", "2019-05-02 22:30:15.377962\t开始回放历史数据\n", "2019-05-02 22:30:16.346749\t历史数据回放结束\n", "2019-05-02 22:30:16.346749\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:16.352609\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:16.352609\t开始计算策略统计指标\n", "2019-05-02 22:30:16.365305\t开始加载历史数据\n", "2019-05-02 22:30:16.365305\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:16.445386\t策略初始化完成\n", "2019-05-02 22:30:16.446363\t开始回放历史数据\n", "2019-05-02 22:30:17.544061\t历史数据回放结束\n", "2019-05-02 22:30:17.545038\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:17.550897\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:17.550897\t开始计算策略统计指标\n", "2019-05-02 22:30:17.563593\t开始加载历史数据\n", "2019-05-02 22:30:17.563593\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:17.640744\t策略初始化完成\n", "2019-05-02 22:30:17.640744\t开始回放历史数据\n", "2019-05-02 22:30:18.641759\t历史数据回放结束\n", "2019-05-02 22:30:18.642736\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:18.647619\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:18.647619\t开始计算策略统计指标\n", "2019-05-02 22:30:18.659338\t开始加载历史数据\n", "2019-05-02 22:30:18.660315\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:18.736490\t策略初始化完成\n", "2019-05-02 22:30:18.736490\t开始回放历史数据\n", "2019-05-02 22:30:19.827352\t历史数据回放结束\n", "2019-05-02 22:30:19.828328\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:19.833211\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:19.833211\t开始计算策略统计指标\n", "2019-05-02 22:30:19.844931\t开始加载历史数据\n", "2019-05-02 22:30:19.845907\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:19.927942\t策略初始化完成\n", "2019-05-02 22:30:19.928918\t开始回放历史数据\n", "2019-05-02 22:30:20.916261\t历史数据回放结束\n", "2019-05-02 22:30:20.916261\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:20.922120\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:20.922120\t开始计算策略统计指标\n", "2019-05-02 22:30:20.934816\t开始加载历史数据\n", "2019-05-02 22:30:20.935793\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:21.010991\t策略初始化完成\n", "2019-05-02 22:30:21.011968\t开始回放历史数据\n", "2019-05-02 22:30:22.131151\t历史数据回放结束\n", "2019-05-02 22:30:22.131151\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:22.137011\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:22.137011\t开始计算策略统计指标\n", "2019-05-02 22:30:22.149707\t开始加载历史数据\n", "2019-05-02 22:30:22.149707\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:22.227835\t策略初始化完成\n", "2019-05-02 22:30:22.228811\t开始回放历史数据\n", "2019-05-02 22:30:23.201505\t历史数据回放结束\n", "2019-05-02 22:30:23.202481\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:23.207364\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:23.207364\t开始计算策略统计指标\n", "2019-05-02 22:30:23.219084\t开始加载历史数据\n", "2019-05-02 22:30:23.219084\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:23.295258\t策略初始化完成\n", "2019-05-02 22:30:23.295258\t开始回放历史数据\n", "2019-05-02 22:30:24.418348\t历史数据回放结束\n", "2019-05-02 22:30:24.418348\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:24.423231\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:24.424208\t开始计算策略统计指标\n", "2019-05-02 22:30:24.437880\t开始加载历史数据\n", "2019-05-02 22:30:24.437880\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:24.517962\t策略初始化完成\n", "2019-05-02 22:30:24.517962\t开始回放历史数据\n", "2019-05-02 22:30:25.200605\t历史数据回放结束\n", "2019-05-02 22:30:25.201582\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:25.201582\t成交记录为空,无法计算\n", "2019-05-02 22:30:25.202558\t开始计算策略统计指标\n", "2019-05-02 22:30:25.202558\t开始加载历史数据\n", "2019-05-02 22:30:25.203535\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:25.275803\t策略初始化完成\n", "2019-05-02 22:30:25.276780\t开始回放历史数据\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "2019-05-02 22:30:25.947704\t历史数据回放结束\n", "2019-05-02 22:30:25.948681\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:25.948681\t成交记录为空,无法计算\n", "2019-05-02 22:30:25.949657\t开始计算策略统计指标\n", "2019-05-02 22:30:25.949657\t开始加载历史数据\n", "2019-05-02 22:30:25.949657\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:26.027785\t策略初始化完成\n", "2019-05-02 22:30:26.027785\t开始回放历史数据\n", "2019-05-02 22:30:27.024894\t历史数据回放结束\n", "2019-05-02 22:30:27.025870\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:27.030753\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:27.030753\t开始计算策略统计指标\n", "2019-05-02 22:30:27.042473\t开始加载历史数据\n", "2019-05-02 22:30:27.042473\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:27.127437\t策略初始化完成\n", "2019-05-02 22:30:27.128413\t开始回放历史数据\n", "2019-05-02 22:30:28.317912\t历史数据回放结束\n", "2019-05-02 22:30:28.317912\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:28.323772\t逐日盯市盈亏计算完成\n", "2019-05-02 22:30:28.324748\t开始计算策略统计指标\n", "2019-05-02 22:30:28.335491\t开始加载历史数据\n", "2019-05-02 22:30:28.336468\t历史数据加载完成,数据量:18240\n", "2019-05-02 22:30:28.412642\t策略初始化完成\n", "2019-05-02 22:30:28.413619\t开始回放历史数据\n", "2019-05-02 22:30:29.072824\t历史数据回放结束\n", "2019-05-02 22:30:29.072824\t开始计算逐日盯市盈亏\n", "2019-05-02 22:30:29.072824\t成交记录为空,无法计算\n", "2019-05-02 22:30:29.072824\t开始计算策略统计指标\n", "gen\tnevals\tmean \tstd \tmin \tmax \n", "0 \t100 \t[1.24452619]\t[2.90495733]\t[-3.24204978]\t[8.88922512]\n" ] }, { "ename": "ValueError", "evalue": "empty range for randrange() (1,1, 0)", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)", "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[0;32m 3\u001b[0m \u001b[0msetting\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0madd_parameter\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"atr_length\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m3\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m105\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 5\u001b[1;33m \u001b[0mengine\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrun_ga_optimization\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msetting\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[1;32mC:\\Github\\vnpy\\vnpy\\app\\cta_strategy\\backtesting.py\u001b[0m in \u001b[0;36mrun_ga_optimization\u001b[1;34m(self, optimization_setting, output)\u001b[0m\n\u001b[0;32m 602\u001b[0m \u001b[0mNGEN\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 603\u001b[0m \u001b[0mstats\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 604\u001b[1;33m \u001b[0mhalloffame\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mhof\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 605\u001b[0m ) \n\u001b[0;32m 606\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\miniconda3\\lib\\site-packages\\deap\\algorithms.py\u001b[0m in \u001b[0;36meaMuPlusLambda\u001b[1;34m(population, toolbox, mu, lambda_, cxpb, mutpb, ngen, stats, halloffame, verbose)\u001b[0m\n\u001b[0;32m 316\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mgen\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mngen\u001b[0m \u001b[1;33m+\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 317\u001b[0m \u001b[1;31m# Vary the population\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 318\u001b[1;33m \u001b[0moffspring\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mvarOr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mpopulation\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mtoolbox\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mlambda_\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcxpb\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mmutpb\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 319\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 320\u001b[0m \u001b[1;31m# Evaluate the individuals with an invalid fitness\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\miniconda3\\lib\\site-packages\\deap\\algorithms.py\u001b[0m in \u001b[0;36mvarOr\u001b[1;34m(population, toolbox, lambda_, cxpb, mutpb)\u001b[0m\n\u001b[0;32m 234\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mop_choice\u001b[0m \u001b[1;33m<\u001b[0m \u001b[0mcxpb\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;31m# Apply crossover\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 235\u001b[0m \u001b[0mind1\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mind2\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mlist\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mmap\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mtoolbox\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mclone\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mrandom\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msample\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mpopulation\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m2\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 236\u001b[1;33m \u001b[0mind1\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mind2\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mtoolbox\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmate\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mind1\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mind2\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 237\u001b[0m \u001b[1;32mdel\u001b[0m \u001b[0mind1\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfitness\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mvalues\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 238\u001b[0m \u001b[0moffspring\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mind1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\miniconda3\\lib\\site-packages\\deap\\tools\\crossover.py\u001b[0m in \u001b[0;36mcxTwoPoint\u001b[1;34m(ind1, ind2)\u001b[0m\n\u001b[0;32m 42\u001b[0m \u001b[0msize\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mmin\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mind1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mind2\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 43\u001b[0m \u001b[0mcxpoint1\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mrandom\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrandint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0msize\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 44\u001b[1;33m \u001b[0mcxpoint2\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mrandom\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrandint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0msize\u001b[0m \u001b[1;33m-\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 45\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mcxpoint2\u001b[0m \u001b[1;33m>=\u001b[0m \u001b[0mcxpoint1\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 46\u001b[0m \u001b[0mcxpoint2\u001b[0m \u001b[1;33m+=\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\miniconda3\\lib\\random.py\u001b[0m in \u001b[0;36mrandint\u001b[1;34m(self, a, b)\u001b[0m\n\u001b[0;32m 220\u001b[0m \"\"\"\n\u001b[0;32m 221\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 222\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrandrange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0ma\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mb\u001b[0m\u001b[1;33m+\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 223\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 224\u001b[0m def _randbelow(self, n, int=int, maxsize=1< 200\u001b[1;33m \u001b[1;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"empty range for randrange() (%d,%d, %d)\"\u001b[0m \u001b[1;33m%\u001b[0m \u001b[1;33m(\u001b[0m\u001b[0mistart\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mistop\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mwidth\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 201\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 202\u001b[0m \u001b[1;31m# Non-unit step argument supplied.\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;31mValueError\u001b[0m: empty range for randrange() (1,1, 0)" ] } ], "source": [ "setting = OptimizationSetting()\n", "setting.set_target(\"total_return\")\n", "setting.add_parameter(\"atr_length\", 3, 105, 1)\n", "\n", "engine.run_ga_optimization(setting)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.1" } }, "nbformat": 4, "nbformat_minor": 2 }