Administrator
2023-08-01 9f3c35b90dba12d2b746e121fc807a8c8c7da529
code_attribute/gpcode_manager.py
@@ -408,6 +408,19 @@
    return None
__price_pre_cache = {}
# 获取缓存
def get_price_pre_cache(code):
    if code in __price_pre_cache:
        return __price_pre_cache[code]
    val = get_price_pre(code)
    if val:
        __price_pre_cache[code] = val
    return val
# 设置收盘价
def set_price_pre(code, price, force=False):
    codes = get_gp_list()
@@ -583,7 +596,9 @@
        # 获取健康状态
        available_positions_health_states = l2_listen_pos_health_manager.list_health_state(available_positions)
        # 尽量不分配第一个位置
        available_positions_new = sorted(available_positions, key=lambda x: (available_positions_health_states[x], 0 if x[1] ==0 else 1), reverse=True)
        available_positions_new = sorted(available_positions,
                                         key=lambda x: (available_positions_health_states[x], 0 if x[1] == 0 else 1),
                                         reverse=True)
        # available_positions.sort(key=lambda x: available_positions_health_states[x], reverse=True)
        # 取第1个数据
        return available_positions_new[0][0], available_positions_new[0][1]