| | |
| | | pre_close_price = round(float(limit_up_price) / tool.get_limit_up_rate(code), 2) |
| | | # 如果涨幅大于7%就读取板块 |
| | | price_rate = (buy_1_price - pre_close_price) / pre_close_price |
| | | if price_rate > 0.07: |
| | | if price_rate > 0.07 * (tool.get_limit_up_rate(code)-1) * 10: |
| | | jx_blocks_info = self.get_jx_blocks_cache(code) |
| | | if not jx_blocks_info: |
| | | start_time = time.time() |
| | |
| | | async_log_util.info(logger_kpl_block_can_buy, |
| | | f"{code}:获取到精选板块(更新)-{blocks} 耗时:{int(time.time() - start_time)}s") |
| | | self.save_jx_blocks(code, blocks, current_limit_up_blocks) |
| | | elif price_rate > 0.03: |
| | | elif price_rate > 0.03 * (tool.get_limit_up_rate(code)-1) * 10: |
| | | # 添加备用板块 |
| | | if not self.get_jx_blocks_cache(code, by=True): |
| | | start_time = time.time() |
| | |
| | | threading.Thread(target=cls.run_limit_up_task, daemon=True).start() |
| | | |
| | | @classmethod |
| | | def run_limit_up_task(cls): |
| | | def run_limit_up_task(cls, limit_up_result_callback): |
| | | # 关闭log |
| | | log.close_print() |
| | | while True: |
| | | try: |
| | | if (tool.is_trade_time() and int(tool.get_now_time_str().replace(':', '')) > int("092530")): |
| | | if (tool.is_trade_time() and int(tool.get_now_time_str().replace(':', '')) > int("092530")) or True: |
| | | results = kpl_api.getLimitUpInfoNew() |
| | | result = json.loads(results) |
| | | start_time = time.time() |
| | | cls.__upload_data("limit_up", result) |
| | | limit_up_result_callback(result) |
| | | except Exception as e: |
| | | try: |
| | | logging.exception(e) |