We deployed 1.1.4 today

David's Avatar

David

24 Mar, 2010 08:48 AM via web

A new version was deployed today.

New features and fixes

Market Runner Improvements

  • Hourly bars (read below about data quality)
  • A new, more compact and clearer API was developed. This API breaks code written with previous versions. Please see below for details.
  • Indicators are now built with a fluent API
  • Third party libraries are shipped with Market Runner and available remotely : Apache Math, libsvm, ta-lib
  • Libraries are shipped with sources and licenses
  • Better graphs for indicators with a different scale than the prices
  • Increased optimization limit to 500 backtests (from an initial 100)

Better scorecard

  • Daily return distribution
  • Trades distribution
  • Advice to improve score
  • Kurtosis and Skewness
  • Strategy summary
  • Max drawdown duration

Web site

  • Download Page
  • Roadmap page
  • Better Quick Start page with code formatting for samples
  • Market Runner Javadoc

Known bugs

  • Hourly market data quality is NOT good so far. We are working on it. Still, we wanted to give you a preview.

What we are working on

  • Hourly market hours quality
  • Five minutes intraday bars
  • More documentation
  • Redesigned Scorecard

API Changes & Strategy Migration Guide

The API changes introduced in this version (1.1.4) breaks compatibility with the previous version (1.1.3) of MarketRunner. Most of the changes are cosmetic and you should be able to change your strategy code to fit the new API easily. The best way to do so is to have a look at the code from the samples and compare it to your own code. We provide here a brief summary of the changes by comparing the old API to the new one.

Hourly Market Data

There is an optional 'type' parameter in the MarketData annotation to select hourly bars for your strategy market data feed.
Also, the annotation MarketDataConfig has been renamed MarketData, and startDate and endDate have been renamed:

  • Before

    @MarketDataConfig(startDate = "2009/10/01", endDate = "2010/10/01")
    public class OptimizedParameters extends AbstractStrategy {
    
  • Now

    @MarketData(start = "2009/10/01", end = "2010/10/01", type = Hourly)
    public class OptimizedParameters extends AbstractStrategy {
    

instrument selection

The strategy instrument list in the '@Instruments' annotation must be set to the parameter 'futures'. This change will allow us to add additional asset classes easily in the future.

  • Before

    @Instruments( {
            CAC_40, E_MINI_SP
    })
    
  • Now

    @Instruments(futures = { CAC_40, E_MINI_SP })
    

onBarOpen and onBarClose renaming

onBarOpen event is now onOpen and take an OpenPrice parameter instead of a Bar.

  • Before

    @Override
    public void onBarOpen(Bar barOpen) {
    
  • Now

    @Override
    public void onOpen(OpenPrice openPrice) {
    

onBarClose is now OnClose with the same signature.

  • Before

    @Override
    public void onBarClose(Bar bar) {
    
  • Now

    @Override
    public void onClose(Bar bar) {
    

mandatory comment parameter when sending orders

All actions related to orders now takes a mandatory comment parameter. Before there were also overloaded methods with no need to pass a comment. Notice also that methods that had a 'Futures' argument now takes a 'Instrument' instead.
Here are the changes for buy methods, the same changes apply for sell methods.

  • Before

    buy(long quantity)
    buy(long quantity, Futures future future)
    buy(long quantity, Futures future, String comment)
    buy(long quantity, String comment)
    buyLimit(long quantity, double)
    buyLimit(long quantity, double, Futures future)
    buyLimit(long quantity, double, Futures future, String comment)
    buyLimit(long quantity, double, String comment)
    buyStop(long quantity, double)
    buyStop(long quantity, double, Futures future)
    buyStop(long quantity, double, Futures future, String comment)
    buyStop(long quantity, double, String comment)
    
  • Now

    buy(long quantity, Instrument instrument, String comment)
    buy(long quantity, String comment)
    buyLimit(long quantity, double, Instrument instrument, String comment)
    buyLimit(long quantity, double, String comment)
    buyStop(long quantity, double, Instrument instrument, String comment)
    buyStop(long quantity, double, String comment)
    

indicator creation and drawing

Indicator creation is now using a different syntax with a builder method - 'newIndicator()'. Drawing indicators is now specified at indicator creation time with a chained 'draw' method call. Indicators are preferably created in onStrategyStart, especially if optimization parameters are used.
Some indicators have now different class names, for example 'SimpleMovingAverage' changed to 'SMA' and 'AverageTrueRange' to 'ATR'.

  • Before

    TimeSeries lowestLowSeries;
    TimeSeries highestHighSeries;
    SMA maSeries;
    ATR atr;
    
    @Override
    public void onStrategyStart() {
        lowestLowSeries = new TimeSeries("lowest");
        highestHighSeries = new TimeSeries("highest");
        maSeries = new SimpleMovingAverage(channelLag, getBars());
        atr = new AverageTrueRange(channelLag, getBars());
    
        draw(lowestLowSeries, Color.BLUE);
        draw(highestHighSeries, Color.BLUE);
        draw(maSeries, Color.ORANGE);
     }
    
  • Now

    TimeSeries lowestLowSeries;
    TimeSeries highestHighSeries;
    SimpleMovingAverage maSeries;
    AverageTrueRange atr;
    
    @Override
    public void onStrategyStart() {
        lowestLowSeries = newIndicator().timeSeries("lowest").draw(Color.BLUE).get();
        highestHighSeries = newIndicator().timeSeries("highest").draw(Color.BLUE).get();
        maSeries = newIndicator().sma().withLength(channelLag).draw(Color.ORANGE).get();
        atr = newIndicator().atr().withLength(channelLag).get();
    }
    

For certain indicators such as SMA, you can specify whether to compute the indicator on bar close or on another bar component (open, high, low, close...) :

  • Now
    SMA shortOpenSMA = newIndicator().sma().withLength(90).on(TO_OPEN).draw(RED).get();
    SMA longAverageSMA = newIndicator().sma().withLength(300).on(AVERAGE).draw(MAGENTA).get();
    

You can draw indicators that have different range of values than the instrument bars on a separate graph by specifying the draw mode of the indicator:

  • Now
    atr = newIndicator().atr().withLength(channelLag).draw(RED, DrawMode.INDEPENDENT).get();
    

optimization parameters

Optimization parameters have a different syntax. 'start', 'end', parameters are replaced by 'from', 'to'.

  • Before
    @Optimized(start = 2, end = 8, step = 1)
    int consecutiveClosesCount = 4;
    
  • Now
    @Optimized(from = 2, to = 8, step = 1)
    int consecutiveClosesCount = 4;
    

You can now optimize over different types, and even use a generator to specify the optimization parameter values. Please check this article for more information about using optimization parameters.

  • Now
    @Optimized(strings = { BUY_WHEN_DOWN, BUY_WHEN_UP })
    String mode = BUY_WHEN_DOWN;
    
    @Optimized(numbers = { 2l, 100l })
    long quantityBuy = 2;
    
    @Optimized(generator = Fibonacci.class)
    double quantitySell = 1;
    
    @Optimized(from = 0.01, to = 0.02, step = 0.01)
    double factor = 0.01;
    
    @Optimized(futures = { Futures.CAC_40, Futures.E_MINI_SP })
    Instrument tradedInstrument = Futures.CAC_40;
    
    @Optimized
    Boolean skipEveryOtherBar = false;
    
    @Optimized(booleans = false)
    Boolean disabled = false;
    

Portfolio API

A Portfolio API provides access to instruments, positions and orders in the strategy. Some methods previously available in Strategy are now available on Portfolio:

  • Before
    remainingOrders = getOrders();
    
  • Now
    remainingOrders = getPortfolio().getOrders();
    

Some convenience methods are still available to easily get the position on the strategy instrument or check the position. These methods are shortcut methods to the equivalent methods on Portfolio
Portfolio also provides a more detailed API for all positions especially useful in multi-instrument strategies

  • Now
    double cacPosition = getPortfolio().getPosition(CAC_40).getAmount()
    
  1. David closed this discussion on 24 Mar, 2010 07:32 PM.

Comments are currently closed for this discussion. You can start a new one.