SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Sun Sep 24, 2017 6:08 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 16 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: OpenQuant 2014
PostPosted: Tue Aug 16, 2016 11:10 am 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6769
Optimization manager

OpenQuant 2014 offers several different optimization algorithms including multicore brute force and stochastic optimization algorithms such as multicore genetics and adaptive simulated annealing.

The Optimization Manager (Framework.OptimizationManager) maintains a list of Optimizers (OptimizationManager.Optimizers) and provides a reference to the default framework optimizer (OptimizationManager.Optimizer).

You can use Optimizers window in OpenQuant 2014 IDE to see the list of available optimizers, set default framework optimizer and set parameters of optimization algorithms. Navigate to View -> Optimizers in OpenQuant 2014 main menu to open Optimizers window.

Right click on the optimizer name and select Set as default from context menu to set selected optimizer as default in the framework.

You can select an optimizer and change its properties in the Properties window

Properties of registered optimizers are stored in the optimizationmanager.xml file in the AppData\Roaming\SmartQuant Ltd\OpenQuant 2014\config folder.

Indeed you can also change optimizer properties programmatically, for example

Code:
Genetic MulticoreOptimizer optimizer = (GeneticMulticoreOptimizer)OptimizationManager.GetOptimizer(OptimizerId.GeneticMulticore));
optimizer.GenerationCount = 50;


The Optimization Manager provides

Code:
public OptimizationParameterSet Optimize(Strategy strategy, OptimizationUniverse universe = null)


and

Code:
public OptimizationParameterSet Optimize(Scenario scenario, OptimizationUniverse universe = null)


methods, which you can use to optimize a strategy or a scenario.

Note that Scenario class provides built-in Optimize method, so that you can simply write Optimize(strategy) in your scenarios. The second optional parameter in the Optimize method tells to the optimizer to use OptimizationUniverse instead of parameters marked with OptimizationParameter attribute in your strategy. Remember that you can use OptimizationParameter attribute to indicate which parameters of your strategy you want to optimize and what bounds and step you want to use during optimization. For example you can write

Code:
        [OptimizationParameter(5, 25)]
        public int Length1 = 14;

        [OptimizationParameter(26, 60)]
        public int Length2 = 50;

        [OptimizationParameter(0.05, 0.10, 0.05)]
        public double StopLevel = 0.05;


in your strategy and this will tell to optimizers that StopLevel parameter of your strategy should be varied between 0.05 (lower bound) and 0.1(upper bound) with step 0.05 (step will be used if optimization algorithm needs it, for example in case of Multicore brute force optimizer).

Alternatively you can use OptimizationUniverse where you explicitly create a complete set of optimization parameters and their values and pass it to Optimize method. Take a look at the multicore optimizer chapter where we create and use OptimizationUniverse.

Optimization results

Navigate to View->Optimization Results in the OpenQuant 2014 main menu to open Optimization Results window. This window is updated dynamically during optimization process.
Optimization progress and current top 100 results


Objective function development graph


1d parameter distribution graph


2d parameter distribution color map


2d parameter distribution 3d plot


Optimizing scenarios

Note that Optimizer as well as OptimizationManager provides

Code:
public OptimizationParameterSet Optimize(Scenario scenario, OptimizationUniverse universe = null)


method. This suggests that you can optimize not only strategies but also scenarios. Why would you want to do it? Assume you would like to optimize a strategy parameter on a Monte-Carlo ensemble of simulated data trajectories. Then you could create a scenario where you run strategy backtests in a loop changing input data or instruments representing different trajectories in the ensemble, and then calculate an average of backtest results in the end of this scenario. If you declare an optimization parameter in the scenario and pass it to the strategy, you can optimize the scenario to find the best value of the strategy parameter on ensemble of data trajectories.

In order to optimize a scenario you should override its Objective() method and then run Framework.Current.OptimizationManager.Optimize(scenario) in you program.cs file.


Attachments:
map.jpg
map.jpg [ 282.27 KiB | Viewed 657 times ]
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page Previous  1, 2

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group