This document summarizes an automated trading system developed using open source tools. It discusses the components of the trading system including quote sources, strategy engines, order placement, and system monitoring. Key points:
- The system uses AnyMQ to distribute quotes via RabbitMQ and strategies are implemented using Finance::GeniusTrader and a new engine called TradeSpring.
- Orders are placed through brokers using JSON-RPC and position monitoring is done to ensure risk control.
- The system was moved to Amazon EC2 for improved performance and monitoring is done with AnyEvent::Monitor and Ganglia.
- Past performance showed net returns of 40.15% in 2009 and profits are analyzed using R and Protovis.
Powerful Google developer tools for immediate impact! (2023-24 C)
Trading with opensource tools, two years later
1. Trading
with open source tools
two years later
Chia-liang Kao
clkao@clkao.org
OSDC.TW 2011 Taipei
2. Trading System
Trading system, also known as algorithmic trading, is the use of
computer programs for entering trading orders with the computer
algorithm deciding on certain aspects of the order such as the
timing, price, quantity of order
Even with dice
19. AnyEvent::Monitor
my $foo = AnyEvent::Monitor->new(
name => 'foo',
on_softfail => sub {
warn "==> service fail: $_[1]";
},
on_hardfail => sub {
my ($resume_check);
warn "==> service fail, should attempt to do something to fix it: $_[1]";
$resume_check->(60); # resume checking after 60 secs
},
on_resume => sub {
my ($prev, $outage) = @_;
if ($prev) {
warn "service resumed from: $prev, total outage: $outage secs";
}
});
20. PAGM
• a daemon listening on rabbitmq topic
• tells client where to look for aggregated
price ticks
• answers historical price request:
{ type: ‘pagm.history’, reply: ‘client-name’,
code: ‘XTAF.TX’, timeframe: ‘5min’, count: 180 }
21. Strategy
• the core that decides:
• when to buy/sell?
• how much to buy/sell?
• when to stop loss, take profit?
• Finance::GeniusTrader
• TradeSpring
22. Finance::GeniusTrader
• DSL for trade systems
SY:Generic
{S:G:Above {I:Random 6} 2} {S:G:Below {I:Random 6} 3}
|TF:Generic {S:G:CrossOverUp {I:Hour} 850}
{S:G:CrossOverUp {I:Hour} 850}
|TF:MaxOpenTrades 1
|CS:DayTrade
• too verbose
• designed for backtesting
• didn’t support live trading by default