14
Distributed Trading System SWE 622 Charles Beach Sharita Green Scott Jones James Wolfe

Distributed Trading System SWE 622

  • Upload
    naomi

  • View
    25

  • Download
    0

Embed Size (px)

DESCRIPTION

Distributed Trading System SWE 622. Charles Beach Sharita Green Scott Jones James Wolfe. Agenda. Prototype Design Exchange/Trader Communication High Level Implementation Details Clock Calculations Experiment Calculations. System Design. Evaluator. Trader1. TraderX. Logs. - PowerPoint PPT Presentation

Citation preview

Page 1: Distributed Trading System SWE 622

Distributed Trading System

SWE 622 Charles Beach

Sharita Green

Scott Jones

James Wolfe

Page 2: Distributed Trading System SWE 622

Agenda

Prototype Design Exchange/Trader Communication High Level Implementation Details Clock Calculations Experiment Calculations

Page 3: Distributed Trading System SWE 622

Evaluator

. . .

network

Exchange1

Trader1

System Design

ExchangeX

TraderX . . . Logs

Page 4: Distributed Trading System SWE 622

TraderClientGoodsMap<good, price>

ExchangeEngine

network

Exec <main>

Buy/Sell

<RMI>Echo

Pub/Sub

Exchange

GUI

Trader

Exchange Design

Page 5: Distributed Trading System SWE 622

Exec <main>

GUI

network

Exchange

ConfigFile

ExchangeInterface

Buy/Sell

<RMI>

Receive Echoes

<Pub/Sub>

Trader

TraderEngine

Trader Design

Page 6: Distributed Trading System SWE 622

Communication

Traders communicate with Exchanges via RMI Register Buy Sell

Exchanges echo transactions to Traders via Pub/Sub.

Page 7: Distributed Trading System SWE 622

Trader Registration

Exchange1 IP RMI-Port Topic Name

Exchange2 IP RMI-Port Topic Name

<Configuration File>

TraderEngine

ExchangeInterface <Exchange1>

ExchangeInterface <Exchange2>

ExchangeEngine ExchangeEngine

network

TraderClient<Trader1>

TraderClient<Trader1>

Exchange1 Exchange2

RMI: register()

Trader1

Page 8: Distributed Trading System SWE 622

Exchange Transaction Echoes

Exchange

network

ExchangeInterface

TraderEngine

TraderGUI

ExchangeInterface

TraderEngine

TraderGUI

Trader1 TraderN

RMI: buy/sellTraderX

Pub/Sub

Page 9: Distributed Trading System SWE 622

Publish/Subscribe

To send out updates about what products have been bought or sold we will be using Topic structure to publish messages to registered traders from the various exchanges.

Example Trader 1 registers with Exchange 1 and Trader 2 registers with Exchange 1 and Exchange 2. When Exchange 1 receives a buy or sell request it will send a message to the posted queue of Trader 1 and Trader 2. When Exchange 2 receives a buy or sell request it will send a message to Trader 2 queue.

Trader 1 Trader 2

Exchange 1 Exchange 2

Page 10: Distributed Trading System SWE 622

Publish/Subscribe

An asynchronous messaging paradigm where senders (publishers) of messages are not programmed to send their messages to specific receivers (subscribers). Rather, published messages are characterized into classes, without knowledge of what (if any) subscribers there may be. Subscribers express interest in one or more classes, and only receive messages that are of interest, without knowledge of what (if any) publishers there are. This decoupling of publishers and subscribers can allow for greater scalability and a more dynamic network topology.

Wikipedia (http://en.wikipedia.org/wiki/Publish/subscribe)

Page 11: Distributed Trading System SWE 622

Clock Calculations

Traders are responsible for calculating the clock differences between themselves and the Exchanges. Exchange timestamp passed back as part of the Trader registration. Timestamp is used to calculate the “time offset” relevant to its own clock.

Data Staleness Each transaction is time-stamped by the Exchange Trader applies its saved “time offset” for the given Exchange to determine the age of the data with

respect to its own clock. Staleness = Tt(now) – (Et(data) + offset)

Traders must invoke the Exchange RMI “register” method every 60 seconds. Time offset is re-calculated to keep up with the “clock skew” between the clocks.

Page 12: Distributed Trading System SWE 622

RMI register

Trader Exchange

(ET)

Tt1

Tt2

Trader CalculationsTte = (Tt1 + Tt2) / 2

Offset = Et - Tte

EtTte

Offset Calculation

Page 13: Distributed Trading System SWE 622

The Traders/Exchanges will output time stamped information to a log file. Exchanges

Requests from Traders for buying/selling goods. Trader registrations Processed Transactions Detection of Trader failures

Traders Received transaction events from Exchanges Requests to buy/sell goods Time offsets between clock and Exchange clocks.

A stand-alone application will be responsible for performing the Experiments. Process all of the log files Make latency calculations.

Processed Orders Detection of failures (Traders/Exchange crashes)

Clock calculations Clock Skew between Trader/Exchange clocks. Network Latency

Experiments

Page 14: Distributed Trading System SWE 622

Planning the Implementation

Initial prototype implementation has been completed RMI and Pub/Sub communications.

Needs to be implemented Formalize the prototype. Time calculations to detect data staleness. Logging capability. Stand Alone application to perform experiment calculations.