コード例 #1
0
 def riseStopCheck(self, stocks):
     # 选出日涨停,且不是连续涨停
     check_period = 10
     selected_stocks = []
     for stock in stocks:
         high_prices = history_bars(stock, check_period+1, '1d', 'high')
         close_prices = history_bars(stock, check_period+1, '1d', 'close')
         # 要求收盘价等于最高价,但要求收盘价高于9.95%
         if (Utility.isRiseStopNow(close_prices) and close_prices[-1] == high_prices[-1]
                 and not Utility.isContinueRiseStop(close_prices, max_co_present=2)):
             selected_stocks.append(stock)
             self.logger.debug('选出当日涨停,且不连续涨停的股票%s' % stock)
     return selected_stocks
コード例 #2
0
 def seekBoardCheck(self, sc_dict):
     # 涨停卖出规则:买入条件为打板时,只要不能连续涨停就卖出
     sell_stocks = []
     for stock in sc_dict.keys():
         close = history_bars(stock, self.period, '1d', 'close')
         buy_reason = sc_dict[stock][2]
         if buy_reason == '打板' \
            and not Utility.isRiseStopNow(close):
             sell_stocks.append(stock)
     # 从可卖股票中删除打板股票,以免对后续处理造成影响
     for stock in sell_stocks:
         sc_dict.pop(stock)
     return sell_stocks