Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
A
alpha-mind
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dr.李
alpha-mind
Commits
40967ae5
Commit
40967ae5
authored
Mar 02, 2018
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update example
parent
165e81c0
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
176 additions
and
15426 deletions
+176
-15426
Example 1 - Factor IC analysis.ipynb
notebooks/Example 1 - Factor IC analysis.ipynb
+28
-19
Example 2 - Strategy Analysis.ipynb
notebooks/Example 2 - Strategy Analysis.ipynb
+71
-17
Example 3 - Multi Weight Gap Comparison.ipynb
notebooks/Example 3 - Multi Weight Gap Comparison.ipynb
+62
-1369
Example 4 - Single Factor Analysis.ipynb
notebooks/Example 4 - Single Factor Analysis.ipynb
+15
-14021
No files found.
notebooks/Example 1 - Factor IC analysis.ipynb
View file @
40967ae5
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
"industry_lower = 1.0\n",
"industry_lower = 1.0\n",
"industry_upper = 1.0\n",
"industry_upper = 1.0\n",
"method = 'risk_neutral'\n",
"method = 'risk_neutral'\n",
"neutralize_risk =
['SIZE'] +
industry_styles\n",
"neutralize_risk = industry_styles\n",
"industry_name = 'sw_adj'\n",
"industry_name = 'sw_adj'\n",
"industry_level = 1\n",
"industry_level = 1\n",
"benchmark_total_lower = 0.8\n",
"benchmark_total_lower = 0.8\n",
...
@@ -62,7 +62,7 @@
...
@@ -62,7 +62,7 @@
"\"\"\"\n",
"\"\"\"\n",
"\n",
"\n",
"industry_names = industry_list(industry_name, industry_level)\n",
"industry_names = industry_list(industry_name, industry_level)\n",
"constraint_risk = ['SIZE', 'SIZENL', 'BETA']\n",
"constraint_risk = ['SIZE', 'SIZENL', 'BETA']
+ industry_names
\n",
"total_risk_names = constraint_risk + ['benchmark', 'total']\n",
"total_risk_names = constraint_risk + ['benchmark', 'total']\n",
"\n",
"\n",
"b_type = []\n",
"b_type = []\n",
...
@@ -160,7 +160,7 @@
...
@@ -160,7 +160,7 @@
" factor_values = factor_processing(total_data[alpha_name].values,\n",
" factor_values = factor_processing(total_data[alpha_name].values,\n",
" pre_process=[winsorize_normal, standardize],\n",
" pre_process=[winsorize_normal, standardize],\n",
" risk_factors=risk_exp,\n",
" risk_factors=risk_exp,\n",
" post_process=[winsorize_normal, standardize
, rank
])\n",
" post_process=[winsorize_normal, standardize])\n",
"\n",
"\n",
" # const linear model\n",
" # const linear model\n",
" er = const_model.predict(pd.DataFrame(data={alpha_name[0]: factor_values.flatten()}))\n",
" er = const_model.predict(pd.DataFrame(data={alpha_name[0]: factor_values.flatten()}))\n",
...
@@ -224,8 +224,18 @@
...
@@ -224,8 +224,18 @@
"cell_type": "code",
"cell_type": "code",
"execution_count": 5,
"execution_count": 5,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Wall time: 8.86 s\n"
]
}
],
"source": [
"source": [
"%%time\n",
"\n",
"df = engine.fetch_factor_coverage(start_date='2011-01-01',\n",
"df = engine.fetch_factor_coverage(start_date='2011-01-01',\n",
" end_date='2018-02-12',\n",
" end_date='2018-02-12',\n",
" universe=universe_name[0])\n",
" universe=universe_name[0])\n",
...
@@ -236,17 +246,9 @@
...
@@ -236,17 +246,9 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
6
,
"execution_count":
null
,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"Wall time: 1h 25min 5s\n"
]
}
],
"source": [
"source": [
"%%time\n",
"%%time\n",
"\n",
"\n",
...
@@ -274,7 +276,7 @@
...
@@ -274,7 +276,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
7
,
"execution_count":
null
,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
...
@@ -287,26 +289,33 @@
...
@@ -287,26 +289,33 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
8
,
"execution_count":
null
,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
"with pd.ExcelWriter(f'{universe_name[0]}_{benchmark_code}.xlsx', engine='xlsxwriter') as writer:\n",
"with pd.ExcelWriter(f'{universe_name[0]}_{benchmark_code}.xlsx', engine='xlsxwriter') as writer:\n",
" factor_df.to_excel(writer, sheet_name='ret')\n",
" factor_df.to_excel(writer, sheet_name='ret')\n",
"
factor_res
.to_excel(writer, sheet_name='ic')\n",
"
ic_df
.to_excel(writer, sheet_name='ic')\n",
" factor_
df
.to_excel(writer, sheet_name='ret_stat')\n",
" factor_
res
.to_excel(writer, sheet_name='ret_stat')\n",
" ic_res.to_excel(writer, sheet_name='ic_stat')"
" ic_res.to_excel(writer, sheet_name='ic_stat')"
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
9
,
"execution_count":
null
,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
"client.close()"
"client.close()"
]
]
},
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": null,
"execution_count": null,
...
...
notebooks/Example 2 - Strategy Analysis.ipynb
View file @
40967ae5
This source diff could not be displayed because it is too large. You can
view the blob
instead.
notebooks/Example 3 - Multi Weight Gap Comparison.ipynb
View file @
40967ae5
This diff is collapsed.
Click to expand it.
notebooks/Example 4 - Single Factor Analysis.ipynb
View file @
40967ae5
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment