[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN112035533B - System resource scheduling method and device based on multi-parameter quantization strategy feedback - Google Patents

System resource scheduling method and device based on multi-parameter quantization strategy feedback Download PDF

Info

Publication number
CN112035533B
CN112035533B CN202010913281.5A CN202010913281A CN112035533B CN 112035533 B CN112035533 B CN 112035533B CN 202010913281 A CN202010913281 A CN 202010913281A CN 112035533 B CN112035533 B CN 112035533B
Authority
CN
China
Prior art keywords
database
backtesting
financial
optimal
combinations
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN202010913281.5A
Other languages
Chinese (zh)
Other versions
CN112035533A (en
Inventor
袁均良
骆伟祺
叶玮材
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sun Yat Sen University
Original Assignee
Sun Yat Sen University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sun Yat Sen University filed Critical Sun Yat Sen University
Priority to CN202010913281.5A priority Critical patent/CN112035533B/en
Publication of CN112035533A publication Critical patent/CN112035533A/en
Application granted granted Critical
Publication of CN112035533B publication Critical patent/CN112035533B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2457Query processing with adaptation to user needs
    • G06F16/24578Query processing with adaptation to user needs using ranking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/283Multi-dimensional databases or data warehouses, e.g. MOLAP or ROLAP
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/06Asset management; Financial planning or analysis
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • Finance (AREA)
  • General Physics & Mathematics (AREA)
  • Accounting & Taxation (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Game Theory and Decision Science (AREA)
  • Human Resources & Organizations (AREA)
  • Operations Research (AREA)
  • Computational Linguistics (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The invention discloses a system resource scheduling method and device based on multi-parameter quantization strategy retest, which comprises the steps of setting a plurality of database combinations according to the idle memory amount of a server, the memory occupied amount of a single-parameter quantization strategy and the memory occupied amount of a single financial database, and retesting multi-parameter quantization strategies according to the plurality of database combinations to obtain the retest running time corresponding to each database combination; the method comprises the steps of searching a plurality of optimal database combinations in a plurality of database combinations and the corresponding backtesting running time of each database combination according to the number of specified backtesting tasks input by a user, determining the number of financial databases to be opened and the number of backtesting tasks served by each financial database according to the optimal database combinations, and backtesting the multi-parameter quantization strategy according to the result, so that the backtesting time of the multi-parameter quantization strategy can be shortened, and the resource cost is reduced.

Description

基于多参数量化策略回测的系统资源调度方法及装置System resource scheduling method and device based on multi-parameter quantization strategy backtesting

技术领域technical field

本发明涉及服务器资源调度技术领域,更具体地,涉及一种基于多参数量化策略回测的系统资源调度方法及装置。The present invention relates to the technical field of server resource scheduling, and more particularly, to a system resource scheduling method and device based on multi-parameter quantization strategy backtesting.

背景技术Background technique

近些年来,越来越多投资者以股票的历史数据为基础,设计相应的量化策略,以实现股票的投资分析。现有量化策略通常由金融工程师编写而成,可以通过历史数据对量化策略进行回测,以评估量化策略的性能好坏。具体地,在用户设定了某些股票指标组合之后,基于某一段时间段内已经发生过的真实行情数据,按照量化策略得到的股票组合进行模拟交易,根据模拟交易过程中所获得的该时间段内的盈利、回撤率等数据,对量化策略进行综合地评估。In recent years, more and more investors have designed corresponding quantitative strategies based on the historical data of stocks to realize the investment analysis of stocks. Existing quantitative strategies are usually written by financial engineers, and the quantitative strategies can be back-tested through historical data to evaluate the performance of quantitative strategies. Specifically, after the user has set some stock indicator combinations, based on the real market data that has occurred within a certain period of time, the simulated trading is performed according to the stock combination obtained by the quantitative strategy, according to the time obtained in the simulated trading process. Data such as profit and drawdown rate in the segment are used to comprehensively evaluate the quantitative strategy.

一般情况下,量化策略会涉及大量的参数,如单、双均线量化策略中均线长度等,这些参数均会对量化策略的性能产生较大的影响。而为了获取更高的投资回报,需要在不同参数以及不同场景(如不同股票标的或不同回测区间等)下,分别对量化策略进行回测。由于涉及的参数多,在回测时可以采用并行计算,以加快计算速度。但是,现有技术中采用并行计算主要是通过单数据库多进程的方法进行的,这样对系统资源造成的负担较大,导致量化策略的回测效率过低。In general, the quantization strategy involves a large number of parameters, such as the length of the moving average in the single and double moving average quantization strategies, and these parameters will have a greater impact on the performance of the quantization strategy. In order to obtain a higher return on investment, it is necessary to carry out backtesting of quantitative strategies under different parameters and different scenarios (such as different stock targets or different backtesting intervals, etc.). Due to the large number of parameters involved, parallel computing can be used during backtesting to speed up the calculation. However, in the prior art, parallel computing is mainly performed by means of a single database and multiple processes, which imposes a heavy burden on system resources, resulting in an excessively low back-testing efficiency of the quantitative strategy.

经检索,在中国申请的专利“一种基于集群的量化策略回测系统及其回测方法”(公开日2018.11.06,公开号CN108765149A)公开了在对量化策略进行回测的时候,根据每个计算机节点的负载情况进行任务分配,使每个计算机节点得到最大效率的利用,可以提高回测效率。但是,很明显通过调用多台计算机进行来实现并行计算回测,资源成本过高。After retrieval, the patent "A Cluster-based Quantitative Strategy Backtesting System and its Backtesting Method" (published on 2018.11.06, publication number CN108765149A) disclosed in China when backtesting the quantitative strategy, according to each The load conditions of each computer node are assigned tasks, so that each computer node can be used with maximum efficiency, which can improve the efficiency of backtesting. However, it is obvious that the resource cost is too high to realize the parallel computing backtest by calling multiple computers.

发明内容SUMMARY OF THE INVENTION

本发明为克服上述现有技术所述的资源成本过高的缺陷,提供一种基于多参数量化策略回测的系统资源调度方法及装置,能够缩短多参数量化策略的回测时间,同时降低资源成本。In order to overcome the above-mentioned defect of high resource cost in the prior art, the present invention provides a system resource scheduling method and device based on multi-parameter quantization strategy back-testing, which can shorten the back-test time of multi-parameter quantization strategy and reduce resources at the same time. cost.

为解决上述技术问题,本发明的技术方案如下:For solving the above-mentioned technical problems, the technical scheme of the present invention is as follows:

本发明第一方面公开一种基于多参数量化策略回测的系统资源调度方法,包括以下步骤:A first aspect of the present invention discloses a system resource scheduling method based on multi-parameter quantization strategy backtesting, comprising the following steps:

S1:根据预设回测时间段以及预设标准股票标的,对指定的单参数量化策略进行回测,记录回测过程中所述单参数量化策略的占用内存量;S1: Back-test the specified single-parameter quantitative strategy according to the preset back-test time period and the preset standard stock target, and record the amount of memory occupied by the single-parameter quantitative strategy during the back-test;

S2:根据服务器的空闲内存量、所述单参数量化策略的占用内存量以及单个金融数据库的占用内存量,设置多个数据库组合;其中,每个所述数据库组合包括一定数量的金融数据库以及每个所述金融数据库所服务的回测任务数量,每个所述数据库组合中的金融数据库的数量不同;S2: Set up multiple database combinations according to the amount of free memory of the server, the amount of memory occupied by the single-parameter quantization strategy, and the amount of memory occupied by a single financial database; wherein, each of the database combinations includes a certain number of financial databases and each The number of backtesting tasks served by each of the financial databases, and the number of financial databases in each of the database combinations is different;

S3:按照所述多个数据库组合、所述预设的回测时间段以及所述预设股票标的,对所述多参数量化策略进行回测,以获得每个所述数据库组合对应的回测运行时间;S3: Back-test the multi-parameter quantification strategy according to the multiple database combinations, the preset back-test time period, and the preset stock target, so as to obtain a back-test corresponding to each of the database combinations operation hours;

S4:根据用户针对所述多参数量化策略输入的指定回测任务数量,在所述多个数据库组合以及每个所述数据库组合对应的回测运行时间中进行搜索,以获得多个最优数据库组合;其中,所述多个最优数据库组合包括根据所述指定回测任务数量对所述多参数量化策略进行回测时所需要开启的金融数据库最优数量以及每个所述金融数据库所服务的回测任务最优数量;S4: According to the specified number of backtesting tasks input by the user for the multi-parameter quantification strategy, search the multiple database combinations and the backtesting running time corresponding to each of the database combinations to obtain multiple optimal databases combination; wherein, the multiple optimal database combinations include the optimal number of financial databases that need to be opened when back-testing the multi-parameter quantitative strategy according to the specified number of back-testing tasks and the services each financial database serves The optimal number of backtesting tasks;

S5:根据所述多个最优数据库组合,对所述多参数量化策略的其它股票标的或其它回测时间段进行回测,所述其它股票标的与所述预设标准股票标的不同,所述其它回测时间段与所述预设回测时间段不同,所述其它回测时间段与所述预设回测时间段的长度相同。S5: Back-test other stock targets or other back-testing time periods of the multi-parameter quantitative strategy according to the multiple optimal database combinations, where the other stock targets are different from the preset standard stock targets, and the The other back-test time periods are different from the preset back-test time periods, and the other back-test time periods have the same length as the preset back-test time periods.

优选地,步骤S4包括以下步骤:Preferably, step S4 includes the following steps:

S4.1:采用加速比分组的方式对所述多个数据库组合以及每个所述数据库组合对应的回测运行时间进行压缩,以获得加速比队列;S4.1: compress the multiple database combinations and the backtest running time corresponding to each of the database combinations in a speedup ratio grouping manner to obtain a speedup ratio queue;

S4.2:根据用户针对所述多参数量化策略输入的指定回测任务数量,在所述加速比队列中进行搜索,以获得多个最优数据库组合。S4.2: According to the specified number of backtesting tasks input by the user for the multi-parameter quantization strategy, search in the speedup ratio queue to obtain multiple optimal database combinations.

优选地,步骤S4.1包括:Preferably, step S4.1 includes:

S4.1.1:根据每个所述数据库组合对应的回测运行时间,计算出每个所述数据库组合对应的加速比,以获得多个加速比;S4.1.1: Calculate the speedup ratio corresponding to each of the database combinations according to the backtest running time corresponding to each of the database combinations to obtain multiple speedup ratios;

S4.1.2:对所述多个加速比进行分组,形成加速比队列。S4.1.2: Group the multiple speedup ratios to form a speedup ratio queue.

优选地,步骤S4.1.2包括以下步骤:Preferably, step S4.1.2 includes the following steps:

S4.1.2.1:按照多个加速比中最大的加速比值、最小的加速比值以及预设组数,通过以下公式计算出每组间隔Δspeedup:S4.1.2.1: According to the maximum acceleration ratio, the minimum acceleration ratio and the preset number of groups among the multiple acceleration ratios, calculate the interval Δspeedup of each group by the following formula:

Figure BDA0002664082680000031
Figure BDA0002664082680000031

式中,T表示预设组数,speedupmax表示加速比最大值,speedupmin表示加速比最小值;In the formula, T represents the preset number of groups, speedup max represents the maximum speedup ratio, and speedup min represents the minimum speedup ratio;

S4.1.2.2:根据每组间隔通过以下公式对多个加速比进行分组,以获得多个加速比组SiS4.1.2.2: Group multiple speedup ratios according to each group interval by the following formula to obtain multiple speedup ratio groups S i :

Si={s|[speedupmin+(i-1)*Δspeedup]≤s≤[speedupmin+i*Δspeedup],s∈speedup},1≤i≤TS i ={s|[speedup min +(i-1)*Δspeedup]≤s≤[speedup min +i*Δspeedup],s∈speedup},1≤i≤T

其中,每一个加速比组包括多个加速比、每个加速比对应的数据库组合以及该数据库组合对应的回测运行时间;Wherein, each acceleration ratio group includes multiple acceleration ratios, a database combination corresponding to each acceleration ratio, and a backtesting running time corresponding to the database combination;

S4.1.2.3:确定出每一个加速比组中回测任务数量最大的加速比作为该加速比组的代表参数,构成集合speedup:S4.1.2.3: Determine the speedup ratio with the largest number of backtesting tasks in each speedup ratio group as the representative parameter of the speedup ratio group to form a set speedup:

Figure BDA0002664082680000032
Figure BDA0002664082680000032

其中S表示加速比,Si表示加速比组,nf表示金融数据库的数量,ps表示每个金融数据库所服务的回测任务数量;Among them, S represents the speedup ratio, S i represents the speedup ratio group, nf represents the number of financial databases, and ps represents the number of backtesting tasks served by each financial database;

S4.1.2.4:根据多个加速比组及每个加速比组的代表参数,形成加速比队列。S4.1.2.4: According to a plurality of speedup ratio groups and the representative parameters of each speedup ratio group, a speedup ratio queue is formed.

优选地,所述多参数量化策略根据将所述单参数量化策略的均线长度设置为可变参数而得到。Preferably, the multi-parameter quantization strategy is obtained by setting the moving average length of the single-parameter quantization strategy as a variable parameter.

优选地,所述单参数量化策略具体为单均线策略。Preferably, the single parameter quantization strategy is specifically a single moving average strategy.

优选地,步骤S2中,根据服务器的空闲内存量、所述单参数量化策略的占用内存量以及单个金融数据库的占用内存量,设置多个数据库组合满足以下不等式:Preferably, in step S2, according to the amount of free memory of the server, the amount of memory occupied by the single-parameter quantization strategy, and the amount of memory occupied by a single financial database, multiple database combinations are set to satisfy the following inequality:

Ms*ps*nf+Mf*nf<MMs*ps*nf+Mf*nf<M

其中,M表示所述服务器的空闲内存量,Ms表示所述单参数量化策略的占用内存量,Mf表示单个金融数据库的占用内存量。Wherein, M represents the amount of free memory of the server, Ms represents the amount of memory occupied by the single-parameter quantization strategy, and Mf represents the amount of memory occupied by a single financial database.

优选地,所述多个数据库组合具体为一个有序偶对(nf,ps),所述多个数据库组合的数量N通过以下公式表示:Preferably, the multiple database combinations are specifically an ordered pair (nf, ps), and the number N of the multiple database combinations is represented by the following formula:

N=nf*psN=nf*ps

其中,nf表示金融数据库的数量,ps表示每个金融数据库所服务的回测任务数量。Among them, nf represents the number of financial databases, and ps represents the number of backtesting tasks served by each financial database.

优选地,所述多个最优数据库组合具体为一个或多个最优有序偶对(nf,ps),每一个所述最优有序偶对所包括的最优数据库组合的数量N通过以下公式表示:Preferably, the multiple optimal database combinations are specifically one or more optimal ordered pairs (nf optimal , ps optimal ), and the number of optimal database combinations included in each optimal ordered pair N is expressed by the following formula:

N=nf*ps N excellent = nf excellent * ps excellent

其中,nf表示金融数据库的最优数量,ps表示每个金融数据库所服务的回测任务最优数量;且N≤N。Among them, nf is the optimal number of financial databases, ps is the optimal number of backtesting tasks served by each financial database; and N is ≤ N.

本发明第二方面公开一种基于多参数量化策略回测的系统资源调度装置,包括:A second aspect of the present invention discloses a system resource scheduling device based on multi-parameter quantization strategy backtesting, comprising:

标准测试单元,用于根据预设回测时间段以及预设标准股票标的,对指定的单参数量化策略进行回测,记录回测过程中所述单参数量化策略的占用内存量;The standard testing unit is used to back-test the specified single-parameter quantitative strategy according to the preset back-testing time period and the preset standard stock target, and record the amount of memory occupied by the single-parameter quantitative strategy during the back-testing process;

设置单元,用于根据服务器的空闲内存量、所述单参数量化策略的占用内存量以及单个金融数据库的占用内存量,设置多个数据库组合;其中,每个所述数据库组合包括一定数量的金融数据库以及每个所述金融数据库所服务的回测任务数量,每个所述数据库组合中的金融数据库的数量不同;A setting unit, configured to set a plurality of database combinations according to the amount of free memory of the server, the amount of memory occupied by the single-parameter quantification strategy, and the amount of memory occupied by a single financial database; wherein, each of the database combinations includes a certain amount of financial The database and the number of backtesting tasks served by each of the financial databases, and the number of financial databases in each of the database combinations is different;

回测测试单元,用于按照所述多个数据库组合、所述预设的回测时间段以及所述预设股票标的,对所述多参数量化策略进行回测,以获得每个所述数据库组合对应的回测运行时间;A back-testing unit for back-testing the multi-parameter quantification strategy according to the multiple database combinations, the preset back-test time period and the preset stock target, so as to obtain each of the databases The backtest running time corresponding to the combination;

寻优单元,用于根据用户针对所述多参数量化策略输入的指定回测任务数量,在所述多个数据库组合以及每个所述数据库组合对应的回测运行时间中进行搜索,以获得多个最优数据库组合;其中,所述多个最优数据库组合包括根据所述指定回测任务数量对所述多参数量化策略进行回测时所需要开启的金融数据库最优数量以及每个所述金融数据库所服务的回测任务最优数量;The optimization unit is configured to search the multiple database combinations and the backtesting running time corresponding to each of the database combinations according to the specified number of backtesting tasks input by the user for the multi-parameter quantification strategy, so as to obtain multiple database combinations. optimal database combinations; wherein, the multiple optimal database combinations include the optimal number of financial databases that need to be opened when back-testing the multi-parameter quantitative strategy according to the specified number of back-testing tasks and each of the The optimal number of backtesting tasks served by the financial database;

回测执行单元,用于根据所述多个最优数据库组合,对所述多参数量化策略的其它股票标的或其它回测时间段进行回测,所述其它股票标的与所述预设标准股票标的不同,所述其它回测时间段与所述预设回测时间段不同,所述其它回测时间段与所述预设回测时间段的长度相同。A backtest execution unit, configured to perform backtests on other stock targets or other backtest time periods of the multi-parameter quantitative strategy according to the multiple optimal database combinations, the other stock targets and the preset standard stocks The target is different, the other backtest time period is different from the preset backtest time period, and the other backtest time period and the preset backtest time period have the same length.

与现有技术相比,本发明技术方案的有益效果是:本发明公开一种基于多参数量化策略回测的系统资源调度方法及装置,通过根据服务器的空闲内存量、单参数量化策略的占用内存量以及单个金融数据库的占用内存量,设置多个数据库组合,并根据多个数据库组合对多参数量化策略进行回测,获得每个数据库组合对应的回测运行时间;基于此,当用户输入指定回测任务数量想要对多参数量化策略的其它股票标的或其它回测时间段进行回测时,可以根据指定回测任务数量在多个数据库组合以及每个数据库组合对应的回测运行时间中进行搜索出多个最优数据库组合,根据多个最优数据库组合可以确定需要开启多少个金融数据库以及每个金融数据库服务多少回测任务的结果,并以此结果对多参数量化策略进行回测,能够缩短多参数量化策略的回测时间,加快多参数量化策略的回测效率,同时降低资源成本。Compared with the prior art, the beneficial effects of the technical solution of the present invention are as follows: the present invention discloses a method and device for scheduling system resources based on multi-parameter quantization strategy back-testing, which can be used according to the amount of free memory of the server and the occupation of the single-parameter quantization strategy. The amount of memory and the amount of memory occupied by a single financial database, set up multiple database combinations, and perform backtesting on the multi-parameter quantitative strategy according to the multiple database combinations to obtain the backtesting running time corresponding to each database combination; based on this, when the user inputs Specify the number of backtesting tasks When you want to backtest other stock targets or other backtesting time periods of the multi-parameter quantitative strategy, you can perform backtesting in multiple database combinations and the backtesting running time corresponding to each database combination according to the specified number of backtesting tasks. According to the multiple optimal database combinations, you can determine how many financial databases need to be opened and how many backtest tasks each financial database serves, and use the results to return the multi-parameter quantification strategy. It can shorten the back-test time of multi-parameter quantization strategies, speed up the back-test efficiency of multi-parameter quantization strategies, and reduce resource costs.

附图说明Description of drawings

图1为实施例1基于多参数量化策略回测的系统资源调度方法的流程图。1 is a flowchart of a system resource scheduling method based on multi-parameter quantization strategy backtesting in Embodiment 1.

图2为实施例3基于多参数量化策略回测的系统资源调度装置的示意图。FIG. 2 is a schematic diagram of a system resource scheduling apparatus based on multi-parameter quantization strategy backtesting in Embodiment 3. FIG.

其中:201、标准测试单元;202、设置单元;203、回测测试单元;204、寻优单元;205、回测执行单元。Among them: 201, standard test unit; 202, setting unit; 203, backtest test unit; 204, optimization unit; 205, backtest execution unit.

具体实施方式Detailed ways

附图仅用于示例性说明,不能理解为对本专利的限制;The accompanying drawings are for illustrative purposes only, and should not be construed as limitations on this patent;

下面结合附图和实施例对本发明的技术方案做进一步的说明。The technical solutions of the present invention will be further described below with reference to the accompanying drawings and embodiments.

实施例1Example 1

如图1所示,本实施例提供一种基于多参数量化策略回测的系统资源调度方法,包括如下步骤:As shown in FIG. 1 , this embodiment provides a system resource scheduling method based on multi-parameter quantization strategy backtesting, including the following steps:

S1:根据预设回测时间段以及预设标准股票标的,对指定的单参数量化策略进行回测,记录回测过程中单参数量化策略的占用内存量。S1: According to the preset backtest time period and the preset standard stock target, backtest the specified single-parameter quantitative strategy, and record the amount of memory occupied by the single-parameter quantitative strategy during the backtesting process.

可选地,预设标准股票标的是一支作为参考标准的股票标的,可以由开发人员预先设定。Optionally, the preset standard stock target is a stock target serving as a reference standard, which can be preset by the developer.

其中,单参数量化策略指的是均线长度固定的量化策略,其参数数量为一,具体可以为单均线或双均线策略。Among them, the single-parameter quantitative strategy refers to a quantitative strategy with a fixed moving average length, and the number of parameters is one, which may be a single moving average or a double moving average strategy.

可选地,可以获取回测过程中单参数量化策略的占用信息,其包括占用内存量Ms以及占用CPU核数。比如,占用内存量Ms为12KB,占用CPU核数为1个物理核。Optionally, the occupancy information of the single-parameter quantization strategy in the backtesting process can be acquired, which includes the occupied memory amount Ms and the occupied CPU core number. For example, the amount of occupied memory Ms is 12KB, and the number of occupied CPU cores is 1 physical core.

S2:根据服务器的空闲内存量、单参数量化策略的占用内存量以及单个金融数据库的占用内存量,设置多个数据库组合;其中,每个数据库组合包括一定数量的金融数据库以及每个金融数据库所服务的回测任务数量,每个数据库组合中的金融数据库的数量不同。S2: According to the amount of free memory of the server, the amount of memory occupied by the single-parameter quantification strategy, and the amount of memory occupied by a single financial database, multiple database combinations are set; wherein, each database combination includes a certain number of financial databases and each financial database. The number of backtesting tasks for the service, the number of financial databases in each database combination is different.

可选地,步骤S2之前,可以使用工具或命令获取服务器的硬件信息,该硬件信息包括CPU基本信息及内存信息;其中,CPU基本信息可以CPU主频、CPU核数等;内存信息包括空闲内存量、内存频率等;其中,空闲内存量具体可以是空闲内存的字节数,以下简称M。Optionally, before step S2, a tool or command can be used to obtain the hardware information of the server, and the hardware information includes basic CPU information and memory information; wherein, the basic information of the CPU can be the CPU frequency, the number of CPU cores, etc.; the memory information includes free memory. The amount of free memory, memory frequency, etc.; wherein, the amount of free memory may specifically be the number of bytes of free memory, hereinafter referred to as M.

以及,步骤S2之前,还可以在服务器中开启一个金融数据库,并获取金融数据库的占用内存量Mf。可选地,金融数据库可以是redis数据库。And, before step S2, a financial database may also be opened in the server, and the amount of memory Mf occupied by the financial database may be obtained. Optionally, the financial database can be a redis database.

可选地,多个数据库组合具体为一个有序偶对(nf,ps),其中,nf表示金融数据库的数量,ps表示每个金融数据库所服务的回测任务数量。nf和ps的选择范围受到服务器的空闲内存量M、单参数量化策略的占用内存量Ms以及单个金融数据库的占用内存量Mf的限制,即需要满足以下的不等式:Optionally, the combination of multiple databases is specifically an ordered pair (nf, ps), where nf represents the number of financial databases, and ps represents the number of backtesting tasks served by each financial database. The selection range of nf and ps is limited by the amount of free memory M of the server, the amount of memory occupied by the single-parameter quantization strategy Ms, and the amount of memory occupied by a single financial database Mf, that is, the following inequality needs to be satisfied:

Ms*ps*nf+Mf*nf<M (1)Ms*ps*nf+Mf*nf<M (1)

S3:按照多个数据库组合、预设的回测时间段以及预设股票标的,对多参数量化策略进行回测,以获得每个数据库组合对应的回测运行时间;S3: Back-test the multi-parameter quantitative strategy according to multiple database combinations, preset back-test time periods and preset stock targets to obtain the back-test running time corresponding to each database combination;

需要说明的是,单参数量化策略指的是均线长度固定的量化策略,当户打算从若干个不同均线长度的单参数量化策略中找出最优收益的那个单参数量化策略时,可以将单参数量化策略的均线长度设置为可变的参数,构成多参数量化策略,多参数量化策略则可以包括多个单参数量化策略,且每个单参数量化策略的均线长度不相同。也即是说,多参数量化策略可以根据将步骤S1中的单参数量化策略的均线长度设置为可变参数而得到。It should be noted that the single-parameter quantization strategy refers to a quantization strategy with a fixed moving average length. When a user intends to find the single-parameter quantization strategy with the best return from several single-parameter quantization strategies with different moving average lengths, the single-parameter quantization strategy can be used. The average length of the parameter quantization strategy is set as a variable parameter, which constitutes a multi-parameter quantization strategy. The multi-parameter quantization strategy may include multiple single-parameter quantization strategies, and the average length of each single-parameter quantization strategy is different. That is to say, the multi-parameter quantization strategy can be obtained by setting the moving average length of the single-parameter quantization strategy in step S1 as a variable parameter.

其中,多参数量化策略的参数数量大于一。Among them, the number of parameters of the multi-parameter quantization strategy is greater than one.

S4:根据用户针对多参数量化策略输入的指定回测任务数量,在多个数据库组合以及每个数据库组合对应的回测运行时间中进行搜索,以获得多个最优数据库组合;S4: According to the specified number of backtesting tasks input by the user for the multi-parameter quantitative strategy, search through multiple database combinations and the backtesting running time corresponding to each database combination to obtain multiple optimal database combinations;

其中,多个最优数据库组合包括根据指定回测任务数量对多参数量化策略进行回测时所需要开启的金融数据库最优数量以及每个金融数据库所服务的回测任务最优数量。The multiple optimal database combinations include the optimal number of financial databases that need to be opened when backtesting the multi-parameter quantitative strategy according to the specified number of backtesting tasks, and the optimal number of backtesting tasks served by each financial database.

可选地,多个数据库组合具体为一个有序偶对(nf,ps),多个数据库组合的数量N通过N=nf*ps计算得到。Optionally, the multiple database combinations are specifically an ordered pair (nf, ps), and the number N of the multiple database combinations is calculated by N=nf*ps.

进一步地,多个最优数据库组合具体可以为一个或多个最优有序偶对(nf,ps),每一个最优有序偶对所包括的最优数据库组合的数量N通过N=nf*ps计算得到。其中,nf表示金融数据库的最优数量,ps表示每个金融数据库所服务的回测任务最优数量;且N≤N。也即,每个最优数据库组合中金融数据库所服务的回测任务数量总和小于或等于多个数据库组合中金融数据库所服务的回测任务数量总和。Further, the multiple optimal database combinations may specifically be one or more optimal ordered pairs (nf optimal , ps optimal ), and the number of optimal database combinations included in each optimal ordered pair N optimally passes through N excellent = nf excellent * ps excellent calculated. Among them, nf is the optimal number of financial databases, ps is the optimal number of backtesting tasks served by each financial database; and N is ≤ N. That is, the total number of backtesting tasks served by financial databases in each optimal database combination is less than or equal to the total number of backtesting tasks served by financial databases in multiple database combinations.

具体地,当用户输入指定回测任务数量n对多参数量化策略进行回测时,可以根据指定回测任务数量n,在多个数据库组合以及每个数据库组合对应的回测运行时间中进行搜索,以获得多个最优数据库组合。Specifically, when the user inputs the specified number of backtesting tasks n to backtest the multi-parameter quantification strategy, the user can search through multiple database combinations and the backtesting running time corresponding to each database combination according to the specified number of backtesting tasks n , to obtain multiple optimal database combinations.

但是,由于在多个数据库组合以及每个数据库组合对应的回测运行时间中进行搜索的搜索空间较大,导致寻优过程花费时间较多。为了减少寻优过程花费的时间,可选地,步骤S4可以包括以下步骤:However, due to the large search space for searching in multiple database combinations and the backtesting running time corresponding to each database combination, the optimization process takes more time. In order to reduce the time spent in the optimization process, optionally, step S4 may include the following steps:

S4.1:采用加速比分组的方式对多个数据库组合以及每个数据库组合对应的回测运行时间进行压缩,以获得加速比队列;S4.1: Compress multiple database combinations and the backtest running time corresponding to each database combination in a speedup ratio grouping manner to obtain a speedup ratio queue;

S4.2:根据用户针对多参数量化策略输入的指定回测任务数量,在加速比队列中进行搜索,以获得多个最优数据库组合。S4.2: According to the specified number of backtesting tasks input by the user for the multi-parameter quantization strategy, search in the acceleration ratio queue to obtain multiple optimal database combinations.

具体地,可以在加速比队列中进行搜索,以获得多个最优数据库组合。Specifically, a search can be performed in the speedup queue to obtain multiple optimal database combinations.

进一步可选地,步骤S4.1可以包括以下步骤:Further optionally, step S4.1 may include the following steps:

S4.1.1:根据每个数据库组合对应的回测运行时间,计算出每个数据库组合对应的加速比,以获得多个加速比。S4.1.1: According to the backtest running time corresponding to each database combination, calculate the speedup ratio corresponding to each database combination to obtain multiple speedup ratios.

需要说明的是,加速比用于表征同一个回测任务在单处理器系统和并行处理器系统中的运行时间的比率,用来衡量并行系统或程序并行化的性能和效果。其中,单处理器系统指的是只有一个金融数据库并且该金融数据库只服务一个回测任务的情况,本发明中的数据库组合属于并行处理器系统(即一个或多个金融数据库并且每个金融数据库服务一个或多个回测任务)的情况。It should be noted that the speedup ratio is used to characterize the ratio of the running time of the same backtest task in a single-processor system and a parallel-processor system, and is used to measure the performance and effect of parallel systems or program parallelization. Wherein, the single processor system refers to the situation where there is only one financial database and the financial database only serves one backtesting task, the database combination in the present invention belongs to the parallel processor system (that is, one or more financial databases and each financial database service one or more backtesting tasks).

具体地,可以通过下列公式计算每个数据库组合(nf,ps)对应的加速比:Specifically, the speedup ratio corresponding to each database combination (nf, ps) can be calculated by the following formula:

Figure BDA0002664082680000071
Figure BDA0002664082680000071

其中,N表示运行参数数量,N=nf*ps,nf表示金融数据库的数量,ps表示每个金融数据库所服务的回测任务数量;t(1,1)表示在单处理器系统中进行回测的运行时间,t(nf,ps)表示该数据库组合对应的回测运行时间。Among them, N represents the number of operating parameters, N=nf*ps, nf represents the number of financial databases, ps represents the number of backtesting tasks served by each financial database; t(1,1) represents the backtesting tasks in a single-processor system. The running time of the test, t(nf, ps) represents the running time of the backtest corresponding to the database combination.

S4.1.2:对多个加速比进行分组,形成加速比队列。S4.1.2: Group multiple speedup ratios to form a speedup ratio queue.

进一步可选地,步骤S4.1.2可以包括以下步骤:Further optionally, step S4.1.2 may include the following steps:

S4.1.2.1:按照多个加速比中最大的加速比值、最小的加速比值以及预设组数,通过以下公式(3)计算出每组间隔Δspeedup:S4.1.2.1: According to the maximum acceleration ratio, the minimum acceleration ratio and the preset number of groups among the multiple acceleration ratios, calculate the interval Δspeedup of each group by the following formula (3):

Figure BDA0002664082680000081
Figure BDA0002664082680000081

其中,T表示预设组数,speedupmax表示加速比最大值,speedupmin表示加速比最小值。Among them, T represents the preset number of groups, speedup max represents the maximum speedup ratio, and speedup min represents the minimum speedup ratio.

S4.1.2.2:根据每组间隔通过以下公式(4)对多个加速比进行分组,以获得多个加速比组SiS4.1.2.2: Group multiple speedup ratios according to the following formula (4) according to each group interval to obtain multiple speedup ratio groups S i :

Si={s|[speedupmin+(i-1)*Δspeedup]≤s≤[speedupmin+i*Δspeedup],s∈speedup},1≤i≤T(4)S i ={s|[speedup min +(i-1)*Δspeedup]≤s≤[speedup min +i*Δspeedup],s∈speedup},1≤i≤T(4)

其中,每一个加速比组包括多个加速比、每个加速比对应的数据库组合以及该数据库组合对应的回测运行时间。Wherein, each speedup ratio group includes multiple speedup ratios, a database combination corresponding to each speedup ratio, and a backtesting running time corresponding to the database combination.

需要说明的是,分组的时候需要记录每一个加速比对应的数据库组合(nf,ps)以及数据库组合(nf,ps)对应的回测运行时间t(nf,ps)。It should be noted that when grouping, it is necessary to record the database combination (nf, ps) corresponding to each speedup ratio and the backtest running time t (nf, ps) corresponding to the database combination (nf, ps).

其中,预设组数T可以根据实际需要进行调整。T越大,搜索空间的粒度就越细,所搜索得到的结果也越接近最优,搜索时间也越长。T越小,搜索空间的粒度就越粗,所搜索得到的结果越不接近最优,搜索的时间也越短。The preset number of groups T can be adjusted according to actual needs. The larger the T, the finer the granularity of the search space, the closer the search results are to the optimal, and the longer the search time. The smaller T is, the coarser the granularity of the search space is, the less the search results are close to the optimal, and the shorter the search time is.

S4.1.2.3:确定出每一个加速比组中回测任务数量最大的加速比作为该加速比组的代表参数,构成集合speedup:S4.1.2.3: Determine the speedup ratio with the largest number of backtesting tasks in each speedup ratio group as the representative parameter of the speedup ratio group to form a set speedup:

Figure BDA0002664082680000082
Figure BDA0002664082680000082

需要说明的是,确定出每组代表加速比的时候需要记录每组代表加速比对应的数据库组合(nf,ps)以及数据库组合(nf,ps)对应的回测运行时间t(nf,ps)。It should be noted that when determining the representative speedup ratio of each group, it is necessary to record the database combination (nf, ps) corresponding to each representative speedup ratio and the backtest running time t (nf, ps) corresponding to the database combination (nf, ps) .

S4.1.2.4:根据多个加速比组及每个加速比组的代表参数,形成加速比队列。S4.1.2.4: According to a plurality of speedup ratio groups and the representative parameters of each speedup ratio group, a speedup ratio queue is formed.

相应地,步骤S4.2可以包括:根据用户针对多参数量化策略输入的指定回测任务数量,在加速比队列中进行搜索,以获得多个最优数据库组合。Correspondingly, step S4.2 may include: searching in the acceleration ratio queue according to the specified number of backtesting tasks input by the user for the multi-parameter quantization strategy to obtain multiple optimal database combinations.

进一步可选地,在加速比队列中进行搜索时可以采用以下动态规划算法进行搜索:Further optionally, the following dynamic programming algorithm can be used to search in the speedup queue:

Figure BDA0002664082680000091
Figure BDA0002664082680000091

通过动态规划算法对加速比队列进行搜索后可以输出多个最优数据库组合,具体可为分组集合group:After searching the speedup queue through the dynamic programming algorithm, multiple optimal database combinations can be output, which can specifically be the grouping set group:

group={(nf优1,ps优1),(nf优2,ps优2),L,(nf优k,ps优k)} (6)group={(nf good 1 , ps good 1 ), (nf good 2 , ps good 2 ), L, (nf good k , ps good k )} (6)

其中k为所分的批数。分组集合group表示将指定回测任务数量分成k批进行回测,第1批回测任务使用nf优1个金融数据库,每个金融数据库服务ps优1个回测任务,第2批回测任务使用nf优2个金融数据库,每个金融数据库服务ps优2个回测任务,以此类推,第k批回测任务使用nf优k个金融数据库,每个金融数据库服务ps优k个回测任务。其中,每一批的回测任务数量总数小于或等于N。where k is the number of batches divided. The grouping set group indicates that the specified number of backtesting tasks is divided into k batches for backtesting. The first batch of backtesting tasks uses nf and 1 financial database, each financial database serves ps and has one backtesting task, and the second batch of backtesting tasks Use nf to optimize 2 financial databases, each financial database services ps to optimize 2 backtesting tasks, and so on, the k-th batch of backtesting tasks uses nf to optimize k financial databases, and each financial database serves ps to optimize k backtests Task. Among them, the total number of backtesting tasks in each batch is less than or equal to N.

如此,通过将指定回测任务数量分成多批进行回测,针对每批任务对应输出需要开启多少金融数据库以及每个金融数据库服务多少回测任务的结果,能够进一步缩短并行多参数量化策略的回测时间,加快多参数量化策略的回测效率,同时降低资源成本。In this way, by dividing the specified number of backtesting tasks into multiple batches for backtesting, the results of how many financial databases need to be opened for each batch of tasks and how many backtesting tasks each financial database serves can further shorten the backtesting of parallel multi-parameter quantitative strategies. It reduces the testing time, accelerates the backtesting efficiency of multi-parameter quantization strategies, and reduces resource costs.

S5:根据多个最优数据库组合,对多参数量化策略的其它股票标的或其它回测时间段进行回测;其中,其它股票标的与预设标准股票标的不同,其它回测时间段与预设回测时间段不同,其它回测时间段与预设回测时间段的长度相同。S5: Back-test other stock targets or other back-test time periods of the multi-parameter quantitative strategy according to multiple optimal database combinations; among which, other stock targets are different from the preset standard stock targets, and other back-test time periods are the same as the preset standard stock targets. The backtest time period is different, and other backtest time periods have the same length as the preset backtest time period.

可选地,还可以设置一批任务,该批任务的数量为用户输入的指定回测任务数量n,然后根据步骤S4中的最优数据库组合,分别使用现有的回测方法,如串行回测的方法和单数据库多进程的回测方法,对多参数量化策略进行回测,并分别计算使用本发明的系统资源调度方法相对于串行回测方法所提升的运行效率ratio1以及使用本发明的系统资源调度方法相对于单数据库多进程的回测方法所提升的运行效率ratio2Optionally, a batch of tasks can also be set, and the number of the batch of tasks is the specified number of backtesting tasks n input by the user, and then according to the optimal database combination in step S4, the existing backtesting methods, such as serial The back-testing method and the single-database multi-process back-testing method perform back-testing on the multi-parameter quantization strategy, and respectively calculate the operating efficiency ratio 1 improved by using the system resource scheduling method of the present invention compared with the serial back-testing method and using Compared with the single-database multi-process backtesting method, the system resource scheduling method of the present invention improves the operating efficiency ratio 2 :

Figure BDA0002664082680000101
Figure BDA0002664082680000101

Figure BDA0002664082680000102
Figure BDA0002664082680000102

其中,serial_t为使用串行回测方法下该批任务的总运行时间,single_t为使用单数据库多进程的回测方法下该批任务的总运行时间,optimized_t为使用本发明的系统资源调度方法下该批任务的总运行时间。ratio1表示使用本发明的系统资源调度方法相对于串行回测方法所提升的运行效率,ratio2表示使用本发明的系统资源调度方法相对于单数据库多进程的回测方法所提升的运行效率。Wherein, serial_t is the total running time of the batch of tasks using the serial backtesting method, single_t is the total running time of the batch of tasks using the single-database multi-process backtesting method, and optimized_t is the system resource scheduling method of the present invention. The total running time of this batch of tasks. ratio 1 represents the operating efficiency improved by using the system resource scheduling method of the present invention compared to the serial backtesting method, and ratio 2 represents the operating efficiency improved by using the system resource scheduling method of the present invention compared to the single-database multi-process backtesting method .

本实施例提供一种基于多参数量化策略回测的系统资源调度方法,通过根据服务器的空闲内存量、单参数量化策略的占用内存量以及单个金融数据库的占用内存量,设置多个数据库组合,并根据多个数据库组合对多参数量化策略进行回测,获得每个数据库组合对应的回测运行时间;基于此,当用户输入指定回测任务数量想要对多参数量化策略的其它股票标的或其它回测时间段进行回测时,可以根据指定回测任务数量在多个数据库组合以及每个数据库组合对应的回测运行时间中进行搜索出多个最优数据库组合,根据多个最优数据库组合可以确定需要开启多少个金融数据库以及每个金融数据库服务多少回测任务的结果,并以此结果对多参数量化策略进行回测,能够缩短多参数量化策略的回测时间,加快多参数量化策略的回测效率,同时降低资源成本。This embodiment provides a system resource scheduling method based on multi-parameter quantization strategy backtesting. By setting multiple database combinations according to the amount of free memory of the server, the amount of memory occupied by the single-parameter quantization strategy, and the amount of memory occupied by a single financial database, And backtest the multi-parameter quantitative strategy according to multiple database combinations, and obtain the backtesting running time corresponding to each database combination; When performing backtesting in other backtesting time periods, you can search for multiple optimal database combinations in multiple database combinations and the backtesting running time corresponding to each database combination according to the specified number of backtesting tasks. The combination can determine how many financial databases need to be opened and the results of how many backtesting tasks each financial database serves, and use the results to backtest the multi-parameter quantization strategy, which can shorten the backtest time of the multi-parameter quantization strategy and speed up the multi-parameter quantization Backtesting efficiency of strategies while reducing resource costs.

除此之外,还能够将指定回测任务数量分成多批进行回测,针对每批任务对应输出需要开启多少金融数据库以及每个金融数据库服务多少回测任务的结果,从而进一步缩短多参数量化策略的回测时间,加快多参数量化策略的回测效率,同时降低资源成本。In addition, the specified number of backtesting tasks can also be divided into multiple batches for backtesting, and how many financial databases need to be opened for each batch of tasks and the results of how many backtesting tasks each financial database serves, thereby further shortening the multi-parameter quantification. The backtest time of the strategy is accelerated, the backtest efficiency of the multi-parameter quantitative strategy is accelerated, and the resource cost is reduced at the same time.

实施例2Example 2

本实施例提供一种基于多参数量化策略回测的系统资源调度方法,包括如下步骤:This embodiment provides a system resource scheduling method based on multi-parameter quantization strategy backtesting, including the following steps:

步骤1:选取平安银行(000001.SZ)作为预设标准股票标的,并且采用单均线策略作为指定的单参数量化策略,单均线策略的均线长度为5,该单均线策略所占用的占用内存量Ms为12KB,占用CPU核数为1个物理核。Step 1: Select Ping An Bank (000001.SZ) as the default standard stock target, and adopt the single moving average strategy as the specified single parameter quantitative strategy. The moving average length of the single moving average strategy is 5, and the amount of memory occupied by the single moving average strategy Ms is 12KB, and the number of CPU cores occupied is 1 physical core.

步骤2:使用工具或命令获取服务器的硬件信息;该硬件信息包括CPU基本信息及内存信息。Step 2: Use tools or commands to obtain hardware information of the server; the hardware information includes basic CPU information and memory information.

其中,CPU基本信息:CPU主频是2.10GHz;CPU核数:2颗物理CPU,1颗CPU有16核,总共64逻辑CPU;内存信息:空闲内存量M是224GB,内存频率是2666MHz。Among them, the basic information of the CPU: the main frequency of the CPU is 2.10GHz; the number of CPU cores: 2 physical CPUs, 1 CPU has 16 cores, a total of 64 logical CPUs; memory information: the amount of free memory M is 224GB, and the memory frequency is 2666MHz.

步骤3:在服务器中开启一个redis数据库作为金融数据库,并获取金融数据库的占用内存量Mf,金融数据库的占用内存量Mf为5.17GB,即占用一个物理核。Step 3: Open a redis database on the server as a financial database, and obtain the memory occupied Mf of the financial database. The occupied memory Mf of the financial database is 5.17 GB, that is, one physical core is occupied.

步骤4:根据服务器的空闲内存量M、单均线策略所占用的占用内存量Ms以及金融数据库的占用内存量Mf,通过公式(1)计算出最多可以设置12个不同的金融数据库,每个金融数据库最多服务32个回测任务。Step 4: According to the amount of free memory M of the server, the amount of memory occupied by the single moving average strategy Ms, and the amount of memory occupied by the financial database Mf, it is calculated by formula (1) that a maximum of 12 different financial databases can be set. The database serves up to 32 backtesting tasks.

步骤5:从1到12分别设置金融数据库的数量nf,以及从1到32设置每个金融数据库服务的回测任务数量ps之后,对多参数量化策略进行回测,可以获得每个数据库组合对应的回测运行时间,如下表1所示:Step 5: Set the number of financial databases nf from 1 to 12, and set the number of backtest tasks ps for each financial database service from 1 to 32. After backtesting the multi-parameter quantitative strategy, you can obtain the corresponding data for each database combination. The backtest running time of , as shown in Table 1 below:

表1运行时间分布情况表Table 1 Running time distribution table

Figure BDA0002664082680000111
Figure BDA0002664082680000111

Figure BDA0002664082680000121
Figure BDA0002664082680000121

Figure BDA0002664082680000131
Figure BDA0002664082680000131

步骤6:对步骤5中获得的运行时间分布情况表,根据每个数据库组合对应的回测运行时间,计算出每个数据库组合对应的加速比,如下表2所示:Step 6: For the running time distribution table obtained in Step 5, according to the backtest running time corresponding to each database combination, calculate the speedup ratio corresponding to each database combination, as shown in Table 2 below:

表2加速比列表Table 2 List of speedup ratios

Figure BDA0002664082680000132
Figure BDA0002664082680000132

Figure BDA0002664082680000141
Figure BDA0002664082680000141

步骤7:取T=100,对加速比列表进行降维,获得加速比分组,以及确定出每个加速比分组的代表加速比,以获得加速比队列如下表3:Step 7: Take T=100, reduce the dimension of the speedup ratio list, obtain speedup ratio groups, and determine the representative speedup ratio of each speedup ratio group to obtain the speedup ratio queue as shown in Table 3 below:

表3加速比队列Table 3 Speedup Queue

Figure BDA0002664082680000142
Figure BDA0002664082680000142

Figure BDA0002664082680000151
Figure BDA0002664082680000151

Figure BDA0002664082680000161
Figure BDA0002664082680000161

步骤8:分别针对用户指定的不同的回测任务数量24、96、200、320,采用动态规划算法在加速比队列Speedup中进行搜索,可以获得每个指定回测任务数量各自对应的最优数据库组合的分组集合group,如下表4所示:Step 8: For the different numbers of backtesting tasks specified by the user, 24, 96, 200, and 320, the dynamic programming algorithm is used to search in the speedup queue Speedup, and the optimal database corresponding to each specified number of backtesting tasks can be obtained. The combined grouping set group, as shown in Table 4 below:

表4最优数据库组合的分组集合Table 4 Grouping sets of optimal database combinations

指定回测任务数量nSpecify the number of backtesting tasks n 分组集合groupgrouping set group 24twenty four {(4,6)}{(4,6)} 9696 {(8,12)}{(8,12)} 200200 {(8,12),(2,4),(8,12)}{(8,12),(2,4),(8,12)} 320320 {(13,12),(2,4),(13,12)}{(13,12),(2,4),(13,12)}

步骤9:根据每个指定回测任务数量及其各自对应的最优数据库组合的集合、随机挑选的股票标的、对多参数量化策略进行回测;以及,分别使用现有的回测方法,如串行回测的方法和单数据库多进程的回测方法,对多参数量化策略进行回测,并通过公式(7)计算使用本发明的系统资源调度方法相对于串行回测方法所提升的运行效率ratio1,以及通过公式(8)计算使用本发明的系统资源调度方法相对于单数据库多进程的回测方法所提升的运行效率ratio2。如下表5所示,表5为本发明的系统资源调度方法相对于现有回测方法的运行效率对比表。Step 9: Back-test the multi-parameter quantification strategy according to the number of each specified back-testing task and its respective set of optimal database combinations, randomly selected stock targets; and, respectively, use existing back-testing methods, such as The serial backtesting method and the single-database multiprocess backtesting method perform backtesting on the multi-parameter quantization strategy, and use the formula (7) to calculate the improvement of the system resource scheduling method of the present invention relative to the serial backtesting method. The operating efficiency ratio 1 , and the operating efficiency ratio 2 that is improved by using the system resource scheduling method of the present invention relative to the single-database multi-process backtesting method is calculated by formula (8). As shown in Table 5 below, Table 5 is a comparison table of the operation efficiency of the system resource scheduling method of the present invention with respect to the existing backtesting method.

表5运行效率对比表Table 5 Operational efficiency comparison table

Figure BDA0002664082680000162
Figure BDA0002664082680000162

根据表5可以看出,在指定回测任务数量较多时,使用本发明的系统资源调度方法相对于串行回测方法所提升的效率在20倍以上,而使用本发明的系统资源调度方法相对于单数据库多进程的回测方法所提升的效率在4倍以上。According to Table 5, it can be seen that when the number of specified backtesting tasks is large, using the system resource scheduling method of the present invention improves the efficiency by more than 20 times compared to the serial backtesting method, while using the system resource scheduling method of the present invention is relatively The efficiency improved by the backtesting method of single database and multiple processes is more than 4 times.

可见,采用本发明的基于多参数量化策略回测的系统资源调度方法,可以大大地提高多参数量化策略回测的运行效率,同时降低资源成本。It can be seen that by using the system resource scheduling method based on the multi-parameter quantization strategy back-test of the present invention, the operation efficiency of the multi-parameter quantization strategy back-test can be greatly improved, and the resource cost can be reduced at the same time.

实施例3Example 3

如图2所示,本实施例提供一种基于多参数量化策略回测的系统资源调度装置,包括标准测试单元201、设置单元202、回测测试单元203、寻优单元204以及回测执行单元205,其中:As shown in FIG. 2 , this embodiment provides a system resource scheduling apparatus based on multi-parameter quantization strategy backtesting, including a standard test unit 201 , a setting unit 202 , a backtest test unit 203 , an optimization unit 204 and a backtest execution unit 205, of which:

标准测试单元201,用于根据预设回测时间段以及预设标准股票标的,对指定的单参数量化策略进行回测,记录回测过程中单参数量化策略的占用内存量;The standard testing unit 201 is configured to perform back-testing on a specified single-parameter quantitative strategy according to a preset back-testing time period and a preset standard stock target, and record the amount of memory occupied by the single-parameter quantitative strategy during the back-testing process;

设置单元202,用于根据服务器的空闲内存量、单参数量化策略的占用内存量以及单个金融数据库的占用内存量,设置多个数据库组合;其中,每个数据库组合包括一定数量的金融数据库以及每个金融数据库所服务的回测任务数量,每个数据库组合中的金融数据库的数量不同;The setting unit 202 is configured to set multiple database combinations according to the amount of free memory of the server, the amount of memory occupied by the single-parameter quantization strategy, and the amount of memory occupied by a single financial database; wherein, each database combination includes a certain number of financial databases and each The number of backtesting tasks served by each financial database, and the number of financial databases in each database combination is different;

回测测试单元203,用于按照多个数据库组合、预设的回测时间段以及预设股票标的,对多参数量化策略进行回测,以获得每个数据库组合对应的回测运行时间;The back-testing unit 203 is configured to back-test the multi-parameter quantitative strategy according to a plurality of database combinations, a preset back-test time period and a preset stock target, so as to obtain the back-test running time corresponding to each database combination;

寻优单元204,用于根据用户针对多参数量化策略输入的指定回测任务数量,在多个数据库组合以及每个数据库组合对应的回测运行时间中进行搜索,以获得多个最优数据库组合;其中,多个最优数据库组合包括根据指定回测任务数量对多参数量化策略进行回测时所需要开启的金融数据库最优数量以及每个金融数据库所服务的回测任务最优数量;The optimization unit 204 is configured to search among multiple database combinations and the backtesting running time corresponding to each database combination according to the specified number of backtesting tasks input by the user for the multi-parameter quantification strategy, so as to obtain multiple optimal database combinations ; wherein, the multiple optimal database combinations include the optimal number of financial databases that need to be opened when backtesting the multi-parameter quantitative strategy according to the specified number of backtesting tasks, and the optimal number of backtesting tasks served by each financial database;

回测执行单元205,用于根据多个最优数据库组合,对多参数量化策略的其它股票标的或其它回测时间段进行回测,其它股票标的与预设标准股票标的不同,其它回测时间段与预设回测时间段不同,其它回测时间段与预设回测时间段的长度相同。The backtest execution unit 205 is configured to perform backtests on other stock targets or other backtest time periods of the multi-parameter quantitative strategy according to multiple optimal database combinations. Other stock targets are different from the preset standard stock targets, and other backtest time The period is different from the preset backtest period, and other backtest periods have the same length as the preset backtest period.

本实施例公开一种基于多参数量化策略回测的系统资源调度装置,通过根据服务器的空闲内存量、单参数量化策略的占用内存量以及单个金融数据库的占用内存量,设置多个数据库组合,并根据多个数据库组合对多参数量化策略进行回测,获得每个数据库组合对应的回测运行时间;基于此,当用户输入指定回测任务数量想要对多参数量化策略的其它股票标的或其它回测时间段进行回测时,可以根据指定回测任务数量在多个数据库组合以及每个数据库组合对应的回测运行时间中进行搜索出多个最优数据库组合,根据多个最优数据库组合可以确定需要开启多少个金融数据库以及每个金融数据库服务多少回测任务的结果,并以此结果对多参数量化策略进行回测,能够缩短多参数量化策略的回测时间,加快多参数量化策略的回测效率,同时降低资源成本。This embodiment discloses a system resource scheduling device based on multi-parameter quantization strategy back-testing. By setting multiple database combinations according to the amount of free memory of the server, the amount of memory occupied by the single-parameter quantization strategy, and the amount of memory occupied by a single financial database, And backtest the multi-parameter quantitative strategy according to multiple database combinations, and obtain the backtesting running time corresponding to each database combination; When performing backtesting in other backtesting time periods, you can search for multiple optimal database combinations in multiple database combinations and the backtesting running time corresponding to each database combination according to the specified number of backtesting tasks. The combination can determine how many financial databases need to be opened and the results of how many backtesting tasks each financial database serves, and use the results to backtest the multi-parameter quantization strategy, which can shorten the backtest time of the multi-parameter quantization strategy and speed up the multi-parameter quantization Backtesting efficiency of strategies while reducing resource costs.

显然,本发明的上述实施例仅仅是为清楚地说明本发明所作的举例,而并非是对本发明的实施方式的限定。对于所属领域的普通技术人员来说,在上述说明的基础上还可以做出其它不同形式的变化或变动。这里无需也无法对所有的实施方式予以穷举。凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明权利要求的保护范围之内。Obviously, the above-mentioned embodiments of the present invention are only examples for clearly illustrating the present invention, rather than limiting the embodiments of the present invention. For those of ordinary skill in the art, changes or modifications in other different forms can also be made on the basis of the above description. There is no need and cannot be exhaustive of all implementations here. Any modification, equivalent replacement and improvement made within the spirit and principle of the present invention shall be included within the protection scope of the claims of the present invention.

Claims (7)

1. A system resource scheduling method based on multi-parameter quantization strategy feedback is characterized by comprising the following steps:
s1: according to a preset backtesting time period and a preset standard stock mark, performing backtesting on a specified single-parameter quantization strategy, and recording the memory usage amount of the single-parameter quantization strategy in the backtesting process;
s2: setting a plurality of database combinations according to the idle memory amount of the server, the memory occupied amount of the single-parameter quantization strategy and the memory occupied amount of a single financial database; each database combination comprises a certain number of financial databases and the number of the return testing tasks served by each financial database, and the number of the financial databases in each database combination is different;
setting a plurality of database combinations to satisfy the following inequality according to the idle memory amount of the server, the memory occupied amount of the single parameter quantization strategy and the memory occupied amount of a single financial database:
Ms*ps*nf+Mf*nf<M
wherein, M represents the free memory amount of the server, Ms represents the memory amount occupied by the single-parameter quantization strategy, and Mf represents the memory amount occupied by a single financial database;
s3: carrying out retest on the multi-parameter quantization strategy according to the plurality of database combinations, the preset retest time period and the preset stock labels to obtain the retest time period corresponding to each database combination;
s4: searching the plurality of database combinations and the corresponding backtesting running time of each database combination according to the specified number of the backtesting tasks input by the user aiming at the multi-parameter quantization strategy so as to obtain a plurality of optimal database combinations; the optimal database combinations comprise the optimal number of financial databases to be started when the multi-parameter quantization strategy is subjected to the recovery according to the specified recovery test task number and the optimal number of recovery test tasks served by each financial database;
the plurality of database combinations are specifically an ordered even pair (ps, nf), and the number N of the plurality of database combinations is represented by the following formula:
N=nf*ps
wherein nf represents the number of financial databases, ps represents the number of the backtesting tasks served by each financial database;
the plurality of optimal database combinations are specifically one or more optimal ordered even pairs (ps)Youyou (an instant noodle),nfYouyou (an instant noodle)) The number N of optimal database combinations included in each of the optimal ordered pairingsYouyou (an instant noodle)Expressed by the following formula:
Nsuperior food=nfSuperior food*psYouyou (an instant noodle)
Wherein, nfSuperior foodRepresenting the optimal quantity, ps, of financial databasesSuperior foodRepresenting the optimal number of the return testing tasks served by each financial database; and N isSuperior food≤N;
S5: and according to the optimal database combinations, carrying out retesting on other stock labels or other retesting time periods of the multi-parameter quantization strategy, wherein the other stock labels are different from the preset standard stock labels, the other retesting time periods are different from the preset retesting time period, and the other retesting time periods are the same as the preset retesting time period in length.
2. The method for scheduling system resources based on multi-parameter quantization policy backtesting as claimed in claim 1, wherein step S4 comprises the following steps:
s4.1: compressing the plurality of database combinations and the corresponding backtesting running time of each database combination in an acceleration ratio grouping mode to obtain an acceleration ratio queue;
s4.2: and searching in the acceleration ratio queue according to the number of specified backtesting tasks input by a user aiming at the multi-parameter quantization strategy so as to obtain a plurality of optimal database combinations.
3. The method for scheduling system resources based on multi-parameter quantization strategy feedback according to claim 2, wherein step S4.1 comprises:
s4.1.1: calculating the acceleration ratio corresponding to each database combination according to the retest running time corresponding to each database combination to obtain a plurality of acceleration ratios;
s4.1.2: and grouping the plurality of speed-up ratios to form a speed-up ratio queue.
4. The method of claim 3, wherein the step S4.1.2 comprises the following steps:
s4.1.2.1: according to the maximum acceleration ratio, the minimum acceleration ratio and the preset number of groups in the multiple acceleration ratios, calculating each group interval delta speed by the following formula:
Figure FDA0003571572410000021
wherein T represents a predetermined number of groups, speedupmaxIndicating the maximum acceleration ratio, speedupminRepresents an acceleration ratio minimum;
s4.1.2.2: grouping a plurality of acceleration ratios according to each group interval by the following formula to obtain a plurality of acceleration ratio groups Si
Si={s|[speedupmin+(i-1)*Δspeedup]≤s≤[speedupmin+i*Δspeedup],s∈speedup},1≤i≤T
Each acceleration ratio group comprises a plurality of acceleration ratios, a database combination corresponding to each acceleration ratio and a retest running time corresponding to the database combination;
s4.1.2.3: and determining the acceleration ratio with the maximum retest task number in each acceleration ratio group as a representative parameter of the acceleration ratio group to form a set speed:
Figure FDA0003571572410000031
wherein S represents an acceleration ratio, SiRepresenting the acceleration ratio set, nf representing the number of financial databases, ps representing the number of the backtesting tasks served by each financial database;
s4.1.2.4: and forming an acceleration ratio queue according to the acceleration ratio groups and the representative parameters of each acceleration ratio group.
5. The method as claimed in any one of claims 1 to 4, wherein the multi-parameter quantization strategy is obtained by setting the mean line length of the single-parameter quantization strategy as a variable parameter.
6. The method as claimed in claim 5, wherein the single-parameter quantization strategy is a single-average line strategy.
7. A system resource scheduling device based on multi-parameter quantization strategy feedback is characterized by comprising:
the standard test unit is used for carrying out retest on the appointed single-parameter quantization strategy according to the preset retest time period and the preset standard stock mark and recording the memory occupied amount of the single-parameter quantization strategy in the retest process;
a setting unit, configured to set a plurality of database combinations according to the idle memory amount of the server, the memory occupied amount of the single-parameter quantization policy, and the memory occupied amount of a single financial database; each database combination comprises a certain number of financial databases and the number of the return testing tasks served by each financial database, and the number of the financial databases in each database combination is different;
setting a plurality of database combinations to satisfy the following inequality according to the idle memory amount of the server, the memory occupied amount of the single parameter quantization strategy and the memory occupied amount of a single financial database:
Ms*ps*nf+Mf*nf<M
wherein, M represents the free memory amount of the server, Ms represents the memory amount occupied by the single-parameter quantization strategy, and Mf represents the memory amount occupied by a single financial database;
the retest test unit is used for retesting the multi-parameter quantization strategy according to the multiple database combinations, the preset retest time period and the preset stock labels so as to obtain the retest running time corresponding to each database combination;
the optimizing unit is used for searching the plurality of database combinations and the corresponding backtesting running time of each database combination according to the specified number of backtesting tasks input by a user aiming at the multi-parameter quantization strategy so as to obtain a plurality of optimal database combinations; the optimal database combinations comprise the optimal number of financial databases required to be started when the multi-parameter quantization strategy is subjected to the recovery according to the specified recovery test task number and the optimal number of recovery test tasks served by each financial database;
the plurality of database combinations are specifically an ordered even pair (ps, nf), and the number N of the plurality of database combinations is represented by the following formula:
N=nf*ps
wherein nf represents the number of financial databases, ps represents the number of the backtesting tasks served by each financial database;
the plurality of optimal database combinations are specifically one or more optimal ordered even pairs (ps)Youyou (an instant noodle),nfSuperior food) The number N of optimal database combinations included in each of the optimal ordered pairingsSuperior foodExpressed by the following formula:
Nsuperior food=nfSuperior food*psSuperior food
Wherein, nfSuperior foodRepresenting the optimal quantity, ps, of the financial databaseSuperior foodRepresenting the optimal number of the return testing tasks served by each financial database; and N isSuperior food≤N;
And the backtesting execution unit is used for backtesting other stock marks or other backtesting time periods of the multi-parameter quantization strategy according to the optimal database combinations, wherein the other stock marks are different from the preset standard stock marks, the other backtesting time periods are different from the preset backtesting time period, and the other backtesting time periods are the same as the preset backtesting time period in length.
CN202010913281.5A 2020-09-03 2020-09-03 System resource scheduling method and device based on multi-parameter quantization strategy feedback Expired - Fee Related CN112035533B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010913281.5A CN112035533B (en) 2020-09-03 2020-09-03 System resource scheduling method and device based on multi-parameter quantization strategy feedback

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010913281.5A CN112035533B (en) 2020-09-03 2020-09-03 System resource scheduling method and device based on multi-parameter quantization strategy feedback

Publications (2)

Publication Number Publication Date
CN112035533A CN112035533A (en) 2020-12-04
CN112035533B true CN112035533B (en) 2022-07-12

Family

ID=73591683

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010913281.5A Expired - Fee Related CN112035533B (en) 2020-09-03 2020-09-03 System resource scheduling method and device based on multi-parameter quantization strategy feedback

Country Status (1)

Country Link
CN (1) CN112035533B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101692206A (en) * 2009-08-28 2010-04-07 腾讯科技(深圳)有限公司 Method for adding dynamic parameters to static callback function and related realization
CN107833137A (en) * 2017-11-03 2018-03-23 上海宽全智能科技有限公司 Quantization trading strategies generation method and device, equipment and storage medium based on multiple-objection optimization
CN108765149A (en) * 2018-05-11 2018-11-06 南京工程学院 A kind of quantization strategy based on cluster returns examining system and its returns survey method
CN110533540A (en) * 2019-09-06 2019-12-03 北京神州同道智能科技有限公司 A kind of whole city multi items finance money guard system based on intelligence dimension Meta-Policy platform

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101692206A (en) * 2009-08-28 2010-04-07 腾讯科技(深圳)有限公司 Method for adding dynamic parameters to static callback function and related realization
CN107833137A (en) * 2017-11-03 2018-03-23 上海宽全智能科技有限公司 Quantization trading strategies generation method and device, equipment and storage medium based on multiple-objection optimization
CN108765149A (en) * 2018-05-11 2018-11-06 南京工程学院 A kind of quantization strategy based on cluster returns examining system and its returns survey method
CN110533540A (en) * 2019-09-06 2019-12-03 北京神州同道智能科技有限公司 A kind of whole city multi items finance money guard system based on intelligence dimension Meta-Policy platform

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
《科学技术与工程》第十卷总目录;《科学技术与工程》;20101228(第36期);第1-48页 *

Also Published As

Publication number Publication date
CN112035533A (en) 2020-12-04

Similar Documents

Publication Publication Date Title
CN110377519B (en) Performance capacity test method, device and equipment of big data system and storage medium
CN109960808B (en) A text recognition method, device, equipment and computer-readable storage medium
CN107908536B (en) Performance evaluation method and system for GPU application in CPU-GPU heterogeneous environment
CN115576502B (en) Method, device, electronic device and storage medium for data storage
CN117909199B (en) Performance measurement method, device, equipment, load balancing method, system and medium
US20070219646A1 (en) Device performance approximation
CN112035533B (en) System resource scheduling method and device based on multi-parameter quantization strategy feedback
CN115794570A (en) Pressure testing method, device, equipment and computer readable storage medium
CN118964467A (en) A multi-threaded fast import and export method for timing library based on neural network
CN117312613B (en) Cloud computing-based order data intelligent management method and system
CN108564237A (en) A kind of Capacity Evaluation Model method for building up, capacity evaluating method and device
CN114924941B (en) A performance evaluation system and method for stream computing scenario solutions based on pipeline model
CN108595502B (en) Method, apparatus and computer-readable storage medium for evaluating database service performance
CN112330154A (en) Scientific and technological project achievement transformation evaluation method and device based on AHP and gray clustering
CN119668529B (en) Distributed storage electronic data processing system
CN119046104B (en) A data processing method for financial accounting office equipment
CN118585411B (en) Discrete event simulation engine efficiency evaluation method and device
CN114580538B (en) Load data clustering method, device, electronic device, and storage medium
CN118916045A (en) Middleware deployment method, system, equipment and medium based on hardware parameter weight
CN118838933B (en) Time sequence data scripted sequence calculation and back-weaving method and system
TWI782845B (en) Configuration setting prediction system and method for general-purpose graphics processor core functions
WO2024239227A1 (en) Generating rules for predicting characteristics of computer operations
CN117539760A (en) Operation quality diagnosis method and device
CN119441051A (en) A method, device, equipment, medium and program product for classifying access statements
CN119939289A (en) A multi-link clustering method for data center clusters

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20220712

CF01 Termination of patent right due to non-payment of annual fee