Ejemplo n.º 1
0
    def init_selectors(self, security_list, security_type, exchanges, codes, start_timestamp, end_timestamp):
        myselector = TargetSelector(security_list=security_list, security_type=security_type, exchanges=exchanges,
                                    codes=codes, start_timestamp=start_timestamp, end_timestamp=end_timestamp,
                                    provider='ccxt', level=TradingLevel.LEVEL_1MIN)

        myselector.add_filter_factor(
            CrossMaFactor(security_list=security_list, security_type=security_type, exchanges=exchanges,
                          codes=codes, start_timestamp=start_timestamp, end_timestamp=end_timestamp, provider='ccxt',
                          level=TradingLevel.LEVEL_1MIN))

        self.selectors.append(myselector)
Ejemplo n.º 2
0
    def init_selectors(self, entity_ids, entity_type, exchanges, codes, start_timestamp, end_timestamp):
        myselector = TargetSelector(entity_ids=entity_ids, entity_type=entity_type, exchanges=exchanges,
                                    codes=codes, start_timestamp=start_timestamp, end_timestamp=end_timestamp,
                                    provider='ccxt', level=IntervalLevel.LEVEL_1MIN)

        myselector.add_filter_factor(
            CrossMaFactor(entity_ids=entity_ids, entity_type=entity_type, exchanges=exchanges,
                          codes=codes, start_timestamp=start_timestamp, end_timestamp=end_timestamp, provider='ccxt',
                          level=IntervalLevel.LEVEL_1MIN))

        self.selectors.append(myselector)
Ejemplo n.º 3
0
 def init_selectors(self, security_list, security_type, exchanges, codes,
                    start_timestamp, end_timestamp):
     my_selector = TargetSelector(security_list=security_list,
                                  security_type=security_type,
                                  exchanges=exchanges,
                                  codes=codes,
                                  start_timestamp=start_timestamp,
                                  end_timestamp=end_timestamp)
     # add the factors
     my_selector \
         .add_filter_factor(BullFactor(security_list=security_list,
                                       security_type=security_type,
                                       exchanges=exchanges,
                                       codes=codes,
                                       start_timestamp=start_timestamp,
                                       end_timestamp=end_timestamp,
                                       level=TradingLevel.LEVEL_1DAY))
     # .add_score_factor(FinanceGrowthFactor(security_list=security_list,
     #                                       security_type=security_type,
     #                                       exchanges=exchanges,
     #                                       codes=codes,
     #                                       start_timestamp=start_timestamp,
     #                                       end_timestamp=end_timestamp,
     #                                       level=TradingLevel.LEVEL_1DAY))
     self.selectors.append(my_selector)
Ejemplo n.º 4
0
    def init_selectors(self, security_list, security_type, exchanges, codes,
                       start_timestamp, end_timestamp):
        myselector = TargetSelector(security_list=security_list,
                                    security_type=security_type,
                                    exchanges=exchanges,
                                    codes=codes,
                                    start_timestamp=start_timestamp,
                                    end_timestamp=end_timestamp)

        myselector.add_filter_factor(
            CrossMaFactor(security_list=security_list,
                          security_type=security_type,
                          exchanges=exchanges,
                          codes=codes,
                          start_timestamp=start_timestamp,
                          end_timestamp=end_timestamp))

        self.selectors.append(myselector)
Ejemplo n.º 5
0
    def init_selectors(self, entity_ids, entity_type, exchanges, codes,
                       start_timestamp, end_timestamp):
        myselector = TargetSelector(entity_ids=entity_ids,
                                    entity_type=entity_type,
                                    exchanges=exchanges,
                                    codes=codes,
                                    start_timestamp=start_timestamp,
                                    end_timestamp=end_timestamp,
                                    provider='joinquant')

        myselector.add_filter_factor(
            BullFactor(entity_ids=entity_ids,
                       entity_type=entity_type,
                       exchanges=exchanges,
                       codes=codes,
                       start_timestamp=start_timestamp,
                       end_timestamp=end_timestamp))

        self.selectors.append(myselector)
Ejemplo n.º 6
0
def test_cross_ma_selector():
    security_list = ['stock_sz_000338']
    security_type = 'stock'
    start_timestamp = '2018-01-01'
    end_timestamp = '2019-06-30'
    my_selector = TargetSelector(security_list=security_list,
                                 security_type=security_type,
                                 start_timestamp=start_timestamp,
                                 end_timestamp=end_timestamp)
    # add the factors
    my_selector \
        .add_filter_factor(CrossMaFactor(security_list=security_list,
                                         security_type=security_type,
                                         start_timestamp=start_timestamp,
                                         end_timestamp=end_timestamp,
                                         level=TradingLevel.LEVEL_1DAY))
    my_selector.run()
    print(my_selector.open_long_df)
    print(my_selector.open_short_df)
    assert 'stock_sz_000338' in my_selector.get_open_short_targets('2018-01-29')
Ejemplo n.º 7
0
def test_cross_ma_selector():
    entity_ids = ['stock_sz_000338']
    entity_type = 'stock'
    start_timestamp = '2018-01-01'
    end_timestamp = '2019-06-30'
    my_selector = TargetSelector(entity_ids=entity_ids,
                                 entity_type=entity_type,
                                 start_timestamp=start_timestamp,
                                 end_timestamp=end_timestamp)
    # add the factors
    my_selector \
        .add_filter_factor(CrossMaFactor(entity_ids=entity_ids,
                                         entity_type=entity_type,
                                         start_timestamp=start_timestamp,
                                         end_timestamp=end_timestamp,
                                         level=IntervalLevel.LEVEL_1DAY, auto_load=True))
    my_selector.run()
    print(my_selector.open_long_df)
    print(my_selector.open_short_df)
    assert 'stock_sz_000338' in my_selector.get_open_short_targets(
        '2018-01-29')
Ejemplo n.º 8
0
 def init_selectors(self, security_list, security_type, exchanges, codes,
                    start_timestamp, end_timestamp):
     my_selector = TargetSelector(security_list=security_list,
                                  security_type=security_type,
                                  exchanges=exchanges,
                                  codes=codes,
                                  start_timestamp=start_timestamp,
                                  end_timestamp=end_timestamp)
     # add the factors
     my_selector \
         .add_filter_factor(CrossMaFactor(security_list=security_list,
                                          security_type=security_type,
                                          exchanges=exchanges,
                                          codes=codes,
                                          start_timestamp=start_timestamp,
                                          end_timestamp=end_timestamp,
                                          level=TradingLevel.LEVEL_1DAY))
     self.selectors.append(my_selector)