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
cae62afe
Commit
cae62afe
authored
Sep 25, 2017
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed models ref_date bug
parent
7dd0bb99
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
1 deletion
+39
-1
api.py
alphamind/api.py
+2
-0
pipeline.py
alphamind/execution/pipeline.py
+36
-0
targetvolexecutor.py
alphamind/execution/targetvolexecutor.py
+1
-1
No files found.
alphamind/api.py
View file @
cae62afe
...
@@ -30,6 +30,7 @@ from alphamind.model.data_preparing import fetch_data_package
...
@@ -30,6 +30,7 @@ from alphamind.model.data_preparing import fetch_data_package
from
alphamind.execution.naiveexecutor
import
NaiveExecutor
from
alphamind.execution.naiveexecutor
import
NaiveExecutor
from
alphamind.execution.thresholdexecutor
import
ThresholdExecutor
from
alphamind.execution.thresholdexecutor
import
ThresholdExecutor
from
alphamind.execution.targetvolexecutor
import
TargetVolExecutor
from
alphamind.utilities
import
alpha_logger
from
alphamind.utilities
import
alpha_logger
...
@@ -57,5 +58,6 @@ __all__ = [
...
@@ -57,5 +58,6 @@ __all__ = [
'load_model'
,
'load_model'
,
'NaiveExecutor'
,
'NaiveExecutor'
,
'ThresholdExecutor'
,
'ThresholdExecutor'
,
'TargetVolExecutor'
,
'alpha_logger'
'alpha_logger'
]
]
\ No newline at end of file
alphamind/execution/pipeline.py
0 → 100644
View file @
cae62afe
# -*- coding: utf-8 -*-
"""
Created on 2017-9-25
@author: cheng.li
"""
from
typing
import
List
from
typing
import
Tuple
import
pandas
as
pd
from
alphamind.execution.baseexecutor
import
ExecutorBase
class
ExecutionPipeline
(
object
):
def
__init__
(
self
,
executors
:
List
[
ExecutorBase
]):
self
.
executors
=
executors
def
execute
(
self
,
target_pos
)
->
Tuple
[
float
,
pd
.
DataFrame
]:
turn_over
,
planed_pos
=
0.
,
target_pos
for
executor
in
self
.
executors
:
turn_over
,
planed_pos
=
executor
.
execute
(
target_pos
)
executed_pos
=
planed_pos
for
executor
in
self
.
executors
:
executor
.
set_current
(
executed_pos
)
return
turn_over
,
executed_pos
def
update
(
self
,
data_dict
):
for
executor
in
self
.
executors
:
executor
.
update
(
data_dict
=
data_dict
)
alphamind/execution/targetvolexecutor.py
View file @
cae62afe
...
@@ -22,7 +22,7 @@ class TargetVolExecutor(ExecutorBase):
...
@@ -22,7 +22,7 @@ class TargetVolExecutor(ExecutorBase):
def
execute
(
self
,
target_pos
:
pd
.
DataFrame
)
->
Tuple
[
float
,
pd
.
DataFrame
]:
def
execute
(
self
,
target_pos
:
pd
.
DataFrame
)
->
Tuple
[
float
,
pd
.
DataFrame
]:
if
not
self
.
m_vol
.
isFull
():
if
not
self
.
m_vol
.
isFull
():
if
self
.
current_pos
.
empty
:
if
self
.
current_pos
.
empty
:
turn_over
=
target_pos
.
abs
()
.
weight
.
sum
()
turn_over
=
target_pos
.
weight
.
abs
()
.
sum
()
else
:
else
:
turn_over
=
self
.
calc_turn_over
(
target_pos
,
self
.
current_pos
)
turn_over
=
self
.
calc_turn_over
(
target_pos
,
self
.
current_pos
)
return
turn_over
,
target_pos
return
turn_over
,
target_pos
...
...
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