コード例 #1
0
    def init_selectors(self,
                       entity_ids,
                       entity_schema,
                       exchanges,
                       codes,
                       start_timestamp,
                       end_timestamp,
                       adjust_type=None):
        myselector = TargetSelector(region=self.region,
                                    entity_ids=entity_ids,
                                    entity_schema=entity_schema,
                                    exchanges=exchanges,
                                    codes=codes,
                                    start_timestamp=start_timestamp,
                                    end_timestamp=end_timestamp,
                                    provider=Provider.JoinQuant)

        myselector.add_filter_factor(
            CrossMaFactor(region=self.region,
                          entity_ids=entity_ids,
                          entity_schema=entity_schema,
                          exchanges=exchanges,
                          codes=codes,
                          start_timestamp=start_timestamp,
                          end_timestamp=end_timestamp,
                          windows=[5, 10],
                          need_persist=False))

        self.selectors.append(myselector)
コード例 #2
0
    def init_selectors(self, entity_ids, entity_schema, exchanges, codes, start_timestamp, end_timestamp,
                       adjust_type=None):
        # 周线策略
        week_selector = TargetSelector(region=self.region, entity_ids=entity_ids, entity_schema=entity_schema,
                                       exchanges=exchanges, codes=codes, start_timestamp=start_timestamp,
                                       end_timestamp=end_timestamp, provider=Provider.JoinQuant,
                                       level=IntervalLevel.LEVEL_1WEEK)
        week_bull_factor = GoldBullFactor(region=self.region, entity_ids=entity_ids, entity_schema=entity_schema,
                                          exchanges=exchanges, codes=codes, start_timestamp=start_timestamp,
                                          end_timestamp=end_timestamp, provider=Provider.JoinQuant,
                                          level=IntervalLevel.LEVEL_1WEEK)
        week_selector.add_filter_factor(week_bull_factor)

        # 日线策略
        day_selector = TargetSelector(region=self.region, entity_ids=entity_ids, entity_schema=entity_schema,
                                      exchanges=exchanges, codes=codes, start_timestamp=start_timestamp,
                                      end_timestamp=end_timestamp, provider=Provider.JoinQuant,
                                      level=IntervalLevel.LEVEL_1DAY)
        cross_ma_factor = CrossMaFactor(region=self.region, entity_ids=entity_ids, entity_schema=entity_schema,
                                        exchanges=exchanges, codes=codes, start_timestamp=start_timestamp,
                                        end_timestamp=end_timestamp, provider=Provider.JoinQuant,
                                        level=IntervalLevel.LEVEL_1DAY, windows=[5, 250])

        day_selector.add_filter_factor(cross_ma_factor)

        self.selectors.append(week_selector)
        self.selectors.append(day_selector)
コード例 #3
0
ファイル: ma_trader.py プロジェクト: zvtvz/zvt
    def init_selectors(self,
                       entity_ids,
                       entity_schema,
                       exchanges,
                       codes,
                       start_timestamp,
                       end_timestamp,
                       adjust_type=None):
        myselector = TargetSelector(
            entity_ids=entity_ids,
            entity_schema=entity_schema,
            exchanges=exchanges,
            codes=codes,
            start_timestamp=start_timestamp,
            end_timestamp=end_timestamp,
            provider="joinquant",
        )

        myselector.add_factor(
            CrossMaFactor(
                entity_ids=entity_ids,
                entity_schema=entity_schema,
                exchanges=exchanges,
                codes=codes,
                start_timestamp=start_timestamp,
                end_timestamp=end_timestamp,
                windows=[5, 10],
                need_persist=False,
            ))

        self.selectors.append(myselector)