Administrator
2025-06-03 c4ed4da4ac8b8bc24e0a3ed0e782e9248b4a511c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import json
import logging
 
from log_module.log import logger_debug
from trade import trade_data_manager
from utils import tool
 
if __name__ == "__main__":
    try:
        fdata = {"delegates": {}}
        # 获取本月的手续费
        end_date = tool.get_now_date_str("%Y%m%d")
        start_date = f"{end_date[:6]}01"
        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]
        fdata["delegates"]["buy"] = delegates[0]
        fdata["delegates"]["buy_cancel"] = delegates[1]
        fdata["delegates"]["sell_cancel"] = delegates[2]
        fdata["delegates"]["sell"] = delegates[3]
        deals = trade_data_manager.AccountMoneyManager().get_deal_count_info()
        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()
        print(fdata)
        response_data = json.dumps({"code": 0, "data": fdata})
    except Exception as e:
        logging.exception(e)
        logger_debug.exception(e)