Commit cae62afe authored by Dr.李's avatar Dr.李

fixed models ref_date bug

parent 7dd0bb99
...@@ -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
# -*- 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)
...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment