def __init__( self, codes=None, the_timestamp: Union[str, pd.Timestamp] = None, start_timestamp: Union[str, pd.Timestamp] = None, end_timestamp: Union[str, pd.Timestamp] = None, columns: List = [ IndexMoneyFlow.net_inflows, IndexMoneyFlow.net_inflow_rate, IndexMoneyFlow.net_main_inflows, IndexMoneyFlow.net_main_inflow_rate ], filters: List = [], order: object = None, limit: int = None, provider: str = 'sina', level: Union[str, IntervalLevel] = IntervalLevel.LEVEL_1DAY, category_field: str = 'entity_id', time_field: str = 'timestamp', keep_all_timestamp: bool = False, fill_method: str = 'ffill', effective_number: int = 10, scorer: Scorer = RankScorer(ascending=True) ) -> None: super().__init__(IndexMoneyFlow, None, 'index', None, codes, the_timestamp, start_timestamp, end_timestamp, columns, filters, order, limit, provider, level, category_field, time_field, keep_all_timestamp, fill_method, effective_number, scorer)
def __init__( self, provider: str = 'sina', entity_provider: str = 'sina', the_timestamp: Union[str, pd.Timestamp] = None, start_timestamp: Union[str, pd.Timestamp] = None, end_timestamp: Union[str, pd.Timestamp] = None, columns: List = [ BlockMoneyFlow.net_inflows, BlockMoneyFlow.net_main_inflows ], category=BlockCategory.industry.value, window=20, scorer: Scorer = RankScorer(ascending=True)) -> None: df = Block.query_data(provider=entity_provider, filters=[Block.category == category]) entity_ids = df['entity_id'].tolist() self.window = window super().__init__(BlockMoneyFlow, Block, provider=provider, entity_provider=entity_provider, entity_ids=entity_ids, the_timestamp=the_timestamp, start_timestamp=start_timestamp, end_timestamp=end_timestamp, columns=columns, scorer=scorer)
def __init__(self, entity_schema: EntityMixin = Stock, provider: str = None, entity_provider: str = None, entity_ids: List[str] = None, exchanges: List[str] = None, codes: List[str] = None, the_timestamp: Union[str, pd.Timestamp] = None, start_timestamp: Union[str, pd.Timestamp] = None, end_timestamp: Union[str, pd.Timestamp] = None, filters: List = None, order: object = None, limit: int = None, level: Union[str, IntervalLevel] = IntervalLevel.LEVEL_1DAY, category_field: str = 'entity_id', time_field: str = 'timestamp', computing_window: int = None, keep_all_timestamp: bool = False, fill_method: str = 'ffill', effective_number: int = None, transformer: Transformer = None, accumulator: Accumulator = None, need_persist: bool = False, dry_run: bool = False) -> None: super().__init__(Stock1dKdata, entity_schema, provider, entity_provider, entity_ids, exchanges, codes, the_timestamp, start_timestamp, end_timestamp, [Stock1dKdata.turnover], filters, order, limit, level, category_field, time_field, computing_window, keep_all_timestamp, fill_method, effective_number, transformer, accumulator, need_persist, dry_run, RankScorer(ascending=True))
class VolFactor(TechnicalFactor, ScoreFactor): scorer = RankScorer(ascending=True) def __init__(self, region: Region, entity_schema: Type[EntityMixin] = Stock, provider: Provider = Provider.Default, entity_ids: List[str] = None, exchanges: List[str] = None, codes: List[str] = None, the_timestamp: Union[str, pd.Timestamp] = None, start_timestamp: Union[str, pd.Timestamp] = None, end_timestamp: Union[str, pd.Timestamp] = None, filters: List = None, order: object = None, limit: int = None, level: Union[str, IntervalLevel] = IntervalLevel.LEVEL_1DAY, category_field: str = 'entity_id', time_field: str = 'timestamp', computing_window: int = None, keep_all_timestamp: bool = False, fill_method: str = 'ffill', effective_number: int = None, transformer: Transformer = None, accumulator: Accumulator = None, need_persist: bool = False, dry_run: bool = False, factor_name: str = None, clear_state: bool = False, not_load_data: bool = False, adjust_type: Union[AdjustType, str] = None) -> None: super().__init__(region, entity_schema, provider, entity_ids, exchanges, codes, the_timestamp, start_timestamp, end_timestamp, ['turnover'], filters, order, limit, level, category_field, time_field, computing_window, keep_all_timestamp, fill_method, effective_number, transformer, accumulator, need_persist, dry_run, factor_name, clear_state, not_load_data, adjust_type) def pre_compute(self): super().pre_compute() self.pipe_df = self.pipe_df[['turnover']]