Advanced optimizations
Advanced Optimizations
Prerequisite
Before going further, make sure you already know and understand the basis of optimizations here.
New optimization types
To go beyond the simple @Optimized(start=, end=,
step=), we have added some useful configuration options. You
can trigger them using <ctrl>+<space> in
Eclipse, just after typing the opening brace of
@Optimized(
Here is a comprehensive list of the available options:
numbers: specifies an array of numbers. Make sure that the values specified in the numbers field are compatible with the type of the variable.strings: specifies an array of Strings. Useful to run very specific comparisons, for instance you could specify patterns in the optimization, check that the market generate patterns that match them, and buy when they do.futures: specifies an array of Futures. These must be selected from theFuturesclass, just like the values in the@Instrumentsannotation. Useful if you want to explore various arbitrage possibilities across multiple instruments.generator: an advance option. Takes a custom class that provides calculated values. Useful to implement your very own generator, either for unsupported types such as complex number or unusual series of numbers, such as the Fibonacci sequence.booleans: specifies an array of booleans. Only really useful with the pair true / false, to enable or disable a part of your code across an optimization.
Some samples
Numbers
@Optimized(numbers = {
0, 1, 1.5
})
double field;
Futures
@Optimized(futures = {
CAC_40, E_MINI_SP, CRUDE_OIL
})
Future myArbitragedInstrument = CAC_40;
Generator
@Optimized(generator = Generator.class)
double buyStopLevel = 1.04;
static class Generator.class implements OptimizationValuesGenerator<Double> {
double myVeryOwnSpecificDouble = 3.1416;
public Iterable<Double> getValues() {
return myVeryOwnSpecificDouble;
}
}
Check out the live sample
In Market Runner, or in the Web samples, make sure you check out the sample DemoOptimizedParameters, with the various optimizations implemented in a working sample to play with. Enjoy!