| | |
| | | if current_delegates: |
| | | for c in current_delegates: |
| | | if int(c["direction"]) != huaxin_util.TORA_TSTP_D_Buy: |
| | | continue |
| | | continue |
| | | codes_set.add(c["securityID"]) |
| | | if code not in codes_set: |
| | | # 没有挂单 |
| | |
| | | response_data = json.dumps({"code": 0, "data": fdata}) |
| | | elif url.path == "/get_want_buy_detail_list": |
| | | # 获取想买单详细信息 |
| | | |
| | | history_limit_up_datas = LimitUpDataConstant.history_limit_up_datas |
| | | codes = set() |
| | | if history_limit_up_datas: |
| | | codes |= set([x[3] for x in history_limit_up_datas]) |
| | | want_codes = gpcode_manager.WantBuyCodesManager().list_code_cache() |
| | | if want_codes: |
| | | codes |= want_codes |
| | | # 拉取涨停时间 |
| | | # 拉取最近成交信息 |
| | | fdatas = [] |
| | | yesterday_codes = kpl_data_manager.get_yesterday_limit_up_codes() |
| | | for code in codes: |
| | | # (代码,名称,涨停时间,涨幅,现手,自由市值,现价) |
| | | data = [code, gpcode_manager.get_code_name(code)] |
| | | limit_up_time = LimitUpDataConstant.get_first_limit_up_time(code) |
| | | limit_up_price = gpcode_manager.get_limit_up_price_as_num(code) |
| | | data.append(limit_up_time) |
| | | pre_close_price = CodePrePriceManager().get_price_pre_cache(code) |
| | | latest_transaction_data = HuaXinTransactionDatasProcessor.get_latest_transaction_data(code) |
| | | # 获取L1数据 |
| | | price = L1DataManager.get_l1_current_price(code) |
| | | if price: |
| | | data.append(round((price - pre_close_price) * 100 / pre_close_price, 2)) |
| | | else: |
| | | data.append("--") |
| | | zylt_volume = global_util.zylt_volume_map.get(code) |
| | | zyltgb = zylt_volume * limit_up_price |
| | | if latest_transaction_data: |
| | | data.append((latest_transaction_data[2]//100, latest_transaction_data[6] - latest_transaction_data[7])) |
| | | else: |
| | | data.append(("--", 0)) |
| | | data.append(output_util.money_desc(zyltgb) if zyltgb else '--') |
| | | if price: |
| | | data.append(price) |
| | | else: |
| | | data.append("--") |
| | | # 是否是想买单 |
| | | data.append(1 if code in want_codes else 0) |
| | | # 显示代码板块身位 |
| | | block_rank_info = None |
| | | # 获取当前板块 |
| | | try: |
| | | if limit_up_time: |
| | | # 涨停过的数据才有身位 |
| | | blocks = LimitUpCodesBlockRecordManager().get_radical_buy_blocks(code) |
| | | if blocks: |
| | | blocks_info=[] |
| | | for b in blocks: |
| | | info = radical_buy_data_manager.RadicalBuyBlockManager.get_history_index(code,b, yesterday_codes) |
| | | blocks_info.append((b,info[0],info[2])) |
| | | max_info = max(blocks_info, key= lambda x:x[2]) |
| | | block_rank_info = max_info |
| | | except: |
| | | pass |
| | | data.append(block_rank_info) |
| | | fdatas.append(data) |
| | | |
| | | |
| | | |
| | | fdatas.sort(key=lambda x: x[2] if x[2] else time.time()) |
| | | response_data = json.dumps({"code": 0, "data": fdatas}) |
| | | |
| | | try: |
| | | history_limit_up_datas = LimitUpDataConstant.history_limit_up_datas |
| | | codes = set() |
| | | if history_limit_up_datas: |
| | | codes |= set([x[3] for x in history_limit_up_datas]) |
| | | want_codes = gpcode_manager.WantBuyCodesManager().list_code_cache() |
| | | if want_codes: |
| | | codes |= want_codes |
| | | # 拉取涨停时间 |
| | | # 拉取最近成交信息 |
| | | fdatas = [] |
| | | yesterday_codes = kpl_data_manager.get_yesterday_limit_up_codes() |
| | | for code in codes: |
| | | try: |
| | | if code in yesterday_codes: |
| | | continue |
| | | # (代码,名称,涨停时间,涨幅,现手,自由市值,现价) |
| | | data = [code, gpcode_manager.get_code_name(code)] |
| | | limit_up_time = LimitUpDataConstant.get_first_limit_up_time(code) |
| | | limit_up_price = gpcode_manager.get_limit_up_price_as_num(code) |
| | | data.append(limit_up_time) |
| | | pre_close_price = CodePrePriceManager().get_price_pre_cache(code) |
| | | latest_transaction_data = HuaXinTransactionDatasProcessor.get_latest_transaction_data(code) |
| | | # 获取L1数据 |
| | | price = L1DataManager.get_l1_current_price(code) |
| | | if price: |
| | | data.append(round((price - pre_close_price) * 100 / pre_close_price, 2)) |
| | | else: |
| | | data.append("--") |
| | | zylt_volume = global_util.zylt_volume_map.get(code) |
| | | zyltgb = zylt_volume * limit_up_price |
| | | if latest_transaction_data: |
| | | data.append( |
| | | (latest_transaction_data[2] // 100, latest_transaction_data[6] - latest_transaction_data[7])) |
| | | else: |
| | | data.append(("--", 0)) |
| | | data.append(output_util.money_desc(zyltgb) if zyltgb else '--') |
| | | if price: |
| | | data.append(price) |
| | | else: |
| | | data.append("--") |
| | | # 是否是想买单 |
| | | data.append(1 if code in want_codes else 0) |
| | | # 显示代码板块身位 |
| | | block_rank_info = None |
| | | # 获取当前板块 |
| | | try: |
| | | if limit_up_time: |
| | | # 涨停过的数据才有身位 |
| | | blocks = LimitUpCodesBlockRecordManager().get_radical_buy_blocks(code) |
| | | if blocks: |
| | | blocks_info = [] |
| | | for b in blocks: |
| | | info = radical_buy_data_manager.RadicalBuyBlockManager.get_history_index(code, b, |
| | | yesterday_codes) |
| | | blocks_info.append((b, info[0], info[2])) |
| | | max_info = max(blocks_info, key=lambda x: x[2]) |
| | | block_rank_info = max_info |
| | | except: |
| | | pass |
| | | data.append(block_rank_info) |
| | | fdatas.append(data) |
| | | except Exception as e1: |
| | | logger_debug.exception(e1) |
| | | fdatas.sort(key=lambda x: x[2] if x[2] else time.time()) |
| | | response_data = json.dumps({"code": 0, "data": fdatas}) |
| | | 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) |
| | | # 发给请求客户端的响应数据 |