From 178158cf7e540b119607309bef5d391637281bb1 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期五, 09 八月 2024 15:47:32 +0800 Subject: [PATCH] bug修复 --- servers/data_server.py | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-) diff --git a/servers/data_server.py b/servers/data_server.py index 8826192..8282e95 100644 --- a/servers/data_server.py +++ b/servers/data_server.py @@ -715,11 +715,15 @@ # 鑾峰彇鏈湀鐨勬墜缁垂 end_date = tool.get_now_date_str("%Y%m%d") start_date = f"{end_date[:6]}01" - delegates = trade_data_manager.AccountMoneyManager().get_delegated_count_info(start_date, end_date) - deal_count = trade_data_manager.AccountMoneyManager().get_deal_count(start_date, end_date) - cost = sum([round(0.1 * x[1], 2) for x in delegates]) - make = deal_count * 5 - fdata["month_commission"] = round(make - cost, 2) + delegates_month = trade_data_manager.AccountMoneyManager().get_delegated_count_info(start_date, + end_date) + # 鑲$エ锛屼笂璇佸彲杞�� 锛� 娣辫瘉鍙浆鍊� + + deals_month = trade_data_manager.AccountMoneyManager().get_deal_count_info(start_date, end_date) + cost_month = sum([round(0.1 * x[1], 2) for x in delegates_month]) + make_month = 0 + make_month += 5 * deals_month[0][1] + 1 * deals_month[1][1] + 0 * deals_month[2][1] + fdata["month_commission"] = round(make_month - cost_month, 2) # 璁$畻褰撴棩鎵嬬画璐硅鎯� delegates = trade_data_manager.AccountMoneyManager().get_delegated_count_info() delegates = [{"count": x[1], "price": 0.1, "money": round(0.1 * x[1], 2)} for x in delegates] @@ -727,8 +731,11 @@ fdata["delegates"]["buy_cancel"] = delegates[1] fdata["delegates"]["sell_cancel"] = delegates[2] fdata["delegates"]["sell"] = delegates[3] - deal_count = trade_data_manager.AccountMoneyManager().get_deal_count() - fdata["deal"] = {"count": deal_count, "price": 5, "money": round(5 * deal_count, 2)} + deals = trade_data_manager.AccountMoneyManager().get_deal_count() + fdata["deals"] = [] + fdata["deals"]["stock"]={"count": deals[0][1], "price": 5, "money": round(5 * deals[0][1], 2)} + fdata["deals"]["sh_cb"]={"count": deals[1][1], "price": 1, "money": round(1 * deals[1][1], 2)} + fdata["deals"]["sz_cb"]={"count": deals[2][1], "price": 0, "money": round(0 * deals[2][1], 2)} fdata["commission"] = trade_data_manager.AccountMoneyManager().get_commission_cache() response_data = json.dumps({"code": 0, "data": fdata}) except Exception as e: -- Gitblit v1.8.0