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
9928de58
Commit
9928de58
authored
May 17, 2017
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added more test for linear build
parent
ee85a1c4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
test_linearbuild.py
alphamind/tests/portfolio/test_linearbuild.py
+18
-0
No files found.
alphamind/tests/portfolio/test_linearbuild.py
View file @
9928de58
...
@@ -31,6 +31,24 @@ class TestLinearBuild(unittest.TestCase):
...
@@ -31,6 +31,24 @@ class TestLinearBuild(unittest.TestCase):
expected_risk
=
np
.
zeros
(
self
.
risk_exp
.
shape
[
1
])
expected_risk
=
np
.
zeros
(
self
.
risk_exp
.
shape
[
1
])
np
.
testing
.
assert_array_almost_equal
(
calc_risk
,
expected_risk
)
np
.
testing
.
assert_array_almost_equal
(
calc_risk
,
expected_risk
)
def
test_linear_build_with_inequality_constraints
(
self
):
bm
=
self
.
bm
/
self
.
bm
.
sum
()
eplson
=
1e-6
status
,
value
,
w
=
linear_build
(
self
.
er
,
0.
,
0.01
,
self
.
risk_exp
,
bm
,
risk_target
=
(
-
1e-2
,
1e-2
))
self
.
assertEqual
(
status
,
'optimal'
)
self
.
assertAlmostEqual
(
np
.
sum
(
w
),
1.
)
self
.
assertTrue
(
np
.
all
(
w
<=
0.01
+
eplson
))
self
.
assertTrue
(
np
.
all
(
w
>=
-
eplson
))
calc_risk
=
(
w
-
bm
)
@
self
.
risk_exp
/
np
.
abs
(
bm
@
self
.
risk_exp
)
self
.
assertTrue
(
np
.
all
(
np
.
abs
(
calc_risk
)
<=
1e-2
))
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
\ No newline at end of file
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