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
9bb86b11
Commit
9bb86b11
authored
Sep 22, 2017
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug
parent
552b014c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
4 deletions
+21
-4
test_naiveexecutor.py
alphamind/tests/execution/test_naiveexecutor.py
+20
-2
test_thresholdexecutor.py
alphamind/tests/execution/test_thresholdexecutor.py
+1
-2
No files found.
alphamind/tests/execution/test_naiveexecutor.py
View file @
9bb86b11
...
...
@@ -12,12 +12,30 @@ from alphamind.execution.naiveexecutor import NaiveExecutor
class
TestNaiveExecutor
(
unittest
.
TestCase
):
@
staticmethod
def
test_naive_executor
():
def
test_naive_executor
(
self
):
target_pos
=
pd
.
DataFrame
({
'code'
:
[
1
,
2
,
3
],
'weight'
:
[
0.2
,
0.3
,
0.5
],
'industry'
:
[
'a'
,
'b'
,
'c'
]})
# 1st round
executor
=
NaiveExecutor
()
turn_over
,
executed_pos
=
executor
.
execute
(
target_pos
)
self
.
assertAlmostEqual
(
turn_over
,
1.0
)
# 2nd round
target_pos
=
pd
.
DataFrame
({
'code'
:
[
1
,
2
,
4
],
'weight'
:
[
0.3
,
0.2
,
0.5
],
'industry'
:
[
'a'
,
'b'
,
'd'
]})
turn_over
,
executed_pos
=
executor
.
execute
(
target_pos
)
self
.
assertAlmostEqual
(
turn_over
,
1.2
)
# 3rd round
target_pos
=
pd
.
DataFrame
({
'code'
:
[
1
,
3
,
4
],
'weight'
:
[
0.3
,
0.2
,
0.5
],
'industry'
:
[
'a'
,
'c'
,
'd'
]})
turn_over
,
executed_pos
=
executor
.
execute
(
target_pos
)
if
__name__
==
'__main__'
:
unittest
.
main
()
\ No newline at end of file
alphamind/tests/execution/test_thresholdexecutor.py
View file @
9bb86b11
...
...
@@ -12,7 +12,6 @@ from alphamind.execution.thresholdexecutor import ThresholdExecutor
class
TestThresholdExecutor
(
unittest
.
TestCase
):
@
staticmethod
def
test_threshold_executor
(
self
):
target_pos
=
pd
.
DataFrame
({
'code'
:
[
1
,
2
,
3
],
'weight'
:
[
0.2
,
0.3
,
0.5
],
...
...
@@ -35,7 +34,7 @@ class TestThresholdExecutor(unittest.TestCase):
self
.
assertTrue
(
executed_pos
.
equals
(
executor
.
current_pos
))
self
.
assertAlmostEqual
(
turn_over
,
1.2
)
# 3
n
d round
# 3
r
d round
target_pos
=
pd
.
DataFrame
({
'code'
:
[
1
,
3
,
4
],
'weight'
:
[
0.3
,
0.2
,
0.5
],
'industry'
:
[
'a'
,
'c'
,
'd'
]})
...
...
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