text: 
  import pandas as pd
  import hiquant as hq
  
  class StrategyMultiFactor( hq.BasicStrategy ):
      def __init__(self, fund):
          super().__init__(fund, __file__)
  
      def schedule_task(self, trader):
          trader.run_daily(self.daily_task, None, time='03:00')
          trader.run_daily(self.trade, None, time='09:30')
          trader.run_on_bar_update(self.trade, None)
  
      def daily_task(self, param = None):
          d = self.fund.market.current_date
          self.daily(param)   # every day
          if d.weekday() == 0:    # monday of every week
              self.weekly(param)
          if d.day == 1:          # first day of every onth
              self.monthly(param)
              if d.month % 3 == 1:    # first day of every quarter
                  self.quarterly(param)
              if d.month == 1:        # first day of every year
                  self.yearly(param)
  
      def daily(self,param = None):
          pass
  
      def weekly(self, param = None):
          pass
  
      def monthly(self, param = None):
          pass
  
      def quarterly(self, param = None):
          pass
  
      def yearly(self, param = None):
          pass
  
      def select_stock(self):
          stock_df = pd.read_csv('stockpool/t0_white_horse_20.csv', dtype=str)
          if self.fund.verbose:
              print(stock_df)
          return stock_df['symbol'].tolist()
  
      def gen_trade_signal(self, symbol, init_data = False):
          market = self.fund.market
          if init_data:
              df = market.get_daily(symbol)
          else:
              df = market.get_daily(symbol, end = market.current_date, count = 26+9)
  
          dif, dea, macd_hist = hq.MACD(df.close, fast=12, slow=26, signal=9)
          signal = pd.Series( hq.CROSS(dif, dea), index=df.index )
  
          # Notice!!! Important !!!
          # if we used the close price of the day to calc indicator,
          # to avoid "future data or function" in backtesting, it should not be used for today's trading
          # either we trade at 14:30 before market close
          # or, shift(1) and trade next morning
          return signal.shift(1).fillna(0)
  
      def get_signal_comment(self, symbol, signal):
          return 'MACD 金叉' if (signal > 0) else 'MACD 死叉'
  
  def init(fund):
      strategy = StrategyMultiFactor(fund)
  
  if __name__ == '__main__':
      backtest_args = dict(
          #start_cash= 1000000.00,
          date_start= hq.date_from_str('6 months ago'),
          #date_end= hq.date_from_str('yesterday'),
          #out_file= 'output/demo.png',
          #parallel= True,
          compare_index= 'sh000300',
      )
      hq.backtest_strategy( StrategyMultiFactor, **backtest_args )
  