| | |
| | | from urllib.parse import parse_qs |
| | | from output import code_info_output, limit_up_data_filter, output_util, kp_client_msg_manager |
| | | |
| | | from trade import bidding_money_manager, trade_manager, l2_trade_util, trade_record_log_util, trade_constant |
| | | from trade import bidding_money_manager, trade_manager, l2_trade_util, trade_record_log_util, trade_constant, \ |
| | | trade_data_manager |
| | | import concurrent.futures |
| | | |
| | | # 禁用http.server的日志输出 |
| | |
| | | num = total_datas[trade_progress]['val']['num'] |
| | | if dealing_active_info and dealing_info[0] == dealing_active_info[0]: |
| | | if tool.is_sh_code(code): |
| | | num += dealing_active_info[1]//100 |
| | | num += dealing_active_info[1] // 100 |
| | | percent = int(dealing_info[1] / num) |
| | | response_data = json.dumps( |
| | | {"code": 0, "data": {"trade_progress": trade_progress, "is_default": is_default, "percent": percent}}) |
| | |
| | | except Exception as e: |
| | | logger_debug.exception(e) |
| | | |
| | | elif url.path == "/get_account_commission_detail": |
| | | # 获取手续费详情 |
| | | try: |
| | | fdata = {"delegates": {}} |
| | | 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] |
| | | deal_count = trade_data_manager.AccountMoneyManager().get_deal_count() |
| | | fdata["deal"] = {"count": deal_count, "price": 5, "money": round(5 * deal_count, 2)} |
| | | fdata["commission"] = trade_data_manager.AccountMoneyManager().get_commission_cache() |
| | | response_data = json.dumps({"code": 0, "data": fdata}) |
| | | except Exception as e: |
| | | logger_debug.exception(e) |
| | | |
| | | async_log_util.info(logger_request_api, f"结束请求{tool.get_thread_id()}-{url}") |
| | | self.send_response(200) |
| | | # 发给请求客户端的响应数据 |
| | |
| | | self.__kplDataManager.save_data(type_, result_list_) |
| | | except Exception as e: |
| | | logger_debug.exception(e) |
| | | |
| | | # 将"概念"二字替换掉 |
| | | data = data_origin |
| | | type_ = data["type"] |