admin
2025-04-07 e7c7efc9d6fc46a2925fa5b2b74358c68b007df2
并行批量处理L1数据/日志调整/初步集成L2数据
7个文件已修改
1个文件已添加
807 ■■■■■ 已修改文件
data_server.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/l1_api_client.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/l2_client.py 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/l2_data_manager.py 223 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main.py 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/buying_strategy.py 355 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/instant_time_market.py 67 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/selling_strategy.py 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
data_server.py
@@ -95,7 +95,7 @@
            fdatas = []
            for code in codes:
                data = data_cache.latest_code_market_info_dict.get(code)
                logger_debug.info(f"获取L1行情接口:{code}-{data}")
                # logger_debug.info(f"获取L1行情接口:{code}-{data}")
                if data:
                    fdatas.append(data)
            response_data = json.dumps({"code": 0, "data": fdatas})
huaxin_client/l1_api_client.py
@@ -215,7 +215,7 @@
                "LXLastPrice": pStockIndexData.LXLastPrice,
            }
            self.stock_index_data_dict[data["SecurityID"]] = data
            logger_debug.info(f"指数行情应答:{data}")
            # logger_debug.info(f"指数行情应答:{data}")
        except Exception as e:
            logging.exception(e)
huaxin_client/l2_client.py
@@ -7,19 +7,17 @@
import threading
import time
import concurrent.futures
from typing import List
from huaxin_client import command_manager, l2_data_transform_protocol
from huaxin_client import command_manager
from huaxin_client import constant
from huaxin_client import l2_data_manager
import lev2mdapi
from huaxin_client.code_queue_distribute_manager import CodeQueueDistributeManager, CodeDataCallbackDistributeManager
from huaxin_client.code_queue_distribute_manager import CodeDataCallbackDistributeManager
from huaxin_client.command_manager import L2ActionCallback
from huaxin_client.l2_data_manager import L2DataUploadManager
from huaxin_client.l2_data_transform_protocol import L2DataCallBack
from log_module import log, async_log_util
from log_module.async_log_util import huaxin_l2_log
from log_module.log import logger_local_huaxin_l2_subscript, logger_system,logger_l2_codes_subscript, printlog, logger_debug, logger_local_huaxin_l2_market
from log_module.log import logger_local_huaxin_l2_subscript, logger_system, logger_l2_codes_subscript, printlog, logger_debug, logger_local_huaxin_l2_market
from utils import tool
###B类###
huaxin_client/l2_data_manager.py
New file
@@ -0,0 +1,223 @@
# -*- coding: utf-8 -*-
import logging
import marshal
import queue
import threading
import time
from huaxin_client.code_queue_distribute_manager import CodeDataCallbackDistributeManager
from log_module.async_log_util import huaxin_l2_log
import collections
from log_module.log import logger_local_huaxin_contact_debug
order_detail_upload_active_time_dict = {}
transaction_upload_active_time_dict = {}
# 临时数据
tmep_order_detail_queue_dict = {}
tmep_transaction_queue_dict = {}
target_codes = set()
target_codes_add_time = {}
common_queue = queue.Queue()
# L2上传数据管理器
class L2DataUploadManager:
    def __init__(self, data_callback_distribute_manager: CodeDataCallbackDistributeManager):
        self.data_callback_distribute_manager = data_callback_distribute_manager
        # 代码分配的对象
        self.temp_order_queue_dict = {}
        self.temp_transaction_queue_dict = {}
        self.temp_log_queue_dict = {}
        self.filter_order_condition_dict = {}
        self.upload_l2_data_task_dict = {}
        self.l2_order_codes = set()
        self.l2_transaction_codes = set()
        self.__real_time_buy1_data = {}
    # 过滤订单
    def __filter_order(self, item):
        if item[1] * item[2] < 500000:
            return None
        return item
        # 过滤订单
    def __filter_transaction(self, item):
        return item
    # 添加委托详情
    def add_l2_order_detail(self, data, start_time=0, istransaction=False):
        code = data["SecurityID"]
        if code in self.__real_time_buy1_data:
            if self.__real_time_buy1_data[code][1] == data["Price"]:
                # 与买的价格一致
                if data["Side"] == '1':
                    if data["OrderStatus"] == 'D':
                        # 买撤
                        self.__real_time_buy1_data[code][3] -= data["Volume"]
                    else:
                        # 买
                        self.__real_time_buy1_data[code][3] += data["Volume"]
        q: collections.deque = self.temp_order_queue_dict.get(code)
        q.append((data['SecurityID'], data['Price'], data['Volume'], data['Side'], data['OrderType'], data['OrderTime'],
                  data['MainSeq'], data['SubSeq'], data['OrderNO'], data['OrderStatus'], time.time(), start_time))
    # 添加逐笔成交
    def add_transaction_detail(self, data):
        code = data["SecurityID"]
        if code in self.__real_time_buy1_data:
            if self.__real_time_buy1_data[code][1] == data["TradePrice"]:
                # 与买的价格一致
                self.__real_time_buy1_data[code][3] -= data["TradeVolume"]
        q: collections.deque = self.temp_transaction_queue_dict.get(code)
        q.append((data['SecurityID'], data['TradePrice'], data['TradeVolume'],
                  data['OrderTime'], data['MainSeq'], data['SubSeq'], data['BuyNo'],
                  data['SellNo'], data['ExecType']))
    def add_market_data(self, data):
        code = data["securityID"]
        # [时间,买1价格,原始买1量,计算后的买1量]}
        self.__real_time_buy1_data[code] = [data["dataTimeStamp"], data["buy"][0][0], data["buy"][0][1],
                                            data["buy"][0][1]]
        self.data_callback_distribute_manager.get_distributed_callback(code).OnMarketData(code, [data])
    # 分配上传队列
    def distribute_upload_queue(self, code):
        if not self.data_callback_distribute_manager.get_distributed_callback(code):
            self.data_callback_distribute_manager.distribute_callback(code)
        if code not in self.temp_order_queue_dict:
            self.temp_order_queue_dict[code] = collections.deque()
        if code not in self.temp_transaction_queue_dict:
            self.temp_transaction_queue_dict[code] = collections.deque()
        if code not in self.temp_log_queue_dict:
            self.temp_log_queue_dict[code] = queue.Queue()
        if code not in self.upload_l2_data_task_dict:
            t1 = threading.Thread(target=lambda: self.__run_upload_order_task(code), daemon=True)
            t1.start()
            t2 = threading.Thread(target=lambda: self.__run_upload_transaction_task(code), daemon=True)
            t2.start()
            t3 = threading.Thread(target=lambda: self.__run_upload_real_time_buy1_task(code), daemon=True)
            t3.start()
            self.upload_l2_data_task_dict[code] = (t1, t2, t3)
        # 释放已经分配的队列
    def release_distributed_upload_queue(self, code):
        self.data_callback_distribute_manager.release_distribute_callback(code)
        if code in self.temp_order_queue_dict:
            self.temp_order_queue_dict[code].clear()
            self.temp_order_queue_dict.pop(code)
        if code in self.temp_transaction_queue_dict:
            self.temp_transaction_queue_dict[code].clear()
            self.temp_transaction_queue_dict.pop(code)
        if code in self.temp_log_queue_dict:
            self.temp_log_queue_dict.pop(code)
        if code in self.upload_l2_data_task_dict:
            self.upload_l2_data_task_dict.pop(code)
    def __upload_l2_data(self, code, _queue, datas):
        _queue.put_nowait(marshal.dumps([code, datas, time.time()]))
    # 处理订单数据并上传
    def __run_upload_order_task(self, code):
        q: collections.deque = self.temp_order_queue_dict.get(code)
        temp_list = []
        while True:
            try:
                while len(q) > 0:
                    data = q.popleft()
                    # 前置数据处理,过滤掉无用的数据
                    data = self.__filter_order(data)
                    if data:
                        temp_list.append(data)
                if temp_list:
                    # 上传数据
                    # self.__upload_l2_data(code, upload_queue, temp_list)
                    # self.__upload_l2_order_data(code, temp_list)
                    __start_time = time.time()
                    last_data = temp_list[-1]
                    self.data_callback_distribute_manager.get_distributed_callback(code).OnL2Order(code, temp_list,
                                                                                                   time.time())
                    use_time = time.time() - __start_time
                    if use_time > 0.01:
                        # 记录10ms以上的数据
                        huaxin_l2_log.info(logger_local_huaxin_contact_debug, f"耗时:{use_time}s  结束数据:{last_data}")
                    temp_list = []
                else:
                    if code not in self.temp_order_queue_dict:
                        self.l2_order_codes.discard(code)
                        break
                    self.l2_order_codes.add(code)
                    time.sleep(0.001)
            except Exception as e:
                logging.exception(e)
            finally:
                pass
    # 处理成交数据并上传
    def __run_upload_transaction_task(self, code):
        q: collections.deque = self.temp_transaction_queue_dict.get(code)
        temp_list = []
        while True:
            try:
                while len(q) > 0:
                    data = q.popleft()
                    data = self.__filter_transaction(data)
                    if data:
                        temp_list.append(data)
                if temp_list:
                    # 上传数据
                    # self.__upload_l2_data(code, upload_queue, temp_list)
                    self.data_callback_distribute_manager.get_distributed_callback(code).OnL2Transaction(code,
                                                                                                         temp_list)
                    temp_list = []
                else:
                    if code not in self.temp_transaction_queue_dict:
                        self.l2_transaction_codes.discard(code)
                        break
                    self.l2_transaction_codes.add(code)
                    time.sleep(0.001)
            except:
                pass
            finally:
                pass
    # 处理实时买1数据
    def __run_upload_real_time_buy1_task(self, code):
        while True:
            try:
                if code in self.__real_time_buy1_data:
                    data = self.__real_time_buy1_data[code]
                    # 如果最新的买1是原来买1的1/2时开始上传
                    if data[2] > 0 and data[3] / data[2] <= 0.5:
                        self.data_callback_distribute_manager.get_distributed_callback(code).OnRealTimeBuy1Info(code,
                                                                                                                data)
            except:
                pass
            finally:
                time.sleep(0.1)
def add_target_code(code):
    target_codes.add(code)
    # 记录代码加入时间
    target_codes_add_time[code] = time.time()
def del_target_code(code):
    target_codes.discard(code)
    if code in target_codes_add_time:
        target_codes_add_time.pop(code)
def add_subscript_codes(codes):
    pass
if __name__ == "__main__":
    add_subscript_codes(["000333"])
main.py
@@ -1,9 +1,6 @@
# coding=utf-8
from __future__ import print_function, absolute_import, unicode_literals
import logging
import json
import os.path
# from log import logger
import threading
import time
@@ -11,7 +8,8 @@
# 引入掘金桥梁API
import utils.juejin_api
from db.redis_manager_delegate import RedisUtils
from log_module.log import logger_common, logger_kpl_jingxuan_in, logger_system
from huaxin_client.l2_data_transform_protocol import L2DataCallBack
from log_module.log import logger_common, logger_kpl_jingxuan_in, logger_system, logger_debug
# 引入开盘啦API模块
# 引入全局变量模块
# 引入定时器模块
@@ -23,7 +21,7 @@
from huaxin_client import l2_market_client
from log_module import async_log_util
from trade import huaxin_trade_data_update
from utils import hx_qc_value_util
from utils import hx_qc_value_util, huaxin_util
# 引入行情订阅模块
# import subscribe_market
@@ -95,6 +93,7 @@
    # print(f"all_stocks_all_K_line_property_dict== {type(data_cache.all_stocks_all_K_line_property_dict)}")
    # 获取实时大盘指数行情线程
    threading.Thread(target=lambda: instant_time_market.index_market_current(), daemon=True).start()
    # instant_time_market.index_market_trend()
    #  开盘啦的涨停概念的回调函数
@@ -165,9 +164,29 @@
            else:
                instant_time_market.set_current_info(datas)
    class MyL2DataCallback(L2DataCallBack):
        def OnL2Transaction(self, code, datas):
            if datas:
                # 获取最近的成交价
                price, time_str = datas[-1][1],  huaxin_util.convert_time(datas[-1][3])
                pass
        def OnMarketData(self, code, datas):
            # logger_debug.info(f"收到L2Market数据:{datas}")
            for d in datas:
                code = d["securityID"]
                buy1 = d["buy"][0]
        def OnRealTimeBuy1Info(self, code, buy1_info):
            # buy1_info: [买1时间,买1价格, 原始买1量, 实时买1量]
            async_log_util.info(logger_debug, f"OnRealTimeBuy1Info:{code}-{buy1_info}")
            # L1DataProcessor.excute_sell_rule(code, buy1_info[3], buy1_info[1], "l2-real")
    # 加载开盘啦板块日志数据
    kpl_data_manager.KPLStockOfMarketsPlateLogManager()
    # 启动异步日志
    threading.Thread(target=async_log_util.run_sync, daemon=True).start()
strategy/buying_strategy.py
@@ -9,6 +9,7 @@
# from datetime import timedelta
import time
import utils.tool
from log_module import async_log_util
from log_module.log import logger_kpl_jingxuan_in, logger_common
# import dateutil
# 引入掘金API
@@ -17,7 +18,6 @@
from strategy import basic_methods
from strategy import account_management
from strategy import order_methods
from utils import tool, huaxin_util
@@ -100,6 +100,15 @@
    return last_volume
def logger_info(content):
    """
    日志记录
    :param content:
    :return:
    """
    async_log_util.info(logger, content)
# 涨幅视界策略【根据涨幅进入视界为起始的策略】
def growth_view_strategy(current_info):
    symbol_code = current_info[0]  # 券商接口为纯数字编号
@@ -140,7 +149,7 @@
        # 由于会存在分时L1数据中最新价为0导致current_low==0的情况,所以当出现这一情况时,将它直接赋值为昨收价(目前没有办法根本解决)
        if current_low == 0:
            current_low = k_line_data[0]['close']
            # logger.info(f"current_low == 0 赋值为K线昨收价")
            # logger_info(f"current_low == 0 赋值为K线昨收价")
        # 如果公司名称中不包含["ST", "退市", "退", "XD", "XR", "DR", "N"] 则继续逻辑判断
        if not any(keyword in k_line_data[0]['sec_name'] for keyword in ["ST", "退市", "退", "XD", "XR", "DR", "N"]):
@@ -150,17 +159,17 @@
                deep_low = (current_low - k_line_data[0]['close']) / k_line_data[0]['close'] * 100  # 当日最大跌幅比
            else:
                deep_low = 0  # 当日最大跌幅比
                # logger.info(f"current_low is None or current_low == 0  按照K线昨收价作为当日当时最低价赋值,强行将最大跌幅比赋值为0")
                # logger_info(f"current_low is None or current_low == 0  按照K线昨收价作为当日当时最低价赋值,强行将最大跌幅比赋值为0")
            # 由于已经把回调的涨停概念数据全局化了,所以直接使用这个数据列表,并且直接去重后列表化
            limit_up_block_names = list(set(data_cache.limit_up_block_names))
            # 在循环监测个股瞬时行情时进入涨幅视界的情况  *************************************************************【涨幅视界】********************************************************
            if tick_growth is not None and tick_growth >= 0.3:
                logger.info(f"上证指数 开盘涨幅 ====》》》 {round(data_cache.Shanghai_open_growth, 4)}%")
                logger.info(f"深证指数 开盘涨幅 ====》》》 {round(data_cache.Shenzhen_open_growth, 4)}%")
                logger.info(f"创业板指 开盘涨幅 ====》》》 {round(data_cache.TSXV_open_growth, 4)}%")
                async_log_util.info(logger, f"上证指数 开盘涨幅 ====》》》 {round(data_cache.Shanghai_open_growth, 4)}%")
                async_log_util.info(logger, f"深证指数 开盘涨幅 ====》》》 {round(data_cache.Shenzhen_open_growth, 4)}%")
                async_log_util.info(logger, f"创业板指 开盘涨幅 ====》》》 {round(data_cache.TSXV_open_growth, 4)}%")
                now = datetime.datetime.now()
                logger.info(
                    f"获取时间========================================={current_created_at}=========================================")
                async_log_util.info(logger,
                                    f"获取时间========================================={current_created_at}=========================================")
                # 调用安全交易量公式
                ratios = basic_methods.secure_volume(now)
                # print(f"ratios==================={ratios} ,")
@@ -174,8 +183,8 @@
                # print(f"自由市值=========={free_market_value} 亿")
                # 使用 get 方法安全地获取板块列表,如果股票代码不存在则返回 None 或一个空列表作为默认值
                stocks_plates = data_cache.all_stocks_plate_dict.get(symbol_to_search, {}).get("plate", [])
                logger.info(f"【{k_line_data[0]['sec_name']}】概念板块=========={stocks_plates} ")
                logger.info(f"【大盘当前】涨停概念=========={limit_up_block_names}")
                async_log_util.info(logger, f"【{k_line_data[0]['sec_name']}】概念板块=========={stocks_plates} ")
                async_log_util.info(logger, f"【大盘当前】涨停概念=========={limit_up_block_names}")
                # 将获取的板块列表转换为集合,并计算与涨停板块的交集
                stocks_plates_set = set(stocks_plates)
                limit_up_plate_set = set(limit_up_block_names)
@@ -199,16 +208,17 @@
                    # 遍历每个键对应的列表中的列表
                    for stock_list in values:
                        if len(stock_list) > 1 and symbol_code in stock_list[1]:
                            logger.info(f"在板块强度个股列表中找到了 {key}:{k_line_data[0]['sec_name']}。")
                            async_log_util.info(logger,
                                                f"在板块强度个股列表中找到了 {key}:{k_line_data[0]['sec_name']}。")
                            # 打印概念对应的个股列表
                            # print(f"stock_list=={stock_list}")
                            # 将个股精选的相关两个概念字符串转化为列表
                            correlation_plate_list = stock_list[4].split('、')
                            logger.info(
                                f"【{stock_list[0]}】,当日当时涨幅:{stock_list[2]}%,当时涨速:{stock_list[3]},个股精选相关板块=={correlation_plate_list} ,领涨次数:{stock_list[6]}")
                            async_log_util.info(logger,
                                                f"【{stock_list[0]}】,当日当时涨幅:{stock_list[2]}%,当时涨速:{stock_list[3]},个股精选相关板块=={correlation_plate_list} ,领涨次数:{stock_list[6]}")
                            # 如果只需要找到一个就停止,可以在这里使用 break
                            if len(values) >= 2:
                                logger.info(f"单一板块内瞬时拉升数为:{len(values)},分别为===={values}")
                                async_log_util.info(logger, f"单一板块内瞬时拉升数为:{len(values)},分别为===={values}")
                                # 如果子列表长度大于1且第二个元素包含 当前进入涨幅视界的symbol_code
                                strength_list_have_it = True
                                strength_plate = correlation_plate_list
@@ -218,14 +228,16 @@
                # 调用历史K累计涨停天数函数
                limit_up_day = basic_methods.count_limit_up_day(k_line_data)
                # 调用大抛压位计算函数
                throwing_pressure_position = basic_methods.position_of_throwing_pressure(k_line_data, current_open, current_volume, today_limit_up_price)
                throwing_pressure_position = basic_methods.position_of_throwing_pressure(k_line_data, current_open,
                                                                                         current_volume,
                                                                                         today_limit_up_price)
                # print(f"throwing_pressure_position === {throwing_pressure_position}")
                # 计算瞬时量幅比
                last_volume_to_growth_ratio = (round(current_last_volume / 10000, 2) / round(
                    k_line_data[0]['volume'] / 10000, 2)) / (round(tick_growth, 2) / 100)
                logger.info(
                    f"当日当时涨幅:{today_growth}%,当日当时总成交量:{round(current_volume / 10000, 2)}万,昨日的总成交量{round(k_line_data[0]['volume'] / 10000, 2)}万,瞬时成交量:{round(current_last_volume / 10000, 2)}万,瞬时涨幅:{round(tick_growth, 2)}%,瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%")
                async_log_util.info(logger,
                                    f"当日当时涨幅:{today_growth}%,当日当时总成交量:{round(current_volume / 10000, 2)}万,昨日的总成交量{round(k_line_data[0]['volume'] / 10000, 2)}万,瞬时成交量:{round(current_last_volume / 10000, 2)}万,瞬时涨幅:{round(tick_growth, 2)}%,瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%")
                # print(
                #     f"卖一量:{current_quotes[0]['ask_v']},卖二量:{current_quotes[1]['ask_v']},卖三量:{current_quotes[2]['ask_v']},卖四量:{current_quotes[3]['ask_v']},卖五量:{current_quotes[4]['ask_v']}")
                # print(
@@ -234,7 +246,7 @@
                buying_strong = basic_methods.get_buying_strength(current_quotes_buy, current_quotes_sell)
                # print(f"buying_strong==={buying_strong}")
                if len(data_cache.bought_plate) > 0:
                    logger.info(f"已买入的概念板块==={data_cache.bought_plate}")
                    async_log_util.info(logger, f"已买入的概念板块==={data_cache.bought_plate}")
                    # 创建一个已买板块集合
                bought_plate_set = set(data_cache.bought_plate)
                # 设定当前时间点
@@ -248,7 +260,7 @@
                    if deep_low > -3 and deep_low is not None:
                        # 进入乐观涨幅区间
                        if 0 <= today_growth <= 6.5:
                            # logger.info(f"进入乐观涨幅区间!公司名称:{k_line_data[0]['sec_name']},当日当时涨幅:{today_growth},当前时间:{current_data['created_at']}")
                            # logger_info(f"进入乐观涨幅区间!公司名称:{k_line_data[0]['sec_name']},当日当时涨幅:{today_growth},当前时间:{current_data['created_at']}")
                            # 进入无高位风险 且 无二次近前高风险等 视界
                            if k_line_data[0]['risk_position'] not in ['recent_high_position_risk',
                                                                       'recent_second_break_near_high_position_risk',
@@ -259,167 +271,169 @@
                                '''
                                if len(limit_up_plate_included) != 0 and limit_up_plate_included.issubset(
                                        check_plate_list) is False:
                                    logger.info(
                                    logger_info(
                                        f"【{k_line_data[0]['sec_name']}】--------------------------------------------------------------------------------------------------------[有概念视界]")
                                    logger.info(f"包含涨停概念:{limit_up_plate_included}")
                                    logger_info(f"包含涨停概念:{limit_up_plate_included}")
                                    if len(limit_up_plate_included) >= 3:
                                        logger.info(f"包含多个涨停概念:{limit_up_plate_included}")
                                        logger_info(f"包含多个涨停概念:{limit_up_plate_included}")
                                    limit_up_plate_included_list = list(limit_up_plate_included)
                                    intersection_plate = bought_plate_set.intersection(limit_up_plate_included)
                                    if len(intersection_plate) > 0:
                                        logger.info(f"重复相交概念==={intersection_plate}")
                                    logger.info(
                                        logger_info(f"重复相交概念==={intersection_plate}")
                                    logger_info(
                                        f"【有概念】(涨停列表中包含自身概念 且 不是唯一包含概念不可用) !最新价: {current_price},,当日当时涨幅:{today_growth}%。")
                                    # 有概念有强度视界
                                    if strength_list_have_it is True:
                                        logger.info(
                                        logger_info(
                                            f"【有概念 有强度】出现在板块强度大于2的列表中 瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,当日当时涨幅:{today_growth}%。")
                                        if last_volume_to_growth_ratio > 0.8 and (
                                                free_market_value < 40 and current_price < 20):
                                            logger.info(
                                            logger_info(
                                                f"【不利】瞬时量幅比> 0.8 且 (小自由市值<40亿 或 最新价小于20元 )!,瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,自由市值:{free_market_value} 亿。")
                                        elif now_time <= datetime.time(9, 30, 5).strftime("%H:%M:%S"):
                                            logger.info(
                                            logger_info(
                                                f"【不利】早盘第一个tick,瞬时涨幅计算恐有误,不买!瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%。")
                                        elif limit_up_day < 1 and tick_growth < 1:
                                            logger.info(
                                            logger_info(
                                                f"【不利】冷票 且 瞬时涨幅小于 1 !不买!!,瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,90天内涨停天数:{limit_up_day}")
                                        # for d in k_line_data[1:3] 只检查k_line_data中的第二个和第三个元素
                                        elif limit_up_day > 6 and any(
                                                'attribute' in d and d['attribute'] in data_cache.limit_up_type for d in
                                                k_line_data[1:3]) and current_volume <= k_line_data[0]['volume'] * 1.5:
                                            logger.info(
                                            logger_info(
                                                f"【不利】过于显著票 且 上日或上上涨停板 当日量还不足昨日量的1.5倍!不买!! 今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,最新价: {current_price},,90天内涨停天数:{limit_up_day}")
                                        elif k_line_data[0]['attribute'] in data_cache.frying_plate_type:
                                            logger.info(f"【不利】昨日炸板!不买!!")
                                            logger_info(f"【不利】昨日炸板!不买!!")
                                        elif k_line_data[0]['attribute'] in data_cache.limit_up_type:
                                            logger.info(f"【不利】昨日涨停!不买!!")
                                            logger_info(f"【不利】昨日涨停!不买!!")
                                        elif k_line_data[0]['attribute'] in data_cache.limit_down_type:
                                            logger.info(f"【不利】昨日跌停!不买!!")
                                            logger_info(f"【不利】昨日跌停!不买!!")
                                        # elif k_line_data[0]['attribute'] == 'up_down' and k_line_data[0]['today_volume_shape'] == 'increases_down':
                                        #     logger.info(f"【不利】昨日高开低走 且 放量下跌,不买!!")
                                        elif k_line_data[0]['attribute'] == 'down_down' and k_line_data[0]['today_volume_shape'] == 'increases_down':
                                            logger.info(f"【不利】昨日低开低走 且 放量下跌,不买!!")
                                        #     logger_info(f"【不利】昨日高开低走 且 放量下跌,不买!!")
                                        elif k_line_data[0]['attribute'] == 'down_down' and k_line_data[0][
                                            'today_volume_shape'] == 'increases_down':
                                            logger_info(f"【不利】昨日低开低走 且 放量下跌,不买!!")
                                        elif throwing_pressure_position[0] is True:
                                            # 最近涨停日期:{k_line_data[limit_up_day_min_index]['bob']} ,
                                            logger.info(
                                            logger_info(
                                                f"【不利】接近涨停大抛压价位 近7日涨停过票 且 当前价和今日涨停价  且 当日量还不足涨停次日量的1.5倍!且 次日最高价小于涨停最高价的1.02倍 不买!! 今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,90天内涨停天数:{limit_up_day}")
                                        elif throwing_pressure_position[1] is True:
                                            # 最近涨停日期:{k_line_data[frying_plate_day_min_index]['bob']} ,炸板次日量{round(k_line_data[frying_plate_day_min_index - 1]['volume'], 2)},
                                            logger.info(
                                            logger_info(
                                                f"【不利】接近炸板大抛压价位 近7日炸板过票 且 当前价和今日涨停价  且 当日量还不足涨停次日量的1.5倍!且 次日最高价小于炸板最高价的1.02倍 不买!! ,90天内涨停天数:{limit_up_day}")
                                        elif throwing_pressure_position[2] is True:
                                            # 最近涨停日期:{k_line_data[limit_down_day_min_index]['bob']} ,
                                            logger.info(
                                            logger_info(
                                                f"【不利】接近跌停大抛压价位[跌停日的最高价或最低价] 近7日跌停过票 且 当前价和今日涨停价  且当日量还不足昨日量的1.5倍!不买!!今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,90天内涨停天数:{limit_up_day}")
                                        elif (
                                                free_market_value == 0 or free_market_value == 0.0) and free_market_value < 6:
                                            logger.info(
                                            logger_info(
                                                f"【不利】自由市值小于6亿!不买!! 公司名称:{k_line_data[0]['sec_name']},最新价: {current_price}")
                                        elif len(intersection_plate) > 0:
                                            logger.info(
                                            logger_info(
                                                f"【不利】同概念只买一次,不买了,重复相交概念==={intersection_plate}")
                                        elif data_cache.have_plate_buy_times >= 3:
                                            logger.info(f"【不利】有概念买入已经 3 次了!不买了!!")
                                            logger_info(f"【不利】有概念买入已经 3 次了!不买了!!")
                                        elif len(data_cache.addition_position_symbols_set) >= 3:
                                            logger.info(f"【不利】当日已经买了3只票!不买了!!")
                                            logger_info(f"【不利】当日已经买了3只票!不买了!!")
                                        elif now_time < data_cache.OPENING_TIME or now_time > data_cache.NOON_MARKET_TIME:
                                            logger.info(f"【不利】不在9:30-13:05时间内!不买!!")
                                            logger_info(f"【不利】不在9:30-13:05时间内!不买!!")
                                        else:
                                            logger.info(
                                            logger_info(
                                                f"************************************************【有概念有强度指标下单】************************************************")
                                            logger.info(
                                            logger_info(
                                                f"最新价: {current_price}, 当日最高价:{current_high},瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%,公司名称:{k_line_data[0]['sec_name']},当前时间:{current_created_at},低于水位线:{deep_low:.2f},交易量今日与昨日的比例{round(current_volume / k_line_data[0]['volume'], 2)}")
                                            logger.info(
                                            logger_info(
                                                f"大盘综合强度分数:{data_cache.real_time_market_strong},大盘指数情绪预期分数==={data_cache.index_trend_expectation_score}分,设想的下单金额:{data_cache.today_planned_order_amount}")
                                            # 调用下单方法下单
                                            order_methods.buy_order_by_value(symbol, data_cache.today_planned_order_amount,
                                            order_methods.buy_order_by_value(symbol,
                                                                             data_cache.today_planned_order_amount,
                                                                             k_line_data[0]['sec_name'],
                                                                             current_price)
                                            # 查看一下该股有无大单
                                            L2_data_analysis.find_L2_big_order_of_code(symbol_code)
                                            # 检测持仓代码集合中有无下单个股,才认为交易成功
                                            if symbol_code not in data_cache.position_symbols_set:
                                                logger.info(f"【{k_line_data[0]['sec_name']}】交易失败~持仓集合:{data_cache.position_symbols_set}")
                                                logger_info(
                                                    f"【{k_line_data[0]['sec_name']}】交易失败~持仓集合:{data_cache.position_symbols_set}")
                                            else:
                                                # 将有概念买入次数自加1
                                                data_cache.have_plate_buy_times += 1
                                                # 将买入个股的当时概念添加到全局变量中存储
                                                data_cache.bought_plate.extend(limit_up_plate_included_list)
                                                logger.info(f"【{k_line_data[0]['sec_name']}】交易成功!持仓集合:{data_cache.position_symbols_set}")
                                                logger_info(
                                                    f"【{k_line_data[0]['sec_name']}】交易成功!持仓集合:{data_cache.position_symbols_set}")
                                    # 有概念无强度视界
                                    if strength_list_have_it is False:
                                        logger.info(
                                        logger_info(
                                            f"【有概念 无强度】未出现在板块强度大于2的列表中 瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,当日当时涨幅:{today_growth}%。")
                                        if tick_growth >= 0.8:
                                            logger.info(
                                            logger_info(
                                                f"【有概念 无强度 有强拉】瞬时涨幅 > 0.8% !瞬时涨幅:{round(tick_growth, 2)}%")
                                            if last_volume_to_growth_ratio > 0.8 and (
                                                    free_market_value < 40 and current_price < 20):
                                                logger.info(
                                                logger_info(
                                                    f"【不利】瞬时量幅比> 0.8 且 (小自由市值<40亿 或 最新价小于20元 )!,瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,自由市值:{free_market_value} 亿。")
                                            elif now_time <= datetime.time(9, 30, 5).strftime("%H:%M:%S"):
                                                logger.info(
                                                logger_info(
                                                    f"【不利】早盘第一个tick,瞬时涨幅计算恐有误,不买!瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%。")
                                            elif now_time <= datetime.time(9, 35, 00).strftime("%H:%M:%S"):
                                                logger.info(
                                                logger_info(
                                                    f"【不利】早盘前5分钟,不做有概念无强度试验,不买!瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%。")
                                            elif today_growth < 3:
                                                logger.info(
                                                logger_info(
                                                    f"【不利】当日当时涨幅小于3%,信心不足,不太可能有强度,不买!瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%。")
                                            elif limit_up_day < 1 and tick_growth < 1:
                                                logger.info(
                                                logger_info(
                                                    f"【不利】冷票 且 瞬时涨幅小于 1 !不买!!,瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,90天内涨停天数:{limit_up_day}")
                                            # for d in k_line_data[1:3] 只检查k_line_data中的第二个和第三个元素
                                            elif limit_up_day > 6 and any(
                                                    'attribute' in d and d['attribute'] in data_cache.limit_up_type
                                                    for d in k_line_data[1:3]) and current_volume <= k_line_data[0][
                                                'volume'] * 1.5:
                                                logger.info(
                                                logger_info(
                                                    f"【不利】过于显著票 且 上日或上上涨停板 当日量还不足昨日量的1.5倍!不买!! 今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,最新价: {current_price},,90天内涨停天数:{limit_up_day}")
                                            elif k_line_data[0]['attribute'] in data_cache.frying_plate_type:
                                                logger.info(f"【不利】昨日炸板!不买!!")
                                                logger_info(f"【不利】昨日炸板!不买!!")
                                            elif k_line_data[0]['attribute'] in data_cache.limit_up_type:
                                                logger.info(f"【不利】昨日涨停!不买!!")
                                                logger_info(f"【不利】昨日涨停!不买!!")
                                            elif k_line_data[0]['attribute'] in data_cache.limit_down_type:
                                                logger.info(f"【不利】昨日跌停!不买!!")
                                                logger_info(f"【不利】昨日跌停!不买!!")
                                            # elif k_line_data[0]['attribute'] == 'up_down' and k_line_data[0]['today_volume_shape'] == 'increases_down':
                                            #     logger.info(f"【不利】昨日高开低走 且 放量下跌,不买!!")
                                            #     logger_info(f"【不利】昨日高开低走 且 放量下跌,不买!!")
                                            elif k_line_data[0]['attribute'] == 'down_down' and k_line_data[0][
                                                'today_volume_shape'] == 'increases_down':
                                                logger.info(f"【不利】昨日低开低走 且 放量下跌,不买!!")
                                                logger_info(f"【不利】昨日低开低走 且 放量下跌,不买!!")
                                            elif throwing_pressure_position[0] is True:
                                                # 最近涨停日期:{k_line_data[limit_up_day_min_index]['bob']} ,
                                                logger.info(
                                                logger_info(
                                                    f"【不利】接近涨停大抛压价位 近7日涨停过票 且 当前价和今日涨停价  且 当日量还不足涨停次日量的1.5倍!且 次日最高价小于涨停最高价的1.02倍 不买!! 今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,90天内涨停天数:{limit_up_day}")
                                            elif throwing_pressure_position[1] is True:
                                                # 最近涨停日期:{k_line_data[frying_plate_day_min_index]['bob']} ,炸板次日量{round(k_line_data[frying_plate_day_min_index - 1]['volume'], 2)},
                                                logger.info(
                                                logger_info(
                                                    f"【不利】接近炸板大抛压价位 近7日炸板过票 且 当前价和今日涨停价  且 当日量还不足涨停次日量的1.5倍!且 次日最高价小于炸板最高价的1.02倍 不买!! ,90天内涨停天数:{limit_up_day}")
                                            elif throwing_pressure_position[2] is True:
                                                # 最近涨停日期:{k_line_data[limit_down_day_min_index]['bob']} ,
                                                logger.info(
                                                logger_info(
                                                    f"【不利】接近跌停大抛压价位[跌停日的最高价或最低价] 近7日跌停过票 且 当前价和今日涨停价  且当日量还不足昨日量的1.5倍!不买!!今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,90天内涨停天数:{limit_up_day}")
                                            elif (
                                                    free_market_value == 0 or free_market_value == 0.0) and free_market_value < 6:
                                                logger.info(
                                                logger_info(
                                                    f"【不利】自由市值小于6亿!不买!! 公司名称:{k_line_data[0]['sec_name']},最新价: {current_price}")
                                            elif len(intersection_plate) > 0:
                                                logger.info(
                                                logger_info(
                                                    f"【不利】同概念只买一次,不买了,重复相交概念==={intersection_plate}")
                                            elif data_cache.have_plate_buy_times >= 1:
                                                logger.info(f"【不利】有概念无强度买入已经1次了!不买了!!")
                                                logger_info(f"【不利】有概念无强度买入已经1次了!不买了!!")
                                            elif len(data_cache.addition_position_symbols_set) >= 4:
                                                logger.info(f"【不利】当日已经买了3只票!不买了!!")
                                                logger_info(f"【不利】当日已经买了3只票!不买了!!")
                                            elif now_time < data_cache.OPENING_TIME or now_time > data_cache.NOON_MARKET_TIME:
                                                logger.info(f"【不利】不在9:30-13:05时间内!不买!!")
                                                logger_info(f"【不利】不在9:30-13:05时间内!不买!!")
                                            else:
                                                logger.info(
                                                logger_info(
                                                    f"************************************************【有概念无强度指标下单】************************************************")
                                                logger.info(
                                                logger_info(
                                                    f"最新价: {current_price}, 当日最高价:{current_high},瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%,公司名称:{k_line_data[0]['sec_name']},当前时间:{current_created_at},低于水位线:{deep_low:.2f},交易量今日与昨日的比例{round(current_volume / k_line_data[0]['volume'], 2)}")
                                                # 调用下单方法下单
                                                # order_methods.buy_order_by_value(symbol, 1000,
@@ -433,89 +447,89 @@
                                                L2_data_analysis.find_L2_big_order_of_code(symbol_code)
                                                # 检测持仓代码集合中有无下单个股,才认为交易成功
                                                if symbol_code not in data_cache.position_symbols_set:
                                                    logger.info(
                                                    logger_info(
                                                        f"【{k_line_data[0]['sec_name']}】交易失败~持仓集合:{data_cache.position_symbols_set}")
                                                else:
                                                    # 将有概念买入次数自加1
                                                    data_cache.have_plate_buy_times += 1
                                                    # 将买入个股的当时概念添加到全局变量中存储
                                                    data_cache.bought_plate.extend(limit_up_plate_included_list)
                                                    logger.info(
                                                    logger_info(
                                                        f"【{k_line_data[0]['sec_name']}】交易成功!持仓集合:{data_cache.position_symbols_set}")
                                '''
                                无概念 有强度视界
                                '''
                                if len(limit_up_plate_included) == 0 or limit_up_plate_included.issubset(
                                        check_plate_list) is True:
                                    # logger.info(f"【无概念】")
                                    # logger_info(f"【无概念】")
                                    if strength_list_have_it is True:
                                        logger.info(
                                        logger_info(
                                            f"【{k_line_data[0]['sec_name']}】--------------------------------------------------------------------------------------------------------[有强度视界]")
                                        logger.info(
                                        logger_info(
                                            f"【无概念 有强度】出现在板块强度大于2的列表中!瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,最新价: {current_price},瞬时涨幅:{round(tick_growth, 2)}%,当日当时涨幅:{today_growth}%,当前时间:{current_created_at}。")
                                        logger.info(
                                        logger_info(
                                            f"【强度数据】 == {data_cache.market_sift_plate_stock_dict}")
                                        strength_plate_set = set(strength_plate)
                                        intersection_plate = bought_plate_set.intersection(strength_plate_set)
                                        if len(intersection_plate) > 0:
                                            logger.info(f"重复相交强度==={intersection_plate}")
                                            logger_info(f"重复相交强度==={intersection_plate}")
                                        if last_volume_to_growth_ratio < 0.8:
                                            logger.info(
                                            logger_info(
                                                f"【有强度 有小量换大涨幅】瞬时量幅比< 0.8 !瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,最新价: {current_price},瞬时涨幅:{round(tick_growth, 2)}%,当日当时涨幅:{today_growth}%,当前时间:{current_created_at}。")
                                            if tick_growth >= 0.8:
                                                logger.info(
                                                logger_info(
                                                    f"【有强度 有小量换大涨幅 有强拉】瞬时涨幅 > 0.8% !瞬时涨幅:{round(tick_growth, 2)}%")
                                                if limit_up_day < 1:
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】冷票 !不买!!,瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,90天内涨停天数:{limit_up_day}")
                                                # for d in k_line_data[1:3] 只检查k_line_data中的第二个和第三个元素
                                                elif limit_up_day > 6 and any(
                                                        'attribute' in d and d['attribute'] in data_cache.limit_up_type
                                                        for d in k_line_data[1:3]) and current_volume <= k_line_data[0][
                                                    'volume'] * 1.5:
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】过于显著票 且 上日或上上涨停板 当日量还不足昨日量的1.5倍!不买!! 今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,90天内涨停天数:{limit_up_day}")
                                                elif k_line_data[0]['attribute'] in data_cache.frying_plate_type:
                                                    logger.info(f"【不利】昨日炸板!不买!!")
                                                    logger_info(f"【不利】昨日炸板!不买!!")
                                                elif k_line_data[0]['attribute'] in data_cache.limit_up_type:
                                                    logger.info(f"【不利】昨日涨停!不买!!")
                                                    logger_info(f"【不利】昨日涨停!不买!!")
                                                elif k_line_data[0]['attribute'] in data_cache.limit_down_type:
                                                    logger.info(f"【不利】昨日跌停!不买!!")
                                                    logger_info(f"【不利】昨日跌停!不买!!")
                                                # elif k_line_data[0]['attribute'] == 'up_down' and k_line_data[0]['today_volume_shape'] == 'increases_down':
                                                #     logger.info(
                                                #     logger_info(
                                                #         f"【不利】昨日高开低走 且 放量下跌,不买!!")
                                                elif k_line_data[0]['attribute'] == 'down_down' and k_line_data[0][
                                                    'today_volume_shape'] == 'increases_down':
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】昨日低开低走 且 放量下跌,不买!!")
                                                elif throwing_pressure_position[0] is True:
                                                    # 最近涨停日期:{k_line_data[limit_up_day_min_index]['bob']} ,
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】接近涨停大抛压价位 近7日涨停过票 且 当前价和今日涨停价 且 当日量还不足涨停次日量的1.5倍!且 次日最高价小于涨停最高价的1.02倍 不买!! 今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,90天内涨停天数:{limit_up_day}")
                                                elif throwing_pressure_position[1] is True:
                                                    # 最近涨停日期:{k_line_data[frying_plate_day_min_index]['bob']} ,炸板次日量{round(k_line_data[frying_plate_day_min_index - 1]['volume'], 2)},
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】接近炸板大抛压价位 近7日炸板过票 且 当前价和今日涨停价 且 当日量还不足涨停次日量的1.5倍!且 次日最高价小于炸板最高价的1.02倍 不买!!90天内涨停天数:{limit_up_day}")
                                                elif throwing_pressure_position[2] is True:
                                                    # 最近涨停日期:{k_line_data[limit_down_day_min_index]['bob']} ,
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】接近跌停大抛压价位[跌停日的最高价或最低价] 近7日跌停过票 且 当前价和今日涨停价 且当日量还不足昨日量的1.5倍!不买!!今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,,90天内涨停天数:{limit_up_day}")
                                                elif (
                                                        free_market_value == 0 or free_market_value == 0.0) and free_market_value < 6:
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】自由市值小于6亿!不买!! 公司名称:{k_line_data[0]['sec_name']},最新价: {current_price}")
                                                elif data_cache.have_strength_buy_times >= 1:
                                                    logger.info(f"【不利】有强度买入 1 次了!不买了!!")
                                                    logger_info(f"【不利】有强度买入 1 次了!不买了!!")
                                                elif len(data_cache.addition_position_symbols_set) >= 3:
                                                    logger.info(f"【不利】当日已经买了3只票!不买了!!")
                                                    logger_info(f"【不利】当日已经买了3只票!不买了!!")
                                                elif now_time < data_cache.OPENING_TIME or now_time > data_cache.NOON_MARKET_TIME:
                                                    logger.info(f"【不利】不在9:30-13:05时间内!不买!!")
                                                    logger_info(f"【不利】不在9:30-13:05时间内!不买!!")
                                                else:
                                                    logger.info(
                                                    logger_info(
                                                        f"************************************************【有强度有强拉指标下单】************************************************")
                                                    logger.info(
                                                    logger_info(
                                                        f"最新价: {current_price}, 当日最高价:{current_high},瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%,公司名称:{k_line_data[0]['sec_name']},当前时间:{current_created_at},低于水位线:{deep_low:.2f},交易量今日与昨日的比例{round(current_volume / k_line_data[0]['volume'], 2)}")  # 输出当前价格和3秒涨幅信息
                                                    logger.info(
                                                    logger_info(
                                                        f"大盘综合强度分数:{data_cache.real_time_market_strong},大盘指数情绪预期分数==={data_cache.index_trend_expectation_score}分,设想的下单金额:{data_cache.today_planned_order_amount}")
                                                    # 调用下单方法下单
                                                    order_methods.buy_order_by_value(symbol,
@@ -530,48 +544,49 @@
                                                    L2_data_analysis.find_L2_big_order_of_code(symbol_code)
                                                    # 检测持仓代码集合中有无下单个股,才认为交易成功
                                                    if symbol_code not in data_cache.position_symbols_set:
                                                        logger.info(
                                                        logger_info(
                                                            f"【{k_line_data[0]['sec_name']}】交易失败~持仓集合:{data_cache.position_symbols_set}")
                                                    else:
                                                        # 将有概念买入次数自加1
                                                        data_cache.have_strength_buy_times += 1
                                                        # 将买入个股的当时概念添加到全局变量中存储
                                                        data_cache.bought_plate.extend(strength_plate)
                                                        logger.info(
                                                        logger_info(
                                                            f"【{k_line_data[0]['sec_name']}】交易成功!持仓集合:{data_cache.position_symbols_set}")
                                '''
                                无概念无强度 有小量换大涨幅度视界
                                '''
                                if len(limit_up_plate_included) == 0 or limit_up_plate_included.issubset(
                                        check_plate_list) is True:
                                    # logger.info(f"【无概念】")
                                    # logger_info(f"【无概念】")
                                    if strength_list_have_it is False:
                                        logger.info(
                                        logger_info(
                                            f"【{k_line_data[0]['sec_name']}】--------------------------------------------------------------------------------------------------------[小量大涨幅视界]")
                                        logger.info(
                                        logger_info(
                                            f"【无概念 无强度】未出现在板块强度大于2的列表中!瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,最新价: {current_price},瞬时涨幅:{round(tick_growth, 2)}%,当日当时涨幅:{today_growth}%。")
                                        # logger.info(
                                        # logger_info(
                                        #     f"【强度数据】  ==  {data_cache.market_sift_plate_stock_dict}")
                                        if last_volume_to_growth_ratio < 0.8:
                                            logger.info(
                                            logger_info(
                                                f"【无概念 无强度 有小量换大涨幅】瞬时量幅比< 0.8 !瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%。")
                                            if tick_growth >= 0.8:
                                                logger.info(
                                                logger_info(
                                                    f"【无概念 无强度 有小量换大涨幅 有强拉】瞬时涨幅 > 0.8% !瞬时涨幅:{round(tick_growth, 2)}%")
                                                if current_volume < k_line_data[0]['volume'] * ratios:
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】今日成交量 < 昨日的{ratios}倍,不买!!公司名称:{k_line_data[0]['sec_name']},今日目前成交量为昨日的{round(current_volume / k_line_data[0]['volume'], 2)}")
                                                elif buying_strong is not True and current_volume <= k_line_data[0]['volume'] * ratios and now_time > data_cache.MORN_MARKET_TIME:
                                                    logger.info(
                                                elif buying_strong is not True and current_volume <= k_line_data[0][
                                                    'volume'] * ratios and now_time > data_cache.MORN_MARKET_TIME:
                                                    logger_info(
                                                        f"【不利】买一量小于卖一量 且 挂买总量小于挂卖总量 且 当日量不足 (9:35后实施)!不买!!公司名称:{k_line_data[0]['sec_name']},自由市值:{free_market_value} 亿,最新价: {current_price}")
                                                    # logger.info(
                                                    # logger_info(
                                                    #     f"目前获取的精选板块股票强度数据  ==  {data_cache.market_sift_plate_stock_dict}")
                                                elif current_high - current_price > 0.05:
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】当前最新价小于今日最高价!不买!!公司名称:{k_line_data[0]['sec_name']},,最新价: {current_price},,当日最高价:{current_high}")
                                                elif limit_up_day < 1 and current_volume <= k_line_data[0][
                                                    'volume'] * 2:
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】冷票 且 (瞬时涨幅小于1 或 瞬时量与昨总量比与瞬时涨幅的比值大于0.8)且 当日量还不足昨日量的1.5倍!不买!! 公司名称:{k_line_data[0]['sec_name']},最新价: {current_price},,90天内涨停天数:{limit_up_day}")
                                                # for d in k_line_data[1:3] 只检查k_line_data中的第二个和第三个元素
                                                elif limit_up_day > 6 and any(
@@ -579,51 +594,52 @@
                                                        for d in
                                                        k_line_data[1:3]) and current_volume <= k_line_data[0][
                                                    'volume'] * 1.5:
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】过于显著票 且 上日或上上涨停板 当日量还不足昨日量的1.5倍!不买!! 公司名称:{k_line_data[0]['sec_name']},今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,最新价: {current_price},,90天内涨停天数:{limit_up_day}")
                                                elif k_line_data[0]['attribute'] in data_cache.frying_plate_type:
                                                    logger.info(f"【不利】昨日炸板!不买!!")
                                                    logger_info(f"【不利】昨日炸板!不买!!")
                                                elif k_line_data[0]['attribute'] in data_cache.limit_up_type:
                                                    logger.info(f"【不利】昨日涨停!不买!!")
                                                    logger_info(f"【不利】昨日涨停!不买!!")
                                                elif k_line_data[0]['attribute'] in data_cache.limit_down_type:
                                                    logger.info(f"【不利】昨日跌停!不买!!")
                                                    logger_info(f"【不利】昨日跌停!不买!!")
                                                # elif k_line_data[0]['attribute'] == 'up_down' and k_line_data[0]['today_volume_shape'] == 'increases_down':
                                                #     logger.info(f"【不利】昨日高开低走 且 放量下跌,不买!!公司名称:{k_line_data[0]['sec_name']}")
                                                elif k_line_data[0]['attribute'] == 'down_down' and k_line_data[0]['today_volume_shape'] == 'increases_down':
                                                    logger.info(
                                                #     logger_info(f"【不利】昨日高开低走 且 放量下跌,不买!!公司名称:{k_line_data[0]['sec_name']}")
                                                elif k_line_data[0]['attribute'] == 'down_down' and k_line_data[0][
                                                    'today_volume_shape'] == 'increases_down':
                                                    logger_info(
                                                        f"【不利】昨日低开低走 且 放量下跌,不买!!公司名称:{k_line_data[0]['sec_name']}")
                                                elif throwing_pressure_position[0] is True:
                                                    # 最近涨停日期:{k_line_data[limit_up_day_min_index]['bob']} ,
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】近7日涨停过票 且 当前价和今日涨停价 接近涨停大抛压价位 且 当日量还不足涨停次日量的1.5倍!且 次日最高价小于涨停最高价的1.02倍 不买!! 公司名称:{k_line_data[0]['sec_name']},今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,最新价: {current_price}")
                                                elif throwing_pressure_position[1] is True:
                                                    # 最近涨停日期:{k_line_data[frying_plate_day_min_index]['bob']} ,炸板次日量{round(k_line_data[frying_plate_day_min_index - 1]['volume'], 2)},
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】近7日炸板过票 且 当前价和今日涨停价 接近炸板大抛压价位 且 当日量还不足涨停次日量的1.5倍!且 次日最高价小于炸板最高价的1.02倍 不买!! 公司名称:{k_line_data[0]['sec_name']},最新价: {current_price}")
                                                elif throwing_pressure_position[2] is True:
                                                    # 最近涨停日期:{k_line_data[limit_down_day_min_index]['bob']} ,
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】近7日跌停过票 且 当前价和今日涨停价 接近跌停大抛压价位[跌停日的最高价或最低价] 且当日量还不足昨日量的1.5倍!不买!! 公司名称:{k_line_data[0]['sec_name']},最新价: {current_price}")
                                                elif (
                                                        free_market_value == 0 or free_market_value == 0.0) and free_market_value < 6:
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】自由市值小于6亿!不买!! 公司名称:{k_line_data[0]['sec_name']},最新价: {current_price}")
                                                elif data_cache.have_small_turn_large_buy_times >= 1:
                                                    logger.info(f"【不利】有小量换大涨幅买入已经 1 次了!不买了!!")
                                                    logger_info(f"【不利】有小量换大涨幅买入已经 1 次了!不买了!!")
                                                elif len(data_cache.addition_position_symbols_set) >= 4:
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】当日已经买了4只票!不买了!!")
                                                elif (
                                                        data_cache.MORN_MARKET_TIME < now_time < data_cache.NOON_MARKET_TIME) is False or free_market_value < 100 or (
                                                        today_open_growth < 5 or today_growth < 5):
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】不在9:35-13:05时间内!或自由市值小于100亿!或开盘涨幅或当日当时涨幅都小于5%!不买!!")
                                                else:
                                                    logger.info(
                                                    logger_info(
                                                        f"************************************************【小量大涨幅指标】************************************************")
                                                    logger.info(
                                                    logger_info(
                                                        f"最新价: {current_price}, 当日最高价:{current_high},瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%,公司名称:{k_line_data[0]['sec_name']},当前时间:{current_created_at},低于水位线:{deep_low:.2f},交易量今日与昨日的比例{round(current_volume / k_line_data[0]['volume'], 2)}")  # 输出当前价格和3秒涨幅信息
                                                    logger.info(
                                                    logger_info(
                                                        f"目前获取的精选板块股票强度数据  ==  {data_cache.market_sift_plate_stock_dict}")
                                                    # buying_ratio = basic_methods.maximum_buying_ratio(len(data_cache.addition_position_symbols_set))
                                                    # 调用下单方法下单
@@ -638,98 +654,102 @@
                                                    L2_data_analysis.find_L2_big_order_of_code(symbol_code)
                                                    # 检测持仓代码集合中有无下单个股,才认为交易成功
                                                    if symbol_code not in data_cache.position_symbols_set:
                                                        logger.info(
                                                        logger_info(
                                                            f"【{k_line_data[0]['sec_name']}】交易失败~持仓集合:{data_cache.position_symbols_set}")
                                                    else:
                                                        # 将有概念买入次数自加1
                                                        data_cache.have_small_turn_large_buy_times += 1
                                                        # 将买入个股的当时概念添加到全局变量中存储
                                                        data_cache.bought_plate.extend(k_line_data[0]['sec_name'])
                                                        logger.info(
                                                        logger_info(
                                                            f"【{k_line_data[0]['sec_name']}】交易成功!持仓集合:{data_cache.position_symbols_set}")
                                '''
                                昨日涨停视界,今日连板预期盯视界
                                '''
                                if k_line_data[0]['attribute'] in data_cache.limit_up_type:
                                    # logger.info(f"昨日涨停")
                                    if k_line_data[1]['attribute'] not in data_cache.limit_up_type and k_line_data[2]['attribute'] not in data_cache.limit_up_type:
                                        # logger.info(f"前日大前日未涨停")
                                    # logger_info(f"昨日涨停")
                                    if k_line_data[1]['attribute'] not in data_cache.limit_up_type and k_line_data[2][
                                        'attribute'] not in data_cache.limit_up_type:
                                        # logger_info(f"前日大前日未涨停")
                                        if today_open_growth > 1:
                                            logger.info(
                                            logger_info(
                                                f"【{k_line_data[0]['sec_name']}】--------------------------------------------------------------------------------------------------------[昨日涨停视界]")
                                            logger.info(
                                            logger_info(
                                                f"【{k_line_data[0]['sec_name']}】,瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,最新价: {current_price},,当日当时涨幅:{today_growth}%,当前时间:{current_created_at}")
                                            logger.info(f"昨日首板涨停,当日中等以上高开 {today_open_growth}% !")
                                            logger_info(f"昨日首板涨停,当日中等以上高开 {today_open_growth}% !")
                                            if limit_up_day > 6 and any(
                                                    'attribute' in d and d['attribute'] in data_cache.limit_up_type for
                                                    d in k_line_data[1:3]) and current_volume <= k_line_data[0]['volume'] * 1.5:
                                                logger.info(
                                                    d in k_line_data[1:3]) and current_volume <= k_line_data[0][
                                                'volume'] * 1.5:
                                                logger_info(
                                                    f"【不利】过于显著票 且 前日或上前日涨停板 当日量还不足昨日量的1.5倍!不买!! 今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,90天内涨停天数:{limit_up_day}")
                                            elif len(data_cache.addition_position_symbols_set) >= 3:
                                                logger.info(
                                                logger_info(
                                                    f"【不利】当日已经买了3只票!不买!!")
                                            elif now_time < data_cache.OPENING_TIME or now_time > data_cache.MORN_MARKET_TIME:
                                                logger.info(
                                                logger_info(
                                                    f"【不利】不在9:30-9:35时间内!不买!!")
                                            else:
                                                # logger.info(
                                                # logger_info(
                                                #     f"************************************************【昨日首板指标下单】************************************************")
                                                logger.info(
                                                logger_info(
                                                    f"最新价: {current_price}, 当日最高价:{current_high},瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%,公司名称:{k_line_data[0]['sec_name']},当前时间:{current_created_at},低于水位线:{deep_low:.2f},交易量今日与昨日的比例{round(current_volume / k_line_data[0]['volume'], 2)}")  # 输出当前价格和3秒涨幅信息
                                                # order_methods.buy_order_by_value(symbol, 10000,k_line_data[0]['sec_name'],today_limit_up_price)
                                                logger.info(f"昨日首版涨停,今日高开5%!考虑下叉")
                                                logger_info(f"昨日首版涨停,今日高开5%!考虑下叉")
                                '''
                                昨日炸板,今日涨停预期盯视界
                                '''
                                if k_line_data[0]['attribute'] in data_cache.frying_plate_type:
                                    # logger.info(
                                    # logger_info(
                                    #     f"昨日炸板!公司名称:{k_line_data[0]['sec_name']},当前时间:{current_data['created_at']}")
                                    if k_line_data[0]['attribute'] == 'first_frying_plate':
                                        # logger.info(
                                        # logger_info(
                                        #     f"昨日首炸板!公司名称:{k_line_data[0]['sec_name']},当前时间:{current_data['created_at']}")
                                        if today_open_growth > 4:
                                            logger.info(
                                            logger_info(
                                                f"【{k_line_data[0]['sec_name']}】--------------------------------------------------------------------------------------------------------[昨日首炸板视界]")
                                            logger.info(
                                            logger_info(
                                                f"【{k_line_data[0]['sec_name']}】,瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,最新价: {current_price},,当日当时涨幅:{today_growth}%,当前时间:{current_created_at}")
                                            logger.info(f"昨日首板炸板,当日中等以上高开 {today_open_growth}% !")
                                            logger_info(f"昨日首板炸板,当日中等以上高开 {today_open_growth}% !")
                                            # 在买票预设时间段 视界
                                            if limit_up_day > 6 and any(
                                                    'attribute' in d and d['attribute'] in data_cache.limit_up_type for d in k_line_data[1:3]) and current_volume <= k_line_data[0]['volume'] * 1.5:
                                                logger.info(
                                                    'attribute' in d and d['attribute'] in data_cache.limit_up_type for
                                                    d in k_line_data[1:3]) and current_volume <= k_line_data[0][
                                                'volume'] * 1.5:
                                                logger_info(
                                                    f"【不利】过于显著票 且 上日或上上涨停板 当日量还不足昨日量的1.5倍!不买!! 今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,90天内涨停天数:{limit_up_day}")
                                            elif len(data_cache.addition_position_symbols_set) >= 3:
                                                logger.info(
                                                logger_info(
                                                    f"【不利】当日已经买了3只票!不买!!")
                                            elif now_time < data_cache.OPENING_TIME or now_time > data_cache.MORN_MARKET_TIME:
                                                logger.info(
                                                logger_info(
                                                    f"【不利】不在9:30-9:05时间内!不买!!")
                                            else:
                                                # logger.info(
                                                # logger_info(
                                                #     f"************************************************【昨日首炸板指标下单】************************************************")
                                                logger.info(
                                                logger_info(
                                                    f"最新价: {current_price}, 当日最高价:{current_high},瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%,公司名称:{k_line_data[0]['sec_name']},当前时间:{current_created_at},低于水位线:{deep_low:.2f},交易量今日与昨日的比例{round(current_volume / k_line_data[0]['volume'], 2)}")  # 输出当前价格和3秒涨幅信息
                                                # order_methods.buy_order_by_value(symbol, 10000,k_line_data[0]['sec_name'],today_limit_up_price)
                                                logger.info(f"昨日首版炸板,今日高开5%!考虑下叉")
                                                logger_info(f"昨日首版炸板,今日高开5%!考虑下叉")
                                '''
                                昨日跌停,今日涨停预期盯视界
                                '''
                                if k_line_data[0]['attribute'] in data_cache.limit_down_type:
                                    # logger.info(
                                    # logger_info(
                                    #     f"昨日跌停!公司名称:{k_line_data[0]['sec_name']},当前时间:{current_data['created_at']}")
                                    pass
                            else:
                                logger.info(
                                logger_info(
                                    f"当前高位风险 或 其他二次近前高等风险,不买!公司名称:【{k_line_data[0]['sec_name']}】")
                        else:
                            logger.info(
                            logger_info(
                                f"当日当时涨幅不在预设范围,不买!公司名称:【{k_line_data[0]['sec_name']}】,当日当时涨幅:{round(today_growth, 2)}%")
                    else:
                        logger.info(
                        logger_info(
                            f"当日最低跌幅低于 -3% ,不买!公司名称:【{k_line_data[0]['sec_name']}】,当日当时最低价:{current_low} 当日当时最大跌幅:{deep_low} ,当日当时最新价:{current_price},买五档:{current_quotes_buy},K线昨收价{k_line_data[0]['close']}")
                else:
                    logger.info(f"已持仓,不买!公司名称:【{k_line_data[0]['sec_name']}】")
                    logger_info(f"已持仓,不买!公司名称:【{k_line_data[0]['sec_name']}】")
                # 以下部分主要计算整体的花费时间
                # 将current_created_at转换为datetime对象,这里假设是今天的日期
                # 注意:这里使用了datetime.now()来获取当前日期,但你可以根据需要调整
@@ -741,19 +761,18 @@
                # print(f"now_end===={now_end}")
                # print(f"now_end type===={type(now_end)}")
                now_start_to_end = abs(created_at - now_end)
                logger.info(f"获取到判断花费==={round(now_start_to_end,2)} 秒")
                logger_info(f"获取到判断花费==={round(now_start_to_end, 2)} 秒")
                # print(f" now_end=={now_end}  created_at=={created_at}")
                # 设定一个时间阈值(比如9秒)
                threshold_4 = datetime.timedelta(seconds=4).total_seconds()
                if now_start_to_end > threshold_4:
                    logger.info(f"获取到判断花费大于4秒啦!!!")
                    logger_info(f"获取到判断花费大于4秒啦!!!")
                threshold_6 = datetime.timedelta(seconds=6).total_seconds()
                if now_start_to_end > threshold_6:
                    logger.info(f"获取到判断花费大于6秒啦!!!")
                logger.info(
                    logger_info(f"获取到判断花费大于6秒啦!!!")
                logger_info(
                    f"完成时间======================================{tool.to_time_str(now_end)}======================================")
    else:
        pass
        # 如果K线数据为空,则不进入后续判断
        # print(f"代码:{symbol},k_line_data is None,未get到该股的K线属性,或为新股、次新股第一天的时候确实没有历史K线")
strategy/instant_time_market.py
@@ -5,8 +5,12 @@
import logging
import time
import datetime
import dask
import utils
from log_module.log import logger_common
from log_module import async_log_util
from log_module.log import logger_common, logger_debug
from strategy.trade_setting import TradeSetting
from utils import huaxin_util, tool
# 引入华鑫API(小辉整理)
@@ -101,7 +105,8 @@
                # logger.info(f"【没有】在集合竞价内启动,采用【掘金数据】记录")
                print(f"【没有】在开盘前内启动,采用【掘金数据】记录 开盘价")
                data_cache.record_current_open_execution = True
                current_datas = utils.juejin_api.JueJinApi.get_codes_open(data_cache.DataCache().min_stocks, fields='symbol,open')
                current_datas = utils.juejin_api.JueJinApi.get_codes_open(data_cache.DataCache().min_stocks,
                                                                          fields='symbol,open')
                # print(f"current_datas=={current_datas}")
                for current_data in current_datas:
                    # print(f"current_data=={current_data}")
@@ -160,8 +165,13 @@
__current_high_and_low_dict = {}
# 生成所有个股的最高价、最低价 字典
#
def get_all_stocks_current_high_and_low(current_infos):
    """
    生成所有个股的最高价、最低价 字典
    :param current_infos:
    :return:
    """
    # 获取当前时间
    now_time = tool.get_now_time_str()
    # 如果当前时间大于09:25:06才运行最高价和最低价的运算
@@ -174,9 +184,9 @@
            # print(f"current_info=={current_infos}")
            for current_info in current_infos:
                symbol = basic_methods.format_stock_symbol(current_info[0])  #股票代码
                pre_close = current_info[1]        # 昨日收盘价
                current_price = current_info[2]   # 最新价
                current_quotes_buy_1_price = current_info[5][0][0]   #买一价格
                pre_close = current_info[1]  # 昨日收盘价
                current_price = current_info[2]  # 最新价
                current_quotes_buy_1_price = current_info[5][0][0]  #买一价格
                price_tracker = __current_high_or_low_dict.get(symbol)
                if not price_tracker:
                    # 赋初值
@@ -186,21 +196,21 @@
                # print(f"current_price>>>>>>==={current_price}")
                if current_price is not None:
                    # 为避免L1数据中最新价偶发为0,在最新价为0时使用买一价记录
                    if current_price != 0 or current_price != 0.0:
                    if current_price > 0:
                        # logger.info(
                        #     f"《current_price 不为空 也不为0.0 也不为0 当日当时最新价:{current_price}》")
                        get_current_high_or_low.set_current_price(current_price)
                        data_cache.all_stocks_current_high_and_low[symbol] = {
                            'current_high': get_current_high_or_low.current_high,
                            'current_low': get_current_high_or_low.current_low}
                    elif current_quotes_buy_1_price != 0 or current_quotes_buy_1_price != 0.0:
                    elif current_quotes_buy_1_price > 0:
                        # logger.info(
                        #     f"代码:{symbol}::《current_price 未获取成功 或 值为0.0 零食采用买一价作为最新价,买一价:{current_quotes_buy_1_price}》 ")
                        get_current_high_or_low.set_current_price(current_quotes_buy_1_price)
                        data_cache.all_stocks_current_high_and_low[symbol] = {
                            'current_high': get_current_high_or_low.current_high,
                            'current_low': get_current_high_or_low.current_low}
                    elif pre_close != 0 or pre_close != 0.0:
                    elif pre_close > 0:
                        logger.info(
                            f"最新价和买一价获取失败或有误,获取到的当日当时最新价:{current_price},买一价:{current_quotes_buy_1_price}》,临时性采用昨收价作为最新价,昨收价:{pre_close}")
                        get_current_high_or_low.set_current_price(pre_close)
@@ -303,9 +313,25 @@
# 把current_infos灌入相应的线程
def set_current_info(current_infos):
    @dask.delayed
    def process_current_infos(current_info_list):
        for current_info in current_info_list:
            try:
                if current_info is not None:
                    strategic_thread_manager(current_info)
            except Exception as error:
                logging.exception(error)
                # print("异常:", current_info)
                logger_debug.exception(error)
                logger_debug.error(f"L1处理出错:{current_info}")
    @dask.delayed
    def batch_process_current_infos(fs):
        return fs
    logging.info(f"set_current_info进入")
    now_start = time.time()
    try:
        now_start = time.time()
        now_time = tool.get_now_time_str()
        if len(current_infos) == 0 and now_time > data_cache.L1_DATA_START_TIME:
            print(f"9:15后 l1数据为空=l1_data_current_infos===={current_infos}")
@@ -314,13 +340,17 @@
        #         print(f"i===={i}")
        get_all_stocks_current_open(current_infos)
        get_all_stocks_current_high_and_low(current_infos)
        for current_info in current_infos:
            try:
                if current_info is not None:
                    strategic_thread_manager(current_info)
            except Exception as error:
                logging.exception(error)
                # print("异常:", current_info)
        if current_infos:
            # 分批处理数据
            ds = []
            total_count = len(current_infos)
            page = 5
            page_size = total_count // page + 1
            for p in range(page):
                temp_list = current_infos[p * page_size:(p + 1) * page_size]
                ds.append(process_current_infos(temp_list))
            dask_result = batch_process_current_infos(ds)
            dask_result.compute()
        now_end: float = time.time()
        start_to_end = now_end - now_start
        print(f"运行中=={round(start_to_end, 2)} 秒")
@@ -328,8 +358,7 @@
    except Exception as error:
        logging.exception(error)
    finally:
        pass
        async_log_util.info(logger_debug, f"L1处理时间:{time.time() - now_start}")
# 仅仅用于测试数据进入策略后的数据情况
# get_current_info()
strategy/selling_strategy.py
@@ -4,6 +4,7 @@
# import decimal
import datetime
from log_module import async_log_util
from log_module.log import logger_common
# import time
# 引入掘金API
@@ -77,6 +78,15 @@
symbol_volume_trackers = {}
def logger_info(content):
    """
    日志记录
    :param content:
    :return:
    """
    async_log_util.info(logger, content)
# 更新个股成交量函数
def update_symbol_volume(symbol, new_volume):
    # 确保股票代码在字典中有对应的VolumeTracker实例
@@ -134,8 +144,8 @@
            # print(f"element=={element}")
            element_symbol = basic_methods.format_stock_symbol(element['securityID'])
            if symbol_code == element['securityID']:  # 当循环到的持仓代码正好是current_data的代码时,即取得了持仓个股的行情快照数据
                # logger.info(f"index = {index}")
                # logger.info(f"element = {element}")
                # logger_info(f"index = {index}")
                # logger_info(f"element = {element}")
                account_positions_symbol = element_symbol  # 当前循环到的持仓个股代码
                # print(f"account_positions_symbol==={account_positions_symbol}")
                # available_now = element['available_now']  # 当前个股可用金额
@@ -163,7 +173,7 @@
                if position_volume_yesterday > 0:  # 如果可用资金不等于0 且 持仓数量大于0 (不知名原因导致有些票会获取到零值导致后续公式报错,阻止intraday_growth函数正常运行)
                    # 进入集合竞价前和收盘前作持仓可用交易,在此时间为不生效
                    if data_cache.BEFORE_OPEN_BIDDING_TIME < now_time < data_cache.AFTER_CLOSING_TIME:
                        # logger.info(f"account_positions_element = 【{k_line_data[0]['sec_name']}】  代码:{element['symbol']}  股持仓均价:{element['vwap']}    持仓量:{element['volume']} ")
                        # logger_info(f"account_positions_element = 【{k_line_data[0]['sec_name']}】  代码:{element['symbol']}  股持仓均价:{element['vwap']}    持仓量:{element['volume']} ")
                        # print(f"available_now_index===={index}")
                        # 调用涨幅公式计算对应的股票tick瞬时涨幅
                        tick_growth = basic_methods.tick_growth(symbol, current_price)
@@ -196,18 +206,19 @@
                        集合竞价阶段决断(只判断一次)
                        '''
                        #  09:25:06---09:30:00
                        if data_cache.LATER_OPEN_BIDDING_TIME < now_time < data_cache.OPENING_TIME and data_cache.execution_times < len(data_cache.available_symbols_set):
                        if data_cache.LATER_OPEN_BIDDING_TIME < now_time < data_cache.OPENING_TIME and data_cache.execution_times < len(
                                data_cache.available_symbols_set):
                            # 每进入该条件分支一次就把进入次数自加1
                            data_cache.execution_times += 1
                            logger.info(f"这个分支逻辑已经执行次数:{data_cache.execution_times}")
                            logger.info(
                            logger_info(f"这个分支逻辑已经执行次数:{data_cache.execution_times}")
                            logger_info(
                                f"【集合竞价】【{k_line_data[0]['sec_name']}】,开盘涨幅:{today_open_growth}%,当日当时涨幅:{today_growth},瞬时涨幅{tick_growth},当日当时浮动盈亏{floating_profit_and_loss}。当日开盘价:{current_open},昨日收盘价:{k_line_data[0]['close']}")
                            # 昨日起飞失败
                            if k_line_data[0]['attribute'] not in (
                                    data_cache.limit_up_type + data_cache.frying_plate_type + data_cache.limit_down_type):
                                if floating_profit_and_loss > 0:
                                    if today_open_growth < -1:
                                        logger.info(
                                        logger_info(
                                            f"【集合竞价】【{k_line_data[0]['sec_name']}】【昨日起飞失败】【浮盈】【低开】,低开:{today_open_growth}%,设定委卖数量【十分之一仓】")
                                        order_methods.sell_order_by_part_volume(0.1, symbol, position_volume_yesterday,
                                                                                current_price,
@@ -216,14 +227,14 @@
                                if floating_profit_and_loss <= 0:
                                    # 中高开/大高开视界
                                    if today_open_growth >= 4:
                                        logger.info(
                                        logger_info(
                                            f"【集合竞价】【{k_line_data[0]['sec_name']}】【昨日起飞失败】【浮亏】【中高开/大高开】,高开:{today_open_growth}%,设定委卖数量【十分之五仓】")
                                        order_methods.sell_order_by_part_volume(0.5, symbol, position_volume_yesterday,
                                                                                current_price,
                                                                                k_line_data[0]['sec_name'], index)
                                    # 小高开视界
                                    if 4 > today_open_growth >= 1:
                                        logger.info(
                                        logger_info(
                                            f"【集合竞价】【{k_line_data[0]['sec_name']}】【昨日起飞失败】【浮亏】【小高开】,高开:{today_open_growth}%,设定委卖数量【十分之三仓】")
                                        order_methods.sell_order_by_part_volume(0.3, symbol, position_volume_yesterday,
                                                                                current_price,
@@ -231,7 +242,7 @@
                                                                                index)
                                    # 平开视界 +- 1
                                    if -1 < today_open_growth < 1:
                                        logger.info(
                                        logger_info(
                                            f"【集合竞价】【平开】【{k_line_data[0]['sec_name']}】【昨日起飞失败】【浮亏】【平开】,平开:{today_open_growth}%,设定委卖数量【十分之五仓】")
                                        order_methods.sell_order_by_part_volume(0.5, symbol, position_volume_yesterday,
                                                                                current_price,
@@ -239,7 +250,7 @@
                                                                                index)
                                    # 低开视界
                                    if today_open_growth <= -1:
                                        logger.info(
                                        logger_info(
                                            f"【集合竞价】【{k_line_data[0]['sec_name']}】【昨日起飞失败】【浮亏】【小低开】,低开:{today_open_growth}%,设定委卖数量【全仓】")
                                        order_methods.sell_order_by_part_volume(1, symbol, position_volume_yesterday,
                                                                                current_price,
@@ -251,29 +262,31 @@
                                if floating_profit_and_loss <= 0:
                                    # 平开视界 < ±1%
                                    if -1 < today_open_growth < 1:
                                        logger.info(
                                        logger_info(
                                            f"【集合竞价】【{k_line_data[0]['sec_name']}】【昨日涨停】【浮亏】【平开】,平开:{today_open_growth}%,设定委卖数量【无,集合竞价阶段不决策】")
                                    # 低开视界
                                    if today_open_growth <= -1:
                                        # 小低开视界
                                        if -4 < today_open_growth <= -1:
                                            logger.info(
                                            logger_info(
                                                f"【集合竞价】【{k_line_data[0]['sec_name']}】【昨日涨停】【浮亏】【小低开】,低开:{today_open_growth}%,设定委卖数量【十分之五仓】")
                                            order_methods.sell_order_by_part_volume(0.5, symbol, position_volume_yesterday,
                                            order_methods.sell_order_by_part_volume(0.5, symbol,
                                                                                    position_volume_yesterday,
                                                                                    current_price,
                                                                                    k_line_data[0]['sec_name'], index)
                                        # 中低开/大低开视界
                                        if today_open_growth <= -4:
                                            logger.info(
                                            logger_info(
                                                f"【集合竞价】【{k_line_data[0]['sec_name']}】【昨日涨停】【浮亏】【中低开/大低开】,低开:{today_open_growth}%,设定委卖数量【全仓】")
                                            order_methods.sell_order_by_part_volume(1, symbol, position_volume_yesterday,
                                            order_methods.sell_order_by_part_volume(1, symbol,
                                                                                    position_volume_yesterday,
                                                                                    current_price,
                                                                                    k_line_data[0]['sec_name'], index)
                                #  如果昨日集合竞价最后时刻炸板的股票【开盘啦昨日炸板但通过K线数据计算涨停的股票代码列表】
                                if symbol in data_cache.yesterday_frying_plate_last_minute_list:
                                    # 开盘涨幅小于9.6%
                                    if today_open_growth < 9.6:
                                        logger.info(
                                        logger_info(
                                            f"【集合竞价】【{k_line_data[0]['sec_name']}】【昨日K线涨停,开盘啦炸板】【非触摸板状态】,开盘涨幅:{today_open_growth}%,设定委卖数量【全仓】")
                                        order_methods.sell_order_by_part_volume(1, symbol, position_volume_yesterday,
                                                                                current_price,
@@ -283,35 +296,35 @@
                                if floating_profit_and_loss > 0:
                                    # 中高开/大高开视界
                                    if today_open_growth >= 4:
                                        logger.info(
                                        logger_info(
                                            f"【集合竞价】【{k_line_data[0]['sec_name']}】【昨日炸板】【浮盈】【中高开/大高开】,高开:{today_open_growth}%,设定委卖数量【二十分之一仓】")
                                        order_methods.sell_order_by_part_volume(0.05, symbol, position_volume_yesterday,
                                                                                current_price,
                                                                                k_line_data[0]['sec_name'], index)
                                    # 小高开视界
                                    if 4 > today_open_growth >= 1:
                                        logger.info(
                                        logger_info(
                                            f"【集合竞价】【{k_line_data[0]['sec_name']}】【昨日炸板】【浮盈】【小高开】,高开:{today_open_growth}%,设定委卖数量【十分之一仓】")
                                        order_methods.sell_order_by_part_volume(0.1, symbol, position_volume_yesterday,
                                                                                current_price,
                                                                                k_line_data[0]['sec_name'], index)
                                    # 平开视界 < ±1%
                                    if -1 < today_open_growth < 1:
                                        logger.info(
                                        logger_info(
                                            f"【集合竞价】【{k_line_data[0]['sec_name']}】【昨日炸板】【浮盈】【平开】,平开:{today_open_growth}%,设定委卖数量【十分之五仓】")
                                        order_methods.sell_order_by_part_volume(0.5, symbol, position_volume_yesterday,
                                                                                current_price,
                                                                                k_line_data[0]['sec_name'], index)
                                    # 小低开视界
                                    if -4 < today_open_growth <= -1:
                                        logger.info(
                                        logger_info(
                                            f"【集合竞价】【{k_line_data[0]['sec_name']}】【昨日炸板】【浮盈】【小低开】,低开:{today_open_growth}%,设定委卖数量【十分之七仓】")
                                        order_methods.sell_order_by_part_volume(0.7, symbol, position_volume_yesterday,
                                                                                current_price,
                                                                                k_line_data[0]['sec_name'], index)
                                    # 中低开/大低开视界
                                    if today_open_growth <= -4:
                                        logger.info(
                                        logger_info(
                                            f"【集合竞价】【{k_line_data[0]['sec_name']}】【昨日炸板】【中低开/大低开】,低开:{today_open_growth}%,设定委卖数量【全仓】")
                                        order_methods.sell_order_by_part_volume(1, symbol, position_volume_yesterday,
                                                                                current_price,
@@ -320,42 +333,42 @@
                                if floating_profit_and_loss <= 0:
                                    # 中高开/大高开视界
                                    if today_open_growth >= 4:
                                        logger.info(
                                        logger_info(
                                            f"【集合竞价】【{k_line_data[0]['sec_name']}】【昨日炸板】【浮亏】【中高开/大高开】,高开:{today_open_growth}%,设定委卖数量【十分之二仓】")
                                        order_methods.sell_order_by_part_volume(0.2, symbol, position_volume_yesterday,
                                                                                current_price,
                                                                                k_line_data[0]['sec_name'], index)
                                    # 小高开视界
                                    if 4 > today_open_growth >= 1:
                                        logger.info(
                                        logger_info(
                                            f"【集合竞价】【{k_line_data[0]['sec_name']}】【昨日炸板】【浮亏】【小高开】,高开:{today_open_growth}%,设定委卖数量【十分之五仓】")
                                        order_methods.sell_order_by_part_volume(0.5, symbol, position_volume_yesterday,
                                                                                current_price,
                                                                                k_line_data[0]['sec_name'], index)
                                    # 平开视界 < ±1%
                                    if -1 < today_open_growth < 1:
                                        logger.info(
                                        logger_info(
                                            f"【集合竞价】【{k_line_data[0]['sec_name']}】【昨日炸板】【浮亏】【平开】,平开:{today_open_growth}%,设定委卖数量【十分之五仓】")
                                        order_methods.sell_order_by_part_volume(0.5, symbol, position_volume_yesterday,
                                                                                current_price,
                                                                                k_line_data[0]['sec_name'], index)
                                    # 小低开视界
                                    if -4 < today_open_growth <= -1:
                                        logger.info(
                                        logger_info(
                                            f"【集合竞价】【{k_line_data[0]['sec_name']}】【昨日炸板】【浮亏】【小低开】,低开:{today_open_growth}%,设定委卖数量【十分之七仓】")
                                        order_methods.sell_order_by_part_volume(0.7, symbol, position_volume_yesterday,
                                                                                current_price,
                                                                                k_line_data[0]['sec_name'], index)
                                    # 中低开/大低开视界
                                    if today_open_growth <= -4:
                                        logger.info(
                                        logger_info(
                                            f"【集合竞价】【{k_line_data[0]['sec_name']}】【昨日炸板】【浮亏】【中低开/大低开】,低开:{today_open_growth}%,设定委卖数量【全仓】")
                                        order_methods.sell_order_by_part_volume(1, symbol, position_volume_yesterday,
                                                                                current_price,
                                                                                k_line_data[0]['sec_name'], index)
                            # 昨日跌停视界
                            if k_line_data[0]['attribute'] in data_cache.limit_down_type:
                                logger.info(
                                logger_info(
                                    f"【集合竞价】【{k_line_data[0]['sec_name']}】【昨日跌停】【无论开盘涨幅多少!!!】,开盘涨幅:{today_open_growth}%,设定委卖数量【全仓】")
                                order_methods.sell_order_by_part_volume(1, symbol, position_volume_yesterday,
                                                                        current_price,
@@ -373,15 +386,17 @@
                                    # 浮动盈亏【亏】
                                    if floating_profit_and_loss < 0:
                                        if tick_growth < -0.1 and current_price <= current_low:
                                            logger.info(
                                            logger_info(
                                                f"【开盘临机】【浮动盈亏当前亏】【瞬时跌幅 <-0.1%】【当日新低】【{k_line_data[0]['sec_name']}】,设定委卖数量【十分之一仓】,【瞬时跌幅:{round(tick_growth, 2)}%】,当日当时涨幅:{today_growth}。最新价::{current_price},昨日收盘价:{k_line_data[0]['close']}")
                                            order_methods.sell_order_by_part_volume(0.1, symbol, position_volume_yesterday,
                                            order_methods.sell_order_by_part_volume(0.1, symbol,
                                                                                    position_volume_yesterday,
                                                                                    current_price,
                                                                                    k_line_data[0]['sec_name'], index)
                                        if tick_growth < -1 and today_growth < 0 and current_price <= current_low:
                                            logger.info(
                                            logger_info(
                                                f"【开盘临机】【浮动盈亏当前亏】【瞬时跌幅 <-1%】【当日当时涨幅 <0%】【当日新低】【{k_line_data[0]['sec_name']}】,设定委卖数量【全仓】,【瞬时跌幅:{round(tick_growth, 2)}%】,当日当时涨幅:{today_growth}。最新价::{current_price},昨日收盘价:{k_line_data[0]['close']}")
                                            order_methods.sell_order_by_part_volume(1, symbol, position_volume_yesterday,
                                            order_methods.sell_order_by_part_volume(1, symbol,
                                                                                    position_volume_yesterday,
                                                                                    current_price,
                                                                                    k_line_data[0]['sec_name'], index)
                                # 昨日涨停视界
@@ -389,7 +404,7 @@
                                    # 浮动盈亏【亏】
                                    if floating_profit_and_loss < 0:
                                        if tick_growth < -0.1 and today_growth < -4:
                                            logger.info(
                                            logger_info(
                                                f"【开盘临机】【浮动盈亏当前亏】【瞬时跌幅 <-1%】【当日当时涨幅 <-4%】【{k_line_data[0]['sec_name']}】,设定委卖数量【十分之一仓】,【瞬时跌幅:{round(tick_growth, 2)}%】,当日当时涨幅:{today_growth}。最新价::{current_price},昨日收盘价:{k_line_data[0]['close']}")
                                            order_methods.sell_order_by_part_volume(0.1, symbol,
                                                                                    position_volume_yesterday,
@@ -397,7 +412,7 @@
                                                                                    k_line_data[0]['sec_name'],
                                                                                    index)
                                        if tick_growth < -0.1 and today_growth < 0 and current_price <= current_low:
                                            logger.info(
                                            logger_info(
                                                f"【开盘临机】【浮动盈亏当前亏】【瞬时跌幅 <-1%】【当日当时涨幅小于0%】【当日新低】【{k_line_data[0]['sec_name']}】,设定委卖数量【全仓】,【瞬时跌幅:{round(tick_growth, 2)}%】,当日当时涨幅:{today_growth}。最新价::{current_price},昨日收盘价:{k_line_data[0]['close']}")
                                            order_methods.sell_order_by_part_volume(1, symbol,
                                                                                    position_volume_yesterday,
@@ -417,7 +432,7 @@
                                    # 浮动盈亏【亏】
                                    if floating_profit_and_loss < 0:
                                        if tick_growth < -0.1 and current_price <= current_low:
                                            logger.info(
                                            logger_info(
                                                f"【开盘临机】【浮动盈亏当前亏】【瞬时跌幅 <-0.1%】【当日新低】【{k_line_data[0]['sec_name']}】,设定委卖数量【十分之一仓】,【瞬时跌幅:{round(tick_growth, 2)}%】,当日当时涨幅:{today_growth}。最新价::{current_price},昨日收盘价:{k_line_data[0]['close']}")
                                            order_methods.sell_order_by_part_volume(0.1, symbol,
                                                                                    position_volume_yesterday,
@@ -425,7 +440,7 @@
                                                                                    k_line_data[0]['sec_name'],
                                                                                    index)
                                        if tick_growth < -1 and today_growth < 0 and current_price <= current_low:
                                            logger.info(
                                            logger_info(
                                                f"【开盘临机】【浮动盈亏当前亏】【瞬时跌幅 <-1%】【当日当时涨幅小于0%】【当日新低】【{k_line_data[0]['sec_name']}】,设定委卖数量【全仓】,【瞬时跌幅:{round(tick_growth, 2)}%】,当日当时涨幅:{today_growth}。最新价::{current_price},昨日收盘价:{k_line_data[0]['close']}")
                                            order_methods.sell_order_by_part_volume(1, symbol,
                                                                                    position_volume_yesterday,
@@ -441,14 +456,14 @@
                            if data_cache.OPENING_TIME < now_time < data_cache.WATCH_DISK_END_TIME:
                                # if symbol in data_cache.LIMIT_UP_SELL_CODES:
                                if today_limit_up_price == current_high:
                                    logger.info(
                                    logger_info(
                                        f"【开盘临机】【{k_line_data[0]['sec_name']}】 触及涨停! 买一总金额:{round(current_quotes_buy[0][1] * current_quotes_buy[0][0] / 10000, 2)} 万,当日当时量:{current_volume}")
                                    # 如果 买一总金额 < 200000   买一总金额 在L1情况下估计的炸板前最后一刻的最低买一额无法缩小到更小,其本身跨度也因股票因时间因往下砸的力度而异,不然无法观察到结果。
                                    if current_quotes_buy[0][1] * current_quotes_buy[0][0] < 1000000:
                                        logger.info(
                                        logger_info(
                                            f"【开盘临机】【炸板风险!!】【{k_line_data[0]['sec_name']}】 买盘金额小于100万! 买一额:【{current_quotes_buy[0][1]}】,当日当时量:{current_volume}")
                                        if current_volume < k_line_data[0]['volume'] * 0.6:
                                            logger.info(
                                            logger_info(
                                                f"【开盘临机】【 炸板!!且当日量不足】【{k_line_data[0]['sec_name']}】 买盘小于1万 且 今日量小于昨日量的 0.6,设定委卖数量【十分之一仓】,当日当时量:{current_volume}")
                                            # 设定委卖数量【十分之一仓】
                                            order_methods.sell_order_by_part_volume(0.1, symbol,
@@ -457,18 +472,18 @@
                                                                                    k_line_data[0]['sec_name'],
                                                                                    index)
                                    else:
                                        logger.info(f"【开盘临机】【{k_line_data[0]['sec_name']}】 涨停封板!!")
                                        logger_info(f"【开盘临机】【{k_line_data[0]['sec_name']}】 涨停封板!!")
                                    '''
                                    下面是目前看来更有效的板上盯卖
                                    '''
                                    # 如果 卖一 量 为零
                                    if current_quotes_sell[0][1] * current_quotes_sell[0][0] == 0:
                                        logger.info(
                                        logger_info(
                                            f"【开盘临机】【强势封板!!!】【{k_line_data[0]['sec_name']}】 买一总金额:{round(current_quotes_buy[0][1] * current_quotes_buy[0][0] / 10000, 2)} 万,当日当时量:{current_volume}")
                                    else:
                                        if current_volume < k_line_data[0]['volume'] * 0.6:
                                            logger.info(
                                            logger_info(
                                                f"【开盘临机】【 炸板中!!且当日量不足】【{k_line_data[0]['sec_name']}】 卖一数量不等于0,设定委卖数量【十分之一仓】,当日当时量:{current_volume}")
                                            order_methods.sell_order_by_part_volume(0.1, symbol,
                                                                                    position_volume_yesterday,
@@ -477,7 +492,7 @@
                                                                                    index)
                                        # 如果 卖二 量炸出来了,那么就是彻底炸开了。
                                        if current_quotes_sell[1][1] != 0:
                                            logger.info(
                                            logger_info(
                                                f"【开盘临机】【 炸板炸开了!!】【{k_line_data[0]['sec_name']}】 卖二数量不等于0,设定委卖数量【十分之二仓】,当日当时量:{current_volume}")
                                            order_methods.sell_order_by_part_volume(0.2, symbol,
                                                                                    position_volume_yesterday,
@@ -485,11 +500,11 @@
                                                                                    k_line_data[0]['sec_name'],
                                                                                    index)
                                            if current_volume < k_line_data[0]['volume'] * 0.8:
                                                logger.info(
                                                logger_info(
                                                    f"【开盘临机】【 炸板!!且当日量不足】【{k_line_data[0]['sec_name']}】 买盘小于1万 且 今日量小于昨日量的 0.8,当日当时量:{current_volume}")
                                                # 该股加入到板上盯卖的集合中  所以设定卖出全仓
                                                if symbol in data_cache.LIMIT_UP_SELL_CODES:
                                                    logger.info(
                                                    logger_info(
                                                        f"【开盘临机】【 炸板!!且当日量不足】【{k_line_data[0]['sec_name']}】 板上盯卖 |开启| 设定委卖【全仓】")
                                                    order_methods.sell_order_by_part_volume(1, symbol,
                                                                                            position_volume_yesterday,
@@ -497,7 +512,7 @@
                                                                                            k_line_data[0]['sec_name'],
                                                                                            index)
                                                else:
                                                    logger.info(
                                                    logger_info(
                                                        f"【开盘临机】【 炸板!!且当日量不足】【{k_line_data[0]['sec_name']}】 板上盯卖 |关闭| 设定委卖【十分之一仓】")
                                                    order_methods.sell_order_by_part_volume(0.1, symbol,
                                                                                            position_volume_yesterday,
@@ -510,19 +525,21 @@
                                # 进入当前最新价低于当日最低价 且 瞬时下跌
                                if current_price <= current_low and tick_growth < -0.2:
                                    # 进入昨日首板涨停视界(昨日涨停但前日未涨停)且 当日当前量未超昨日量
                                    if k_line_data[0]['attribute'] in data_cache.limit_up_type and k_line_data[1]['attribute'] not in data_cache.limit_up_type and current_volume <= k_line_data[0]['volume']:
                                    if k_line_data[0]['attribute'] in data_cache.limit_up_type and k_line_data[1][
                                        'attribute'] not in data_cache.limit_up_type and current_volume <= \
                                            k_line_data[0]['volume']:
                                        if today_limit_up_price != current_high or today_growth < 7:
                                            logger.info(
                                            logger_info(
                                                f"【午盘决策】【昨日涨停】【当日未涨停 或 当日当时涨幅小于7%】【{k_line_data[0]['sec_name']}】 设定委卖数量【十分之五仓】,当日当时涨幅为{today_growth}。最新价::{current_price},昨日收盘价:{k_line_data[0]['close']}")
                                            order_methods.sell_order_by_part_volume(0.5, symbol, position_volume_yesterday,
                                            order_methods.sell_order_by_part_volume(0.5, symbol,
                                                                                    position_volume_yesterday,
                                                                                    current_price,
                                                                                    k_line_data[0]['sec_name'], index)
                            # 当前时间超过平仓时间【尾盘决断】
                            if now_time > data_cache.CLOSE_POSITION_TIME:
                                if today_limit_up_price != current_high or today_growth < 7:
                                    logger.info(
                                    logger_info(
                                        f"【尾盘决断】【当日未涨停 或 当日当时涨幅小于7%】【{k_line_data[0]['sec_name']}】 设定委卖数量【全仓】,当日当时涨幅为{today_growth}。最新价::{current_price},昨日收盘价:{k_line_data[0]['close']}")
                                    order_methods.sell_order_by_part_volume(1, symbol, position_volume_yesterday,
                                                                            current_price,
                                                                            k_line_data[0]['sec_name'], index)