def riseStopCheck(self, stocks): # 连续3个涨停板,三个涨停必须满足: 1,连续; 2,只有3个,不能多。 check_period = 10 selected_stocks = [] for stock in stocks: close_prices = history_bars(stock, check_period+1, '1d', 'close') if (Utility.isContinueRiseStop(close_prices, max_co_present=3) and not Utility.isContinueRiseStop(close_prices, max_co_present=4)): selected_stocks.append(stock) self.logger.debug('选出三连板的股票%s' % (stock)) return selected_stocks
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