test_clientImportFile.py

import os
import time
import pandas as pd
import tools.get_config as get_config
import tools.send_requestEvt as send_requestEvt
from tools.generate_event_file import generateEventF
from apamaeventparser.eventparser import parse
from messages.event_message_initial import EventMsg
import pytest
from datetime import datetime
import datetime
import allure
import random
import csv
import test_cases.test_06010001_queryCommodity
import xml.etree.ElementTree as ET

@allure.story("生成客户端导入文件")
class test_clientImportFile():
    def __init__(self):
        self.IP = get_config.input_remoteIP
        self.environment = get_config.input_environment

    @allure.step("生成客户端导入文件")
    def compare_response_actual_value(self):
        try:
            os.remove("./input_CSV_files/Memory_file/onequant/algoMould/300_symbols.csv")
        except:
            print("没有文件")
        try:
            os.remove("./input_CSV_files/Memory_file/onequant/algoMould/1000_symbols.csv")
        except:
            print("没有文件")
        try:
            os.remove("./input_CSV_files/Memory_file/onequant/algoMould/3000_symbols.csv")
        except:
            print("没有文件")
        try:
            os.remove("./input_CSV_files/Memory_file/onequant/algoMould/OQAlgoMould.csv")
        except:
            print("没有文件")
        try:
            os.remove("./input_CSV_files/Memory_file/onequant/algoMould/XTAlgoMould.csv")
        except:
            print("没有文件")
        try:
            os.remove("./input_CSV_files/Memory_file/onequant/algoMould/KFAlgoMould.csv")
        except:
            print("没有文件")
        try:
            os.remove("./input_CSV_files/Memory_file/onequant/algoMould/HXAlgoMould.csv")
        except:
            print("没有文件")
        try:
            os.remove("./input_CSV_files/Memory_file/onequant/algoMould/FTAlgoMould.csv")
        except:
            print("没有文件")
        try:
            os.remove("./input_CSV_files/Memory_file/onequant/algoMould/QNDAlgoMould.csv")
        except:
            print("没有文件")
        try:
            os.remove("./input_CSV_files/Memory_file/onequant/algoMould/YRAlgoMould.csv")
        except:
            print("没有文件")
        try:
            os.remove("./input_CSV_files/Memory_file/onequant/algoMould/allAlgoMould.csv")
        except:
            print("没有文件")
        try:
            os.remove("./input_CSV_files/Memory_file/onequant/algoMould/BOMould.csv")
        except:
            print("没有文件")

        # 生成300股票模板
        with open('./input_CSV_files/Memory_file/onequant/algoMould/300_symbols.csv', "a+", newline='') as file:
            csv_file = csv.writer(file)
            datas = [["symbol", "qty"]]
            csv_file.writerows(datas)

        # 生成1000股票模板
        with open('./input_CSV_files/Memory_file/onequant/algoMould/1000_symbols.csv', "a+", newline='') as file:
            csv_file = csv.writer(file)
            datas = [["symbol", "qty"]]
            csv_file.writerows(datas)

        # 生成3000股票模板
        with open('./input_CSV_files/Memory_file/onequant/algoMould/3000_symbols.csv', "a+", newline='') as file:
            csv_file = csv.writer(file)
            datas = [["symbol", "qty"]]
            csv_file.writerows(datas)

        # 生成OQ算法导入文件
        with open('./input_CSV_files/Memory_file/onequant/algoMould/OQAlgoMould.csv', "a+", newline='') as file:
            csv_file = csv.writer(file)
            datas = [["账户类型", "账户", "代码", "交易方向", "目标量", "目标金额", "算法类型", "算法参数", ]]
            csv_file.writerows(datas)

        # 生成XT算法导入文件
        with open('./input_CSV_files/Memory_file/onequant/algoMould/XTAlgoMould.csv', "a+", newline='') as file:
            csv_file = csv.writer(file)
            datas = [["账户类型", "账户", "代码", "交易方向", "目标量", "目标金额", "算法类型", "算法参数", ]]
            csv_file.writerows(datas)

        # 生成KF算法导入文件
        with open('./input_CSV_files/Memory_file/onequant/algoMould/KFAlgoMould.csv', "a+", newline='') as file:
            csv_file = csv.writer(file)
            datas = [["账户类型", "账户", "代码", "交易方向", "目标量", "目标金额", "算法类型", "算法参数", ]]
            csv_file.writerows(datas)

        # 生成HX算法导入文件
        with open('./input_CSV_files/Memory_file/onequant/algoMould/HXAlgoMould.csv', "a+", newline='') as file:
            csv_file = csv.writer(file)
            datas = [["账户类型", "账户", "代码", "交易方向", "目标量", "目标金额", "算法类型", "算法参数", ]]
            csv_file.writerows(datas)

        # 生成FT算法导入文件
        with open('./input_CSV_files/Memory_file/onequant/algoMould/FTAlgoMould.csv', "a+", newline='') as file:
            csv_file = csv.writer(file)
            datas = [["账户类型", "账户", "代码", "交易方向", "目标量", "目标金额", "算法类型", "算法参数", ]]
            csv_file.writerows(datas)

        # 生成QND算法导入文件
        with open('./input_CSV_files/Memory_file/onequant/algoMould/QNDAlgoMould.csv', "a+", newline='') as file:
            csv_file = csv.writer(file)
            datas = [["账户类型", "账户", "代码", "交易方向", "目标量", "目标金额", "算法类型", "算法参数", ]]
            csv_file.writerows(datas)
        # 生成YR算法导入文件
        with open('./input_CSV_files/Memory_file/onequant/algoMould/YRAlgoMould.csv', "a+", newline='') as file:
            csv_file = csv.writer(file)
            datas = [["账户类型", "账户", "代码", "交易方向", "目标量", "目标金额", "算法类型", "算法参数", ]]
            csv_file.writerows(datas)
        # 生成全部算法导入文件
        with open('./input_CSV_files/Memory_file/onequant/algoMould/allAlgoMould.csv', "a+", newline='') as file:
            csv_file = csv.writer(file)
            datas = [["账户类型", "账户", "代码", "交易方向", "目标量", "目标金额", "算法类型", "算法参数", ]]
            csv_file.writerows(datas)

        # 生成BO导入文件
        with open('./input_CSV_files/Memory_file/onequant/algoMould/BOMould.csv', "a+", newline='') as file:
            csv_file = csv.writer(file)
            datas = [["账户类型", "账户", "代码", "数量", "买卖方向", "委托价"]]
            csv_file.writerows(datas)

        OQ_csv_index = 0  # 用于取OQ的算法类型
        param_OQ_csv_index = 0  # 用于取不同的下单结束时间
        XT_csv_index = 0  # 用于取OQ的算法类型
        param_XT_csv_index = 0  # 用于取不同的下单结束时间
        KF_csv_index = 0  # 用于取OQ的算法类型
        param_KF_csv_index = 0  # 用于取不同的下单结束时间
        HX_csv_index = 0  # 用于取OQ的算法类型
        param_HX_csv_index = 0  # 用于取不同的下单结束时间
        FT_csv_index = 0  # 用于取FT的算法类型
        param_FT_csv_index = 0  # 用于取不同的下单结束时间
        QND_csv_index = 0  # 用于取QND的算法类型
        param_QND_csv_index = 0  # 用于取不同的下单结束时间
        YR_csv_index = 0  # 用于取YR的算法类型
        param_YR_csv_index = 0  # 用于取不同的下单结束时间
        allAlgo_csv_index = 0  # 用于取全部的算法类型
        param_allAlgo_csv_index = 0  # 用于取不同的下单结束时间

        sum_sz_main_OQ = 0  # 深市主板股票个数
        sum_sz_chinext_OQ = 0  # 创业板股票个数
        sum_sz_fund_OQ = 0  # 深市基金个数
        sum_sz_bond_3c_OQ = 0  # 深市可转债股票个数
        sum_sz_bond_3t_OQ = 0  # 深市国债股票个数
        sum_sh_main_OQ = 0  # 沪市主板股票个数
        sum_sh_chinext_OQ = 0  # 科创板股票个数
        sum_sh_fund_OQ = 0  # 沪市基金个数
        sum_sh_bond_3c_OQ = 0  # 沪市可转债股票个数
        sum_sh_bond_3t_OQ = 0  # 沪市国债股票个数

        sum_sz_main_XT = 0  # 深市主板股票个数
        sum_sz_chinext_XT = 0  # 创业板股票个数
        sum_sz_fund_XT = 0  # 深市基金个数
        sum_sz_bond_3c_XT = 0  # 深市可转债股票个数
        sum_sz_bond_3t_XT = 0  # 深市国债股票个数
        sum_sh_main_XT = 0  # 沪市主板股票个数
        sum_sh_chinext_XT = 0  # 科创板股票个数
        sum_sh_fund_XT = 0  # 沪市基金个数
        sum_sh_bond_3c_XT = 0  # 沪市可转债股票个数
        sum_sh_bond_3t_XT = 0  # 沪市国债股票个数

        sum_sz_main_KF = 0  # 深市主板股票个数
        sum_sz_chinext_KF = 0  # 创业板股票个数
        sum_sz_fund_KF = 0  # 深市基金个数
        sum_sz_bond_3c_KF = 0  # 深市可转债股票个数
        sum_sz_bond_3t_KF = 0  # 深市国债股票个数
        sum_sh_main_KF = 0  # 沪市主板股票个数
        sum_sh_chinext_KF = 0  # 科创板股票个数
        sum_sh_fund_KF = 0  # 沪市基金个数
        sum_sh_bond_3c_KF = 0  # 沪市可转债股票个数
        sum_sh_bond_3t_KF = 0  # 沪市国债股票个数

        sum_sz_main_HX = 0  # 深市主板股票个数
        sum_sz_chinext_HX = 0  # 创业板股票个数
        sum_sz_fund_HX = 0  # 深市基金个数
        sum_sz_bond_3c_HX = 0  # 深市可转债股票个数
        sum_sz_bond_3t_HX = 0  # 深市国债股票个数
        sum_sh_main_HX = 0  # 沪市主板股票个数
        sum_sh_chinext_HX = 0  # 科创板股票个数
        sum_sh_fund_HX = 0  # 沪市基金个数
        sum_sh_bond_3c_HX = 0  # 沪市可转债股票个数
        sum_sh_bond_3t_HX = 0  # 沪市国债股票个数

        sum_sz_main_FT = 0  # 深市主板股票个数
        sum_sz_chinext_FT = 0  # 创业板股票个数
        sum_sz_fund_FT = 0  # 深市基金个数
        sum_sz_bond_3c_FT = 0  # 深市可转债股票个数
        sum_sz_bond_3t_FT = 0  # 深市国债股票个数
        sum_sh_main_FT = 0  # 沪市主板股票个数
        sum_sh_chinext_FT = 0  # 科创板股票个数
        sum_sh_fund_FT = 0  # 沪市基金个数
        sum_sh_bond_3c_FT = 0  # 沪市可转债股票个数
        sum_sh_bond_3t_FT = 0  # 沪市国债股票个数

        sum_sz_main_QND = 0  # 深市主板股票个数
        sum_sz_chinext_QND = 0  # 创业板股票个数
        sum_sz_fund_QND = 0  # 深市基金个数
        sum_sz_bond_3c_QND = 0  # 深市可转债股票个数
        sum_sz_bond_3t_QND = 0  # 深市国债股票个数
        sum_sh_main_QND = 0  # 沪市主板股票个数
        sum_sh_chinext_QND = 0  # 科创板股票个数
        sum_sh_fund_QND = 0  # 沪市基金个数
        sum_sh_bond_3c_QND = 0  # 沪市可转债股票个数
        sum_sh_bond_3t_QND = 0  # 沪市国债股票个数

        sum_sz_main_YR = 0  # 深市主板股票个数
        sum_sz_chinext_YR = 0  # 创业板股票个数
        sum_sz_fund_YR = 0  # 深市基金个数
        sum_sz_bond_3c_YR = 0  # 深市可转债股票个数
        sum_sz_bond_3t_YR = 0  # 深市国债股票个数
        sum_sh_main_YR = 0  # 沪市主板股票个数
        sum_sh_chinext_YR = 0  # 科创板股票个数
        sum_sh_fund_YR = 0  # 沪市基金个数
        sum_sh_bond_3c_YR = 0  # 沪市可转债股票个数
        sum_sh_bond_3t_YR = 0  # 沪市国债股票个数

        sum_sz_main_allAlgo = 0  # 深市主板股票个数
        sum_sz_chinext_allAlgo = 0  # 创业板股票个数
        sum_sz_fund_allAlgo = 0  # 深市基金个数
        sum_sz_bond_3c_allAlgo = 0  # 深市可转债股票个数
        sum_sz_bond_3t_allAlgo = 0  # 深市国债股票个数
        sum_sh_main_allAlgo = 0  # 沪市主板股票个数
        sum_sh_chinext_allAlgo = 0  # 科创板股票个数
        sum_sh_fund_allAlgo = 0  # 沪市基金个数
        sum_sh_bond_3c_allAlgo = 0  # 沪市可转债股票个数
        sum_sh_bond_3t_allAlgo = 0  # 沪市国债股票个数

        sum_sz_main_BO = 0  # 深市主板股票个数
        sum_sz_chinext_BO = 0  # 创业板股票个数
        sum_sz_fund_BO = 0  # 深市基金个数
        sum_sz_bond_3c_BO = 0  # 深市可转债股票个数
        sum_sz_bond_3t_BO = 0  # 深市国债股票个数
        sum_sh_main_BO = 0  # 沪市主板股票个数
        sum_sh_chinext_BO = 0  # 科创板股票个数
        sum_sh_fund_BO = 0  # 沪市基金个数
        sum_sh_bond_3c_BO = 0  # 沪市可转债股票个数
        sum_sh_bond_3t_BO = 0  # 沪市国债股票个数

        sum_sz_main_300 = 0  # 深市主板股票个数
        sum_sz_chinext_300 = 0  # 创业板股票个数
        sum_sz_fund_300 = 0  # 深市基金个数
        sum_sz_bond_3c_300 = 0  # 深市可转债股票个数
        sum_sz_bond_3t_300 = 0  # 深市国债股票个数
        sum_sh_main_300 = 0  # 沪市主板股票个数
        sum_sh_chinext_300 = 0  # 科创板股票个数
        sum_sh_fund_300 = 0  # 沪市基金个数
        sum_sh_bond_3c_300 = 0  # 沪市可转债股票个数
        sum_sh_bond_3t_300 = 0  # 沪市国债股票个数

        sum_sz_main_1000 = 0  # 深市主板股票个数
        sum_sz_chinext_1000 = 0  # 创业板股票个数
        sum_sz_fund_1000 = 0  # 深市基金个数
        sum_sz_bond_3c_1000 = 0  # 深市可转债股票个数
        sum_sz_bond_3t_1000 = 0  # 深市国债股票个数
        sum_sh_main_1000 = 0  # 沪市主板股票个数
        sum_sh_chinext_1000 = 0  # 科创板股票个数
        sum_sh_fund_1000 = 0  # 沪市基金个数
        sum_sh_bond_3c_1000 = 0  # 沪市可转债股票个数
        sum_sh_bond_3t_1000 = 0  # 沪市国债股票个数

        sum_sz_main_3000 = 0  # 深市主板股票个数
        sum_sz_chinext_3000 = 0  # 创业板股票个数
        sum_sz_fund_3000 = 0  # 深市基金个数
        sum_sz_bond_3c_3000 = 0  # 深市可转债股票个数
        sum_sz_bond_3t_3000 = 0  # 深市国债股票个数
        sum_sh_main_3000 = 0  # 沪市主板股票个数
        sum_sh_chinext_3000 = 0  # 科创板股票个数
        sum_sh_fund_3000 = 0  # 沪市基金个数
        sum_sh_bond_3c_3000 = 0  # 沪市可转债股票个数
        sum_sh_bond_3t_3000 = 0  # 沪市国债股票个数

        endTime = '"' + (datetime.datetime.now() + datetime.timedelta(minutes=15)).strftime("%H%M%S") + '"'

        algoType_OQ = ["OQ-TWAP", "OQ-VWAP", "OQ-POV"]
        algoType_XT = ["XT-TWAP", "XT-VWAP", "XT-VP"]
        algoType_KF = ["KF-TWAP-CORE", "KF-TWAP-PLUS", "KF-VWAP-CORE", "KF-VWAP-PLUS", "KF-POV"]
        algoType_HX = ["HX-SMART-TWAP", "HX-SMART-VWAP"]
        algoType_FT = ["FT-WAP"]
        algoType_QND = ["QND-TWAP","QND-VWAP"]
        algoType_YR = ["YR-VWAP"]

        # 暂时去掉了皓兴
        # algoType_all = ["OQ-TWAP", "OQ-VWAP", "OQ-POV", "XT-TWAP", "XT-VWAP", "XT-VP", "KF-TWAP-CORE", "KF-TWAP-PLUS","KF-VWAP-CORE", "KF-VWAP-PLUS", "KF-POV", "HX-SMART-TWAP", "HX-SMART-VWAP", "FT-WAP","QND-TWAP"]
        algoType_all = ["OQ-TWAP", "OQ-VWAP", "OQ-POV", "XT-TWAP", "XT-VWAP", "XT-VP", "KF-TWAP-CORE", "KF-TWAP-PLUS","KF-VWAP-CORE", "KF-VWAP-PLUS", "KF-POV", "FT-WAP","QND-TWAP","QND-VWAP","YR-VWAP"]

        # 改
        # allAlgo_csv_index == 14  加上皓兴要改成 allAlgo_csv_index == 15

        # 14:30之前
        if int(datetime.datetime.now().strftime("%H%M%S")) - 143000 < 0:
            param_OQ = ['beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=15)).strftime("%H%M%S") + ';limitPrice=0;participateRate=0.15;minAmount=0;tradingStyle=2;notBuyOnLLAndSellOnHL=0;custBatchNo=',
                        'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=60)).strftime("%H%M%S") + ';limitPrice=0;participateRate=0.15;minAmount=0;tradingStyle=2;notBuyOnLLAndSellOnHL=0;custBatchNo=',
                        "beginTime=93000;endTime=145500;limitPrice=0;participateRate=0.15;minAmount=0;tradingStyle=2;notBuyOnLLAndSellOnHL=0;custBatchNo=",
                        "beginTime=93000;endTime=150000;limitPrice=0;participateRate=0.15;minAmount=0;tradingStyle=2;notBuyOnLLAndSellOnHL=0;custBatchNo="]

            param_XT = ['beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=15)).strftime("%H%M%S") + ';limitPrice=0;PartRate=0.20;MinAmount=0;m_nStopTradeForOwnHiLow=0;custBatchNo=',
                        'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=60)).strftime("%H%M%S") + ';limitPrice=0;PartRate=0.20;MinAmount=0;m_nStopTradeForOwnHiLow=0;custBatchNo=',
                        "beginTime=93000;endTime=145500;limitPrice=0;PartRate=0.20;MinAmount=0;m_nStopTradeForOwnHiLow=0;custBatchNo=",
                        "beginTime=93000;endTime=150000;limitPrice=0;PartRate=0.20;MinAmount=0;m_nStopTradeForOwnHiLow=0;custBatchNo="]

            param_KFCORE = ['beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=15)).strftime("%H%M%S") + ';priceF=0;UpLimitF=0.05;DownLimitF=0.05;limitAction=0;afterAction=0;custBatchNo=',
                            'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=60)).strftime("%H%M%S") + ';priceF=0;UpLimitF=0.05;DownLimitF=0.05;limitAction=0;afterAction=0;custBatchNo=',
                            "beginTime=93000;endTime=145500;priceF=0;UpLimitF=0.05;DownLimitF=0.05;limitAction=0;afterAction=0;custBatchNo=",
                            "beginTime=93000;endTime=150000;priceF=0;UpLimitF=0.05;DownLimitF=0.05;limitAction=0;afterAction=0;custBatchNo="]

            param_KFPLUS = ['beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=15)).strftime("%H%M%S") + ';priceF=0;UpLimitF=0.05;DownLimitF=0.05;limitAction=0;afterAction=0;custBatchNo=',
                            'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=60)).strftime("%H%M%S") + ';priceF=0;UpLimitF=0.05;DownLimitF=0.05;limitAction=0;afterAction=0;custBatchNo=',
                            "beginTime=93000;endTime=145500;priceF=0;UpLimitF=0.05;DownLimitF=0.05;limitAction=0;afterAction=0;custBatchNo=",
                            "beginTime=93000;endTime=150000;priceF=0;UpLimitF=0.05;DownLimitF=0.05;limitAction=0;afterAction=0;custBatchNo="]

            param_KFPOV = ['beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=15)).strftime("%H%M%S") + ';priceF=0;UpLimitF=0.05;DownLimitF=0.05;maxpercentageF=0.20;limitAction=1;afterAction=1;custBatchNo=',
                           'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=60)).strftime("%H%M%S") + ';priceF=0;UpLimitF=0.05;DownLimitF=0.05;maxpercentageF=0.20;limitAction=1;afterAction=1;custBatchNo=',
                           "beginTime=93000;endTime=145500;priceF=0;UpLimitF=0.05;DownLimitF=0.05;maxpercentageF=0.20;limitAction=1;afterAction=1;custBatchNo=",
                           "beginTime=93000;endTime=150000;priceF=0;UpLimitF=0.05;DownLimitF=0.05;maxpercentageF=0.20;limitAction=1;afterAction=1;custBatchNo="]

            param_HX = ['beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=15)).strftime("%H%M%S") + ';limitPrice=0;participateRate=0.20;notBuyOnLLAndSellOnHL=0',
                        'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=60)).strftime("%H%M%S") + ';limitPrice=0;participateRate=0.20;notBuyOnLLAndSellOnHL=0',
                        "beginTime=93000;endTime=145500;limitPrice=0;participateRate=0.20;notBuyOnLLAndSellOnHL=0",
                        "beginTime=93000;endTime=150000;limitPrice=0;participateRate=0.20;notBuyOnLLAndSellOnHL=0"]

            param_FT = ['beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=15)).strftime("%H%M%S"),
                        'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=60)).strftime("%H%M%S"),
                        "beginTime=93000;endTime=145500",
                        "beginTime=93000;endTime=150000"]

            param_QND = ['beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=15)).strftime("%H%M%S")+';allowTradeAtLimit=0;allowTradeAfterEnd=0',
                         'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=60)).strftime("%H%M%S")+';allowTradeAtLimit=0;allowTradeAfterEnd=0',
                         "beginTime=93000;endTime=145500;allowTradeAtLimit=0;allowTradeAfterEnd=0",
                         "beginTime=93000;endTime=150000;allowTradeAtLimit=0;allowTradeAfterEnd=0"]
            param_YR = ['beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=15)).strftime("%H%M%S")+';limitRule=0',
                         'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=60)).strftime("%H%M%S")+';limitRule=0',
                         "beginTime=93000;endTime=145500;limitRule=0",
                         "beginTime=93000;endTime=150000;limitRule=0"]

        else:
            param_OQ = ['beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=15)).strftime("%H%M%S") + ';limitPrice=0;participateRate=0.15;minAmount=0;tradingStyle=2;notBuyOnLLAndSellOnHL=0;custBatchNo=',
                        'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=30)).strftime("%H%M%S") + ';limitPrice=0;participateRate=0.15;minAmount=0;tradingStyle=2;notBuyOnLLAndSellOnHL=0;custBatchNo=',
                        'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=45)).strftime("%H%M%S") + ';limitPrice=0;participateRate=0.15;minAmount=0;tradingStyle=2;notBuyOnLLAndSellOnHL=0;custBatchNo=',
                        'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=60)).strftime("%H%M%S") + ';limitPrice=0;participateRate=0.15;minAmount=0;tradingStyle=2;notBuyOnLLAndSellOnHL=0;custBatchNo=']

            param_XT = ['beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=15)).strftime("%H%M%S") + ';limitPrice=0;PartRate=0.20;MinAmount=0;m_nStopTradeForOwnHiLow=0;custBatchNo=',
                        'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=30)).strftime("%H%M%S") + ';limitPrice=0;PartRate=0.20;MinAmount=0;m_nStopTradeForOwnHiLow=0;custBatchNo=',
                        'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=45)).strftime("%H%M%S") + ';limitPrice=0;PartRate=0.20;MinAmount=0;m_nStopTradeForOwnHiLow=0;custBatchNo=',
                        'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=60)).strftime("%H%M%S") + ';limitPrice=0;PartRate=0.20;MinAmount=0;m_nStopTradeForOwnHiLow=0;custBatchNo=']

            param_KFCORE = ['beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=15)).strftime("%H%M%S") + ';priceF=0;UpLimitF=0.05;DownLimitF=0.05;limitAction=0;afterAction=0;custBatchNo=',
                            'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=30)).strftime("%H%M%S") + ';priceF=0;UpLimitF=0.05;DownLimitF=0.05;limitAction=0;afterAction=0;custBatchNo=',
                            'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=45)).strftime("%H%M%S") + ';priceF=0;UpLimitF=0.05;DownLimitF=0.05;limitAction=0;afterAction=0;custBatchNo=',
                            'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=60)).strftime("%H%M%S") + ';priceF=0;UpLimitF=0.05;DownLimitF=0.05;limitAction=0;afterAction=0;custBatchNo=']

            param_KFPLUS = ['beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=15)).strftime("%H%M%S") + ';priceF=0;UpLimitF=0.05;DownLimitF=0.05;limitAction=0;afterAction=0;custBatchNo=',
                            'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=30)).strftime("%H%M%S") + ';priceF=0;UpLimitF=0.05;DownLimitF=0.05;limitAction=0;afterAction=0;custBatchNo=',
                            'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=45)).strftime("%H%M%S") + ';priceF=0;UpLimitF=0.05;DownLimitF=0.05;limitAction=0;afterAction=0;custBatchNo=',
                            'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=60)).strftime("%H%M%S") + ';priceF=0;UpLimitF=0.05;DownLimitF=0.05;limitAction=0;afterAction=0;custBatchNo=']

            param_KFPOV = ['beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=15)).strftime("%H%M%S") + ';priceF=0;UpLimitF=0.05;DownLimitF=0.05;maxpercentageF=0.20;limitAction=1;afterAction=1;custBatchNo=',
                           'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=30)).strftime("%H%M%S") + ';priceF=0;UpLimitF=0.05;DownLimitF=0.05;maxpercentageF=0.20;limitAction=1;afterAction=1;custBatchNo=',
                           'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=45)).strftime("%H%M%S") + ';priceF=0;UpLimitF=0.05;DownLimitF=0.05;maxpercentageF=0.20;limitAction=1;afterAction=1;custBatchNo=',
                           'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=60)).strftime("%H%M%S") + ';priceF=0;UpLimitF=0.05;DownLimitF=0.05;maxpercentageF=0.20;limitAction=1;afterAction=1;custBatchNo=']

            param_HX = ['beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=15)).strftime("%H%M%S") + ';limitPrice=0;participateRate=0.20;notBuyOnLLAndSellOnHL=0',
                        'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=30)).strftime("%H%M%S") + ';limitPrice=0;participateRate=0.20;notBuyOnLLAndSellOnHL=0',
                        'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=45)).strftime("%H%M%S") + ';limitPrice=0;participateRate=0.20;notBuyOnLLAndSellOnHL=0',
                        'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=60)).strftime("%H%M%S") + ';limitPrice=0;participateRate=0.20;notBuyOnLLAndSellOnHL=0']

            param_FT = ['beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=15)).strftime("%H%M%S"),
                        'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=30)).strftime("%H%M%S"),
                        'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=45)).strftime("%H%M%S"),
                        'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=60)).strftime("%H%M%S")]

            param_QND = ['beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=15)).strftime("%H%M%S")+';allowTradeAtLimit=0;allowTradeAfterEnd=0',
                         'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=60)).strftime("%H%M%S")+';allowTradeAtLimit=0;allowTradeAfterEnd=0',
                         "beginTime=93000;endTime=145500;allowTradeAtLimit=0;allowTradeAfterEnd=0",
                         "beginTime=93000;endTime=150000;allowTradeAtLimit=0;allowTradeAfterEnd=0"]
            param_YR = ['beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=15)).strftime("%H%M%S")+';limitRule=0',
                         'beginTime=93000;endTime=' + (datetime.datetime.now() + datetime.timedelta(minutes=60)).strftime("%H%M%S")+'limitRule=0',
                         "beginTime=93000;endTime=145500;limitRule=0",
                         "beginTime=93000;endTime=150000;limitRule=0"]

        try:
            queryCommodity_data = pd.read_csv('./input_CSV_files/Memory_file/allqueryCommodity.csv', encoding="gb2312")
        except:
            queryCommodity_data = pd.read_csv('./input_CSV_files/Memory_file/allqueryCommodity.csv', encoding="GBK")

        
        for i in range(len(queryCommodity_data["test_case_non"])):
            # 生成OQ算法导入文件
            if queryCommodity_data["商品类型"][i] == '"01"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and (queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sz_main_OQ < 200:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_OQ[OQ_csv_index])
                    Parameter.append(param_OQ[param_OQ_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/OQAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    OQ_csv_index = OQ_csv_index + 1
                    sum_sz_main_OQ = sum_sz_main_OQ + 1
                    if OQ_csv_index == 3:
                        param_OQ_csv_index = param_OQ_csv_index + 1
                        OQ_csv_index = 0
                    if param_OQ_csv_index == 4:
                        param_OQ_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and (queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sh_main_OQ < 200:
                        
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_OQ[OQ_csv_index])
                    Parameter.append(param_OQ[param_OQ_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/OQAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    OQ_csv_index = OQ_csv_index + 1
                    sum_sh_main_OQ = sum_sh_main_OQ + 1
                    if OQ_csv_index == 3:
                        param_OQ_csv_index = param_OQ_csv_index + 1
                        OQ_csv_index = 0
                    if param_OQ_csv_index == 4:
                        param_OQ_csv_index = 0
                # 获取创业板100只股票
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"1c"' and sum_sz_chinext_OQ < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_OQ[OQ_csv_index])
                    Parameter.append(param_OQ[param_OQ_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/OQAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    OQ_csv_index = OQ_csv_index + 1
                    sum_sz_chinext_OQ = sum_sz_chinext_OQ + 1
                    if OQ_csv_index == 3:
                        param_OQ_csv_index = param_OQ_csv_index + 1
                        OQ_csv_index = 0
                    if param_OQ_csv_index == 4:
                        param_OQ_csv_index = 0
                # 获取100只科创板股票
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"1k"' and sum_sh_chinext_OQ < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_OQ[OQ_csv_index])
                    Parameter.append(param_OQ[param_OQ_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/OQAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    OQ_csv_index = OQ_csv_index + 1
                    sum_sh_chinext_OQ = sum_sh_chinext_OQ + 1
                    if OQ_csv_index == 3:
                        param_OQ_csv_index = param_OQ_csv_index + 1
                        OQ_csv_index = 0
                    if param_OQ_csv_index == 4:
                        param_OQ_csv_index = 0
            elif queryCommodity_data["商品类型"][i] == '"02"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sz_fund_OQ < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_OQ[OQ_csv_index])
                    Parameter.append(param_OQ[param_OQ_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/OQAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    OQ_csv_index = OQ_csv_index + 1
                    sum_sz_fund_OQ = sum_sz_fund_OQ + 1
                    if OQ_csv_index == 3:
                        param_OQ_csv_index = param_OQ_csv_index + 1
                        OQ_csv_index = 0
                    if param_OQ_csv_index == 4:
                        param_OQ_csv_index = 0

                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sh_fund_OQ < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_OQ[OQ_csv_index])
                    Parameter.append(param_OQ[param_OQ_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/OQAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    OQ_csv_index = OQ_csv_index + 1
                    sum_sh_fund_OQ = sum_sh_fund_OQ + 1
                    if OQ_csv_index == 3:
                        param_OQ_csv_index = param_OQ_csv_index + 1
                        OQ_csv_index = 0
                    if param_OQ_csv_index == 4:
                        param_OQ_csv_index = 0
            elif queryCommodity_data["商品类型"][i] == '"03"':
                # 可转债
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sz_bond_3c_OQ < 60:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_OQ[OQ_csv_index])
                    Parameter.append(param_OQ[param_OQ_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/OQAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    OQ_csv_index = OQ_csv_index + 1
                    sum_sz_bond_3c_OQ = sum_sz_bond_3c_OQ + 1
                    if OQ_csv_index == 3:
                        param_OQ_csv_index = param_OQ_csv_index + 1
                        OQ_csv_index = 0
                    if param_OQ_csv_index == 4:
                        param_OQ_csv_index = 0
                # 可转债
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sh_bond_3c_OQ < 60:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_OQ[OQ_csv_index])
                    Parameter.append(param_OQ[param_OQ_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/OQAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    OQ_csv_index = OQ_csv_index + 1
                    sum_sh_bond_3c_OQ = sum_sh_bond_3c_OQ + 1
                    if OQ_csv_index == 3:
                        param_OQ_csv_index = param_OQ_csv_index + 1
                        OQ_csv_index = 0
                    if param_OQ_csv_index == 4:
                        param_OQ_csv_index = 0
                # 国债
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sz_bond_3t_OQ < 12:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_OQ[OQ_csv_index])
                    Parameter.append(param_OQ[param_OQ_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/OQAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    OQ_csv_index = OQ_csv_index + 1
                    sum_sz_bond_3t_OQ = sum_sz_bond_3t_OQ + 1
                    if OQ_csv_index == 3:
                        param_OQ_csv_index = param_OQ_csv_index + 1
                        OQ_csv_index = 0
                    if param_OQ_csv_index == 4:
                        param_OQ_csv_index = 0
                # 国债
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sh_bond_3t_OQ < 12:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_OQ[OQ_csv_index])
                    Parameter.append(param_OQ[param_OQ_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/OQAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    OQ_csv_index = OQ_csv_index + 1
                    sum_sh_bond_3t_OQ = sum_sh_bond_3t_OQ + 1
                    if OQ_csv_index == 3:
                        param_OQ_csv_index = param_OQ_csv_index + 1
                        OQ_csv_index = 0
                    if param_OQ_csv_index == 4:
                        param_OQ_csv_index = 0

            # 生成XT算法导入文件
            if queryCommodity_data["商品类型"][i] == '"01"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and (queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sz_main_XT < 200:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_XT[XT_csv_index])
                    Parameter.append(param_XT[param_XT_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/XTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    XT_csv_index = XT_csv_index + 1
                    sum_sz_main_XT = sum_sz_main_XT + 1
                    if XT_csv_index == 3:
                        param_XT_csv_index = param_XT_csv_index + 1
                        XT_csv_index = 0
                    if param_XT_csv_index == 4:
                        param_XT_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and (
                        queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sh_main_XT < 200:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_XT[XT_csv_index])
                    Parameter.append(param_XT[param_XT_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/XTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    XT_csv_index = XT_csv_index + 1
                    sum_sh_main_XT = sum_sh_main_XT + 1
                    if XT_csv_index == 3:
                        param_XT_csv_index = param_XT_csv_index + 1
                        XT_csv_index = 0
                    if param_XT_csv_index == 4:
                        param_XT_csv_index = 0
                # 获取创业板100只股票
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"1c"' and sum_sz_chinext_XT < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_XT[XT_csv_index])
                    Parameter.append(param_XT[param_XT_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/XTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    XT_csv_index = XT_csv_index + 1
                    sum_sz_chinext_XT = sum_sz_chinext_XT + 1
                    if XT_csv_index == 3:
                        param_XT_csv_index = param_XT_csv_index + 1
                        XT_csv_index = 0
                    if param_XT_csv_index == 4:
                        param_XT_csv_index = 0
                # 获取100只科创板股票
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"1k"' and sum_sh_chinext_XT < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_XT[XT_csv_index])
                    Parameter.append(param_XT[param_XT_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/XTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    XT_csv_index = XT_csv_index + 1
                    sum_sh_chinext_XT = sum_sh_chinext_XT + 1
                    if XT_csv_index == 3:
                        param_XT_csv_index = param_XT_csv_index + 1
                        XT_csv_index = 0
                    if param_XT_csv_index == 4:
                        param_XT_csv_index = 0
            elif queryCommodity_data["商品类型"][i] == '"02"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sz_fund_XT < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_XT[XT_csv_index])
                    Parameter.append(param_XT[param_XT_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/XTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    XT_csv_index = XT_csv_index + 1
                    sum_sz_fund_XT = sum_sz_fund_XT + 1
                    if XT_csv_index == 3:
                        param_XT_csv_index = param_XT_csv_index + 1
                        XT_csv_index = 0
                    if param_XT_csv_index == 4:
                        param_XT_csv_index = 0

                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sh_fund_XT < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_XT[XT_csv_index])
                    Parameter.append(param_XT[param_XT_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/XTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    XT_csv_index = XT_csv_index + 1
                    sum_sh_fund_XT = sum_sh_fund_XT + 1
                    if XT_csv_index == 3:
                        param_XT_csv_index = param_XT_csv_index + 1
                        XT_csv_index = 0
                    if param_XT_csv_index == 4:
                        param_XT_csv_index = 0
            elif queryCommodity_data["商品类型"][i] == '"03"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sz_bond_3c_XT < 60:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_XT[XT_csv_index])
                    Parameter.append(param_XT[param_XT_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/XTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    XT_csv_index = XT_csv_index + 1
                    sum_sz_bond_3c_XT = sum_sz_bond_3c_XT + 1
                    if XT_csv_index == 3:
                        param_XT_csv_index = param_XT_csv_index + 1
                        XT_csv_index = 0
                    if param_XT_csv_index == 4:
                        param_XT_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sh_bond_3c_XT < 60:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_XT[XT_csv_index])
                    Parameter.append(param_XT[param_XT_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/XTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    XT_csv_index = XT_csv_index + 1
                    sum_sh_bond_3c_XT = sum_sh_bond_3c_XT + 1
                    if XT_csv_index == 3:
                        param_XT_csv_index = param_XT_csv_index + 1
                        XT_csv_index = 0
                    if param_XT_csv_index == 4:
                        param_XT_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sz_bond_3t_XT < 12:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_XT[XT_csv_index])
                    Parameter.append(param_XT[param_XT_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/XTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    XT_csv_index = XT_csv_index + 1
                    sum_sz_bond_3t_XT = sum_sz_bond_3t_XT + 1
                    if XT_csv_index == 3:
                        param_XT_csv_index = param_XT_csv_index + 1
                        XT_csv_index = 0
                    if param_XT_csv_index == 4:
                        param_XT_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sh_bond_3t_XT < 12:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_XT[XT_csv_index])
                    Parameter.append(param_XT[param_XT_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/XTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    XT_csv_index = XT_csv_index + 1
                    sum_sh_bond_3t_XT = sum_sh_bond_3t_XT + 1
                    if XT_csv_index == 3:
                        param_XT_csv_index = param_XT_csv_index + 1
                        XT_csv_index = 0
                    if param_XT_csv_index == 4:
                        param_XT_csv_index = 0

            # 生成HX算法导入文件
            if queryCommodity_data["商品类型"][i] == '"01"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and (
                        queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sz_main_HX < 200:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_HX[HX_csv_index])
                    Parameter.append(param_HX[param_HX_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/HXAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    HX_csv_index = HX_csv_index + 1
                    sum_sz_main_HX = sum_sz_main_HX + 1
                    if HX_csv_index == 2:
                        param_HX_csv_index = param_HX_csv_index + 1
                        HX_csv_index = 0
                    if param_HX_csv_index == 4:
                        param_HX_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and (
                        queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sh_main_HX < 200:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_HX[HX_csv_index])
                    Parameter.append(param_HX[param_HX_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/HXAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    HX_csv_index = HX_csv_index + 1
                    sum_sh_main_HX = sum_sh_main_HX + 1
                    if HX_csv_index == 2:
                        param_HX_csv_index = param_HX_csv_index + 1
                        HX_csv_index = 0
                    if param_HX_csv_index == 4:
                        param_HX_csv_index = 0
                # 获取创业板100只股票
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"1c"' and sum_sz_chinext_HX < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_HX[HX_csv_index])
                    Parameter.append(param_HX[param_HX_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/HXAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    HX_csv_index = HX_csv_index + 1
                    sum_sz_chinext_HX = sum_sz_chinext_HX + 1
                    if HX_csv_index == 2:
                        param_HX_csv_index = param_HX_csv_index + 1
                        HX_csv_index = 0
                    if param_HX_csv_index == 4:
                        param_HX_csv_index = 0
                # 获取100只科创板股票
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"1k"' and sum_sh_chinext_HX < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_HX[HX_csv_index])
                    Parameter.append(param_HX[param_HX_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/HXAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    HX_csv_index = HX_csv_index + 1
                    sum_sh_chinext_HX = sum_sh_chinext_HX + 1
                    if HX_csv_index == 2:
                        param_HX_csv_index = param_HX_csv_index + 1
                        HX_csv_index = 0
                    if param_HX_csv_index == 4:
                        param_HX_csv_index = 0
            elif queryCommodity_data["商品类型"][i] == '"02"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sz_fund_HX < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_HX[HX_csv_index])
                    Parameter.append(param_HX[param_HX_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/HXAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    HX_csv_index = HX_csv_index + 1
                    sum_sz_fund_HX = sum_sz_fund_HX + 1
                    if HX_csv_index == 2:
                        param_HX_csv_index = param_HX_csv_index + 1
                        HX_csv_index = 0
                    if param_HX_csv_index == 4:
                        param_HX_csv_index = 0

                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sh_fund_HX < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_HX[HX_csv_index])
                    Parameter.append(param_HX[param_HX_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/HXAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    HX_csv_index = HX_csv_index + 1
                    sum_sh_fund_HX = sum_sh_fund_HX + 1
                    if HX_csv_index == 2:
                        param_HX_csv_index = param_HX_csv_index + 1
                        HX_csv_index = 0
                    if param_HX_csv_index == 4:
                        param_HX_csv_index = 0
            elif queryCommodity_data["商品类型"][i] == '"03"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sz_bond_3c_HX < 60:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_HX[HX_csv_index])
                    Parameter.append(param_HX[param_HX_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/HXAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    HX_csv_index = HX_csv_index + 1
                    sum_sz_bond_3c_HX = sum_sz_bond_3c_HX + 1
                    if HX_csv_index == 2:
                        param_HX_csv_index = param_HX_csv_index + 1
                        HX_csv_index = 0
                    if param_HX_csv_index == 4:
                        param_HX_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sh_bond_3c_HX < 60:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_HX[HX_csv_index])
                    Parameter.append(param_HX[param_HX_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/HXAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    HX_csv_index = HX_csv_index + 1
                    sum_sh_bond_3c_HX = sum_sh_bond_3c_HX + 1
                    if HX_csv_index == 2:
                        param_HX_csv_index = param_HX_csv_index + 1
                        HX_csv_index = 0
                    if param_HX_csv_index == 4:
                        param_HX_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sz_bond_3t_HX < 12:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_HX[HX_csv_index])
                    Parameter.append(param_HX[param_HX_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/HXAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    HX_csv_index = HX_csv_index + 1
                    sum_sz_bond_3t_HX = sum_sz_bond_3t_HX + 1
                    if HX_csv_index == 2:
                        param_HX_csv_index = param_HX_csv_index + 1
                        HX_csv_index = 0
                    if param_HX_csv_index == 4:
                        param_HX_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sh_bond_3c_HX < 12:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_HX[HX_csv_index])
                    Parameter.append(param_HX[param_HX_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/HXAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    HX_csv_index = HX_csv_index + 1
                    sum_sh_bond_3c_HX = sum_sh_bond_3c_HX + 1
                    if HX_csv_index == 2:
                        param_HX_csv_index = param_HX_csv_index + 1
                        HX_csv_index = 0
                    if param_HX_csv_index == 4:
                        param_HX_csv_index = 0

            # 生成KF算法导入文件
            if queryCommodity_data["商品类型"][i] == '"01"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and (
                        queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sz_main_KF < 200:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_KF[KF_csv_index])
                    if algoType_KF[KF_csv_index] == "KF-POV":
                        Parameter.append(param_KFPOV[param_KF_csv_index])
                    elif algoType_KF[KF_csv_index] == "KF-TWAP-CORE" or algoType_KF[KF_csv_index] == "KF-VWAP-CORE":
                        Parameter.append(param_KFCORE[param_KF_csv_index])
                    elif algoType_KF[KF_csv_index] == "KF-TWAP-PLUS" or algoType_KF[KF_csv_index] == "KF-VWAP-PLUS":
                        Parameter.append(param_KFPLUS[param_KF_csv_index])

                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/KFAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    KF_csv_index = KF_csv_index + 1
                    sum_sz_main_KF = sum_sz_main_KF + 1
                    if KF_csv_index == 5:
                        param_KF_csv_index = param_KF_csv_index + 1
                        KF_csv_index = 0
                    if param_KF_csv_index == 4:
                        param_KF_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and (
                        queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sh_main_KF < 200:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_KF[KF_csv_index])
                    if algoType_KF[KF_csv_index] == "KF-POV":
                        Parameter.append(param_KFPOV[param_KF_csv_index])
                    elif algoType_KF[KF_csv_index] == "KF-TWAP-CORE" or algoType_KF[KF_csv_index] == "KF-VWAP-CORE":
                        Parameter.append(param_KFCORE[param_KF_csv_index])
                    elif algoType_KF[KF_csv_index] == "KF-TWAP-PLUS" or algoType_KF[KF_csv_index] == "KF-VWAP-PLUS":
                        Parameter.append(param_KFPLUS[param_KF_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/KFAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    KF_csv_index = KF_csv_index + 1
                    sum_sh_main_KF = sum_sh_main_KF + 1
                    if KF_csv_index == 5:
                        param_KF_csv_index = param_KF_csv_index + 1
                        KF_csv_index = 0
                    if param_KF_csv_index == 4:
                        param_KF_csv_index = 0
                # 获取创业板100只股票
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"1c"' and sum_sz_chinext_KF < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_KF[KF_csv_index])
                    if algoType_KF[KF_csv_index] == "KF-POV":
                        Parameter.append(param_KFPOV[param_KF_csv_index])
                    elif algoType_KF[KF_csv_index] == "KF-TWAP-CORE" or algoType_KF[KF_csv_index] == "KF-VWAP-CORE":
                        Parameter.append(param_KFCORE[param_KF_csv_index])
                    elif algoType_KF[KF_csv_index] == "KF-TWAP-PLUS" or algoType_KF[KF_csv_index] == "KF-VWAP-PLUS":
                        Parameter.append(param_KFPLUS[param_KF_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/KFAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    KF_csv_index = KF_csv_index + 1
                    sum_sz_chinext_KF = sum_sz_chinext_KF + 1
                    if KF_csv_index == 5:
                        param_KF_csv_index = param_KF_csv_index + 1
                        KF_csv_index = 0
                    if param_KF_csv_index == 4:
                        param_KF_csv_index = 0
                # 获取100只科创板股票
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"1k"' and sum_sh_chinext_KF < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_KF[KF_csv_index])
                    if algoType_KF[KF_csv_index] == "KF-POV":
                        Parameter.append(param_KFPOV[param_KF_csv_index])
                    elif algoType_KF[KF_csv_index] == "KF-TWAP-CORE" or algoType_KF[KF_csv_index] == "KF-VWAP-CORE":
                        Parameter.append(param_KFCORE[param_KF_csv_index])
                    elif algoType_KF[KF_csv_index] == "KF-TWAP-PLUS" or algoType_KF[KF_csv_index] == "KF-VWAP-PLUS":
                        Parameter.append(param_KFPLUS[param_KF_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/KFAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    KF_csv_index = KF_csv_index + 1
                    sum_sh_chinext_KF = sum_sh_chinext_KF + 1
                    if KF_csv_index == 5:
                        param_KF_csv_index = param_KF_csv_index + 1
                        KF_csv_index = 0
                    if param_KF_csv_index == 4:
                        param_KF_csv_index = 0
            elif queryCommodity_data["商品类型"][i] == '"02"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sz_fund_KF < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_KF[KF_csv_index])
                    if algoType_KF[KF_csv_index] == "KF-POV":
                        Parameter.append(param_KFPOV[param_KF_csv_index])
                    elif algoType_KF[KF_csv_index] == "KF-TWAP-CORE" or algoType_KF[KF_csv_index] == "KF-VWAP-CORE":
                        Parameter.append(param_KFCORE[param_KF_csv_index])
                    elif algoType_KF[KF_csv_index] == "KF-TWAP-PLUS" or algoType_KF[KF_csv_index] == "KF-VWAP-PLUS":
                        Parameter.append(param_KFPLUS[param_KF_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/KFAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    KF_csv_index = KF_csv_index + 1
                    sum_sz_fund_KF = sum_sz_fund_KF + 1
                    if KF_csv_index == 5:
                        param_KF_csv_index = param_KF_csv_index + 1
                        KF_csv_index = 0
                    if param_KF_csv_index == 4:
                        param_KF_csv_index = 0

                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sh_fund_KF < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_KF[KF_csv_index])
                    if algoType_KF[KF_csv_index] == "KF-POV":
                        Parameter.append(param_KFPOV[param_KF_csv_index])
                    elif algoType_KF[KF_csv_index] == "KF-TWAP-CORE" or algoType_KF[KF_csv_index] == "KF-VWAP-CORE":
                        Parameter.append(param_KFCORE[param_KF_csv_index])
                    elif algoType_KF[KF_csv_index] == "KF-TWAP-PLUS" or algoType_KF[KF_csv_index] == "KF-VWAP-PLUS":
                        Parameter.append(param_KFPLUS[param_KF_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/KFAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    KF_csv_index = KF_csv_index + 1
                    sum_sh_fund_KF = sum_sh_fund_KF + 1
                    if KF_csv_index == 5:
                        param_KF_csv_index = param_KF_csv_index + 1
                        KF_csv_index = 0
                    if param_KF_csv_index == 4:
                        param_KF_csv_index = 0
            elif queryCommodity_data["商品类型"][i] == '"03"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sz_bond_3c_KF < 60:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_KF[KF_csv_index])
                    if algoType_KF[KF_csv_index] == "KF-POV":
                        Parameter.append(param_KFPOV[param_KF_csv_index])
                    elif algoType_KF[KF_csv_index] == "KF-TWAP-CORE" or algoType_KF[KF_csv_index] == "KF-VWAP-CORE":
                        Parameter.append(param_KFCORE[param_KF_csv_index])
                    elif algoType_KF[KF_csv_index] == "KF-TWAP-PLUS" or algoType_KF[KF_csv_index] == "KF-VWAP-PLUS":
                        Parameter.append(param_KFPLUS[param_KF_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/KFAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    KF_csv_index = KF_csv_index + 1
                    sum_sz_bond_3c_KF = sum_sz_bond_3c_KF + 1
                    if KF_csv_index == 5:
                        param_KF_csv_index = param_KF_csv_index + 1
                        KF_csv_index = 0
                    if param_KF_csv_index == 4:
                        param_KF_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sh_bond_3c_KF < 60:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_KF[KF_csv_index])
                    if algoType_KF[KF_csv_index] == "KF-POV":
                        Parameter.append(param_KFPOV[param_KF_csv_index])
                    elif algoType_KF[KF_csv_index] == "KF-TWAP-CORE" or algoType_KF[KF_csv_index] == "KF-VWAP-CORE":
                        Parameter.append(param_KFCORE[param_KF_csv_index])
                    elif algoType_KF[KF_csv_index] == "KF-TWAP-PLUS" or algoType_KF[KF_csv_index] == "KF-VWAP-PLUS":
                        Parameter.append(param_KFPLUS[param_KF_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/KFAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    KF_csv_index = KF_csv_index + 1
                    sum_sh_bond_3c_KF = sum_sh_bond_3c_KF + 1
                    if KF_csv_index == 5:
                        param_KF_csv_index = param_KF_csv_index + 1
                        KF_csv_index = 0
                    if param_KF_csv_index == 4:
                        param_KF_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sz_bond_3t_KF < 12:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_KF[KF_csv_index])
                    if algoType_KF[KF_csv_index] == "KF-POV":
                        Parameter.append(param_KFPOV[param_KF_csv_index])
                    elif algoType_KF[KF_csv_index] == "KF-TWAP-CORE" or algoType_KF[KF_csv_index] == "KF-VWAP-CORE":
                        Parameter.append(param_KFCORE[param_KF_csv_index])
                    elif algoType_KF[KF_csv_index] == "KF-TWAP-PLUS" or algoType_KF[KF_csv_index] == "KF-VWAP-PLUS":
                        Parameter.append(param_KFPLUS[param_KF_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/KFAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    KF_csv_index = KF_csv_index + 1
                    sum_sz_bond_3t_KF = sum_sz_bond_3t_KF + 1
                    if KF_csv_index == 5:
                        param_KF_csv_index = param_KF_csv_index + 1
                        KF_csv_index = 0
                    if param_KF_csv_index == 4:
                        param_KF_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sh_bond_3t_KF < 12:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_KF[KF_csv_index])
                    if algoType_KF[KF_csv_index] == "KF-POV":
                        Parameter.append(param_KFPOV[param_KF_csv_index])
                    elif algoType_KF[KF_csv_index] == "KF-TWAP-CORE" or algoType_KF[KF_csv_index] == "KF-VWAP-CORE":
                        Parameter.append(param_KFCORE[param_KF_csv_index])
                    elif algoType_KF[KF_csv_index] == "KF-TWAP-PLUS" or algoType_KF[KF_csv_index] == "KF-VWAP-PLUS":
                        Parameter.append(param_KFPLUS[param_KF_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/KFAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    KF_csv_index = KF_csv_index + 1
                    sum_sh_bond_3t_KF = sum_sh_bond_3t_KF + 1
                    if KF_csv_index == 5:
                        param_KF_csv_index = param_KF_csv_index + 1
                        KF_csv_index = 0
                    if param_KF_csv_index == 4:
                        param_KF_csv_index = 0

            # 生成FT算法导入文件
            if queryCommodity_data["商品类型"][i] == '"01"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and (
                        queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sz_main_FT < 350:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append("FT-WAP")
                    Parameter.append(param_FT[param_FT_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/FTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    FT_csv_index = FT_csv_index + 1
                    sum_sz_main_FT = sum_sz_main_FT + 1
                    if FT_csv_index == 2:
                        param_FT_csv_index = param_FT_csv_index + 1
                        FT_csv_index = 0
                    if param_FT_csv_index == 4:
                        param_FT_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and (
                        queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sh_main_FT < 350:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append("FT-WAP")
                    Parameter.append(param_FT[param_FT_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/FTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    FT_csv_index = FT_csv_index + 1
                    sum_sh_main_FT = sum_sh_main_FT + 1
                    if FT_csv_index == 2:
                        param_FT_csv_index = param_FT_csv_index + 1
                        FT_csv_index = 0
                    if param_FT_csv_index == 4:
                        param_FT_csv_index = 0
                # 获取创业板100只股票
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"1c"' and sum_sz_chinext_FT < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append("FT-WAP")
                    Parameter.append(param_FT[param_FT_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/FTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    FT_csv_index = FT_csv_index + 1
                    sum_sz_chinext_FT = sum_sz_chinext_FT + 1
                    if FT_csv_index == 2:
                        param_FT_csv_index = param_FT_csv_index + 1
                        FT_csv_index = 0
                    if param_FT_csv_index == 4:
                        param_FT_csv_index = 0
                # 获取100只科创板股票
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"1k"' and sum_sh_chinext_FT < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append("FT-WAP")
                    Parameter.append(param_FT[param_FT_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/FTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    FT_csv_index = FT_csv_index + 1
                    sum_sh_chinext_FT = sum_sh_chinext_FT + 1
                    if FT_csv_index == 2:
                        param_FT_csv_index = param_FT_csv_index + 1
                        FT_csv_index = 0
                    if param_FT_csv_index == 4:
                        param_FT_csv_index = 0
            elif queryCommodity_data["商品类型"][i] == '"02"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sz_fund_FT < 10:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append("FT-WAP")
                    Parameter.append(param_FT[param_FT_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/FTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    FT_csv_index = FT_csv_index + 1
                    sum_sz_fund_FT = sum_sz_fund_FT + 1
                    if FT_csv_index == 2:
                        param_FT_csv_index = param_FT_csv_index + 1
                        FT_csv_index = 0
                    if param_FT_csv_index == 4:
                        param_FT_csv_index = 0

                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sh_fund_FT < 10:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append("FT-WAP")
                    Parameter.append(param_FT[param_FT_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/FTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    FT_csv_index = FT_csv_index + 1
                    sum_sh_fund_FT = sum_sh_fund_FT + 1
                    if FT_csv_index == 2:
                        param_FT_csv_index = param_FT_csv_index + 1
                        FT_csv_index = 0
                    if param_FT_csv_index == 4:
                        param_FT_csv_index = 0
            elif queryCommodity_data["商品类型"][i] == '"03"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sz_bond_3c_FT < 10:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append("FT-WAP")
                    Parameter.append(param_FT[param_FT_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/FTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    FT_csv_index = FT_csv_index + 1
                    sum_sz_bond_3c_FT = sum_sz_bond_3c_FT + 1
                    if FT_csv_index == 2:
                        param_FT_csv_index = param_FT_csv_index + 1
                        FT_csv_index = 0
                    if param_FT_csv_index == 4:
                        param_FT_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sh_bond_3c_FT < 10:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append("FT-WAP")
                    Parameter.append(param_FT[param_FT_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/FTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    FT_csv_index = FT_csv_index + 1
                    sum_sh_bond_3c_FT = sum_sh_bond_3c_FT + 1
                    if FT_csv_index == 2:
                        param_FT_csv_index = param_FT_csv_index + 1
                        FT_csv_index = 0
                    if param_FT_csv_index == 4:
                        param_FT_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sz_bond_3t_FT < 12:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append("FT-WAP")
                    Parameter.append(param_FT[param_FT_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/FTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    FT_csv_index = FT_csv_index + 1
                    sum_sz_bond_3t_FT = sum_sz_bond_3t_FT + 1
                    if FT_csv_index == 2:
                        param_FT_csv_index = param_FT_csv_index + 1
                        FT_csv_index = 0
                    if param_FT_csv_index == 4:
                        param_FT_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sh_bond_3t_FT < 12:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append("FT-WAP")
                    Parameter.append(param_FT[param_FT_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/FTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    FT_csv_index = FT_csv_index + 1
                    sum_sh_bond_3t_FT = sum_sh_bond_3t_FT + 1
                    if FT_csv_index == 2:
                        param_FT_csv_index = param_FT_csv_index + 1
                        FT_csv_index = 0
                    if param_FT_csv_index == 4:
                        param_FT_csv_index = 0

            # 生成QND算法导入文件
            if queryCommodity_data["商品类型"][i] == '"01"':
                # 深A股
                if queryCommodity_data["symbol"][i].replace('"', '').split(".")[1] == "SZ" and (queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sz_main_QND < 350:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"', ''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_QND[QND_csv_index])
                    Parameter.append(param_QND[param_QND_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/QNDAlgoMould.csv', "a+",newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    QND_csv_index = QND_csv_index + 1
                    sum_sz_main_QND = sum_sz_main_QND + 1
                    if QND_csv_index == 2:
                        param_QND_csv_index = param_QND_csv_index + 1
                        QND_csv_index = 0
                    if param_QND_csv_index == 4:
                        param_QND_csv_index = 0
                # 沪A股
                elif queryCommodity_data["symbol"][i].replace('"', '').split(".")[1] == "SH" and (queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sh_main_QND < 350:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"', ''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_QND[QND_csv_index])
                    Parameter.append(param_QND[param_QND_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/QNDAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    QND_csv_index = QND_csv_index + 1
                    sum_sh_main_QND = sum_sh_main_QND + 1
                    if QND_csv_index == 2:
                        param_QND_csv_index = param_QND_csv_index + 1
                        QND_csv_index = 0
                    if param_QND_csv_index == 4:
                        param_QND_csv_index = 0
                # 获取创业板100只股票
                elif queryCommodity_data["symbol"][i].replace('"', '').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"1c"' and sum_sz_chinext_QND < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"', ''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_QND[QND_csv_index])
                    Parameter.append(param_QND[param_QND_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/QNDAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    QND_csv_index = QND_csv_index + 1
                    sum_sz_chinext_QND = sum_sz_chinext_QND + 1
                    if QND_csv_index == 2:
                        param_QND_csv_index = param_QND_csv_index + 1
                        QND_csv_index = 0
                    if param_QND_csv_index == 4:
                        param_QND_csv_index = 0
                # 获取100只科创板股票
                elif queryCommodity_data["symbol"][i].replace('"', '').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"1k"' and sum_sh_chinext_QND < 100:

                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"', ''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_QND[QND_csv_index])
                    Parameter.append(param_QND[param_QND_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/QNDAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    QND_csv_index = QND_csv_index + 1
                    sum_sh_chinext_QND = sum_sh_chinext_QND + 1
                    if QND_csv_index == 2:
                        param_QND_csv_index = param_QND_csv_index + 1
                        QND_csv_index = 0
                    if param_QND_csv_index == 4:
                        param_QND_csv_index = 0
            elif queryCommodity_data["商品类型"][i] == '"02"':
                if queryCommodity_data["symbol"][i].replace('"', '').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sz_fund_QND < 10:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"', ''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_QND[QND_csv_index])
                    Parameter.append(param_QND[param_QND_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/QNDAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    QND_csv_index = QND_csv_index + 1
                    sum_sz_fund_QND = sum_sz_fund_QND + 1
                    if QND_csv_index == 2:
                        param_QND_csv_index = param_QND_csv_index + 1
                        QND_csv_index = 0
                    if param_QND_csv_index == 4:
                        param_QND_csv_index = 0

                elif queryCommodity_data["symbol"][i].replace('"', '').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sh_fund_QND < 10:

                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"', ''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_QND[QND_csv_index])
                    Parameter.append(param_QND[param_QND_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/QNDAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    QND_csv_index = QND_csv_index + 1
                    sum_sh_fund_QND = sum_sh_fund_QND + 1
                    if QND_csv_index == 2:
                        param_QND_csv_index = param_QND_csv_index + 1
                        QND_csv_index = 0
                    if param_QND_csv_index == 4:
                        param_QND_csv_index = 0
            elif queryCommodity_data["商品类型"][i] == '"03"':
                if queryCommodity_data["symbol"][i].replace('"', '').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sz_bond_3c_QND < 10:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"', ''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_QND[QND_csv_index])
                    Parameter.append(param_QND[param_QND_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/QNDAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    QND_csv_index = QND_csv_index + 1
                    sum_sz_bond_3c_QND = sum_sz_bond_3c_QND + 1
                    if QND_csv_index == 2:
                        param_QND_csv_index = param_QND_csv_index + 1
                        QND_csv_index = 0
                    if param_QND_csv_index == 4:
                        param_QND_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"', '').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sh_bond_3c_QND < 10:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"', ''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_QND[QND_csv_index])
                    Parameter.append(param_QND[param_QND_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/QNDAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    QND_csv_index = QND_csv_index + 1
                    sum_sh_bond_3c_QND = sum_sh_bond_3c_QND + 1
                    if QND_csv_index == 2:
                        param_QND_csv_index = param_QND_csv_index + 1
                        QND_csv_index = 0
                    if param_QND_csv_index == 4:
                        param_QND_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"', '').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sz_bond_3t_QND < 12:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"', ''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_QND[QND_csv_index])
                    Parameter.append(param_QND[param_QND_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/QNDAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    QND_csv_index = QND_csv_index + 1
                    sum_sz_bond_3t_QND = sum_sz_bond_3t_QND + 1
                    if QND_csv_index == 2:
                        param_QND_csv_index = param_QND_csv_index + 1
                        QND_csv_index = 0
                    if param_QND_csv_index == 4:
                        param_QND_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"', '').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sh_bond_3t_QND < 12:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"', ''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_QND[QND_csv_index])
                    Parameter.append(param_QND[param_QND_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/QNDAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    QND_csv_index = QND_csv_index + 1
                    sum_sh_bond_3t_QND = sum_sh_bond_3t_QND + 1
                    if QND_csv_index == 2:
                        param_QND_csv_index = param_QND_csv_index + 1
                        QND_csv_index = 0
                    if param_QND_csv_index == 4:
                        param_QND_csv_index = 0

            # 生成YR算法导入文件
            if queryCommodity_data["商品类型"][i] == '"01"':
                # 深A股
                if queryCommodity_data["symbol"][i].replace('"', '').split(".")[1] == "SZ" and (queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sz_main_QND < 350:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"', ''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append("YR-VWAP")
                    Parameter.append(param_YR[param_YR_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/YRAlgoMould.csv', "a+",newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    YR_csv_index = YR_csv_index + 1
                    sum_sz_main_YR = sum_sz_main_YR + 1
                    if YR_csv_index == 2:
                        param_YR_csv_index = param_YR_csv_index + 1
                        YR_csv_index = 0
                    if param_YR_csv_index == 4:
                        param_YR_csv_index = 0
                # 沪A股
                elif queryCommodity_data["symbol"][i].replace('"', '').split(".")[1] == "SH" and (queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sh_main_YR < 350:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"', ''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append("YR-VWAP")
                    Parameter.append(param_YR[param_YR_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/YRAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    YR_csv_index = YR_csv_index + 1
                    sum_sh_main_YR = sum_sh_main_YR + 1
                    if YR_csv_index == 2:
                        param_YR_csv_index = param_YR_csv_index + 1
                        YR_csv_index = 0
                    if param_YR_csv_index == 4:
                        param_YR_csv_index = 0
                # 获取创业板100只股票
                elif queryCommodity_data["symbol"][i].replace('"', '').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"1c"' and sum_sz_chinext_YR < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"', ''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append("YR-VWAP")
                    Parameter.append(param_YR[param_YR_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/YRAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    YR_csv_index = YR_csv_index + 1
                    sum_sz_chinext_YR = sum_sz_chinext_YR + 1
                    if YR_csv_index == 2:
                        param_YR_csv_index = param_YR_csv_index + 1
                        YR_csv_index = 0
                    if param_YR_csv_index == 4:
                        param_YR_csv_index = 0
                # 获取100只科创板股票
                elif queryCommodity_data["symbol"][i].replace('"', '').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"1k"' and sum_sh_chinext_YR < 100:

                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"', ''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append("YR-VWAP")
                    Parameter.append(param_YR[param_YR_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/YRAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    YR_csv_index = YR_csv_index + 1
                    sum_sh_chinext_YR = sum_sh_chinext_YR + 1
                    if YR_csv_index == 2:
                        param_YR_csv_index = param_YR_csv_index + 1
                        YR_csv_index = 0
                    if param_YR_csv_index == 4:
                        param_YR_csv_index = 0
            elif queryCommodity_data["商品类型"][i] == '"02"':
                if queryCommodity_data["symbol"][i].replace('"', '').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sz_fund_YR < 10:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"', ''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append("YR-VWAP")
                    Parameter.append(param_YR[param_YR_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/YRAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    YR_csv_index = YR_csv_index + 1
                    sum_sz_fund_YR = sum_sz_fund_YR + 1
                    if YR_csv_index == 2:
                        param_YR_csv_index = param_YR_csv_index + 1
                        YR_csv_index = 0
                    if param_YR_csv_index == 4:
                        param_YR_csv_index = 0

                elif queryCommodity_data["symbol"][i].replace('"', '').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sh_fund_YR < 10:

                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"', ''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append("YR-VWAP")
                    Parameter.append(param_YR[param_YR_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/YRAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    YR_csv_index = YR_csv_index + 1
                    sum_sh_fund_YR = sum_sh_fund_YR + 1
                    if YR_csv_index == 2:
                        param_YR_csv_index = param_YR_csv_index + 1
                        YR_csv_index = 0
                    if param_YR_csv_index == 4:
                        param_YR_csv_index = 0
            elif queryCommodity_data["商品类型"][i] == '"03"':
                if queryCommodity_data["symbol"][i].replace('"', '').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sz_bond_3c_YR < 10:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"', ''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append("YR-VWAP")
                    Parameter.append(param_YR[param_YR_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/YRAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    YR_csv_index = YR_csv_index + 1
                    sum_sz_bond_3c_YR = sum_sz_bond_3c_YR + 1
                    if YR_csv_index == 2:
                        param_YR_csv_index = param_YR_csv_index + 1
                        YR_csv_index = 0
                    if param_YR_csv_index == 4:
                        param_YR_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"', '').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sh_bond_3c_YR < 10:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"', ''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append("YR-VWAP")
                    Parameter.append(param_YR[param_YR_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/YRAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    YR_csv_index = YR_csv_index + 1
                    sum_sh_bond_3c_YR = sum_sh_bond_3c_YR + 1
                    if YR_csv_index == 2:
                        param_YR_csv_index = param_YR_csv_index + 1
                        YR_csv_index = 0
                    if param_YR_csv_index == 4:
                        param_YR_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"', '').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sz_bond_3t_YR < 12:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"', ''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append("YR-VWAP")
                    Parameter.append(param_YR[param_YR_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/YRAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    YR_csv_index = YR_csv_index + 1
                    sum_sz_bond_3t_YR = sum_sz_bond_3t_YR + 1
                    if YR_csv_index == 2:
                        param_YR_csv_index = param_YR_csv_index + 1
                        YR_csv_index = 0
                    if param_YR_csv_index == 4:
                        param_YR_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"', '').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sh_bond_3t_YR < 12:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"', ''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append("YR-VWAP")
                    Parameter.append(param_YR[param_YR_csv_index])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/YRAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    YR_csv_index = YR_csv_index + 1
                    sum_sh_bond_3t_YR = sum_sh_bond_3t_YR + 1
                    if YR_csv_index == 2:
                        param_YR_csv_index = param_YR_csv_index + 1
                        YR_csv_index = 0
                    if param_YR_csv_index == 4:
                        param_YR_csv_index = 0

            # 生成全部算法导入文件
            if queryCommodity_data["商品类型"][i] == '"01"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and (queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sz_main_allAlgo < 150:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_all[allAlgo_csv_index])
                    if algoType_all[allAlgo_csv_index] in ["OQ-TWAP", "OQ-VWAP", "OQ-POV"]:
                        Parameter.append(param_OQ[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] in ["XT-TWAP", "XT-VWAP", "XT-VP"]:
                        Parameter.append(param_XT[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "HX-SMART-TWAP" or algoType_all[
                        allAlgo_csv_index] == "HX-SMART-VWAP":
                        Parameter.append(param_HX[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-TWAP-CORE" or algoType_all[
                        allAlgo_csv_index] == "KF-VWAP-CORE":
                        Parameter.append(param_KFCORE[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-TWAP-PLUS" or algoType_all[
                        allAlgo_csv_index] == "KF-VWAP-PLUS":
                        Parameter.append(param_KFPLUS[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-POV":
                        Parameter.append(param_KFPOV[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "FT-WAP":
                        Parameter.append(param_FT[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "QND-TWAP":
                        Parameter.append(param_QND[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "YR-VWAP":
                        Parameter.append(param_YR[param_allAlgo_csv_index])

                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/allAlgoMould.csv', "a+",newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    allAlgo_csv_index = allAlgo_csv_index + 1
                    sum_sz_main_allAlgo = sum_sz_main_allAlgo + 1

                    if allAlgo_csv_index == 14:
                        param_allAlgo_csv_index = param_allAlgo_csv_index + 1
                        allAlgo_csv_index = 0
                    if param_allAlgo_csv_index == 4:
                        param_allAlgo_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and (queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sh_main_allAlgo < 200:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_all[allAlgo_csv_index])
                    if algoType_all[allAlgo_csv_index] in ["OQ-TWAP", "OQ-VWAP", "OQ-POV"]:
                        Parameter.append(param_OQ[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] in ["XT-TWAP", "XT-VWAP", "XT-VP"]:
                        Parameter.append(param_XT[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "HX-SMART-TWAP" or algoType_all[
                        allAlgo_csv_index] == "HX-SMART-VWAP":
                        Parameter.append(param_HX[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-TWAP-CORE" or algoType_all[
                        allAlgo_csv_index] == "KF-VWAP-CORE":
                        Parameter.append(param_KFCORE[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-TWAP-PLUS" or algoType_all[
                        allAlgo_csv_index] == "KF-VWAP-PLUS":
                        Parameter.append(param_KFPLUS[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-POV":
                        Parameter.append(param_KFPOV[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "FT-WAP":
                        Parameter.append(param_FT[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "QND-TWAP":
                        Parameter.append(param_QND[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "YR-VWAP":
                        Parameter.append(param_YR[param_allAlgo_csv_index])

                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/allAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    allAlgo_csv_index = allAlgo_csv_index + 1
                    sum_sh_main_allAlgo = sum_sh_main_allAlgo + 1
                    # 改过
                    if allAlgo_csv_index == 14:
                        param_allAlgo_csv_index = param_allAlgo_csv_index + 1
                        allAlgo_csv_index = 0
                    if param_allAlgo_csv_index == 4:
                        param_allAlgo_csv_index = 0
                # 获取创业板100只股票
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"1c"' and sum_sz_chinext_allAlgo < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_all[allAlgo_csv_index])
                    if algoType_all[allAlgo_csv_index] in ["OQ-TWAP", "OQ-VWAP", "OQ-POV"]:
                        Parameter.append(param_OQ[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] in ["XT-TWAP", "XT-VWAP", "XT-VP"]:
                        Parameter.append(param_XT[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "HX-SMART-TWAP" or algoType_all[
                        allAlgo_csv_index] == "HX-SMART-VWAP":
                        Parameter.append(param_HX[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-TWAP-CORE" or algoType_all[
                        allAlgo_csv_index] == "KF-VWAP-CORE":
                        Parameter.append(param_KFCORE[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-TWAP-PLUS" or algoType_all[
                        allAlgo_csv_index] == "KF-VWAP-PLUS":
                        Parameter.append(param_KFPLUS[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-POV":
                        Parameter.append(param_KFPOV[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "FT-WAP":
                        Parameter.append(param_FT[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "QND-TWAP":
                        Parameter.append(param_QND[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "YR-VWAP":
                        Parameter.append(param_YR[param_allAlgo_csv_index])

                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/allAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    allAlgo_csv_index = allAlgo_csv_index + 1
                    sum_sz_chinext_allAlgo = sum_sz_chinext_allAlgo + 1
                    # 改过
                    if allAlgo_csv_index == 14:
                        param_allAlgo_csv_index = param_allAlgo_csv_index + 1
                        allAlgo_csv_index = 0
                    if param_allAlgo_csv_index == 4:
                        param_allAlgo_csv_index = 0
                # 获取100只科创板股票
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"1k"' and sum_sh_chinext_allAlgo < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_all[allAlgo_csv_index])
                    if algoType_all[allAlgo_csv_index] in ["OQ-TWAP", "OQ-VWAP", "OQ-POV"]:
                        Parameter.append(param_OQ[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] in ["XT-TWAP", "XT-VWAP", "XT-VP"]:
                        Parameter.append(param_XT[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "HX-SMART-TWAP" or algoType_all[
                        allAlgo_csv_index] == "HX-SMART-VWAP":
                        Parameter.append(param_HX[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-TWAP-CORE" or algoType_all[
                        allAlgo_csv_index] == "KF-VWAP-CORE":
                        Parameter.append(param_KFCORE[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-TWAP-PLUS" or algoType_all[
                        allAlgo_csv_index] == "KF-VWAP-PLUS":
                        Parameter.append(param_KFPLUS[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-POV":
                        Parameter.append(param_KFPOV[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "FT-WAP":
                        Parameter.append(param_FT[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "QND-TWAP":
                        Parameter.append(param_QND[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "YR-VWAP":
                        Parameter.append(param_YR[param_allAlgo_csv_index])

                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/allAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    allAlgo_csv_index = allAlgo_csv_index + 1
                    sum_sh_chinext_allAlgo = sum_sh_chinext_allAlgo + 1
                    # 改过
                    if allAlgo_csv_index == 14:
                        param_allAlgo_csv_index = param_allAlgo_csv_index + 1
                        allAlgo_csv_index = 0
                    if param_allAlgo_csv_index == 4:
                        param_allAlgo_csv_index = 0
            elif queryCommodity_data["商品类型"][i] == '"02"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sz_fund_allAlgo < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_all[allAlgo_csv_index])
                    if algoType_all[allAlgo_csv_index] in ["OQ-TWAP", "OQ-VWAP", "OQ-POV"]:
                        Parameter.append(param_OQ[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] in ["XT-TWAP", "XT-VWAP", "XT-VP"]:
                        Parameter.append(param_XT[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "HX-SMART-TWAP" or algoType_all[
                        allAlgo_csv_index] == "HX-SMART-VWAP":
                        Parameter.append(param_HX[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-TWAP-CORE" or algoType_all[
                        allAlgo_csv_index] == "KF-VWAP-CORE":
                        Parameter.append(param_KFCORE[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-TWAP-PLUS" or algoType_all[
                        allAlgo_csv_index] == "KF-VWAP-PLUS":
                        Parameter.append(param_KFPLUS[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-POV":
                        Parameter.append(param_KFPOV[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "FT-WAP":
                        Parameter.append(param_FT[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "QND-TWAP":
                        Parameter.append(param_QND[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "YR-VWAP":
                        Parameter.append(param_YR[param_allAlgo_csv_index])

                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/allAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    allAlgo_csv_index = allAlgo_csv_index + 1
                    sum_sz_fund_allAlgo = sum_sz_fund_allAlgo + 1
                    # 改过
                    if allAlgo_csv_index == 14:
                        param_allAlgo_csv_index = param_allAlgo_csv_index + 1
                        allAlgo_csv_index = 0
                    if param_allAlgo_csv_index == 4:
                        param_allAlgo_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sh_fund_allAlgo < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_all[allAlgo_csv_index])
                    if algoType_all[allAlgo_csv_index] in ["OQ-TWAP", "OQ-VWAP", "OQ-POV"]:
                        Parameter.append(param_OQ[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] in ["XT-TWAP", "XT-VWAP", "XT-VP"]:
                        Parameter.append(param_XT[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "HX-SMART-TWAP" or algoType_all[
                        allAlgo_csv_index] == "HX-SMART-VWAP":
                        Parameter.append(param_HX[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-TWAP-CORE" or algoType_all[
                        allAlgo_csv_index] == "KF-VWAP-CORE":
                        Parameter.append(param_KFCORE[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-TWAP-PLUS" or algoType_all[
                        allAlgo_csv_index] == "KF-VWAP-PLUS":
                        Parameter.append(param_KFPLUS[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-POV":
                        Parameter.append(param_KFPOV[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "FT-WAP":
                        Parameter.append(param_FT[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "QND-TWAP":
                        Parameter.append(param_QND[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "YR-VWAP":
                        Parameter.append(param_YR[param_allAlgo_csv_index])

                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/allAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    allAlgo_csv_index = allAlgo_csv_index + 1
                    sum_sh_fund_allAlgo = sum_sh_fund_allAlgo + 1
                    # 改过
                    if allAlgo_csv_index == 14:
                        param_allAlgo_csv_index = param_allAlgo_csv_index + 1
                        allAlgo_csv_index = 0
                    if param_allAlgo_csv_index == 4:
                        param_allAlgo_csv_index = 0
            elif queryCommodity_data["商品类型"][i] == '"03"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sz_bond_3c_allAlgo < 60:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_all[allAlgo_csv_index])
                    if algoType_all[allAlgo_csv_index] in ["OQ-TWAP", "OQ-VWAP", "OQ-POV"]:
                        Parameter.append(param_OQ[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] in ["XT-TWAP", "XT-VWAP", "XT-VP"]:
                        Parameter.append(param_XT[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "HX-SMART-TWAP" or algoType_all[
                        allAlgo_csv_index] == "HX-SMART-VWAP":
                        Parameter.append(param_HX[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-TWAP-CORE" or algoType_all[
                        allAlgo_csv_index] == "KF-VWAP-CORE":
                        Parameter.append(param_KFCORE[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-TWAP-PLUS" or algoType_all[
                        allAlgo_csv_index] == "KF-VWAP-PLUS":
                        Parameter.append(param_KFPLUS[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-POV":
                        Parameter.append(param_KFPOV[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "FT-WAP":
                        Parameter.append(param_FT[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "QND-TWAP":
                        Parameter.append(param_QND[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "YR-VWAP":
                        Parameter.append(param_YR[param_allAlgo_csv_index])

                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/allAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    allAlgo_csv_index = allAlgo_csv_index + 1
                    sum_sz_bond_3c_allAlgo = sum_sz_bond_3c_allAlgo + 1
                    # 改过
                    if allAlgo_csv_index == 14:
                        param_allAlgo_csv_index = param_allAlgo_csv_index + 1
                        allAlgo_csv_index = 0
                    if param_allAlgo_csv_index == 4:
                        param_allAlgo_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sh_bond_3c_allAlgo < 60:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_all[allAlgo_csv_index])
                    if algoType_all[allAlgo_csv_index] in ["OQ-TWAP", "OQ-VWAP", "OQ-POV"]:
                        Parameter.append(param_OQ[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] in ["XT-TWAP", "XT-VWAP", "XT-VP"]:
                        Parameter.append(param_XT[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "HX-SMART-TWAP" or algoType_all[
                        allAlgo_csv_index] == "HX-SMART-VWAP":
                        Parameter.append(param_HX[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-TWAP-CORE" or algoType_all[
                        allAlgo_csv_index] == "KF-VWAP-CORE":
                        Parameter.append(param_KFCORE[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-TWAP-PLUS" or algoType_all[
                        allAlgo_csv_index] == "KF-VWAP-PLUS":
                        Parameter.append(param_KFPLUS[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-POV":
                        Parameter.append(param_KFPOV[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "FT-WAP":
                        Parameter.append(param_FT[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "QND-TWAP":
                        Parameter.append(param_QND[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "YR-VWAP":
                        Parameter.append(param_YR[param_allAlgo_csv_index])

                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/allAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    allAlgo_csv_index = allAlgo_csv_index + 1
                    sum_sh_bond_3c_allAlgo = sum_sh_bond_3c_allAlgo + 1
                    # 改过
                    if allAlgo_csv_index == 14:
                        param_allAlgo_csv_index = param_allAlgo_csv_index + 1
                        allAlgo_csv_index = 0
                    if param_allAlgo_csv_index == 4:
                        param_allAlgo_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sz_bond_3t_allAlgo < 14:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_all[allAlgo_csv_index])
                    if algoType_all[allAlgo_csv_index] in ["OQ-TWAP", "OQ-VWAP", "OQ-POV"]:
                        Parameter.append(param_OQ[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] in ["XT-TWAP", "XT-VWAP", "XT-VP"]:
                        Parameter.append(param_XT[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "HX-SMART-TWAP" or algoType_all[
                        allAlgo_csv_index] == "HX-SMART-VWAP":
                        Parameter.append(param_HX[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-TWAP-CORE" or algoType_all[
                        allAlgo_csv_index] == "KF-VWAP-CORE":
                        Parameter.append(param_KFCORE[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-TWAP-PLUS" or algoType_all[
                        allAlgo_csv_index] == "KF-VWAP-PLUS":
                        Parameter.append(param_KFPLUS[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-POV":
                        Parameter.append(param_KFPOV[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "FT-WAP":
                        Parameter.append(param_FT[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "QND-TWAP":
                        Parameter.append(param_QND[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "YR-VWAP":
                        Parameter.append(param_YR[param_allAlgo_csv_index])

                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/allAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    allAlgo_csv_index = allAlgo_csv_index + 1
                    sum_sz_bond_3t_allAlgo = sum_sz_bond_3t_allAlgo + 1
                    # 改过
                    if allAlgo_csv_index == 14:
                        param_allAlgo_csv_index = param_allAlgo_csv_index + 1
                        allAlgo_csv_index = 0
                    if param_allAlgo_csv_index == 4:
                        param_allAlgo_csv_index = 0
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sh_bond_3t_allAlgo < 14:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("1")
                    Parameter.append("5000")
                    Parameter.append("")
                    Parameter.append(algoType_all[allAlgo_csv_index])
                    if algoType_all[allAlgo_csv_index] in ["OQ-TWAP", "OQ-VWAP", "OQ-POV"]:
                        Parameter.append(param_OQ[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] in ["XT-TWAP", "XT-VWAP", "XT-VP"]:
                        Parameter.append(param_XT[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "HX-SMART-TWAP" or algoType_all[
                        allAlgo_csv_index] == "HX-SMART-VWAP":
                        Parameter.append(param_HX[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-TWAP-CORE" or algoType_all[
                        allAlgo_csv_index] == "KF-VWAP-CORE":
                        Parameter.append(param_KFCORE[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-TWAP-PLUS" or algoType_all[
                        allAlgo_csv_index] == "KF-VWAP-PLUS":
                        Parameter.append(param_KFPLUS[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "KF-POV":
                        Parameter.append(param_KFPOV[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "FT-WAP":
                        Parameter.append(param_FT[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "QND-TWAP":
                        Parameter.append(param_QND[param_allAlgo_csv_index])
                    elif algoType_all[allAlgo_csv_index] == "YR-VWAP":
                        Parameter.append(param_YR[param_allAlgo_csv_index])

                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/allAlgoMould.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    allAlgo_csv_index = allAlgo_csv_index + 1
                    sum_sh_bond_3t_allAlgo = sum_sh_bond_3t_allAlgo + 1
                    # 改过
                    if allAlgo_csv_index == 14:
                        param_allAlgo_csv_index = param_allAlgo_csv_index + 1
                        allAlgo_csv_index = 0
                    if param_allAlgo_csv_index == 4:
                        param_allAlgo_csv_index = 0

            # 生成BO导入文件
            if queryCommodity_data["商品类型"][i] == '"01"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and (
                        queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sz_main_BO < 200:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("5000")
                    Parameter.append("1")
                    Parameter.append("10")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/BOMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sz_main_BO = sum_sz_main_BO + 1

                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and (
                        queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sh_main_BO < 200:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("5000")
                    Parameter.append("1")
                    Parameter.append("10")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/BOMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sh_main_BO = sum_sh_main_BO + 1
                # 获取创业板100只股票
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"1c"' and sum_sz_chinext_BO < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("5000")
                    Parameter.append("1")
                    Parameter.append("10")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/BOMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sz_chinext_BO = sum_sz_chinext_BO + 1
                # 获取100只科创板股票
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"1k"' and sum_sh_chinext_BO < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("5000")
                    Parameter.append("1")
                    Parameter.append("10")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/BOMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sh_chinext_BO = sum_sh_chinext_BO + 1
            elif queryCommodity_data["商品类型"][i] == '"02"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sz_fund_BO < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("5000")
                    Parameter.append("1")
                    Parameter.append("10")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/BOMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sz_fund_BO = sum_sz_fund_BO + 1
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sh_fund_BO < 100:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("5000")
                    Parameter.append("1")
                    Parameter.append("10")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/BOMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sh_fund_BO = sum_sh_fund_BO + 1
            elif queryCommodity_data["商品类型"][i] == '"03"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sz_bond_3c_BO < 60:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("5000")
                    Parameter.append("1")
                    Parameter.append("10")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/BOMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sz_bond_3c_BO = sum_sz_bond_3c_BO + 1
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sh_bond_3c_BO < 60:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("5000")
                    Parameter.append("1")
                    Parameter.append("10")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/BOMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sh_bond_3c_BO = sum_sh_bond_3c_BO + 1
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sz_bond_3t_BO < 12:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("5000")
                    Parameter.append("1")
                    Parameter.append("10")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/BOMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sz_bond_3t_BO = sum_sz_bond_3t_BO + 1
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sh_bond_3t_BO < 12:
                    Parameter = []
                    Parameters = []
                    Parameter.append("UF0")
                    Parameter.append("890500027916")
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("5000")
                    Parameter.append("1")
                    Parameter.append("10")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/BOMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sh_bond_3t_BO = sum_sh_bond_3t_BO + 1

            # 生成300股票导入文件
            if queryCommodity_data["商品类型"][i] == '"01"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and (
                        queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sz_main_300 < 50:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/300_symbols.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sz_main_300 = sum_sz_main_300 + 1

                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and (
                        queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sh_main_300 < 50:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/300_symbols.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sh_main_300 = sum_sh_main_300 + 1
                # 获取创业板100只股票
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"1c"' and sum_sz_chinext_300 < 40:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/300_symbols.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sz_chinext_300 = sum_sz_chinext_300 + 1
                # 获取100只科创板股票
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"1k"' and sum_sh_chinext_300 < 40:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/300_symbols.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sh_chinext_300 = sum_sh_chinext_300 + 1
            elif queryCommodity_data["商品类型"][i] == '"02"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sz_fund_300 < 40:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/300_symbols.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sz_fund_300 = sum_sz_fund_300 + 1
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sh_fund_300 < 40:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/300_symbols.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sh_fund_300 = sum_sh_fund_300 + 1
            elif queryCommodity_data["商品类型"][i] == '"03"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sz_bond_3c_300 < 10:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/300_symbols.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sz_bond_3c_300 = sum_sz_bond_3c_300 + 1
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sh_bond_3c_300 < 10:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/300_symbols.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sh_bond_3c_300 = sum_sh_bond_3c_300 + 1
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sz_bond_3t_300 < 10:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/300_symbols.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sz_bond_3t_300 = sum_sz_bond_3t_300 + 1
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sh_bond_3t_300 < 10:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/300_symbols.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sh_bond_3t_300 = sum_sh_bond_3t_300 + 1


            # 生成1000股票导入文件
            if queryCommodity_data["商品类型"][i] == '"01"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and (
                        queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sz_main_1000 < 200:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/1000_symbols.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sz_main_1000 = sum_sz_main_1000 + 1

                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and (
                        queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sh_main_1000 < 200:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/1000_symbols.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sh_main_1000 = sum_sh_main_1000 + 1
                # 获取创业板100只股票
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"1c"' and sum_sz_chinext_1000 < 200:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/1000_symbols.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sz_chinext_1000 = sum_sz_chinext_1000 + 1
                # 获取100只科创板股票
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"1k"' and sum_sh_chinext_1000 < 200:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/1000_symbols.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sh_chinext_1000 = sum_sh_chinext_1000 + 1
            elif queryCommodity_data["商品类型"][i] == '"02"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sz_fund_1000 < 60:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/1000_symbols.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sz_fund_1000 = sum_sz_fund_1000 + 1
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sh_fund_1000 < 60:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/1000_symbols.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sh_fund_1000 = sum_sh_fund_1000 + 1
            elif queryCommodity_data["商品类型"][i] == '"03"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sz_bond_3c_1000 < 29:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/1000_symbols.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sz_bond_3c_1000 = sum_sz_bond_3c_1000 + 1
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sh_bond_3c_1000 < 29:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/1000_symbols.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sh_bond_3c_1000 = sum_sh_bond_3c_1000 + 1
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sz_bond_3t_1000 < 10:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/1000_symbols.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sz_bond_3t_1000 = sum_sz_bond_3t_1000 + 1
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sh_bond_3t_1000 < 10:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/1000_symbols.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sh_bond_3t_1000 = sum_sh_bond_3t_1000 + 1

            # 生成3000股票导入文件
            if queryCommodity_data["商品类型"][i] == '"01"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and (
                        queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sz_main_3000 < 860:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/3000_symbols.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sz_main_3000 = sum_sz_main_3000 + 1

                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and (
                        queryCommodity_data["商品子类型"][i] == '"10"' or queryCommodity_data["商品子类型"][i] == '"1z"') and sum_sh_main_3000 < 860:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/3000_symbols.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sh_main_3000 = sum_sh_main_3000 + 1
                # 获取创业板100只股票
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"1c"' and sum_sz_chinext_3000 < 400:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/3000_symbols.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sz_chinext_3000 = sum_sz_chinext_3000 + 1
                # 获取100只科创板股票
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"1k"' and sum_sh_chinext_3000 < 400:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/3000_symbols.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sh_chinext_3000 = sum_sh_chinext_3000 + 1
            elif queryCommodity_data["商品类型"][i] == '"02"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sz_fund_3000 < 200:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/3000_symbols.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sz_fund_3000 = sum_sz_fund_3000 + 1
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"2e"' and sum_sh_fund_3000 < 200:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/3000_symbols.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sh_fund_3000 = sum_sh_fund_3000 + 1
            elif queryCommodity_data["商品类型"][i] == '"03"':
                if queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sz_bond_3c_3000 < 29:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/3000_symbols.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sz_bond_3c_3000 = sum_sz_bond_3c_3000 + 1
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3c"' and sum_sh_bond_3c_3000 < 29:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/3000_symbols.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sh_bond_3c_3000 = sum_sh_bond_3c_3000 + 1
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SZ" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sz_bond_3t_3000 < 10:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/3000_symbols.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sz_bond_3t_3000 = sum_sz_bond_3t_3000 + 1
                elif queryCommodity_data["symbol"][i].replace('"','').split(".")[1] == "SH" and queryCommodity_data["商品子类型"][i] == '"3t"' and sum_sh_bond_3t_3000 < 10:
                    Parameter = []
                    Parameters = []
                    Parameter.append(queryCommodity_data["symbol"][i].replace('"',''))
                    Parameter.append("900000")
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/3000_symbols.csv', "a+",
                              newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                    sum_sh_bond_3t_3000 = sum_sh_bond_3t_3000 + 1

        symbol_bone = ["131800.SZ", "204001.SH"]

        # algoType_all = ["OQ-TWAP", "OQ-VWAP", "OQ-POV", "XT-TWAP","XT-VWAP", "XT-VP", "KF-TWAP-CORE", "KF-TWAP-PLUS", "KF-VWAP-CORE", "KF-VWAP-PLUS","KF-POV", "HX-SMART-TWAP", "HX-SMART-VWAP", "FT-WAP","QND-TWAP"]



        # 添加逆回购到导入组合交易模板里
        for i in range(len(symbol_bone)):
            Parameter = []
            Parameters = []
            Parameter.append("UF0")
            Parameter.append("890500027916")
            Parameter.append(symbol_bone[i])
            Parameter.append("5000")
            Parameter.append("1")
            Parameter.append("10")
            Parameters.append(Parameter)
            with open('./input_CSV_files/Memory_file/onequant/algoMould/BOMould.csv', "a+", newline='') as file:
                csv_file = csv.writer(file)
                csv_file.writerows(Parameters)

        # 添加逆回购到导入算法交易模板里
        for i in range(len(symbol_bone)):
            for j in range(len(algoType_all)):
                Parameter = []
                Parameters = []
                Parameter.append("UF0")
                Parameter.append("890500027916")
                Parameter.append(symbol_bone[i])
                Parameter.append("1")
                Parameter.append("5000")
                Parameter.append("")
                Parameter.append(algoType_all[j])
                if algoType_all[j] in ["OQ-TWAP", "OQ-VWAP", "OQ-POV"]:
                    Parameter.append(param_OQ[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/OQAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[j] in ["XT-TWAP", "XT-VWAP", "XT-VP"]:
                    Parameter.append(param_XT[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/XTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[j] == "KF-TWAP-CORE" or algoType_all[j] == "KF-VWAP-CORE":
                    Parameter.append(param_KFCORE[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/KFAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[j] == "KF-TWAP-PLUS" or algoType_all[j] == "KF-VWAP-PLUS":
                    Parameter.append(param_KFPLUS[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/KFAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[j] == "KF-POV":
                    Parameter.append(param_KFPOV[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/KFAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[j] == "HX-SMART-TWAP" or algoType_all[j] == "HX-SMART-VWAP":
                    Parameter.append(param_HX[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/HXAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[j] == "FT-WAP" :
                    Parameter.append(param_FT[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/FTAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[j] == ["QND-TWAP", "QND-VWAP"] :
                    Parameter.append(param_QND[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/QNDAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[j] == "YR-VWAP" :
                    Parameter.append(param_YR[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/YRAlgoMould.csv', "a+", newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)

                with open('./input_CSV_files/Memory_file/onequant/algoMould/allAlgoMould.csv', "a+", newline='') as file:
                    csv_file = csv.writer(file)
                    csv_file.writerows(Parameters)

        stop_STOCK = []  # 停牌股票
        stop_FUND = []  # 停牌基金
        stop_BOND = []  # 停牌债券
        stop_INDEX = []  # 停牌指数
        stop_FUTURE = []  # 停牌期货
        stop_OPTION = []  # 停牌期权
        stop_REPO = []  # 停牌回购

        # 获取各种类型停牌的票
        for i in range(len(queryCommodity_data["test_case_non"])):
            if ";" in queryCommodity_data["商品状态"][i]:
                status = queryCommodity_data["商品状态"][i].split('"', 1)[1].split('"', 1)[0].split(";")
                # 获取停牌的股票
                # if "1" in status and queryCommodity_data["商品类型"][i] == '"10"' and exchange == '"SH"':
                if "1" in status:
                    symbol = queryCommodity_data["symbol"][i].replace('"','')
                    if queryCommodity_data["商品类型"][i] == '"01"':
                        stop_STOCK.append(symbol)
                    elif queryCommodity_data["商品类型"][i] == '"02"':
                        stop_FUND.append(symbol)
                    elif queryCommodity_data["商品类型"][i] == '"03"':
                        stop_BOND.append(symbol)
                    elif queryCommodity_data["商品类型"][i] == '"04"':
                        stop_INDEX.append(symbol)
                    elif queryCommodity_data["商品类型"][i] == '"05"':
                        stop_FUTURE.append(symbol)
                    elif queryCommodity_data["商品类型"][i] == '"06"':
                        stop_OPTION.append(symbol)
                    elif queryCommodity_data["商品类型"][i] == '"09"':
                        stop_REPO.append(symbol)
            else:
                status = queryCommodity_data["商品状态"][i].replace('"','')
                # 获取停牌的股票
                # if status == '"1"' and queryCommodity_data["商品类型"][i] == '"10"' and exchange == '"SH"':
                if status == '"1"':
                    symbol = queryCommodity_data["symbol"][i]
                    if queryCommodity_data["商品类型"][i] == '"01"':
                        stop_STOCK.append(symbol)
                    elif queryCommodity_data["商品类型"][i] == '"02"':
                        stop_FUND.append(symbol)
                    elif queryCommodity_data["商品类型"][i] == '"03"':
                        stop_BOND.append(symbol)
                    elif queryCommodity_data["商品类型"][i] == '"04"':
                        stop_INDEX.append(symbol)
                    elif queryCommodity_data["商品类型"][i] == '"05"':
                        stop_FUTURE.append(symbol)
                    elif queryCommodity_data["商品类型"][i] == '"06"':
                        stop_OPTION.append(symbol)
                    elif queryCommodity_data["商品类型"][i] == '"09"':
                        stop_REPO.append(symbol)

        # 添加停牌的股票到算法和BO文件里
        if len(stop_STOCK) != 0:
            # 添加停牌的股票到算法文件里
            for i in range(len(algoType_all)):
                Parameter = []
                Parameters = []
                Parameter.append("UF0")
                Parameter.append("890500027916")
                Parameter.append(stop_STOCK[0])
                Parameter.append("1")
                Parameter.append("5000")
                Parameter.append("")
                Parameter.append(algoType_all[i])
                if algoType_all[i] in ["OQ-TWAP", "OQ-VWAP", "OQ-POV"]:
                    Parameter.append(param_OQ[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/OQAlgoMould.csv', "a+",newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[i] in ["XT-TWAP", "XT-VWAP", "XT-VP"]:
                    Parameter.append(param_XT[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/XTAlgoMould.csv', "a+",newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[i] == "HX-SMART-TWAP" or algoType_all[i] == "HX-SMART-VWAP":
                    Parameter.append(param_HX[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/HXAlgoMould.csv', "a+",newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[i] == "KF-TWAP-CORE" or algoType_all[i] == "KF-VWAP-CORE":
                    Parameter.append(param_KFCORE[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/KFAlgoMould.csv', "a+",newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[i] == "KF-TWAP-PLUS" or algoType_all[i] == "KF-VWAP-PLUS":
                    Parameter.append(param_KFPLUS[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/KFAlgoMould.csv', "a+",newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[i] == "KF-POV":
                    Parameter.append(param_KFPOV[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/KFAlgoMould.csv', "a+",newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[i] == "FT-WAP":
                    Parameter.append(param_FT[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/FTAlgoMould.csv', "a+",newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[i] == ["QND-TWAP", "QND-VWAP"]:
                    Parameter.append(param_QND[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/QNDAlgoMould.csv', "a+",newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[i] == "YR-VWAP":
                    Parameter.append(param_YR[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/YRAlgoMould.csv', "a+",newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                with open('./input_CSV_files/Memory_file/onequant/algoMould/allAlgoMould.csv', "a+", newline='') as file:
                    csv_file = csv.writer(file)
                    csv_file.writerows(Parameters)

            # 添加停牌的股票到B0文件里
            Parameter = []
            Parameters = []
            Parameter.append("UF0")
            Parameter.append("890500027916")
            Parameter.append(stop_STOCK[0])
            Parameter.append("5000")
            Parameter.append("1")
            Parameter.append("10")
            Parameters.append(Parameter)
            with open('./input_CSV_files/Memory_file/onequant/algoMould/BOMould.csv', "a+", newline='') as file:
                csv_file = csv.writer(file)
                csv_file.writerows(Parameters)

        # 添加停牌的基金到算法和BO文件里
        if len(stop_FUND) != 0:
            # 添加停牌的股票到算法文件里
            for i in range(len(algoType_all)):
                Parameter = []
                Parameters = []
                Parameter.append("UF0")
                Parameter.append("890500027916")
                Parameter.append(stop_FUND[0])
                Parameter.append("1")
                Parameter.append("5000")
                Parameter.append("")
                Parameter.append(algoType_all[i])
                if algoType_all[i] in ["OQ-TWAP", "OQ-VWAP", "OQ-POV"]:
                    Parameter.append(param_OQ[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/OQAlgoMould.csv', "a+",newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[i] in ["XT-TWAP", "XT-VWAP", "XT-VP"]:
                    Parameter.append(param_XT[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/XTAlgoMould.csv', "a+",newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[i] == "HX-SMART-TWAP" or algoType_all[i] == "HX-SMART-VWAP":
                    Parameter.append(param_HX[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/HXAlgoMould.csv', "a+",newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[i] == "KF-TWAP-CORE" or algoType_all[i] == "KF-VWAP-CORE":
                    Parameter.append(param_KFCORE[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/KFAlgoMould.csv', "a+",newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[i] == "KF-TWAP-PLUS" or algoType_all[i] == "KF-VWAP-PLUS":
                    Parameter.append(param_KFPLUS[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/KFAlgoMould.csv', "a+",newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[i] == "KF-POV":
                    Parameter.append(param_KFPOV[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/KFAlgoMould.csv', "a+",newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[i] == "FT-WAP":
                    Parameter.append(param_FT[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/FTAlgoMould.csv', "a+",newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[i] == ["QND-TWAP", "QND-VWAP"]:
                    Parameter.append(param_QND[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/QNDAlgoMould.csv', "a+",newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                elif algoType_all[i] == "YR-VWAP":
                    Parameter.append(param_YR[0])
                    Parameters.append(Parameter)
                    with open('./input_CSV_files/Memory_file/onequant/algoMould/YRAlgoMould.csv', "a+",newline='') as file:
                        csv_file = csv.writer(file)
                        csv_file.writerows(Parameters)
                with open('./input_CSV_files/Memory_file/onequant/algoMould/allAlgoMould.csv', "a+", newline='') as file:
                    csv_file = csv.writer(file)
                    csv_file.writerows(Parameters)

            # 添加停牌的股票到B0文件里
            Parameter = []
            Parameters = []
            Parameter.append("UF0")
            Parameter.append("890500027916")
            Parameter.append(stop_FUND[0])
            Parameter.append("5000")
            Parameter.append("1")
            Parameter.append("10")
            Parameters.append(Parameter)
            with open('./input_CSV_files/Memory_file/onequant/algoMould/BOMould.csv', "a+", newline='') as file:
                csv_file = csv.writer(file)
                csv_file.writerows(Parameters)


        print("停牌股票",stop_STOCK)
        print("停牌基金", stop_FUND)
        print("停牌债券", stop_BOND)
        print("停牌指数", stop_INDEX)
        print("停牌期货", stop_FUTURE)
        print("停牌期权", stop_OPTION)
        print("停牌回购", stop_REPO)


    @allure.step("生成客户端导入文件")
    def main_test_clientImportFile(self, csv_index):
        self.compare_response_actual_value()

  

posted @ 2024-06-24 00:20  liuweipaul123  阅读(2)  评论(0编辑  收藏  举报