| | |
| | | def load_target_plate_and_codes(self): |
| | | """ |
| | | 加载目标板块与对应的代码: |
| | | 从最近120个交易日的真正涨停数据中 |
| | | 从最近60个交易日的真正涨停数据中 |
| | | @return: {"板块":[代码]} |
| | | """ |
| | | end_date = self.trade_days[:60][-1] |
| | |
| | | if results: |
| | | results = [x for x in results if |
| | | (tool.is_can_buy_code(x[0]) and x[0] in valid_codes and x[0] not in exclude_codes)] |
| | | max_count = len(results) // 3 if len(results) % 3 == 0 else len(results) // 3 + 1 |
| | | results = results[:max_count] |
| | | # 取前10 |
| | | results = results[:10] |
| | | # 取前1/3且涨停数是前10 |
| | | # max_count = len(results) // 3 if len(results) % 3 == 0 else len(results) // 3 + 1 |
| | | # results = results[:max_count] |
| | | # # 取前10 |
| | | # results = results[:10] |
| | | codes = [x[0] for x in results] |
| | | fresults[kpl_util.filter_block(b)] = codes |
| | | return fresults |
| | |
| | | one_year_ago = (pre_date - datetime.timedelta(days=365)).strftime('%Y-%m-%d') |
| | | pre_date = pre_date.strftime('%Y-%m-%d') |
| | | |
| | | trade_days = self.jueJinLocalApi.get_trading_dates(one_year_ago, pre_date) |
| | | if constant.is_windows(): |
| | | trade_days = self.jueJinLocalApi.get_trading_dates(one_year_ago, pre_date) |
| | | else: |
| | | trade_days = HistoryKDatasUtils.get_trading_dates(one_year_ago, pre_date) |
| | | trade_days.sort(reverse=True) |
| | | trade_days = trade_days[:120] |
| | | return trade_days |
| | |
| | | 加载交易日列表,now_day前120个交易日 |
| | | :return: 交易日列表 |
| | | """ |
| | | next_trade_day = self.jueJinLocalApi.get_next_trading_date(self.now_day) |
| | | if constant.is_windows(): |
| | | next_trade_day = self.jueJinLocalApi.get_next_trading_date(self.now_day) |
| | | else: |
| | | next_trade_day = HistoryKDatasUtils.get_next_trading_date(self.now_day) |
| | | return next_trade_day |
| | | |
| | | def load_target_codes(self): |