Commit e97a8be4 authored by Dr.李's avatar Dr.李

FIX: update all the examples

parent 7223c542
......@@ -69,10 +69,10 @@ def mean_variance_builder(er: np.ndarray,
risk_exposure = risk_model['factor_loading']
if cov is None:
risk = cvxpy.sum_squares(cvxpy.multiply(cvxpy.sqrt(special_risk), w)) \
+ cvxpy.quad_form((w.T * risk_exposure).T, risk_cov)
+ cvxpy.quad_form((w.T @ risk_exposure).T, risk_cov)
else:
risk = cvxpy.quad_form(w, cov)
objective = cvxpy.Minimize(-w.T * er + 0.5 * lam * risk)
objective = cvxpy.Minimize(-w.T @ er + 0.5 * lam * risk)
prob = cvxpy.Problem(objective)
prob.solve(solver='ECOS', feastol=1e-9, abstol=1e-9, reltol=1e-9)
......
......@@ -134,17 +134,17 @@
" warm start: on, polish: on, time_limit: off\n",
"\n",
"iter objective pri res dua res rho time\n",
" 1 -7.8878e+03 4.61e+00 6.68e+04 1.00e-01 1.40e-03s\n",
" 125 -2.4830e+02 3.58e-07 2.76e-05 5.82e-01 4.57e-03s\n",
" 1 -7.8878e+03 4.61e+00 6.68e+04 1.00e-01 1.82e-03s\n",
" 125 -2.4830e+02 3.58e-07 2.76e-05 5.82e-01 5.80e-03s\n",
"\n",
"status: solved\n",
"solution polish: unsuccessful\n",
"number of iterations: 125\n",
"optimal objective: -248.2989\n",
"run time: 5.42e-03s\n",
"run time: 6.87e-03s\n",
"optimal rho estimate: 1.87e+00\n",
"\n",
"Wall time: 49 ms\n"
"Wall time: 38 ms\n"
]
},
{
......@@ -211,9 +211,9 @@
"12 -2.483e+02 -2.483e+02 +3e-07 5e-13 2e-15 1e-10 8e-10 0.9775 1e-04 1 1 1 | 0 0\n",
"\n",
"OPTIMAL (within feastol=5.3e-13, reltol=1.3e-09, abstol=3.2e-07).\n",
"Runtime: 0.015751 seconds.\n",
"Runtime: 0.014540 seconds.\n",
"\n",
"Wall time: 59 ms\n"
"Wall time: 49 ms\n"
]
},
{
......@@ -277,7 +277,7 @@
"12: -2.4829e+02 -2.4831e+02 1e-02 2e-16 4e-16\n",
"13: -2.4830e+02 -2.4830e+02 1e-04 2e-16 1e-15\n",
"Optimal solution found.\n",
"Wall time: 69 ms\n"
"Wall time: 74 ms\n"
]
}
],
......@@ -315,7 +315,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Wall time: 26 ms\n"
"Wall time: 15 ms\n"
]
},
{
......@@ -465,9 +465,9 @@
"output_type": "stream",
"text": [
"Scale(n) cvxpy cvxopt ipopt\n",
"100 0.0320 0.0240 0.0060\n",
"200 0.0360 0.0420 0.0120\n",
"300 0.0440 0.0630 0.0180\n"
"100 0.0320 0.0270 0.0090\n",
"200 0.0370 0.0500 0.0160\n",
"300 0.0430 0.0630 0.0160\n"
]
}
],
......
......@@ -15,7 +15,7 @@
{
"data": {
"text/plain": [
"datetime.datetime(2020, 11, 22, 1, 6, 28, 118072)"
"datetime.datetime(2020, 11, 23, 0, 38, 28, 821914)"
]
},
"execution_count": 1,
......@@ -117,7 +117,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Wall time: 5.93 s\n"
"Wall time: 6.09 s\n"
]
}
],
......@@ -135,14 +135,14 @@
"name": "stderr",
"output_type": "stream",
"text": [
"2020-11-22 01:06:34,553 - ALPHA_MIND - INFO - 2020-01-02 full re-balance: 300\n",
"2020-11-22 01:06:35,020 - ALPHA_MIND - INFO - 2020-01-02 is finished\n",
"2020-11-22 01:06:35,023 - ALPHA_MIND - INFO - 2020-01-16 full re-balance: 300\n",
"2020-11-22 01:06:35,230 - ALPHA_MIND - INFO - 2020-01-16 is finished\n",
"2020-11-22 01:06:35,233 - ALPHA_MIND - INFO - 2020-02-07 full re-balance: 300\n",
"2020-11-22 01:06:35,428 - ALPHA_MIND - INFO - 2020-02-07 is finished\n",
"2020-11-22 01:06:35,432 - ALPHA_MIND - INFO - 2020-02-21 full re-balance: 300\n",
"2020-11-22 01:06:35,711 - ALPHA_MIND - INFO - 2020-02-21 is finished\n"
"2020-11-23 00:38:35,439 - ALPHA_MIND - INFO - 2020-01-02 full re-balance: 300\n",
"2020-11-23 00:38:35,874 - ALPHA_MIND - INFO - 2020-01-02 is finished\n",
"2020-11-23 00:38:35,877 - ALPHA_MIND - INFO - 2020-01-16 full re-balance: 300\n",
"2020-11-23 00:38:36,076 - ALPHA_MIND - INFO - 2020-01-16 is finished\n",
"2020-11-23 00:38:36,080 - ALPHA_MIND - INFO - 2020-02-07 full re-balance: 300\n",
"2020-11-23 00:38:36,276 - ALPHA_MIND - INFO - 2020-02-07 is finished\n",
"2020-11-23 00:38:36,280 - ALPHA_MIND - INFO - 2020-02-21 full re-balance: 300\n",
"2020-11-23 00:38:36,486 - ALPHA_MIND - INFO - 2020-02-21 is finished\n"
]
}
],
......
......@@ -11,7 +11,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
......@@ -35,7 +35,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
......@@ -57,16 +57,16 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"我们使用当期的`[ROE, EPS, ETOP]`因子,来尝试预测未来大概一个月以后的收益。\n",
"我们使用当期的`[\"EMA5D\", \"EMV6D\"]`因子,来尝试预测未来大概一个月以后的收益。\n",
"\n",
"* 训练的股票池为`zz800`;;\n",
"* 训练的股票池为`hs300`;;\n",
"* 因子都经过中性化以及标准化等预处理;\n",
"* 对于线性模型,我们以20个工作日为一个时间间隔,用过去8期的数据作为训练用特征。"
"* 对于线性模型,我们以10个工作日为一个时间间隔,用过去8期的数据作为训练用特征。"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
......@@ -100,7 +100,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
......@@ -111,7 +111,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"outputs": [
{
......@@ -144,7 +144,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
......@@ -157,7 +157,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
......@@ -167,7 +167,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"metadata": {},
"outputs": [
{
......@@ -203,7 +203,7 @@
}
],
"source": [
"print(\"\\nConst. Testing IC: {0:.4f}\".format(const_composer.ic(ref_date=ref_date)[0]))\n",
"print(\"Const. Testing IC: {0:.4f}\".format(const_composer.ic(ref_date=ref_date)[0]))\n",
"print(\"Regression Testing IC: {0:.4f}\".format(regression_composer.ic(ref_date=ref_date)[0]))"
]
},
......@@ -227,7 +227,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 10,
"metadata": {},
"outputs": [
{
......@@ -324,7 +324,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 11,
"metadata": {},
"outputs": [
{
......@@ -373,7 +373,7 @@
"std 0.140552 0.166313"
]
},
"execution_count": 10,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
......@@ -399,7 +399,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
......@@ -416,7 +416,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 13,
"metadata": {},
"outputs": [
{
......@@ -489,7 +489,7 @@
"16 2020-01-02 2010000012 -0.017889"
]
},
"execution_count": 12,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
......@@ -500,21 +500,21 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2020-11-22 01:31:22,196 - ALPHA_MIND - INFO - 2020-01-02 full re-balance: 300\n",
"2020-11-22 01:31:22,210 - ALPHA_MIND - INFO - 2020-01-02 is finished\n",
"2020-11-22 01:31:22,220 - ALPHA_MIND - INFO - 2020-01-16 full re-balance: 300\n",
"2020-11-22 01:31:22,239 - ALPHA_MIND - INFO - 2020-01-16 is finished\n",
"2020-11-22 01:31:22,252 - ALPHA_MIND - INFO - 2020-02-07 full re-balance: 300\n",
"2020-11-22 01:31:22,269 - ALPHA_MIND - INFO - 2020-02-07 is finished\n",
"2020-11-22 01:31:22,280 - ALPHA_MIND - INFO - 2020-02-21 full re-balance: 300\n",
"2020-11-22 01:31:22,297 - ALPHA_MIND - INFO - 2020-02-21 is finished\n"
"2020-11-23 00:39:52,840 - ALPHA_MIND - INFO - 2020-01-02 full re-balance: 300\n",
"2020-11-23 00:39:52,869 - ALPHA_MIND - INFO - 2020-01-02 is finished\n",
"2020-11-23 00:39:52,878 - ALPHA_MIND - INFO - 2020-01-16 full re-balance: 300\n",
"2020-11-23 00:39:52,888 - ALPHA_MIND - INFO - 2020-01-16 is finished\n",
"2020-11-23 00:39:52,897 - ALPHA_MIND - INFO - 2020-02-07 full re-balance: 300\n",
"2020-11-23 00:39:52,909 - ALPHA_MIND - INFO - 2020-02-07 is finished\n",
"2020-11-23 00:39:52,917 - ALPHA_MIND - INFO - 2020-02-21 full re-balance: 300\n",
"2020-11-23 00:39:52,931 - ALPHA_MIND - INFO - 2020-02-21 is finished\n"
]
}
],
......@@ -575,7 +575,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 15,
"metadata": {},
"outputs": [
{
......@@ -584,7 +584,7 @@
"<AxesSubplot:title={'center':'Fixed freq rebalanced: 10b'}>"
]
},
"execution_count": 18,
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
},
......
......@@ -131,19 +131,19 @@
"name": "stderr",
"output_type": "stream",
"text": [
"2020-11-22 01:37:30,583 - ALPHA_MIND - INFO - alpha factor data loading finished ...\n",
"2020-11-22 01:37:30,745 - ALPHA_MIND - INFO - industry data loading finished ...\n",
"2020-11-22 01:37:30,878 - ALPHA_MIND - INFO - benchmark data loading finished ...\n",
"2020-11-22 01:37:31,240 - ALPHA_MIND - INFO - risk_model data loading finished ...\n",
"2020-11-22 01:37:31,909 - ALPHA_MIND - INFO - returns data loading finished ...\n",
"2020-11-22 01:37:32,006 - ALPHA_MIND - INFO - starting backting ...\n",
"2020-11-22 01:37:32,013 - ALPHA_MIND - INFO - alpha models training finished ...\n",
"2020-11-22 01:37:32,018 - ALPHA_MIND - INFO - 2020-01-02 00:00:00 re-balance: 300 codes\n",
"2020-11-22 01:37:32,037 - ALPHA_MIND - INFO - 2020-01-16 00:00:00 re-balance: 300 codes\n",
"2020-11-23 00:40:30,181 - ALPHA_MIND - INFO - alpha factor data loading finished ...\n",
"2020-11-23 00:40:30,383 - ALPHA_MIND - INFO - industry data loading finished ...\n",
"2020-11-23 00:40:30,576 - ALPHA_MIND - INFO - benchmark data loading finished ...\n",
"2020-11-23 00:40:30,944 - ALPHA_MIND - INFO - risk_model data loading finished ...\n",
"2020-11-23 00:40:31,694 - ALPHA_MIND - INFO - returns data loading finished ...\n",
"2020-11-23 00:40:31,795 - ALPHA_MIND - INFO - starting backting ...\n",
"2020-11-23 00:40:31,803 - ALPHA_MIND - INFO - alpha models training finished ...\n",
"2020-11-23 00:40:31,811 - ALPHA_MIND - INFO - 2020-01-02 00:00:00 re-balance: 300 codes\n",
"2020-11-23 00:40:31,828 - ALPHA_MIND - INFO - 2020-01-16 00:00:00 re-balance: 300 codes\n",
"D:\\ProgramData\\Anaconda3\\envs\\alpha-mind\\lib\\site-packages\\cvxpy\\problems\\problem.py:1061: UserWarning: Solution may be inaccurate. Try another solver, adjusting the solver settings, or solve with verbose=True for more information.\n",
" \"Solution may be inaccurate. Try another solver, \"\n",
"2020-11-22 01:37:32,130 - ALPHA_MIND - INFO - 2020-02-07 00:00:00 re-balance: 300 codes\n",
"2020-11-22 01:37:32,218 - ALPHA_MIND - INFO - 2020-02-21 00:00:00 re-balance: 300 codes\n"
"2020-11-23 00:40:31,910 - ALPHA_MIND - INFO - 2020-02-07 00:00:00 re-balance: 300 codes\n",
"2020-11-23 00:40:31,986 - ALPHA_MIND - INFO - 2020-02-21 00:00:00 re-balance: 300 codes\n"
]
}
],
......
......@@ -11,7 +11,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
......@@ -30,7 +30,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
......@@ -51,7 +51,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
......@@ -77,7 +77,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
......@@ -86,44 +86,44 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2020-11-21 15:10:18,028 - ALPHA_MIND - WARNING - winsorize_normal normally should not be done after neutralize\n",
"2020-11-21 15:10:18,038 - ALPHA_MIND - INFO - 2020-01-02 00:00:00 is finished with 300 stocks for BETA\n",
"2020-11-21 15:10:18,041 - ALPHA_MIND - INFO - 2020-01-02 00:00:00 risk_exposure: 3.25829145513029e-31\n",
"2020-11-21 15:10:18,510 - ALPHA_MIND - WARNING - winsorize_normal normally should not be done after neutralize\n",
"2020-11-21 15:10:18,513 - ALPHA_MIND - INFO - 2020-01-16 00:00:00 is finished with 300 stocks for BETA\n",
"2020-11-21 15:10:18,516 - ALPHA_MIND - INFO - 2020-01-16 00:00:00 risk_exposure: 4.602789610027951e-31\n",
"2020-11-21 15:10:19,244 - ALPHA_MIND - WARNING - winsorize_normal normally should not be done after neutralize\n",
"2020-11-21 15:10:19,248 - ALPHA_MIND - INFO - 2020-02-07 00:00:00 is finished with 300 stocks for BETA\n",
"2020-11-21 15:10:19,252 - ALPHA_MIND - INFO - 2020-02-07 00:00:00 risk_exposure: 7.380374200927195e-31\n",
"2020-11-21 15:10:20,041 - ALPHA_MIND - WARNING - winsorize_normal normally should not be done after neutralize\n",
"2020-11-21 15:10:20,046 - ALPHA_MIND - INFO - 2020-02-21 00:00:00 is finished with 300 stocks for BETA\n",
"2020-11-21 15:10:20,052 - ALPHA_MIND - INFO - 2020-02-21 00:00:00 risk_exposure: 1.425987166389731e-31\n",
"2020-11-21 15:10:21,151 - ALPHA_MIND - WARNING - winsorize_normal normally should not be done after neutralize\n",
"2020-11-21 15:10:21,159 - ALPHA_MIND - INFO - 2020-01-02 00:00:00 is finished with 300 stocks for SIZE\n",
"2020-11-21 15:10:21,169 - ALPHA_MIND - INFO - 2020-01-02 00:00:00 risk_exposure: 1.626600676017078e-31\n",
"2020-11-21 15:10:21,952 - ALPHA_MIND - WARNING - winsorize_normal normally should not be done after neutralize\n",
"2020-11-21 15:10:21,961 - ALPHA_MIND - INFO - 2020-01-16 00:00:00 is finished with 300 stocks for SIZE\n",
"2020-11-21 15:10:21,970 - ALPHA_MIND - INFO - 2020-01-16 00:00:00 risk_exposure: 7.114752841729456e-31\n",
"2020-11-21 15:10:22,823 - ALPHA_MIND - WARNING - winsorize_normal normally should not be done after neutralize\n",
"2020-11-21 15:10:22,831 - ALPHA_MIND - INFO - 2020-02-07 00:00:00 is finished with 300 stocks for SIZE\n",
"2020-11-21 15:10:22,839 - ALPHA_MIND - INFO - 2020-02-07 00:00:00 risk_exposure: 2.894999049336361e-31\n",
"2020-11-21 15:10:23,345 - ALPHA_MIND - WARNING - winsorize_normal normally should not be done after neutralize\n",
"2020-11-21 15:10:23,348 - ALPHA_MIND - INFO - 2020-02-21 00:00:00 is finished with 300 stocks for SIZE\n",
"2020-11-21 15:10:23,350 - ALPHA_MIND - INFO - 2020-02-21 00:00:00 risk_exposure: 3.207077036087234e-31\n"
"2020-11-23 00:41:53,439 - ALPHA_MIND - WARNING - winsorize_normal normally should not be done after neutralize\n",
"2020-11-23 00:41:53,445 - ALPHA_MIND - INFO - 2020-01-02 00:00:00 is finished with 300 stocks for BETA\n",
"2020-11-23 00:41:53,447 - ALPHA_MIND - INFO - 2020-01-02 00:00:00 risk_exposure: 4.943553232055517e-31\n",
"2020-11-23 00:41:54,467 - ALPHA_MIND - WARNING - winsorize_normal normally should not be done after neutralize\n",
"2020-11-23 00:41:54,470 - ALPHA_MIND - INFO - 2020-01-16 00:00:00 is finished with 300 stocks for BETA\n",
"2020-11-23 00:41:54,473 - ALPHA_MIND - INFO - 2020-01-16 00:00:00 risk_exposure: 8.396812257213363e-31\n",
"2020-11-23 00:41:55,338 - ALPHA_MIND - WARNING - winsorize_normal normally should not be done after neutralize\n",
"2020-11-23 00:41:55,340 - ALPHA_MIND - INFO - 2020-02-07 00:00:00 is finished with 300 stocks for BETA\n",
"2020-11-23 00:41:55,343 - ALPHA_MIND - INFO - 2020-02-07 00:00:00 risk_exposure: 5.682726866635588e-31\n",
"2020-11-23 00:41:56,058 - ALPHA_MIND - WARNING - winsorize_normal normally should not be done after neutralize\n",
"2020-11-23 00:41:56,061 - ALPHA_MIND - INFO - 2020-02-21 00:00:00 is finished with 300 stocks for BETA\n",
"2020-11-23 00:41:56,063 - ALPHA_MIND - INFO - 2020-02-21 00:00:00 risk_exposure: 9.795355575973521e-32\n",
"2020-11-23 00:41:57,012 - ALPHA_MIND - WARNING - winsorize_normal normally should not be done after neutralize\n",
"2020-11-23 00:41:57,014 - ALPHA_MIND - INFO - 2020-01-02 00:00:00 is finished with 300 stocks for SIZE\n",
"2020-11-23 00:41:57,016 - ALPHA_MIND - INFO - 2020-01-02 00:00:00 risk_exposure: 1.484415398332342e-31\n",
"2020-11-23 00:41:57,794 - ALPHA_MIND - WARNING - winsorize_normal normally should not be done after neutralize\n",
"2020-11-23 00:41:57,796 - ALPHA_MIND - INFO - 2020-01-16 00:00:00 is finished with 300 stocks for SIZE\n",
"2020-11-23 00:41:57,799 - ALPHA_MIND - INFO - 2020-01-16 00:00:00 risk_exposure: 4.379171870810272e-31\n",
"2020-11-23 00:41:58,810 - ALPHA_MIND - WARNING - winsorize_normal normally should not be done after neutralize\n",
"2020-11-23 00:41:58,813 - ALPHA_MIND - INFO - 2020-02-07 00:00:00 is finished with 300 stocks for SIZE\n",
"2020-11-23 00:41:58,815 - ALPHA_MIND - INFO - 2020-02-07 00:00:00 risk_exposure: 2.2500853516126014e-31\n",
"2020-11-23 00:42:00,437 - ALPHA_MIND - WARNING - winsorize_normal normally should not be done after neutralize\n",
"2020-11-23 00:42:00,439 - ALPHA_MIND - INFO - 2020-02-21 00:00:00 is finished with 300 stocks for SIZE\n",
"2020-11-23 00:42:00,442 - ALPHA_MIND - INFO - 2020-02-21 00:00:00 risk_exposure: 1.4975497993984135e-31\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Wall time: 6.91 s\n"
"Wall time: 8.23 s\n"
]
}
],
......@@ -134,7 +134,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
......@@ -147,7 +147,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 7,
"metadata": {},
"outputs": [
{
......@@ -198,7 +198,7 @@
"SIZE 0.941047"
]
},
"execution_count": 16,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
......
......@@ -14,7 +14,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
......@@ -54,7 +54,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 3,
"metadata": {},
"outputs": [
{
......@@ -62,21 +62,21 @@
"output_type": "stream",
"text": [
"Scale(n) time(ms) feval min(x) max(x) sum(x) x(0) + x(1)\n",
"200 23.15 -0.82 -0.000000 0.010000 1.0000000.014999999999355636\n",
"400 29.00 -1.28 -0.000000 0.010000 1.0000000.014999999999977868\n",
"600 31.04 -1.54 -0.000000 0.010000 1.0000000.014999999999630973\n",
"800 37.00 -1.63 -0.000000 0.010000 1.0000000.014999999999937863\n",
"1000 42.99 -1.72 -0.000000 0.010000 1.0000000.014999999999985369\n",
"1200 83.97 -1.81 -0.000000 0.010000 1.0000000.014999999999661145\n",
"1400 121.77 -1.90 -0.000000 0.010000 1.0000000.014999999999617875\n",
"1600 125.93 -1.96 -0.000000 0.010000 1.0000000.01499999999998295\n",
"1800 75.05 -2.03 -0.000000 0.010000 1.0000000.014999999999785373\n",
"2000 45.95 -2.06 -0.000000 0.010000 1.0000000.014999999999994327\n",
"2200 68.05 -2.07 -0.000000 0.010000 1.0000000.014999999999979582\n",
"2400 144.36 -2.13 -0.000000 0.010000 1.0000000.014999999999836155\n",
"2600 140.00 -2.14 -0.000000 0.010000 1.0000000.01499999999985058\n",
"2800 145.48 -2.16 -0.000000 0.010000 1.0000000.014999999999853686\n",
"3000 125.97 -2.19 -0.000000 0.010000 1.0000000.014999999999981861\n"
"200 16.00 -0.82 -0.000000 0.010000 1.0000000.014999999999355636\n",
"400 14.00 -1.28 -0.000000 0.010000 1.0000000.014999999999977868\n",
"600 15.00 -1.54 -0.000000 0.010000 1.0000000.014999999999630973\n",
"800 16.00 -1.63 -0.000000 0.010000 1.0000000.014999999999937863\n",
"1000 20.00 -1.72 -0.000000 0.010000 1.0000000.014999999999985369\n",
"1200 24.00 -1.81 -0.000000 0.010000 1.0000000.014999999999661145\n",
"1400 27.00 -1.90 -0.000000 0.010000 1.0000000.014999999999617875\n",
"1600 36.00 -1.96 -0.000000 0.010000 1.0000000.01499999999998295\n",
"1800 35.03 -2.03 -0.000000 0.010000 1.0000000.014999999999785373\n",
"2000 43.00 -2.06 -0.000000 0.010000 1.0000000.014999999999994327\n",
"2200 36.97 -2.07 -0.000000 0.010000 1.0000000.014999999999979582\n",
"2400 45.00 -2.13 -0.000000 0.010000 1.0000000.014999999999836155\n",
"2600 49.00 -2.14 -0.000000 0.010000 1.0000000.01499999999985058\n",
"2800 59.00 -2.16 -0.000000 0.010000 1.0000000.014999999999853686\n",
"3000 61.00 -2.19 -0.000000 0.010000 1.0000000.014999999999981861\n"
]
}
],
......@@ -91,7 +91,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
......@@ -114,7 +114,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 5,
"metadata": {},
"outputs": [
{
......@@ -122,21 +122,21 @@
"output_type": "stream",
"text": [
"Scale(n) time(ms) feval min(x) max(x) sum(x) x(0) + x(1)\n",
"200 4.00 -0.82 0.000000 0.010000 1.0000000.015000000005429394\n",
"400 5.38 -1.28 0.000000 0.010000 1.0000000.015000000000751215\n",
"600 5.02 -1.54 0.000000 0.010000 1.0000000.01500000000851949\n",
"800 7.89 -1.63 0.000000 0.010000 1.0000000.015000000002481837\n",
"1000 7.97 -1.72 0.000000 0.010000 1.0000000.015000000001100414\n",
"1200 14.04 -1.81 0.000000 0.010000 1.0000000.01500000000548405\n",
"1400 13.85 -1.90 0.000000 0.010000 1.0000000.015000000001956426\n",
"1600 20.96 -1.96 0.000000 0.010000 1.0000000.015000000000082848\n",
"1800 26.95 -2.03 0.000000 0.010000 1.0000000.01500000000204834\n",
"2000 25.59 -2.06 0.000000 0.010000 1.0000000.0150000000008303\n",
"2200 27.25 -2.07 0.000000 0.010000 1.0000000.01500000000729576\n",
"2400 13.10 -2.13 0.000000 0.010000 1.0000000.015000000004022507\n",
"2600 19.00 -2.14 0.000000 0.010000 1.0000000.015000000001118521\n",
"2800 30.60 -2.16 0.000000 0.010000 1.0000000.01500000000064263\n",
"3000 25.00 -2.19 0.000000 0.010000 1.0000000.015000000003030482\n"
"200 2.00 -0.82 0.000000 0.010000 1.0000000.015000000005429394\n",
"400 3.00 -1.28 0.000000 0.010000 1.0000000.015000000000751215\n",
"600 3.00 -1.54 0.000000 0.010000 1.0000000.01500000000851949\n",
"800 5.00 -1.63 0.000000 0.010000 1.0000000.015000000002481837\n",
"1000 9.00 -1.72 0.000000 0.010000 1.0000000.015000000001100414\n",
"1200 7.00 -1.81 0.000000 0.010000 1.0000000.01500000000548405\n",
"1400 7.03 -1.90 0.000000 0.010000 1.0000000.015000000001956426\n",
"1600 7.97 -1.96 0.000000 0.010000 1.0000000.015000000000082848\n",
"1800 8.00 -2.03 0.000000 0.010000 1.0000000.01500000000204834\n",
"2000 10.03 -2.06 0.000000 0.010000 1.0000000.0150000000008303\n",
"2200 15.97 -2.07 0.000000 0.010000 1.0000000.01500000000729576\n",
"2400 16.03 -2.13 0.000000 0.010000 1.0000000.015000000004022507\n",
"2600 13.97 -2.14 0.000000 0.010000 1.0000000.015000000001118521\n",
"2800 17.02 -2.16 0.000000 0.010000 1.0000000.01500000000064263\n",
"3000 17.98 -2.19 0.000000 0.010000 1.0000000.015000000003030482\n"
]
}
],
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -31,24 +31,10 @@
"output_type": "stream",
"text": [
"Optimization status - optimal\n",
"Optimal expect return - 0.750529042208698\n",
"Optimial portfolio weights - [0.1 0.2 0.05 0.4 0.25]\n",
"Initial portfolio weights - [0.1 0.2 0. 0.4 0.3]\n",
"Turn over amount - 0.10000000000050759\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"D:\\ProgramData\\Anaconda3\\envs\\alpha-mind\\lib\\site-packages\\cvxpy\\expressions\\expression.py:550: UserWarning: \n",
"This use of ``*`` has resulted in matrix multiplication.\n",
"Using ``*`` for matrix multiplication has been deprecated since CVXPY 1.1.\n",
" Use ``*`` for matrix-scalar and vector-scalar multiplication.\n",
" Use ``@`` for matrix-matrix and matrix-vector multiplication.\n",
" Use ``multiply`` for elementwise multiplication.\n",
"\n",
" warnings.warn(__STAR_MATMUL_WARNING__, UserWarning)\n"
"Optimal expect return - -0.5259220412385935\n",
"Optimial portfolio weights - [0.11111111 0.38333333 0.22222222 0.11111111 0.17222222]\n",
"Initial portfolio weights - [0.11111111 0.33333333 0.22222222 0.11111111 0.22222222]\n",
"Turn over amount - 0.10000000000058906\n"
]
}
],
......@@ -195,16 +181,7 @@
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"D:\\ProgramData\\Anaconda3\\envs\\alpha-mind\\lib\\importlib\\_bootstrap.py:219: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192 from C header, got 216 from PyObject\n",
" return f(*args, **kwds)\n"
]
}
],
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -15,4 +15,5 @@ scikit-learn
scipy
simpleutils
sqlalchemy
statsmodels
xgboost
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment