Administrator
2023-12-26 bb8a05fc882f31e55b60a838a01058e2727a0b25
开盘啦减持公告获取
1个文件已修改
46 ■■■■ 已修改文件
third_data/kpl_api.py 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/kpl_api.py
@@ -178,15 +178,39 @@
    return list(set(blocks))
# 获取F10里面的大事件
def __getF10BigReminders(code):
    data = f"a=BigReminder&st=25&apiv=w32&c=StockF10Basic&StockID={code}&PhoneOSNew=1&DeviceID=a38adabd-99ef-3116-8bb8-6d893c846e23&VerSion=5.8.0.2&Index=0&"
    result = __base_request("https://apparticle.longhuvip.com/w1/api/index.php", data=data, timeout=3)
    result = json.loads(result)
    if int(result["errcode"]) == 0:
        return result["info"]
    return None
# 获取股票减持日期
def getCodeReductionDate(code):
    infos = __getF10BigReminders(code)
    if not infos:
        return None
    keys = ["终止", "结束", "结果", "不减持", "完成"]
    for info in infos:
        if info.get("type") == 5:
            title = str(info.get("title"))
            if title.find("减持") < 0:
                continue
            wrong = False
            for k in keys:
                if title.find(k) >= 0:
                    wrong = True
            if wrong:
                continue
            return info.get("date").split(" ")[0]
    return None
if __name__ == "__main__":
    blocks = getCodeBlocks("600713")
    blocks1 = getCodeJingXuanBlocks("600713")
    if len(blocks) > 2:
        # 根据涨幅排序
        blocks.sort(key=lambda x: x[2])
        blocks.reverse()
        datas = []
        for b in blocks:
            if b[2] > 0 and b[1] not in constant.KPL_INVALID_BLOCKS:
                datas.append(b)
        print(datas)
    codes = "000422,000536,000619,000766,000892,001255,001258,001300,002288,002442,002584,002632,002771,002942,300505,300949,600293,600610,600679,600769,603168,603188,603291,603329,603392,603518,603759,603767,603836,603839,603938,605218,688655"
    codes = codes.split(",")
    for code in codes:
        print(code, getCodeReductionDate(code))