| | |
| | | 股票代码管理器 |
| | | """ |
| | | import json |
| | | import random |
| | | import time |
| | | |
| | | import constant |
| | |
| | | from ths import l2_listen_pos_health_manager, client_manager |
| | | |
| | | __redisManager = redis_manager.RedisManager(0) |
| | | __db = 0 |
| | | |
| | | |
| | | class CodesNameManager: |
| | |
| | | |
| | | |
| | | def is_in_gp_pool(code): |
| | | return RedisUtils.sismember(__redisManager.getRedis(), "gp_list", code) or FirstGPCodesManager().is_in_first_gp_codes_cache(code) |
| | | return RedisUtils.sismember(__redisManager.getRedis(), "gp_list", |
| | | code) or FirstGPCodesManager().is_in_first_gp_codes_cache(code) |
| | | |
| | | |
| | | def get_gp_list(): |
| | |
| | | return limit_up_price |
| | | |
| | | |
| | | def get_limit_up_price_cache(code): |
| | | if code in __limit_up_price_dict: |
| | | return __limit_up_price_dict[code] |
| | | |
| | | |
| | | return None |
| | | |
| | | |
| | | def get_limit_up_price_by_preprice(price): |
| | | if price is None: |
| | | return None |
| | |
| | | |
| | | # datas:[(code,price)] |
| | | def set_prices(datas): |
| | | pipe = __redisManager.getRedis().pipeline() |
| | | for d in datas: |
| | | code, price = d[0], d[1] |
| | | if code in __current_price_cache and __current_price_cache[code] == price: |
| | | continue |
| | | __current_price_cache[code] = price |
| | | RedisUtils.setex(pipe, "price-{}".format(code), tool.get_expire(), price) |
| | | pipe.execute() |
| | | RedisUtils.setex_async(__db, "price-{}".format(code), tool.get_expire(), price) |
| | | |
| | | |
| | | # 获取正在监听的代码 |