From 63df682b36955113788fd4da32416b91ab27e147 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期一, 09 十月 2023 18:08:36 +0800 Subject: [PATCH] 输出调整 --- output/code_info_output.py | 202 -------------------------------------------------- 1 files changed, 2 insertions(+), 200 deletions(-) diff --git a/output/code_info_output.py b/output/code_info_output.py index c86442d..f937c86 100644 --- a/output/code_info_output.py +++ b/output/code_info_output.py @@ -41,7 +41,6 @@ return f"<head><style>{base_output_content['css']}</style></head>" - def money_desc(money): if abs(money) > 100000000: return f"{round(money / 100000000, 2)}浜�" @@ -87,7 +86,6 @@ l2_data_util.load_l2_data(code) total_datas = l2_data_util.local_today_datas.get(code) if is_target_code: - params["score_data"] = {} limit_up_price = gpcode_manager.get_limit_up_price(code) limit_up_time = limit_up_time_manager.LimitUpTimeManager().get_limit_up_time_cache(code) volume_rate, volume_info = code_volumn_manager.get_volume_rate(code, True) @@ -95,148 +93,6 @@ True) ################################涔板墠璇勫垎################################ - # ["鎹㈡墜閲忚兘", "绔炰环寮哄害", "璧勯噾鍔涘害", "K绾垮舰鎬�", "鍘嗗彶鑲℃��", "鏉垮潡鐑害", "涓婃澘鏃堕棿", "甯傚�煎ぇ灏�","鑲′环澶у皬"] - - # 鎹㈡墜閲忚兘 - # 鑾峰彇褰撳墠閲忎俊鎭� - max_60, yest = code_volumn_manager.get_histry_volumn(code) - today = code_volumn_manager.get_today_volumn(code) - params["score_data"]["volume"] = {"score": score_list[6], "now": f"{round(int(today) / 1000000, 2)}", - "high": {"num": round(max_60[0] / 1000000, 2), "date": max_60[1]}, - "rate": round(score_source_list[6] * 100, 2)} - - # 绔炰环寮哄害 - params["score_data"]["bidding"] = {"score": score_list[2], - "money": (score_source_list[2] if score_source_list[2] else 0)} - - # 璧勯噾鍔涘害 - deal_indexes = set() - deal_info = "" - params["score_data"]["deal_big_money"] = {"score": score_list[8], "money": score_source_list[8][0] // 10000, - "base_money": score_source_list[8][1] // 10000, - "rate": round(score_source_list[8][0] / score_source_list[8][1], 2)} - if deal_indexes: - temps = [] - for index in deal_indexes: - temps.append(int(index)) - temps.sort() - start_index = temps[0] - end_index = temps[-1] - try: - deal_info = f"銆恵total_datas[start_index]['val']['time']}&{total_datas[start_index]['val']['num']}鎵�-{total_datas[end_index]['val']['time']}&{total_datas[end_index]['val']['num']}鎵嬨��," - except: - pass - params["score_data"]["deal_big_money"]["start"] = {"time": total_datas[start_index]['val']['time'], - "num": total_datas[start_index]['val']['num']} - params["score_data"]["deal_big_money"]["end"] = {"time": total_datas[end_index]['val']['time'], - "num": total_datas[end_index]['val']['num']} - - # K绾垮舰鎬� - k_score = 0 - k_source = [] - for k in score_list[3]: - k_score += k - - # (15涓氦鏄撴棩鏄惁娑ㄥ箙24.9%,鏄惁鐮村墠楂橈紝鏄惁瓒呰穼锛屾槸鍚︽帴杩戝墠楂橈紝鏄惁N,鏄惁V) - for k in range(0, len(score_source_list[3])): - if k == 0: - if score_source_list[3][k][0]: - k_source.append(("娑ㄥ箙杩囬珮", score_list[3][k])) - elif k == 1: - if score_source_list[3][k][0]: - k_source.append(("绐佺牬鍓嶉珮", score_list[3][k])) - elif k == 2: - if score_source_list[3][k][0]: - k_source.append(("瓒呰穼琛ユ定", score_list[3][k])) - elif k == 3: - if score_source_list[3][k][0]: - k_source.append((f"閫艰繎鍓嶉珮-{score_source_list[3][k][1]}銆�", score_list[3][k])) - elif k == 4: - if score_source_list[3][k][0]: - k_source.append(("N瀛楀瀷", score_list[3][k])) - elif k == 5: - if score_source_list[3][k][0]: - k_source.append(("V瀛楀瀷", score_list[3][k])) - elif k == 6: - if not score_source_list[3][k][0]: - k_source.append(("涓嶆弧瓒充换浣曞舰鎬�", score_list[3][k])) - elif k == 7: - if score_source_list[3][k][0]: - k_source.append(("澶╅噺澶ч槼", score_list[3][k])) - - params["score_data"]["k_form"] = {"score": k_score, "datas": k_source} - - log.logger_debug.info(f"K绾垮舰鎬佽�楁椂锛歿time.time() - __start_time}") - __start_time = time.time() - - # 鍘嗗彶鑲℃�� - nature_score = 0 - nature_source = [] - for k in score_list[4]: - nature_score += k - - code_nature_datas = {"score": nature_score, "limit_up_count": score_source_list[4][0]} - - for n in range(0, len(score_source_list[4])): - if n == 0: - nature_source.append(f"娑ㄥ仠娆℃暟銆恵score_source_list[4][n]}銆�") - elif n == 1: - if score_source_list[4][n]: - nature_source.append(f"棣栨澘婧环鐜囥�恵round(score_source_list[4][n], 2)}銆�") - code_nature_datas["first_limit_up_yijia"] = round(score_source_list[4][1], 2) - else: - nature_source.append(f"鏃犻鏉�") - code_nature_datas["first_limit_up_yijia"] = "鏃犻鏉�" - elif n == 2: - if score_source_list[4][n]: - nature_source.append(f"棣栨澘鐐告澘婧环鐜囥�恵round(score_source_list[4][n], 2)}銆�") - code_nature_datas["first_open_limit_up_yijia"] = round(score_source_list[4][2], 2) - else: - nature_source.append(f"鏃犻鏉跨偢鏉�") - code_nature_datas["first_open_limit_up_yijia"] = "鏃犻鏉跨偢鏉�" - - params["score_data"]["code_nature"] = code_nature_datas - - log.logger_debug.info(f"鍘嗗彶鑲℃�ц�楁椂锛歿time.time() - __start_time}") - __start_time = time.time() - - # 鏉垮潡鐑害 - hot_block_score = 0 - for k in score_list[5]: - hot_block_score += k - hot_block_source_data = score_source_list[5] - for k in hot_block_source_data: - hot_block = { - # 鐩爣鏉垮潡淇℃伅锛堟澘鍧楀悕绉�,鏉垮潡娑ㄥ箙,鍘嗗彶鏉垮潡鍑虹幇娆℃暟锛� - "target_block_info": ("鏃犳澘鍧�", 0, 0), - # 娑ㄥ仠椤哄簭 - "limit_up_index": 0, - # 娑ㄥ仠浠g爜鏁伴噺 - "limit_up_codes_count": 0, - # 鏉垮潡浠g爜娑ㄥ箙淇℃伅 - "block_codes_rates_info": (0, 0), - # 鐐告澘浠g爜鏁伴噺 - "break_size": 0, - # 鐐告澘鍥炲皝鏁伴噺 - "re_limit_up_size": 0, - # 楂樹綅鐗堜俊鎭� - "high_block_infos": [], - } - params["score_data"]["hot_block"] = {"score": hot_block_score, - "limit_up_index": hot_block_source_data['limit_up_index'] + 1, - "block_name": hot_block_source_data['target_block_info'][0], - "limit_up_count": hot_block_source_data['limit_up_codes_count'], - "block_history_count": hot_block_source_data['target_block_info'][2], - "open_limit_up_count": hot_block_source_data['break_size']} - - # 涓婃澘鏃堕棿 - params["score_data"]["limit_up_time"] = {"score": score_list[7], "time": score_source_list[7]} - # 甯傚�煎ぇ灏� - params["score_data"]["zyltgb"] = {"score": score_list[0], "value": round(score_source_list[0] / 100000000, 2)} - # 鑲′环澶у皬 - params["score_data"]["limit_up_price"] = {"score": score_list[1], "price": score_source_list[1]} - - params["score_data"]["total_score"] = score # zyltgb, limit_price, bidding, k_form, code_nature, hot_block, volume_rate, limit_up_time, # deal_big_money @@ -298,7 +154,7 @@ # buy_params_info.append("鏈瘑鍒�") pass else: - if trade_progress<len(total_datas): + if trade_progress < len(total_datas): data = total_datas[trade_progress] params["trade_data"]["trade_progress"] = {"time": data['val']['time'], "num": data['val']['num'], "money": round( @@ -525,61 +381,7 @@ return break_time, records_new, records_new_data + if __name__ == '__main__': plate_info = kpl_api.getStockIDPlate("600748") print(plate_info) - -if __name__ == '__main__1': - datas = { - "base_url": "http://192.168.3.122/kp/", - "code_name": "澶╁煙鐢熸�� 002255", - "score_data": {"volume": {"score": 20, "now": "12", "high": {"num": "56", "date": "2023-04-13"}}, - "bidding": {"score": 10, "money": "4563"}, - "deal_big_money": {"score": 10, "money": 0, "base_money": 456.5, - "start": {"time": "09:00:00", "num": 1456}, - "end": {"time": "09:00:00", "num": 1456}}, - "k_form": {"score": 10, "datas": ["鐮村墠楂�", "瓒呰穼琛ユ定", "娑ㄥ箙杩囬珮"]}, - "code_nature": {"score": 10, "data_desc": "娑ㄥ仠娆℃暟2娆�"}, - "hot_block": {"score": 10, "block_name": "褰辫", "limit_up_count": 10, "open_limit_up_count": 2}, - "limit_up_time": {"score": 10, "time": "09:56:00"}, - "zyltgb": {"score": 10, "value": "12.5"}, - "limit_up_price": {"score": 10, "price": "6.35"}, - "total_score": "210" - }, - "trade_data": {"star": {"desc": "琚姩涔板叆", "count": 0}, - "safe_count": {"base": 12, "now": 2}, - "m": {"base": 1200, "now": 1000}, - "big_num": {"base": 10, "now": 2}, - "trade_progress": {"time": "09:12:12", "num": 1111, "money": "12.56"}, - "buy_single": {"time": "09:12:12", "num": 1111, "money": "12.56"}, - "buy_exec": {"time": "09:12:12", "num": 1111, "money": "12.56"}, - - }, - "xgb_code_infos": [{"date": "浠婂ぉ", "blocks": [ - {"name": "褰辫", "limit_up_count": 2, "index": 1, "price": "12.00", "rate": "+10.00%"}, - {"name": "鏂囨梾", "limit_up_count": 3, "index": 2, "price": "12.00", "rate": "+10.00%"}, - ]}], - "initiative_buy_codes": [ - {"name": "娴嬭瘯1", "code": "000123", "score": 125, "limit_up": True, "open_limit_up": True}, - {"name": "娴嬭瘯2", "code": "000123", "score": 125, "limit_up": False, "open_limit_up": True}, - {"name": "娴嬭瘯2", "code": "000123", "score": 125, "limit_up": False, "open_limit_up": True}, - {"name": "娴嬭瘯2", "code": "000123", "score": 125, "limit_up": False, "open_limit_up": False} - ], - "passive_buy_codes": [{"name": "娴嬭瘯1", "code": "000123", "score": 125}, - {"name": "娴嬭瘯2", "code": "000123", "score": 125}, - {"name": "娴嬭瘯2", "code": "000123", "score": 125}, - {"name": "娴嬭瘯2", "code": "000123", "score": 125} - ], - "trade_record": {"open_limit_up": "10:00:03", "records": [ - {"type": 1, "index": 1, "time": "11:00:00", "score": 12}, - {"type": 0, "time": "11:26:00", "desc": "H鎾ゆ挙鍗�"} - ]}, - "xgb_infos": [{"block": {"name": "娴嬭瘯1", "rate": "+12.00%", "limit_up_count": 10}, - "codes": [ - {"limit_up": True, "name": "娴嬭瘯浠g爜", "code": "000654"}, - {"limit_up": True, "name": "娴嬭瘯浠g爜", "code": "000654"}, - {"limit_up": True, "name": "娴嬭瘯浠g爜", "code": "000654"}, - {"limit_up": False, "name": "娴嬭瘯浠g爜", "code": "000654"}, - ]}] - } - print(render(datas)) -- Gitblit v1.8.0