| | |
| | | |
| | | from strategy import data_cache |
| | | from strategy import basic_methods |
| | | from strategy.kpl_data_manager import KPLStockOfMarketsPlateLogManager |
| | | from strategy.kpl_data_manager import KPLMarketsSiftPlateLogManager |
| | | from trade import middle_api_protocol |
| | | from utils import hx_qc_value_util, tool |
| | | |
| | |
| | | return result.get("ListJX") |
| | | |
| | | |
| | | # 获取该概念下的个股代码及其他 |
| | | # 获取该概念下的个股代码及其他 st=100 获取前排100只股票 【获取数量】由于这里直接控制强度的数值数量,暂不轻易修改。目标设定为全部,或100 |
| | | def getCodesByPlate(plate_code): |
| | | data = f"Order=1&a=ZhiShuStockList_W8&st=30&c=ZhiShuRanking&PhoneOSNew=1&old=1&DeviceID=a38adabd-99ef-3116-8bb9-6d893c846e23&VerSion=5.8.0.2&IsZZ=0&Token=0&Index=0&apiv=w32&Type=6&IsKZZType=0&UserID=0&PlateID={plate_code}&" |
| | | data = f"Order=1&a=ZhiShuStockList_W8&st=100&c=ZhiShuRanking&PhoneOSNew=1&old=1&DeviceID=a38adabd-99ef-3116-8bb9-6d893c846e23&VerSion=5.8.0.2&IsZZ=0&Token=0&Index=0&apiv=w32&Type=6&IsKZZType=0&UserID=0&PlateID={plate_code}&" |
| | | return __base_request("https://apphq.longhuvip.com/w1/api/index.php", data=data) |
| | | |
| | | |
| | |
| | | result = __getLimitUpInfo(pid_info[0], i + 1, 20) |
| | | # print("请求用时", time.time() - start_time) |
| | | result = json.loads(result) |
| | | # 分页整理数据 |
| | | datas = result["info"][0] |
| | | results.extend(datas) |
| | | # day = result["info"][1] # 连板天数? |
| | | # 如果小于20条数据就不翻页获取了 |
| | | if len(datas) < 20: |
| | | break |
| | | for r in results: |
| | |
| | | fresults.extend(results) |
| | | |
| | | return json.dumps({"errcode": 0, "list": fresults}) |
| | | # list[0] ==["603590", "康辰药业", 0, "", 1752111048, "医药", 52512348, 77368480, 25028664, 204338626, -179309962, 289345508, "创新药、医药", 3274807418, 8.87, 1, 1, 6.46, "首板", "801045", 5] |
| | | # list[0] ==[股票代码,股票名称,未知0值,未知空值,涨停时间时间戳,涨停原因,封单,最大封单,主力净额,主力买,主力卖,成交额,板块(精选板块),实际流通,实际换手,未知1值,未知1值,振幅,状态,所属板块ID,同板块涨停数量] |
| | | |
| | | |
| | | # 获取涨停信息数据 |
| | | def get_limit_up_info(): |
| | | # 获取涨停信息列表 |
| | | limit_up_info = json.loads(getLimitUpInfoNew())['list'] |
| | | # 初始化统计字典 |
| | | concept_stats = {} |
| | | for stock in limit_up_info: |
| | | # 提取概念名称(可能包含多个概念,用"、"分隔) |
| | | concepts = stock[5].split("、") # 第5个字段是概念 通过"、"分隔转化为字符串 |
| | | is_first_board = stock[18] == "首板" # 第18个字段是板块类型(如"首板") |
| | | |
| | | for concept in concepts: |
| | | if concept not in concept_stats: |
| | | concept_stats[concept] = {"total": 0, "first_board": 0} |
| | | concept_stats[concept]["total"] += 1 |
| | | if is_first_board: |
| | | concept_stats[concept]["first_board"] += 1 |
| | | |
| | | # 转换为目标格式 |
| | | result = [ |
| | | [concept, stats["first_board"], stats["total"]] |
| | | for concept, stats in concept_stats.items() |
| | | ] |
| | | # # 打印结果 |
| | | # for item in result: |
| | | # print(item) |
| | | |
| | | # 按概念下股票总只数降序排序 |
| | | data_cache.limit_up_block_info = sorted(result, key=lambda x: x[2], reverse=True) |
| | | # print(f"{data_cache.limit_up_block_info}") |
| | | |
| | | return limit_up_info |
| | | |
| | | |
| | |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | MarketFelling = getMarketFelling() |
| | | print(f"MarketFelling==={MarketFelling}") |
| | | changeStatistics = changeStatistics() |
| | | print(f"changeStatistics==={changeStatistics}") |
| | | # MarketFelling = getMarketFelling() |
| | | # print(f"MarketFelling==={MarketFelling}") |
| | | # changeStatistics = changeStatistics() |
| | | # print(f"changeStatistics==={changeStatistics}") |
| | | result = getCodesByPlate("801045") |
| | | print(result) |
| | | # print(f"limit_up_info=={limit_up_info}") |
| | | |
| | | # 整理归纳涨停概念信息给GUI用 |
| | | # def get_limit_up_block_info(limit_up_info): |
| | | # # 初始化统计字典 |
| | | # concept_stats = {} |
| | | # |
| | | # for stock in limit_up_info: |
| | | # # 提取概念名称(可能包含多个概念,用"、"分隔) |
| | | # concepts = stock[5].split("、") # 第5个字段是概念 通过"、"分隔转化为字符串 |
| | | # is_first_board = stock[18] == "首板" # 第18个字段是板块类型(如"首板") |
| | | # |
| | | # for concept in concepts: |
| | | # if concept not in concept_stats: |
| | | # concept_stats[concept] = {"total": 0, "first_board": 0} |
| | | # concept_stats[concept]["total"] += 1 |
| | | # if is_first_board: |
| | | # concept_stats[concept]["first_board"] += 1 |
| | | # |
| | | # # 转换为目标格式 |
| | | # result = [ |
| | | # [concept, stats["first_board"], stats["total"]] |
| | | # for concept, stats in concept_stats.items() |
| | | # ] |
| | | # # # 打印结果 |
| | | # # for item in result: |
| | | # # print(item) |
| | | # |
| | | # # 按概念下股票总只数降序排序 |
| | | # data_cache.limit_up_block_info = sorted(result, key=lambda x: x[2], reverse=True) |
| | | # |
| | | # # print(f"{data_cache.limit_up_block_info}") |
| | | # |
| | | # get_limit_up_block_info(limit_up_info) |