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
fd809011
Commit
fd809011
authored
Feb 25, 2018
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove shared data
parent
2578387a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
26 deletions
+14
-26
Example 1 - Factor IC analysis.ipynb
notebooks/Example 1 - Factor IC analysis.ipynb
+14
-26
No files found.
notebooks/Example 1 - Factor IC analysis.ipynb
View file @
fd809011
...
@@ -88,42 +88,30 @@
...
@@ -88,42 +88,30 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
4
,
"execution_count":
null
,
"metadata": {
"metadata": {
"collapsed": true
"collapsed": true
},
},
"outputs": [],
"outputs": [],
"source": [
"source": [
"\"\"\"\n",
"def factor_analysis(engine, factor_name, universe, benchmark_code, positive):\n",
"Shared data\n",
"\"\"\"\n",
"\n",
"\n",
"index_return = engine.fetch_dx_return_index_range(benchmark_code, start_date, end_date, horizon=horizon,\n",
" \"\"\"\n",
" Model phase: we need 1 constant linear model and one linear regression model\n",
" \"\"\"\n",
" \n",
" index_return = engine.fetch_dx_return_index_range(benchmark_code, start_date, end_date, horizon=horizon,\n",
" offset=1).set_index('trade_date')\n",
" offset=1).set_index('trade_date')\n",
"\n",
"\n",
"codes_return = engine.fetch_dx_return_range(universe,\n",
"
codes_return = engine.fetch_dx_return_range(universe,\n",
" dates=ref_dates,\n",
" dates=ref_dates,\n",
" horizon=horizon,\n",
" horizon=horizon,\n",
" offset=1)\n",
" offset=1)\n",
"\n",
"\n",
"return_groups = codes_return.groupby('trade_date')\n",
" return_groups = codes_return.groupby('trade_date')\n",
"industry_total = engine.fetch_industry_matrix_range(universe, dates=ref_dates, category=industry_name, level=industry_level)\n",
" industry_total = engine.fetch_industry_matrix_range(universe, dates=ref_dates, category=industry_name, level=industry_level)\n",
"industry_groups = industry_total.groupby('trade_date')"
" industry_groups = industry_total.groupby('trade_date')\n",
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def factor_analysis(engine, factor_name, universe, benchmark_code, positive):\n",
"\n",
"\n",
" \"\"\"\n",
" Model phase: we need 1 constant linear model and one linear regression model\n",
" \"\"\"\n",
" alpha_name = [str(factor_name) + '_' + ('pos' if positive else 'neg')]\n",
" alpha_name = [str(factor_name) + '_' + ('pos' if positive else 'neg')]\n",
" simple_expression = LAST(factor_name) if positive else -LAST(factor_name)\n",
" simple_expression = LAST(factor_name) if positive else -LAST(factor_name)\n",
"\n",
"\n",
...
...
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