| | |
| | | logger_debug.exception(e) |
| | | fdata["today_zylt_updated_count"] = -1 |
| | | |
| | | # 获取今日K线的更新数量 |
| | | try: |
| | | dates = HistoryKDatasUtils.get_latest_trading_date_cache(5) |
| | | latest_trading_date = None |
| | | if dates: |
| | | latest_trading_date = dates[0] |
| | | if latest_trading_date is None: |
| | | raise Exception("没有获取到上一个交易日的日期") |
| | | codes = HistoryKDataManager().get_history_bars_codes(latest_trading_date) |
| | | count = len(codes) |
| | | fdata["today_history_k_bar_count"] = count |
| | | except Exception as e: |
| | | logger_debug.exception(e) |
| | | fdata["today_history_k_bar_count"] = -1 |
| | | |
| | | # 获取交易通道 |
| | | result = {"code": 0, "data": fdata, "msg": ""} |
| | | # print("OnGetEnvInfo 成功") |
| | |
| | | # 获取今日已经更新的自由流通量的代码数量 |
| | | count = ZYLTGBUtil.count_today_updated_volume_codes() |
| | | self.send_response({"code": 0, "data": {"count": count}}, client_id, request_id) |
| | | |
| | | elif ctype == "get_history_bars_codes_count": |
| | | # 获取历史K线更新的代码数量 |
| | | dates = HistoryKDatasUtils.get_latest_trading_date_cache(5) |
| | | latest_trading_date = None |
| | | if dates: |
| | | latest_trading_date = dates[0] |
| | | if latest_trading_date is None: |
| | | raise Exception("没有获取到上一个交易日的日期") |
| | | codes = HistoryKDataManager().get_history_bars_codes(latest_trading_date) |
| | | self.send_response({"code": 0, "data": {"count": len(codes)}}, client_id, request_id) |
| | | # 更新代码的K线 |
| | | elif ctype == "update_history_k_bars": |
| | | # 更新历史K线 |
| | | count = history_k_data_manager.update_history_k_bars() |
| | | self.send_response({"code": 0, "data": {"count": count}}, client_id, request_id) |
| | | |
| | | |
| | | self.send_response({"code": 0, "data": {"count": count}, "msg": f"需要更新K线代码数量:{count}"}, client_id, |
| | | request_id) |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | self.send_response({"code": 1, "msg": f"数据处理出错:{e}"}, client_id, request_id) |