Administrator
2022-09-18 b946684114d097e937b766f986d12c7eea8edce8
juejin.py
@@ -7,6 +7,8 @@
import gm.api as gmapi
import big_money_num_manager
import code_volumn_manager
import global_util
import gpcode_manager
import threading
@@ -41,6 +43,7 @@
# 每日初始化
def everyday_init():
    codes = gpcode_manager.get_gp_list()
    logger_system.info("每日初始化")
    # 载入行业股票代码
    global_util.load_industry()
@@ -50,7 +53,21 @@
    global_util.add_limit_up_codes([], True)
    # 主要获取收盘价
    get_latest_info(None)
    # 获取60天最大量与昨日量
    global_util.today_volumn.clear()
    global_util.max60_volumn.clear()
    global_util.yesterday_volumn.clear()
    volumn_dict = get_volumns(codes)
    for key in volumn_dict:
        code_volumn_manager.set_histry_volumn(key, volumn_dict[key][0], volumn_dict[key][1])
    # 清除大单数据
    global_util.big_money_num.clear()
    # 初始化大单数据
    for code in codes:
        big_money_num_manager.add_num(code, 0)
        big_money_num_manager.expire(code)
    # 清除涨停时间
    global_util.limit_up_time.clear()
def __run_schedule():
    while True:
@@ -170,15 +187,15 @@
    if pricePre is not None:
        rate = round((price - pricePre) * 100 / pricePre, 1)
        if rate >= 7:
            logger_juejin_tick.info("{}-{}-{}",code, price, rate)
            logger_juejin_tick.info("{}-{}-{}", code, price, rate)
            if not gpcode_manager.is_listen(code) and not gpcode_manager.is_operate(
                    code) and not gpcode_manager.is_listen_full():
                L2CodeOperate.get_instance().add_operate(1, code,"现价变化")
                L2CodeOperate.get_instance().add_operate(1, code, "现价变化")
            # 进入监控
        elif rate < 5:
            # 移除监控
            if gpcode_manager.is_listen(code) and not gpcode_manager.is_operate(code):
                L2CodeOperate.get_instance().add_operate(0, code,"现价变化")
                L2CodeOperate.get_instance().add_operate(0, code, "现价变化")
def on_bar(context, bars):
@@ -290,14 +307,14 @@
        volumn = int(result["volume"])
        day = "{:%Y-%m-%d}".format(result["eob"])
        if _fresult.get(code) is None:
            _fresult[code] = {"max_volumn": volumn, "latest_volumn": volumn}
            _fresult[code] = (volumn, volumn)
        if volumn > _fresult[code]["max_volumn"]:
            _fresult[code]["max_volumn"] = volumn;
        _fresult[code]["latest_volumn"] = volumn;
        if volumn > _fresult[code][0]:
            _fresult[code][0] = volumn;
        _fresult[code][1] = volumn;
    return _fresult
if __name__ == '__main__':
    _fresult=get_volumns(["000333","002531"])
    _fresult = get_volumns(["000333", "002531"])
    print(_fresult)