MarketceteraArchitecture.doc - hcmut2005linhtutuyen

needmoreneedmoreData Management

Nov 28, 2012 (4 years and 6 months ago)

202 views








MARKETCETERA ARCHITECTURE

OVERVIEW














TABLE OF CONTENTS


ARCHITECTURE OVERVIEW

................................
................................
................................
...........................

3

1.

Photon

................................
................................
................................
................................
...................

4

2.

Marketcetera Trading Server

................................
................................
................................
................

5

3.

Order Loader

................................
................................
................................
................................
.........

5

4.

Tradebase

................................
................................
................................
................................
..............

6

5.

Strategy Agent
................................
................................
................................
................................
.......

6

6.

Platform modules
................................
................................
................................
................................
..

7

a)

CEP (Complex Event Processing)

................................
................................
................................
.......

7

b)

Strategy

................................
................................
................................
................................
.............

8














ARCHITECTURE OVERVIEW


Marketcetera platform consists of the following components:



Photon

-

a light
-
weight GUI for entering orders, monitori
ng them and running strategies.
Built on top of the
Eclipse Rich Client Platform
.



MTS (ORS)

-

Server that includes an Order Routing System for accepting orders from
Photon, StrategyAgnet or
Order Loader

and routing the
m to an exchange, persistence
layer backed by a database (MySQL is installed with the product) and authentication
module.



Order Loader

-

for batch loading of lar
ge numbers of orders.



Tradebase

-

Web
-
based trade and position reporting application, built using
Ruby on
Rails

version 1.
2.3.



Strategy Agent

-

standalone environment for running strategies.



Platform modules

-

CEP
,
Strategy
, Market Data Adapters (such as the Marketcetera
simulated market data feed) and mor
e.

Currently the Marketcetera platform is built on top of
Spring Framework

with an embedded
ActiveMQ

message queue middleware. Queues (i.e. point
-
to
-
point con
nections) and topics (i.e.
publish/subscribe connections) are both used to communicate amongst the pieces of the
Marketcetera platform. In general, queues are used to communicate messages going "toward" a
broker or exchange, and topics are used for respons
e messages going the other direction. This
way we can guarantee that instructional messages
-

such as orders and cancels
-

are delivered
once and only once, and informational messages
-

such as execution reports
-

are distributed to
all interested parties.

In addition, MTS publishes a set of Web Services interfaces used internally
by the platform client components such as Strategy Agent, Photon, etc. We use
Apache CXF

technology as our web services infrastructure.

MTS

stores all of the trades, execution reports and positions information in a database accessed
by the persistence layer. Both MTS and Tradebase are configured to use the
MySQL

database
out of the box, but we are database

agnostic and can be reconfigured to use any other database,
such as
Oracle

or
PostgreSQL
.

1.

Photon

Photon is Marketcetera's visual order
-
entry and strategy authoring applicatio
n.


It is based on the
Eclipse Rich Client Platform

and is exceptionally light
-
weight and extensible.

Photon is designed to speak with the Marketcetera
Server

and can send orders in the following
ways:

1)

Through standard Order Ticket views

2)

Using a command box for faster order entry

3)

Through the integrated strategy

scripting engine

Photon can be setup to receive and display market data quotes, and to display additional security
information in the embedded browser window.

Photon also has the ability to slice incoming data in a number of different ways, allowing users

to sort and filter messages based on security, account name, order type and a variety of other
metrics. The embedded Ruby scripting environment allows for rapid trading strategy prototyping
and development.

2.

Marketcetera Trading Server


The MTS (also call
ed Order Routing Server) is the heart of the Marketcetera platform. It receives
commands from various entry points (such as
Photon
,
Order Loader
, or
StrategyAgent
) or any
of your custom strategies, and routes them to the appropria
te destination.

The ORS receives the reply from the counter party (broker, exchange, etc) and forwards it to the
client that issued the original order.

3.

Order Loader

OrderLoader is a utility for bulk
-
loading multiple of orders from a
CSV

(Comma Separated
Va
lues) file. The format of the file itself is data
-
driven, which means that the header row
determines the fields that need to be present in the subsequent rows and which will be added to
the message that is later sent to the
Marketcetera Trading Server
.

The tool operates in two modes.

1)

System Mode
: This is the default mode. The orders sent are agnostic of the specific
protocol or it
s version used by the broker. Orders sent in this mode can be sent to any
broker that the Server is connected to. It's recommended that orders be sent in system
mode, unless there's a very good reason to send them in FIX Mode.

2)

FIX Mode
: In this mode, the o
rders are sent in as FIX messages, encoded in a specific
FIX Version. Orders sent in this mode can only be sent to a specific broker that the
Server is connected to. Moreover, the messages need to contain all the fields that the
targeted broker needs the m
essage to have in order to process it.

4.

Tradebase

Tradebase is a web
-
based reporting application for all of your trading activity.

It can be used to view, create and modify positions, trades, accounts and equities.

Tradebase can be accessed from a stand
-
alo
ne web browser or directly from within the Photon
order
-
entry application.

Sample view of the recorded trades listing page:


The Tradebase is a position management tool that also maintains a historical database of trades.
Tradebase is not an order entry t
ool, you can use
Photon

to manage orders.

5.

Strategy Agent

Strategy Agent provides a standalone environment for running strategies. While photon provides
a user
-
friendly env
ironment to develop and run strategies, it needs a GUI (Graphical User
Interface) environment and consumes more resources while running. Strategy Agent, on the
other hand, does not provide a GUI and as a result does not consume as much resources as
Photon
while running. In addition, Strategy Agent is great for scaling out
-

it can run multiple
strategies at once, or you can have multiple instances of Strategy Agent running at the same time.


The above diagram shows one instance of Strategy Agent running w
ith multiple strategies and
dataflows on top of the Module Framework. The first example corresponds to the
Process Data

command
-
line example (with the corresponding
script
), and going

to the logging Sink. You can
find these examples in the
strategyagent/samples

directory of your Marketcetera Platform install.

Note that you can "mix
-
and
-
match" by creating different dataflows between modules to have
multiple strategies subscribe to the s
ame market data module, for example.

Strategy Agent can be started from the command line. An optional commands file can be
provided for it to run commands right after it's started. Once started, the strategy agent keeps on
running until the process is term
inated.

While running, operations can be performed on the strategy agent and it's activity can be
monitored via the MXBean interfaces exposed by its various components. These MXBean
interfaces can be accessed by connecting tothe strategy agent via
JConsole
.

6.

Platform modules

a)

CEP (Complex Event Processing)

The platform provides out
-
of
-
the
-
box integration with the open source CEP library
Esper
.

At the most basic level, strategies can request market data be delivered t
o them after
filtering them through an esper runtime engine using a set of esper queries supplied when
requesting such filtered data.

The platform's integration with Esper is designed such that any data can be supplied into
an esper runtime; Any number of
queries can be submitted to the esper runtime and the
results of those queries can be sent to a strategy or any other module in the platform.

The platform also provides a system CEP module that provides very basic filtering
capabilities based on object typ
e.

b)

Strategy

The Strategy Module is the container for running strategies that can interact with both
market data and complex event processing via Esper. The Strategy Module provides a set
of APIs for callbacks and services available for the strategies at ru
ntime. These APIs
include market data updates, CEP queries, sending orders, execution reports and more.
Full list of APIs and services are detailed below.

Strategies can be run either inside
Photon

GUI, or on command
-
line via the
Strategy
Agent
.

Strategy Status State Changes: