Exemple #1
0
    def clear_account(self):
        trader_info = get_trader_info(session=self.session,
                                      trader_name=self.trader_name,
                                      return_type='domain',
                                      limit=1)

        if trader_info:
            self.logger.warning(
                "trader:{} has run before,old result would be deleted".format(
                    self.trader_name))
            clear_trader(session=self.session, trader_name=self.trader_name)
Exemple #2
0
            start_timestamp=start_timestamp,
            end_timestamp=end_timestamp,
            provider='joinquant',
            level=IntervalLevel.LEVEL_1DAY)
        day_selector.add_factor(day_gold_cross_factor)

        # 同时使用日线,周线级别
        self.selectors.append(day_selector)
        self.selectors.append(week_selector)


if __name__ == '__main__':
    start = '2019-01-01'
    end = '2021-01-01'
    trader_name = 'keep_run_trader'
    clear_trader(trader_name=trader_name)
    for time_interval in split_time_interval(start=start, end=end,
                                             interval=40):
        start_timestamp = time_interval[0]
        end_timestamp = time_interval[-1]
        # 成交量
        vol_df = get_top_volume_entities(entity_type='stock',
                                         start_timestamp=next_date(
                                             start_timestamp, -50),
                                         end_timestamp=start_timestamp,
                                         pct=0.3)
        # 机构重仓
        ii_df = get_top_fund_holding_stocks(timestamp=start_timestamp,
                                            pct=0.3,
                                            by='trading')