| | |
| | | __top_jx_out_blocks = [] |
| | | # 精选板块流入金额 |
| | | __jx_blocks_in_money_dict = {} |
| | | # 市场行情热度,默认为60 |
| | | __market_strong = 60 |
| | | |
| | | @classmethod |
| | | def get_jingxuan_in_block_threshold_count(cls): |
| | | """ |
| | | 获取买精选流入前几 |
| | | @return: |
| | | """ |
| | | score = 60 |
| | | if cls.__market_strong is not None: |
| | | score = int(cls.__market_strong) |
| | | score = score // 10 |
| | | if score >= 10: |
| | | score = 9 |
| | | if score < 6: |
| | | score = 5 |
| | | return score * 2 - 2 |
| | | |
| | | @classmethod |
| | | def set_market_jingxuan_blocks(cls, datas): |
| | |
| | | THRESHOLD_MONEY = min(THRESHOLD_MONEY, 10000) |
| | | THRESHOLD_MONEY = max(THRESHOLD_MONEY, 1000) |
| | | THRESHOLD_MONEY = THRESHOLD_MONEY * 10000 |
| | | # 最大数量 |
| | | MAX_COUNT = cls.get_jingxuan_in_block_threshold_count() |
| | | |
| | | cls.top_in_list_cache = datas |
| | | blocks = set() |
| | |
| | | if has_code: |
| | | count += 1 |
| | | |
| | | if count >= 10: |
| | | if count >= MAX_COUNT: |
| | | break |
| | | # 记录精选流出日志 |
| | | async_log_util.info(logger_kpl_jx_in, f"原数据:{datas[:20]} 板块:{blocks}") |
| | |
| | | # 记录精选流出日志 |
| | | async_log_util.info(logger_kpl_jx_out, f"原数据:{datas[:10]} 板块:{blocks}") |
| | | cls.__top_jx_out_blocks = list(blocks) |
| | | |
| | | @classmethod |
| | | def set_market_strong(cls, strong): |
| | | """ |
| | | 设置市场行情强度 |
| | | @param strong: |
| | | @return: |
| | | """ |
| | | cls.__market_strong = strong |
| | | |
| | | @classmethod |
| | | def get_market_strong(cls): |
| | | return cls.__market_strong |
| | | |
| | | @classmethod |
| | | def get_top_market_jingxuan_blocks(cls): |
| | |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | pass |
| | | RealTimeKplMarketData.set_market_strong(120) |
| | | print(RealTimeKplMarketData.get_jingxuan_in_block_threshold_count()) |