| | |
| | | import random |
| | | import time |
| | | |
| | | import authority |
| | | import global_util |
| | | import client_manager |
| | | import redis_manager |
| | | import tool |
| | | import juejin |
| | | import data_process |
| | | import decimal |
| | | |
| | | __redisManager = redis_manager.RedisManager(0) |
| | | |
| | | |
| | | def set_gp_list(gpset): |
| | | # 获取基本信息 |
| | | code_datas = juejin.JueJinManager.get_gp_latest_info(gpset) |
| | | def set_gp_list(code_datas): |
| | | codes = [] |
| | | name_codes = {} |
| | | for _data in code_datas: |
| | |
| | | def set_limit_up_list(gpset): |
| | | if gpset is None: |
| | | return |
| | | # 保存到内存中 |
| | | global_util.add_limit_up_codes(gpset) |
| | | # 获取基本信息 |
| | | redis_instance = __redisManager.getRedis() |
| | | # 删除之前的 |
| | |
| | | return tool.to_price(decimal.Decimal(str(price)) * decimal.Decimal("1.1")) |
| | | |
| | | |
| | | def get_limit_up_price_by_preprice(price): |
| | | if price is None: |
| | | return None |
| | | return tool.to_price(decimal.Decimal(str(price)) * decimal.Decimal("1.1")) |
| | | |
| | | # 获取跌停价 |
| | | def get_limit_down_price(code): |
| | | price = get_price_pre(code) |
| | |
| | | def get_can_listen_pos(client_id=0): |
| | | client_ids = [] |
| | | if client_id <= 0: |
| | | client_ids = data_process.getValidL2Clients() |
| | | client_ids = client_manager.getValidL2Clients() |
| | | else: |
| | | client_ids.append(client_id) |
| | | random.shuffle(client_ids) |
| | |
| | | |
| | | # 监听是否满了 |
| | | def is_listen_full(): |
| | | clients = data_process.getValidL2Clients() |
| | | clients = client_manager.getValidL2Clients() |
| | | codes = get_listen_codes() |
| | | return len(codes) >= 8 * len(clients) |
| | | |