Unverified Commit f1709d16 authored by iLampard's avatar iLampard Committed by GitHub

Merge pull request #3 from alpha-miner/master

merge update
parents 945f80e0 5a734318
......@@ -670,6 +670,12 @@ class Experimental(Base):
ep_q = Column(Float(53))
ep_q_d_1w = Column(Float(53))
ev = Column(Float(53))
liq = Column(Float(53))
pure_liq_0 = Column(Float(53))
pure_liq_1 = Column(Float(53))
pure_liq_2 = Column(Float(53))
pure_liq_3 = Column(Float(53))
pure_liq_4 = Column(Float(53))
class FactorMaster(Base):
......
......@@ -18,10 +18,11 @@ from alphamind.data.dbmodel.models import Gogoal
from alphamind.data.dbmodel.models import Experimental
from alphamind.data.dbmodel.models import LegacyFactor
from alphamind.data.dbmodel.models import Tiny
from alphamind.data.dbmodel.models import RiskExposure
from alphamind.data.engines.industries import INDUSTRY_MAPPING
factor_tables = [Uqer, Gogoal, Experimental, LegacyFactor, Tiny]
factor_tables = [RiskExposure, Uqer, Gogoal, Experimental, LegacyFactor, Tiny]
def _map_risk_model_table(risk_model: str) -> tuple:
......
......@@ -50,13 +50,6 @@
"target_vol = 0.05\n",
"risk_model = 'short'\n",
"\n",
"if risk_model == 'day':\n",
" risk_model_name = 'd_srisk'\n",
"elif risk_model == 'short':\n",
" risk_model_name = 's_srisk'\n",
"else:\n",
" risk_model_name = 'l_srisk'\n",
"\n",
"executor = NaiveExecutor()\n",
"ref_dates = makeSchedule(start_date, end_date, freq, 'china.sse')\n",
"engine = SqlEngine(data_source)"
......@@ -182,7 +175,7 @@
" \n",
" risk_exposure = res[all_styles].values\n",
" risk_cov = risk_cov[all_styles].values\n",
" special_risk = res[risk_model_name].values\n",
" special_risk = res.srisk.values\n",
" sec_cov = risk_exposure @ risk_cov @ risk_exposure.T / 10000 + np.diag(special_risk ** 2) / 10000\n",
"\n",
" benchmark_w = res.weight.values\n",
......
......@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
......@@ -15,7 +15,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
......@@ -24,7 +24,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
......@@ -64,32 +64,9 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Scale(n) time(ms) feval min(x) max(x) sum(x) x(0) + x(1)\n",
"200 39.72 -0.82 0.000000 0.010000 1.000000 0.015\n",
"400 25.20 -1.28 0.000000 0.010000 1.000000 0.015\n",
"600 29.23 -1.54 0.000000 0.010000 1.000000 0.015\n",
"800 32.27 -1.63 0.000000 0.010000 1.000000 0.015\n",
"1000 15.13 -1.72 0.000000 0.010000 1.000000 0.015\n",
"1200 16.79 -1.81 0.000000 0.010000 1.000000 0.015\n",
"1400 18.62 -1.90 0.000000 0.010000 1.000000 0.015\n",
"1600 20.90 -1.96 0.000000 0.010000 1.000000 0.015\n",
"1800 24.02 -2.03 0.000000 0.010000 1.000000 0.015\n",
"2000 27.05 -2.06 0.000000 0.010000 1.000000 0.015\n",
"2200 28.04 -2.07 0.000000 0.010000 1.000000 0.015\n",
"2400 30.25 -2.13 0.000000 0.010000 1.000000 0.015\n",
"2600 31.96 -2.14 0.000000 0.010000 1.000000 0.015\n",
"2800 34.44 -2.16 0.000000 0.010000 1.000000 0.015\n",
"3000 36.86 -2.19 0.000000 0.010000 1.000000 0.015\n"
]
}
],
"outputs": [],
"source": [
"print(\"{0:<8}{1:>12}{2:>12}{3:>12}{4:>12}{5:>12}{6:>15}\".format('Scale(n)', 'time(ms)', 'feval', 'min(x)', 'max(x)', 'sum(x)', 'x(0) + x(1)'))\n",
"\n",
......@@ -101,7 +78,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
......@@ -124,32 +101,9 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Scale(n) time(ms) feval min(x) max(x) sum(x) x(0) + x(1)\n",
"200 2.95 -0.82 0.000000 0.010000 1.000000 0.015\n",
"400 2.34 -1.28 0.000000 0.010000 1.000000 0.015\n",
"600 2.44 -1.54 0.000000 0.010000 1.000000 0.015\n",
"800 2.91 -1.63 0.000000 0.010000 1.000000 0.015\n",
"1000 7.58 -1.72 0.000000 0.010000 1.000000 0.015\n",
"1200 3.89 -1.81 0.000000 0.010000 1.000000 0.015\n",
"1400 4.22 -1.90 0.000000 0.010000 1.000000 0.015\n",
"1600 4.37 -1.96 0.000000 0.010000 1.000000 0.015\n",
"1800 4.81 -2.03 0.000000 0.010000 1.000000 0.015\n",
"2000 4.98 -2.06 0.000000 0.010000 1.000000 0.015\n",
"2200 5.31 -2.07 0.000000 0.010000 1.000000 0.015\n",
"2400 6.13 -2.13 0.000000 0.010000 1.000000 0.015\n",
"2600 6.12 -2.14 0.000000 0.010000 1.000000 0.015\n",
"2800 6.73 -2.16 0.000000 0.010000 1.000000 0.015\n",
"3000 7.39 -2.19 0.000000 0.010000 1.000000 0.015\n"
]
}
],
"outputs": [],
"source": [
"print(\"{0:<8}{1:>12}{2:>12}{3:>12}{4:>12}{5:>12}{6:>15}\".format('Scale(n)', 'time(ms)', 'feval', 'min(x)', 'max(x)', 'sum(x)', 'x(0) + x(1)'))\n",
"\n",
......@@ -162,9 +116,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": []
}
......@@ -186,6 +138,35 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
}
},
"nbformat": 4,
......
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