| | |
| | | return target_volume[0], target_volume[0], target_volume[1].strftime("%Y-%m-%d") |
| | | |
| | | |
| | | # 关闭服务器之前需要同步的数据 |
| | | def sync_data_before_close_server(): |
| | | # 保存运行时数据 |
| | | def save_running_data(): |
| | | HuaXinTransactionDatasProcessor().sync_dealing_data_to_db() |
| | | |
| | | |
| | |
| | | @classmethod |
| | | def compute_big_num_deal_rate(cls, code): |
| | | total_datas = local_today_datas.get(code) |
| | | order_no_map = local_today_buyno_map.get(code) |
| | | # 获取成交大单手数 |
| | | total_deal_nums = DealOrderNoManager().get_deal_nums(code, local_today_buyno_map.get(code)) |
| | | total_deal_nums = DealOrderNoManager().get_deal_nums(code, order_no_map) |
| | | # 获取板上卖手数 |
| | | total_sell_nums = 0 |
| | | sell_indexs = L2LimitUpSellManager().get_limit_up_sell_indexes(code) |
| | |
| | | val = data["val"] |
| | | if l2_data_util.is_big_money(val) and L2DataUtil.is_limit_up_price_buy(val): |
| | | big_money_count += 1 |
| | | DealOrderNoManager().add_orderno(code, deal_info[0]) |
| | | DealOrderNoManager().add_orderno(code, f"{deal_info[0]}") |
| | | # L后是否有成交,如果有成交就需要除去当前笔数,然后重新囊括一笔 |
| | | LCancelBigNumComputer().add_deal_index(code, data["index"], order_begin_pos.buy_single_index) |
| | | if big_money_count > 0: |
| | |
| | | API_TYPE_GET_FROM_DATA_SERVER = "get_from_data_server" # 从数据服务器拉取数据 |
| | | API_TYPE_CODE_TRADE_INFO = "code_trade_info" # 代码交易信息 |
| | | API_TYPE_CODE_L2_LISTEN_ACTIVE_COUNT = "l2_listen_active_count" # L2有效监听数量 |
| | | API_TYPE_SAVE_RUNNING_DATA = "save_running_data" # 保存运行时数据 |
| | | |
| | | |
| | | class ActionCallback(object): |
| | |
| | | pass |
| | | |
| | | def OnGetActiveListenCount(self, client_id, request_id): |
| | | pass |
| | | |
| | | def OnSaveRunningData(self, client_id, request_id): |
| | | pass |
| | | |
| | | |
| | |
| | | cls.action_callback.OnGetCodeTradeInfo(client_id, request_id, data) |
| | | elif content_type == API_TYPE_CODE_L2_LISTEN_ACTIVE_COUNT: |
| | | cls.action_callback.OnGetActiveListenCount(client_id, request_id) |
| | | elif content_type == API_TYPE_SAVE_RUNNING_DATA: |
| | | cls.action_callback.OnSaveRunningData(client_id, request_id) |
| | | |
| | | except Exception as e: |
| | | logging.exception(e) |
| | |
| | | if val is None: |
| | | val = set() |
| | | tool.CodeDataCacheUtil.set_cache(cls.__deal_orderno_cache, code, val) |
| | | |
| | | finally: |
| | | RedisUtils.realse(__redis) |
| | | |
| | |
| | | total_num = 0 |
| | | for orderno in self.__deal_orderno_cache[code]: |
| | | if orderno_map: |
| | | if orderno in orderno_map: |
| | | data = orderno_map[orderno] |
| | | if str(orderno) in orderno_map: |
| | | data = orderno_map[str(orderno)] |
| | | total_num += data["val"]["num"] * data["re"] |
| | | return total_num |
| | | |
| | |
| | | logging.exception(e) |
| | | self.send_response(json.dumps({"code": 1, "msg": f"数据处理出错:{e}"}), client_id, request_id) |
| | | |
| | | def OnSaveRunningData(self, client_id, request_id): |
| | | try: |
| | | inited_data.save_running_data() |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | self.send_response(json.dumps({"code": 1, "msg": f"数据处理出错:{e}"}), client_id, request_id) |
| | | |
| | | |
| | | class MyL2DataCallback(l2_data_transform_protocol.L2DataCallBack): |
| | | def OnL2Order(self, code, datas, timestamp): |