BetFair.com and Axum

With the recent CTP of Axum, wouldn’t it be interesting to see how well the BetFair.com solution could be implemented in Axum. Today BetFair.com is implemented using Java with the market data caching taking advantage of Coherence. It would be very interesting to see how Axum and Velocity faired, and what transaction volume can be achieved.

Answering a few of Niklas questions:

  • 1. No concepts are fine. Anyone who is already writing parallel applications in finance should be able to pick up the Axum concepts fairly quickly
  • 2. Yes
  • 5. I can see Axum being use for server applications, but I suspect it will take some time for WPF UI’s to adopt Axum (given the GUIHandler on page 23 of the Axum Programmers Guide PDF

Here’s what I managed in Axum in 10 mins or so given the BetFair flywheel concept. Note it’s a little hardcoded :) so would need a directory services etc or similar.

using System;
using System.Concurrency;
using Microsoft.Axum;

namespace ConsoleApplication1
{
    public domain Program
    {
        public Program() {
            Host<AccountAgent>("MattAccount");
            Host<MarketAgent>("F1Barcelona2009");
        }

        channel Bet
        {
            input string account;
            input string market;
            input double betValue;
        }

        agent AccountAgent: channel Bet
        {
            public AccountAgent() {
                string account = receive(PrimaryChannel::account);
                string marketEvent = receive(PrimaryChannel::market);
                double bet = receive(PrimaryChannel::betValue);

                // Check account, validate bet
                System.Console.WriteLine("AccountAgent: Validate {0} bet" , account);

                var marketAgent = new Program.Bet(DefaultCommunicationProvider, "F1Barcelona2009");
                marketAgent::account <-- account;
                marketAgent::market <-- marketEvent;
                marketAgent::betValue <-- bet;
            }
        }

        agent MarketAgent : channel Bet
        {
            public MarketAgent()
            {
                string account = receive(PrimaryChannel::account);
                string marketEvent = receive(PrimaryChannel::market);
                double bet = receive(PrimaryChannel::betValue);

                // Try and match
                System.Console.WriteLine("MarketAgent: Matching {0} on {1} for {2}", bet, marketEvent, account);

            }

        }

        private writer agent MainAgent : channel Microsoft.Axum.Application
        {
            public MainAgent()
            {
                String [] args = receive(PrimaryChannel::CommandLine);

                var accountAgent = new Program.Bet(DefaultCommunicationProvider, "MattAccount");
                accountAgent::account <-- "Matt";
                accountAgent::market <-- "F1Barcelona2009";
                accountAgent::betValue <-- 5.0;

                Console.ReadKey();

                PrimaryChannel::Done <-- Signal.Value;
            }
        }
    }
}
Advertisement

~ by mdavey on May 9, 2009.

One Response to “BetFair.com and Axum”

  1. Exactly what I was thinking however CTP seems to have no extensibility support built in for persisting machine state and messages to external store in case of either failure or for grid distribution.

    Why not Velocity with built-in Axum support I say… just send messages to MS Velocity and subscribe to messages… now that would be one sweet transaction and coordination engine!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 273 other followers