Wednesday, January 26, 2011

New release: more accurate execution, faster backtests

Well, here comes v2.0.2, the latest version of our platform.

Faster backtests

We've put a lot of efforts into speeding up backtests execution, particularly backtests that use small bars (such as bars that last a minute).
A heavy strategy that was using hundreds of instruments with a mix of Daily and Minute bars went from taking more 7 hours to less than 3. Not bad, though smaller strategies will see a less dramatic speed up.

More accurate execution

We've expanded using quotes (in place of trades) for execution prices. Almost all stocks now have them. This might have an impact on your strategies, so you should consider running them again.

On a similar note, we now support slippage for stop orders.

New callback when a future is rolled

Strategies can now be notified when a future is rolling. This is particularly useful if your strategy attempts to take advantage of the periods when the market shifts from one underlying future contract to another.

Here is a naive example:

@Instruments(futures = { CAC_40 })
@MarketData(rolls = true)
public class HowToBeNotifiedWhenARollOccurs extends AbstractStrategy {
public void onClose(Bar bar) {
if (getPosition().getQuantity() > 0) {

public void onRoll(RollInfo roll) {

Be aware that onRoll(RollInfo) is not called when run on your local machine. This is because all the data that we provide are already rolled. You'll have to run your strategy on our grid to see any effect.

For more on this release

See our release notes.

Tuesday, December 7, 2010

New release: neural networks, cash allocation

3 releases have come and gone since our last update on features. High time to let you know about them.

Access to last open price in strategies

Strategies can now programmatically access the last open price:

This can be used in conjunction with

hasNewOpen() can be especially useful when trying to take decisions only once bars for all instruments have been started. See the Using all open prices in multi-instrument strategiesarticle for details.

Cash allocation

We have introduced a mechanism to tune cash allocation. There are two main steps:
  • Write an ExecutionControl class that define whether to accept orders based on the defined allocations

  • Configure allocations in the strategy annotations

This excerpt based on the HowToControlCashAllocation sample show how it looks like:
@Instruments(futures = CAC_40)
@ExecutionConfig(control = CashControl.class, longAllocation = 50000.0, shortAllocation = 50000.0)
public class CashControlledStrategy extends AbstractStrategy {
public void onClose(Bar bar) {
// take buy or sell decisions

public static class CashControl implements ExecutionControl {
public boolean accept(Order order, Portfolio portfolio) {
boolean longAccepted = portfolio.getLongAllocation() > portfolio.getLongExposition();
boolean shortAccepted = portfolio.getShortAllocation() > portfolio.getShortExposition();

return ((order.getSide() == BUY) && longAccepted) || ((order.getSide() == SELL) && shortAccepted);

In the future, we might provide pre-built cash-management strategies. Those would be a good way of testing the compliance of a strategy with various cash-allocation scenarios. In the meantime, feel free to try with your own.

Neural networks

We have added third-party library Encog, a tool that helps implement neural networks. We first introduced Encog version 2.4.3 but swiftly upgraded to version 2.5. This later version uses JOCL for GPU-based execution. Results are impressive: Encog-based strategies now executed in 1/10th of the time needed in the previous version!

Encog seems like a great way to get started with neural networks. If you have been writing your own with Market Runner in the past, you should check it out. We have a sample called TrendPredictionWithEncog to get you started (as always, remember that you can play with samples immediately with our anonymous login).


There are many more small improvements and fixes. For example, we have started to provide quotes information, though that still needs to be rolled out on all our market data. Check out the release notes for version 1.9, version 1.9.1, and version 2.0 for more.

Wednesday, October 27, 2010

New release: Explore Data, Meta Strategies and IE bugfix

We've released version 1.8 of our framework and website last week.

Meta Strategies
For strategy writing, the most significant new feature is the Meta Strategy. It allows for strategies made of several sub-strategies. The sub-strategies follow the same pattern as normal strategies (including extending the AbstractStrategy class), while the parent strategy must extend AbstractMetaStrategy.

The great thing with meta-strategies is that they allow for fine-tuning the association between strategies and instruments. For example, you might want to have a specific strategy that trade slowly on a stock, while another is dedicated to trading quickly on a futures. For example:

public class MetaStrategy extends AbstractMetaStrategy {
public void createStrategies() {
addStrategy(new BuyAtOpen(), APPLE, Daily);
addStrategy(new BuyAtOpen(), E_MINI_SP, Minute);
addStrategy(new SellAtClose(), E_MINI_SP, Daily);
addStrategy(new SellAtClose(), E_MINI_SP, Daily);

public class BuyAtOpen extends AbstractStrategy {
public void onOpen(OpenPrice open) {

public class SellAtClose extends AbstractStrategy {
public void onClose(Bar bar) {
Older-style (non-meta) strategies still work the same way.

Data Exploration
We have made available the graphs for all the market data. We are hoping that this will help quants that want to make sure that data are available at particular dates.

The red arrows indicate when the Futures contract has rolled to another underlying contract. For Stocks, they give the dates of corporate actions (stock splits, dividends and the like).

The data are available down to the day level (with 1-minute bars):

Also, note that you can tune the filters and see the differences in the graph.

We are quite excited with this new feature. Do let us know what you think!

Cool code search (in samples)
If you pay attention to the pictures above, you'll notice a search field for instrument. In both this field and on the samples pages, it is now possible to search simply by typing text.
Search on the Samples page:
And on the Explore Data page:

It's really fun. Try it!

IE bug fix
Last but not least, we have fixed a nasty bug on the Dashboard that was breaking the site entirely under Internet Explorer. Most of our users are under Firefox or Chrome, so this was not affecting many of you. But those that did use IE were prevented from browsing our website when logged in.

If you visited us in the past and went away because of this, we are sorry for the bug. Please give it another try.