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
87a6b547
Commit
87a6b547
authored
Feb 07, 2019
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated quantile analysis
parent
12a4f9d8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
12 deletions
+13
-12
quantileanalysis.py
alphamind/analysis/quantileanalysis.py
+13
-12
No files found.
alphamind/analysis/quantileanalysis.py
View file @
87a6b547
...
...
@@ -35,12 +35,13 @@ def quantile_analysis(factors: pd.DataFrame,
post_process
=
[
standardize
]
er
=
factor_processing
(
factors
.
values
,
pre_process
,
risk_exp
,
post_process
)
@
factor_weights
return
er_quantile_analysis
(
er
,
n_bins
,
dx_return
)
return
er_quantile_analysis
(
er
,
n_bins
,
dx_return
,
**
kwargs
)
def
er_quantile_analysis
(
er
:
np
.
ndarray
,
n_bins
:
int
,
dx_return
:
np
.
ndarray
)
->
np
.
ndarray
:
dx_return
:
np
.
ndarray
,
de_trend
=
False
)
->
np
.
ndarray
:
er
=
er
.
flatten
()
q_groups
=
quantile
(
er
,
n_bins
)
...
...
@@ -52,6 +53,7 @@ def er_quantile_analysis(er: np.ndarray,
total_return
=
group_return
.
sum
()
ret
=
group_return
.
copy
()
if
de_trend
:
resid
=
n_bins
-
1
res_weight
=
1.
/
resid
for
i
,
value
in
enumerate
(
ret
):
...
...
@@ -74,14 +76,13 @@ if __name__ == '__main__':
calculated
=
quantile_analysis
(
f_df
,
x_w
,
r
,
risk_exp
=
risk_exp
,
risk_exp
=
None
,
n_bins
=
n_bins
,
do_neutralize
=
True
,
pre_process
=
[
winsorize_normal
,
standardize
],
post_process
=
[
standardize
])
pre_process
=
[],
#[winsorize_normal, standardize],
post_process
=
[])
#[standardize])
er
=
x_w
@
f_df
.
T
expected
=
er_quantile_analysis
(
er
,
5
,
r
)
er
=
x_w
@
f_df
.
values
.
T
expected
=
er_quantile_analysis
(
er
,
n_bins
,
r
)
print
(
calculated
)
print
(
expected
)
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