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
99b252c3
Commit
99b252c3
authored
Jul 06, 2018
by
wegamekinglc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added with new api
parent
2161714e
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
108 additions
and
119 deletions
+108
-119
optimizers.pyx
alphamind/cython/optimizers.pyx
+3
-7
pfopt
alphamind/pfopt
+1
-1
meanvariancebuilder.py
alphamind/portfolio/meanvariancebuilder.py
+0
-1
strategy.py
alphamind/strategy/strategy.py
+101
-106
test_optimizers.py
alphamind/tests/cython/test_optimizers.py
+0
-4
test_meanvariancebuild.py
alphamind/tests/portfolio/test_meanvariancebuild.py
+3
-0
No files found.
alphamind/cython/optimizers.pyx
View file @
99b252c3
...
@@ -72,7 +72,6 @@ cdef extern from "tvoptimizer.hpp" namespace "pfopt":
...
@@ -72,7 +72,6 @@ cdef extern from "tvoptimizer.hpp" namespace "pfopt":
double*,
double*,
double*,
double*,
double,
double,
double,
int,
int,
double*,
double*,
double*,
double*,
...
@@ -96,8 +95,7 @@ cdef class CVOptimizer:
...
@@ -96,8 +95,7 @@ cdef class CVOptimizer:
cnp.ndarray[double, ndim=2] cons_matrix=None,
cnp.ndarray[double, ndim=2] cons_matrix=None,
double[:] clbound=None,
double[:] clbound=None,
double[:] cubound=None,
double[:] cubound=None,
double target_low=0.0,
double target_vol=1.0,
double target_high=1.0,
cnp.ndarray[double, ndim=2] factor_cov_matrix=None,
cnp.ndarray[double, ndim=2] factor_cov_matrix=None,
cnp.ndarray[double, ndim=2] factor_loading_matrix=None,
cnp.ndarray[double, ndim=2] factor_loading_matrix=None,
double[:] idsync_risk=None):
double[:] idsync_risk=None):
...
@@ -123,8 +121,7 @@ cdef class CVOptimizer:
...
@@ -123,8 +121,7 @@ cdef class CVOptimizer:
&cons[0],
&cons[0],
&clbound[0],
&clbound[0],
&cubound[0],
&cubound[0],
target_low,
target_vol,
target_high,
self.f,
self.f,
&factor_cov[0] if factor_cov is not None else NULL,
&factor_cov[0] if factor_cov is not None else NULL,
&factor_loading[0] if factor_loading is not None else NULL,
&factor_loading[0] if factor_loading is not None else NULL,
...
@@ -139,8 +136,7 @@ cdef class CVOptimizer:
...
@@ -139,8 +136,7 @@ cdef class CVOptimizer:
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
target_low,
target_vol,
target_high,
self.f,
self.f,
&factor_cov[0] if factor_cov is not None else NULL,
&factor_cov[0] if factor_cov is not None else NULL,
&factor_loading[0] if factor_loading is not None else NULL,
&factor_loading[0] if factor_loading is not None else NULL,
...
...
pfopt
@
b78ad8a5
Subproject commit
ffaf2153dfdce380c3d8aa1a69b328ab77665ad3
Subproject commit
b78ad8a55855c448a866f91a3876a271a52d68a1
alphamind/portfolio/meanvariancebuilder.py
View file @
99b252c3
...
@@ -109,7 +109,6 @@ def target_vol_builder(er: np.ndarray,
...
@@ -109,7 +109,6 @@ def target_vol_builder(er: np.ndarray,
cons_mat
,
cons_mat
,
clbound
,
clbound
,
cubound
,
cubound
,
0.
,
vol_target
,
vol_target
,
risk_model
[
'factor_cov'
],
risk_model
[
'factor_cov'
],
risk_model
[
'factor_loading'
],
risk_model
[
'factor_loading'
],
...
...
alphamind/strategy/strategy.py
View file @
99b252c3
This diff is collapsed.
Click to expand it.
alphamind/tests/cython/test_optimizers.py
View file @
99b252c3
...
@@ -116,7 +116,6 @@ class TestOptimizers(unittest.TestCase):
...
@@ -116,7 +116,6 @@ class TestOptimizers(unittest.TestCase):
None
,
None
,
None
,
None
,
None
,
None
,
target_vol
,
target_vol
)
target_vol
)
# check against known good result
# check against known good result
...
@@ -144,7 +143,6 @@ class TestOptimizers(unittest.TestCase):
...
@@ -144,7 +143,6 @@ class TestOptimizers(unittest.TestCase):
cons
,
cons
,
clbound
,
clbound
,
cubound
,
cubound
,
target_vol
,
target_vol
)
target_vol
)
# check against known good result
# check against known good result
...
@@ -173,7 +171,6 @@ class TestOptimizers(unittest.TestCase):
...
@@ -173,7 +171,6 @@ class TestOptimizers(unittest.TestCase):
cons
,
cons
,
clbound
,
clbound
,
cubound
,
cubound
,
0.
,
target_vol
,
target_vol
,
factor_var
,
factor_var
,
factor_load
,
factor_load
,
...
@@ -204,7 +201,6 @@ class TestOptimizers(unittest.TestCase):
...
@@ -204,7 +201,6 @@ class TestOptimizers(unittest.TestCase):
cons
,
cons
,
clbound
,
clbound
,
cubound
,
cubound
,
0.
,
target_vol
)
target_vol
)
# check against known good result
# check against known good result
...
...
alphamind/tests/portfolio/test_meanvariancebuild.py
View file @
99b252c3
...
@@ -57,6 +57,9 @@ class TestMeanVarianceBuild(unittest.TestCase):
...
@@ -57,6 +57,9 @@ class TestMeanVarianceBuild(unittest.TestCase):
status
,
_
,
x
=
mean_variance_builder
(
er
,
model
,
bm
,
lbound
,
ubound
,
None
,
None
,
lam
=
1
)
status
,
_
,
x
=
mean_variance_builder
(
er
,
model
,
bm
,
lbound
,
ubound
,
None
,
None
,
lam
=
1
)
np
.
testing
.
assert_array_almost_equal
(
x
,
np
.
linalg
.
inv
(
cov
)
@
er
)
np
.
testing
.
assert_array_almost_equal
(
x
,
np
.
linalg
.
inv
(
cov
)
@
er
)
def
test_mean_variance_builder_without_constraints_with_factor_model
(
self
):
pass
def
test_mean_variance_builder_with_none_unity_lambda
(
self
):
def
test_mean_variance_builder_with_none_unity_lambda
(
self
):
er
=
np
.
array
([
0.01
,
0.02
,
0.03
])
er
=
np
.
array
([
0.01
,
0.02
,
0.03
])
cov
=
np
.
array
([[
0.02
,
0.01
,
0.02
],
cov
=
np
.
array
([[
0.02
,
0.01
,
0.02
],
...
...
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